mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
servicios acabado finalizados
This commit is contained in:
@ -654,6 +654,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
|
||||
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('getacabados', 'Presupuestoacabados::getAcabados');
|
||||
$routes->post('getvalues', 'Presupuestoacabados::getRowValues');
|
||||
$routes->post('menuitems', 'Presupuestoacabados::menuItems', ['as' => 'menuItemsOfPresupuestoAcabados']);
|
||||
$routes->post('edit/(:num)', 'Presupuestoacabados::edit/$1', ['as' => 'updatePresupuestoacabados']);
|
||||
|
||||
@ -72,18 +72,24 @@ class PresupuestoAcabadosModel extends \App\Models\BaseModel
|
||||
$tarifa_value = $modelTarifa->getTarifaPresupuestoAcabado($tarifa_acabado_id, $tirada, $proveedor_id);
|
||||
if (count($tarifa_value)>0) {
|
||||
|
||||
$result_data = $this->calcularTarifa($tarifa_value[0], $tirada, $POD<$tirada?false:true);
|
||||
$ret_array[] = (object)[
|
||||
'tarifa_id'=> $tarifa_value[0]->tarifa_acabado_id,
|
||||
'tarifa_nombre'=> $tarifa_value[0]->tarifa_acabado_nombre,
|
||||
'nombre'=> $tarifa_value[0]->tarifa_acabado_nombre,
|
||||
'precio_unidad'=> round($result_data[0], 2),
|
||||
'total'=> round($result_data[1], 2),
|
||||
'precio_total'=> round($result_data[1], 2),
|
||||
'margen'=> $result_data[2],
|
||||
'proveedor' => $tarifa_value[0]->proveedor_nombre,
|
||||
'proveedor_id' => $tarifa_value[0]->proveedor_id,
|
||||
];
|
||||
$ret_array = [];
|
||||
foreach ($tarifa_value as $tarifa) {
|
||||
$result_data = $this->calcularTarifa($tarifa, $tirada, $POD<$tirada?false:true);
|
||||
array_push($ret_array, (object)[
|
||||
'tarifa_id'=> $tarifa->tarifa_acabado_id,
|
||||
'tarifa_nombre'=> $tarifa->tarifa_acabado_nombre,
|
||||
'nombre'=> $tarifa->tarifa_acabado_nombre,
|
||||
'precio_unidad'=> round($result_data[0], 2),
|
||||
'total'=> round($result_data[1], 2),
|
||||
'precio_total'=> round($result_data[1], 2),
|
||||
'margen'=> $result_data[2],
|
||||
'proveedor' => $tarifa->proveedor_nombre,
|
||||
'proveedor_id' => $tarifa->proveedor_id,
|
||||
]);
|
||||
}
|
||||
usort($ret_array, function($a, $b) {
|
||||
return $a->precio_total <=> $b->precio_total;
|
||||
});
|
||||
return $ret_array;
|
||||
}
|
||||
else{
|
||||
|
||||
@ -94,6 +94,8 @@
|
||||
<th><?= lang('Presupuestos.precioUnidad') ?></th>
|
||||
<th><?= lang('Presupuestos.precioTotal') ?></th>
|
||||
<th><?= lang('Tarifaacabado.margen') ?></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Reference in New Issue
Block a user