acabado actualizar lineas presupuesto

This commit is contained in:
jaimejimenezortega
2024-03-23 11:56:02 +01:00
parent afce4b35e5
commit 6460b0e502
7 changed files with 282 additions and 25 deletions

View File

@ -75,23 +75,7 @@ class PresupuestoAcabadosModel extends \App\Models\GoBaseModel
return [];
}
private function calcularTarifa($tarifa, $tirada, $is_POD=false){
$precio_unidad = floatval($tarifa->precio_min) - (floatval($tarifa->precio_min) - floatval($tarifa->precio_max))/($tarifa->tirada_max - $tarifa->tirada_min) * ($tirada - $tarifa->tirada_min);
if ($tirada > $tarifa->tirada_max)
$precio_unidad = $tarifa->precio_max;
$precio_unidad = $precio_unidad* (1+ floatval($tarifa->margen)/100.0);
$total = $precio_unidad * $tirada;
$margen = floatval($tarifa->margen);
if (!$is_POD){
$total += floatval($tarifa->tarifa_importe_fijo);
}
return [$precio_unidad, $total, $margen];
}
public function deleteAllServicios($presupuesto_id){
$this->db
@ -261,4 +245,21 @@ class PresupuestoAcabadosModel extends \App\Models\GoBaseModel
return $builder;
}
private function calcularTarifa($tarifa, $tirada, $is_POD=false){
$precio_unidad = floatval($tarifa->precio_min) - (floatval($tarifa->precio_min) - floatval($tarifa->precio_max))/($tarifa->tirada_max - $tarifa->tirada_min) * ($tirada - $tarifa->tirada_min);
if ($tirada > $tarifa->tirada_max)
$precio_unidad = $tarifa->precio_max;
$precio_unidad = $precio_unidad* (1+ floatval($tarifa->margen)/100.0);
$total = $precio_unidad * $tirada;
$margen = floatval($tarifa->margen);
if (!$is_POD){
$total += floatval($tarifa->tarifa_importe_fijo);
}
return [$precio_unidad, $total, $margen];
}
}

View File

@ -105,6 +105,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel
"total_factor_ponderado",
"acabado_cubierta_id",
"acabado_sobrecubierta_id",
"is_duplicado"
];
protected $returnType = "App\Entities\Presupuestos\PresupuestoEntity";
@ -264,6 +265,13 @@ class PresupuestoModel extends \App\Models\GoBaseModel
}
public function removeIsDuplicado($presupuesto_id){
$this->db
->table($this->table . " t1")
->where('id', $presupuesto_id)
->set('is_duplicado', false)
->update();
}
/**
* Get resource data for creating PDFs.
@ -299,6 +307,4 @@ class PresupuestoModel extends \App\Models\GoBaseModel
return $builder;
}
}