mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta update servicios
This commit is contained in:
@ -50,19 +50,27 @@ class PresupuestoServiciosExtraModel extends \App\Models\BaseModel
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoExtra($tarifa_extra_id);
|
||||
if (count($tarifa_value)>0) {
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0]);
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_extra_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_extra_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
];
|
||||
$ret_array = [];
|
||||
foreach($tarifa_value as $tarifa){
|
||||
$result_data = $this->calcularTarifa($tarifa);
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_extra_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_extra_nombre,
|
||||
'nombre'=> $tarifa->tarifa_extra_nombre,
|
||||
'precio'=> $result_data[0],
|
||||
'margen'=> $result_data[1],
|
||||
]);
|
||||
}
|
||||
usort($ret_array, function($a, $b) {
|
||||
return $a->precio <=> $b->precio;
|
||||
});
|
||||
return $ret_array;
|
||||
}
|
||||
else{
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_extra_id,
|
||||
'tarifa_nombre'=> $modelTarifa->getNombreTarifaExtra($tarifa_extra_id)[0]->nombre,
|
||||
'tarifa'=> $modelTarifa->getNombreTarifaExtra($tarifa_extra_id)[0]->nombre,
|
||||
'precio' => 0,
|
||||
'margen' => 0,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user