mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en los errores de calculo de tarifas
This commit is contained in:
@ -209,6 +209,7 @@ class ProveedorModel extends \App\Models\BaseModel
|
||||
->select(
|
||||
"t1.id AS value, t1.nombre AS label, t1.propiedades AS options")
|
||||
->where("tipo_id", $tipoId)
|
||||
->where("is_deleted", 0)
|
||||
->orderBy('t1.nombre', 'asc');
|
||||
|
||||
return $builder->get()->getResultObject();
|
||||
|
||||
@ -283,6 +283,13 @@ class PresupuestoAcabadosModel extends \App\Models\BaseModel
|
||||
$total = $precio_unidad * $tirada;
|
||||
$margen = floatval($tarifa->margen);
|
||||
|
||||
if($tarifa->tarifa_precio_min > $total){
|
||||
$total = $total-($total * $margen/100.0);
|
||||
$margen = round(100.0 * (floatval($tarifa->tarifa_precio_min) - $total) / floatval($tarifa->tarifa_precio_min), 0);
|
||||
$total = floatval($tarifa->tarifa_precio_min);
|
||||
$precio_unidad = round(floatval($total / $tirada), 2);
|
||||
}
|
||||
|
||||
if (!$is_POD){
|
||||
$total += floatval($tarifa->tarifa_importe_fijo);
|
||||
}
|
||||
|
||||
@ -78,6 +78,12 @@ class PresupuestoPreimpresionesModel extends \App\Models\BaseModel
|
||||
$precio = $precio * (1+ floatval($tarifa->margen)/100.0);
|
||||
$margen = $tarifa->margen;
|
||||
|
||||
if($tarifa->tarifa_precio_min > $precio){
|
||||
$precio = $precio-($precio * $margen/100.0);
|
||||
$margen = round(100.0 * (floatval($tarifa->tarifa_precio_min) - $precio) / floatval($tarifa->tarifa_precio_min), 0);
|
||||
$precio = floatval($tarifa->tarifa_precio_min);
|
||||
}
|
||||
|
||||
return [$precio, $margen];
|
||||
}
|
||||
|
||||
|
||||
@ -78,6 +78,12 @@ class PresupuestoServiciosExtraModel extends \App\Models\BaseModel
|
||||
$precio = $precio * (1+ floatval($tarifa->margen)/100.0);
|
||||
$margen = $tarifa->margen;
|
||||
|
||||
if($tarifa->tarifa_precio_min > $precio){
|
||||
$precio = $precio-($precio * $margen/100.0);
|
||||
$margen = round(100.0 * (floatval($tarifa->tarifa_precio_min) - $precio) / floatval($tarifa->tarifa_precio_min), 0);
|
||||
$precio = floatval($tarifa->tarifa_precio_min);
|
||||
}
|
||||
|
||||
return [$precio, $margen];
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,8 @@ class TarifaextraModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS tarifa_extra_id, t1.nombre AS tarifa_extra_nombre, t1.precio AS precio, t1.margen AS margen"
|
||||
"t1.id AS tarifa_extra_id, t1.nombre AS tarifa_extra_nombre, t1.precio AS precio, t1.margen AS margen,
|
||||
t1.precio_min AS tarifa_precio_min, t1.importe_fijo AS importe_fijo"
|
||||
)
|
||||
->where("t1.is_deleted", 0);
|
||||
//->where("t1.mostrar_en_presupuesto", 1)
|
||||
|
||||
@ -101,7 +101,8 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS tarifa_preimpresion_id, t1.nombre AS tarifa_preimpresion_nombre, t1.precio AS precio, t1.margen AS margen"
|
||||
"t1.id AS tarifa_preimpresion_id, t1.nombre AS tarifa_preimpresion_nombre, t1.precio AS precio, t1.margen AS margen,
|
||||
t1.precio_min AS tarifa_precio_min, t1.importe_fijo AS importe_fijo"
|
||||
)
|
||||
->where("t1.is_deleted", 0);
|
||||
//->where("t1.mostrar_en_presupuesto", 1)
|
||||
|
||||
Reference in New Issue
Block a user