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>
|
||||
|
||||
@ -28,8 +28,6 @@ class PresupuestoAdminEdit {
|
||||
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosLibroTip'),
|
||||
{
|
||||
addService: this.addService,
|
||||
removeService: this.removeService,
|
||||
checkPaginasPresupuesto: this.checkPaginasPresupuesto,
|
||||
});
|
||||
this.comparador = new Comparador(this.domItem.find('#accordionDatosPresupuestoClienteTip'));
|
||||
@ -160,15 +158,6 @@ class PresupuestoAdminEdit {
|
||||
}
|
||||
|
||||
|
||||
addService() {
|
||||
|
||||
}
|
||||
|
||||
removeService() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
checkPaginasPresupuesto() {
|
||||
|
||||
let cantidad_total = 0;
|
||||
|
||||
@ -7,8 +7,6 @@ class DatosLibro {
|
||||
|
||||
this.domItem = domItem;
|
||||
|
||||
this.addService = functions.addService;
|
||||
this.removeService = functions.removeService;
|
||||
this.checkPaginasPresupuesto = functions.checkPaginasPresupuesto;
|
||||
|
||||
this.csrf_token = getToken();
|
||||
@ -61,10 +59,20 @@ class DatosLibro {
|
||||
|
||||
init() {
|
||||
|
||||
const self = this;
|
||||
|
||||
this.tamanio.init();
|
||||
this.acabadoCubierta.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")) {
|
||||
this.retractilado.on('change', this.checkRetractilado.bind(this));
|
||||
this.retractilado5.on('change', this.checkRetractilado.bind(this));
|
||||
@ -102,31 +110,32 @@ class DatosLibro {
|
||||
changeFajaColor() {
|
||||
|
||||
if (this.imprimirFajaColor.prop('checked')) {
|
||||
this.addService('fajaColor');
|
||||
$(document).trigger('add-servicio-lineas', 'facaColor');
|
||||
}
|
||||
else {
|
||||
this.removeService('fajaColor');
|
||||
$(document).trigger('remove-servicio-lineas', 'fajaColor');
|
||||
}
|
||||
}
|
||||
|
||||
changeFerro() {
|
||||
|
||||
if (this.ferro.prop('checked')) {
|
||||
this.addService('ferro');
|
||||
$(document).trigger('add-servicio-lineas', 'ferro');
|
||||
}
|
||||
else {
|
||||
this.removeService('ferro');
|
||||
$(document).trigger('remove-servicio-lineas', 'ferro');
|
||||
}
|
||||
}
|
||||
|
||||
changePrototipo() {
|
||||
|
||||
if (this.prototipo.prop('checked')) {
|
||||
this.addService('prototipo');
|
||||
|
||||
$(document).trigger('add-servicio-lineas', 'prototipo');
|
||||
this.ferro.prop('checked', true).trigger('change');
|
||||
}
|
||||
else {
|
||||
this.removeService('prototipo');
|
||||
$(document).trigger('remove-servicio-lineas', 'prototipo');
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,15 +146,15 @@ class DatosLibro {
|
||||
case 'retractilado':
|
||||
if ($('#' + element.id).prop('checked')) {
|
||||
$('#retractilado5').prop('checked', false);
|
||||
this.removeService('retractilado5');
|
||||
this.addService('retractilado');
|
||||
$(document).trigger('remove-servicio-lineas', 'retractilado5');
|
||||
$(document).trigger('add-servicio-lineas', 'retractilado');
|
||||
}
|
||||
break;
|
||||
case 'retractilado5':
|
||||
if ($('#' + element.id).prop('checked')) {
|
||||
$('#retractilado').prop('checked', false);
|
||||
this.removeService('retractilado');
|
||||
this.addService('retractilado5');
|
||||
$(document).trigger('remove-servicio-lineas', 'retractilado');
|
||||
$(document).trigger('add-servicio-lineas', 'retractilado5');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -154,6 +163,7 @@ class DatosLibro {
|
||||
|
||||
}
|
||||
|
||||
|
||||
changeFormato() {
|
||||
|
||||
// Si es negro o color
|
||||
|
||||
Reference in New Issue
Block a user