servicios acabado finalizados

This commit is contained in:
2025-01-11 18:17:03 +01:00
parent 7bb7b807a5
commit 2aae650196
5 changed files with 43 additions and 35 deletions

View File

@ -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->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
$routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) { $routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->get('getacabados', 'Presupuestoacabados::getAcabados');
$routes->post('getvalues', 'Presupuestoacabados::getRowValues'); $routes->post('getvalues', 'Presupuestoacabados::getRowValues');
$routes->post('menuitems', 'Presupuestoacabados::menuItems', ['as' => 'menuItemsOfPresupuestoAcabados']); $routes->post('menuitems', 'Presupuestoacabados::menuItems', ['as' => 'menuItemsOfPresupuestoAcabados']);
$routes->post('edit/(:num)', 'Presupuestoacabados::edit/$1', ['as' => 'updatePresupuestoacabados']); $routes->post('edit/(:num)', 'Presupuestoacabados::edit/$1', ['as' => 'updatePresupuestoacabados']);

View File

@ -72,18 +72,24 @@ class PresupuestoAcabadosModel extends \App\Models\BaseModel
$tarifa_value = $modelTarifa->getTarifaPresupuestoAcabado($tarifa_acabado_id, $tirada, $proveedor_id); $tarifa_value = $modelTarifa->getTarifaPresupuestoAcabado($tarifa_acabado_id, $tirada, $proveedor_id);
if (count($tarifa_value)>0) { if (count($tarifa_value)>0) {
$result_data = $this->calcularTarifa($tarifa_value[0], $tirada, $POD<$tirada?false:true); $ret_array = [];
$ret_array[] = (object)[ foreach ($tarifa_value as $tarifa) {
'tarifa_id'=> $tarifa_value[0]->tarifa_acabado_id, $result_data = $this->calcularTarifa($tarifa, $tirada, $POD<$tirada?false:true);
'tarifa_nombre'=> $tarifa_value[0]->tarifa_acabado_nombre, array_push($ret_array, (object)[
'nombre'=> $tarifa_value[0]->tarifa_acabado_nombre, 'tarifa_id'=> $tarifa->tarifa_acabado_id,
'precio_unidad'=> round($result_data[0], 2), 'tarifa_nombre'=> $tarifa->tarifa_acabado_nombre,
'total'=> round($result_data[1], 2), 'nombre'=> $tarifa->tarifa_acabado_nombre,
'precio_total'=> round($result_data[1], 2), 'precio_unidad'=> round($result_data[0], 2),
'margen'=> $result_data[2], 'total'=> round($result_data[1], 2),
'proveedor' => $tarifa_value[0]->proveedor_nombre, 'precio_total'=> round($result_data[1], 2),
'proveedor_id' => $tarifa_value[0]->proveedor_id, '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; return $ret_array;
} }
else{ else{

View File

@ -94,6 +94,8 @@
<th><?= lang('Presupuestos.precioUnidad') ?></th> <th><?= lang('Presupuestos.precioUnidad') ?></th>
<th><?= lang('Presupuestos.precioTotal') ?></th> <th><?= lang('Presupuestos.precioTotal') ?></th>
<th><?= lang('Tarifaacabado.margen') ?></th> <th><?= lang('Tarifaacabado.margen') ?></th>
<th></th>
<th></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th> <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr> </tr>
</thead> </thead>

View File

@ -28,8 +28,6 @@ class PresupuestoAdminEdit {
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip')); this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosLibroTip'), this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosLibroTip'),
{ {
addService: this.addService,
removeService: this.removeService,
checkPaginasPresupuesto: this.checkPaginasPresupuesto, checkPaginasPresupuesto: this.checkPaginasPresupuesto,
}); });
this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip')); this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'));
@ -160,15 +158,6 @@ class PresupuestoAdminEdit {
} }
addService() {
}
removeService() {
}
checkPaginasPresupuesto() { checkPaginasPresupuesto() {
let cantidad_total = 0; let cantidad_total = 0;

View File

@ -7,8 +7,6 @@ class DatosLibro {
this.domItem = domItem; this.domItem = domItem;
this.addService = functions.addService;
this.removeService = functions.removeService;
this.checkPaginasPresupuesto = functions.checkPaginasPresupuesto; this.checkPaginasPresupuesto = functions.checkPaginasPresupuesto;
this.csrf_token = getToken(); this.csrf_token = getToken();
@ -61,10 +59,20 @@ class DatosLibro {
init() { init() {
const self = this;
this.tamanio.init(); this.tamanio.init();
this.acabadoCubierta.init(); this.acabadoCubierta.init();
this.acabadoSobrecubierta.init(); this.acabadoSobrecubierta.init();
this.acabadoCubierta.item.on('select2:select', function () {
$(document).trigger('add-servicio-lineas', 'acabadoCubierta');
});
this.acabadoSobrecubierta.item.on('select2:select', function () {
$(document).trigger('add-servicio-lineas', 'acabadoSobrecubierta');
});
if (window.location.href.includes("edit")) { if (window.location.href.includes("edit")) {
this.retractilado.on('change', this.checkRetractilado.bind(this)); this.retractilado.on('change', this.checkRetractilado.bind(this));
this.retractilado5.on('change', this.checkRetractilado.bind(this)); this.retractilado5.on('change', this.checkRetractilado.bind(this));
@ -102,31 +110,32 @@ class DatosLibro {
changeFajaColor() { changeFajaColor() {
if (this.imprimirFajaColor.prop('checked')) { if (this.imprimirFajaColor.prop('checked')) {
this.addService('fajaColor'); $(document).trigger('add-servicio-lineas', 'facaColor');
} }
else { else {
this.removeService('fajaColor'); $(document).trigger('remove-servicio-lineas', 'fajaColor');
} }
} }
changeFerro() { changeFerro() {
if (this.ferro.prop('checked')) { if (this.ferro.prop('checked')) {
this.addService('ferro'); $(document).trigger('add-servicio-lineas', 'ferro');
} }
else { else {
this.removeService('ferro'); $(document).trigger('remove-servicio-lineas', 'ferro');
} }
} }
changePrototipo() { changePrototipo() {
if (this.prototipo.prop('checked')) { if (this.prototipo.prop('checked')) {
this.addService('prototipo');
$(document).trigger('add-servicio-lineas', 'prototipo');
this.ferro.prop('checked', true).trigger('change'); this.ferro.prop('checked', true).trigger('change');
} }
else { else {
this.removeService('prototipo'); $(document).trigger('remove-servicio-lineas', 'prototipo');
} }
} }
@ -137,15 +146,15 @@ class DatosLibro {
case 'retractilado': case 'retractilado':
if ($('#' + element.id).prop('checked')) { if ($('#' + element.id).prop('checked')) {
$('#retractilado5').prop('checked', false); $('#retractilado5').prop('checked', false);
this.removeService('retractilado5'); $(document).trigger('remove-servicio-lineas', 'retractilado5');
this.addService('retractilado'); $(document).trigger('add-servicio-lineas', 'retractilado');
} }
break; break;
case 'retractilado5': case 'retractilado5':
if ($('#' + element.id).prop('checked')) { if ($('#' + element.id).prop('checked')) {
$('#retractilado').prop('checked', false); $('#retractilado').prop('checked', false);
this.removeService('retractilado'); $(document).trigger('remove-servicio-lineas', 'retractilado');
this.addService('retractilado5'); $(document).trigger('add-servicio-lineas', 'retractilado5');
} }
break; break;
default: default:
@ -154,6 +163,7 @@ class DatosLibro {
} }
changeFormato() { changeFormato() {
// Si es negro o color // Si es negro o color