mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
totalizadores de servicios realizado
This commit is contained in:
@ -19,7 +19,7 @@ class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
|
||||
2 => "t1.precio_total"
|
||||
];
|
||||
|
||||
protected $allowedFields = ["presupuesto_id", "tarifa_preimpresion_id", "nombre", "precio_total", "precio_unidad"];
|
||||
protected $allowedFields = ["presupuesto_id", "tarifa_preimpresion_id", "nombre", "precio_total", "precio_unidad", "margen"];
|
||||
protected $returnType = "App\Entities\Presupuestos\PresupuestoPreimpresionesEntity";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
@ -55,7 +55,8 @@ class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_preimpresion_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_preimpresion_nombre,
|
||||
'precio'=> $result_data,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
];
|
||||
return $ret_array;
|
||||
}
|
||||
@ -64,6 +65,7 @@ class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
|
||||
'tarifa_id'=> $tarifa_preimpresion_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaPreimpresion($tarifa_preimpresion_id)[0]->nombre,
|
||||
'precio' => 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
return $ret_array;
|
||||
}
|
||||
@ -74,8 +76,9 @@ class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
|
||||
|
||||
$precio = floatval($tarifa->precio);
|
||||
$precio = $precio * (1+ floatval($tarifa->margen)/100.0);
|
||||
|
||||
return $precio;
|
||||
$margen = $tarifa->margen;
|
||||
|
||||
return [$precio, $margen];
|
||||
}
|
||||
|
||||
public function deleteAllServicios($presupuesto_id){
|
||||
@ -114,6 +117,7 @@ class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
|
||||
->where('presupuesto_id', $presupuesto_id)
|
||||
->where('tarifa_preimpresion_id', $tarifa->tarifa_id)
|
||||
->set('precio', $tarifa->precio)
|
||||
->set('margen', $tarifa->margen)
|
||||
->update();
|
||||
|
||||
|
||||
@ -124,6 +128,7 @@ class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
|
||||
->set('presupuesto_id', $presupuesto_id)
|
||||
->set('tarifa_preimpresion_id', $tarifa->tarifa_id)
|
||||
->set('precio', $tarifa->precio)
|
||||
->set('margen', $tarifa->margen)
|
||||
->insert();
|
||||
}
|
||||
}
|
||||
@ -142,7 +147,7 @@ class PresupuestoPreimpresionesModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.tarifa_preimpresion_id AS tarifa_preimpresion_id, t1.precio AS precio, t2.nombre AS nombre"
|
||||
"t1.id AS id, t1.tarifa_preimpresion_id AS tarifa_preimpresion_id, t1.precio AS precio, t1.margen AS margen, t2.nombre AS nombre"
|
||||
);
|
||||
|
||||
$builder->where('t1.presupuesto_id', $presupuesto_id);
|
||||
|
||||
Reference in New Issue
Block a user