diff --git a/ci4/app/Entities/Presupuestos/PresupuestoEncuadernacionesEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoEncuadernacionesEntity.php index 9716d26d..c402d7bb 100755 --- a/ci4/app/Entities/Presupuestos/PresupuestoEncuadernacionesEntity.php +++ b/ci4/app/Entities/Presupuestos/PresupuestoEncuadernacionesEntity.php @@ -10,6 +10,7 @@ class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity "presupuesto_id" => null, "tarifa_encuadernado_id" => null, "precio_unidad" => null, + "tiempo" => null, "precio_total" => null, "margen" => null, "created_at" => null, @@ -19,6 +20,7 @@ class PresupuestoEncuadernacionesEntity extends \CodeIgniter\Entity\Entity "presupuesto_id" => "int", "tarifa_encuadernado_id" => "int", "precio_unidad" => "float", + "tiempo" => "float", "precio_total" => "float", "margen" => "float", ]; diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index 75a5644f..22a8ce5b 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -12,6 +12,8 @@ return [ 'moduleTitleWireoTB' => 'Presupuesto Libro Wire-o Tapa Blanda', 'moduleTitleGrapado' => 'Presupuesto Libro Grapado', + 'advertencia' => 'Advertencia', + 'presupuestoFresadotapaduraList' => 'Lista presupuestos Libros Fresado Tapa Dura', 'presupuestoFresadotapablandaList' => 'Lista presupuestos Libros Fresado Tapa Blanda', 'presupuestoCosidotapaduraList' => 'Lista presupuestos Libros Cosido Tapa Dura', @@ -22,12 +24,6 @@ return [ 'libroCosidoTapaDura' => "Cosido Tapa Dura", 'libroFresadoTapaBlanda' => "Fresado Tapa Blanda", 'libroFresadoTapaDura' => "Fresado Tapa Dura", - 'libroEspiralTapaDura' => "Espiral Tapa Dura", - 'libroEspiralTapaBlanda' => "Espiral Tapa Blanda", - 'libroWireoTapaDura' => "Wire-o Tapa Dura", - 'libroWireoTapaBlanda' => "Wire-o Tapa Blanda", - 'libroGrapado' => "Grapado", - 'datosPresupuesto' => 'Datos generales del presupuesto', 'datosLibro' => 'Datos del libro', @@ -240,6 +236,7 @@ return [ // Servicios 'precio' => 'Precio', 'precioUnidad' => 'Precio unidad', + 'tiempo' => 'Tiempo', 'precioTotal' => 'Precio total', 'serviciosDefault' => 'Servicios por defecto', 'tarifa' => 'Tarifa', @@ -269,6 +266,9 @@ return [ 'actualizacionPreciosLP' => '
- Líneas de presupuesto', 'actualizacionPreciosServicios' => '
- Servicios', 'actualizacionPreciosEnvios' => '
- Precio envíos', + + 'actualizacionSolapasCubierta' => 'El tamaño de las solapas de la cubierta se ha actualizado debido a que supera el máximo permitido (este valor depende del ancho del libro y del número de páginas).', + 'actualizacionSolapasSobrecubierta' => 'El tamaño de las solapas de la sobrecubierta se ha actualizado debido a que supera el máximo permitido (este valor depende del ancho del libro y del número de páginas).', 'validation' => [ diff --git a/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php b/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php index dc64be41..30f327b6 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoEncuadernacionesModel.php @@ -81,6 +81,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel 'tarifa_id'=> $tarifa['tarifa_id'], 'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre, 'precio_unidad'=> $result_data[0], + 'tiempo' => $tiempo, 'total'=> $result_data[1], 'margen' => $result_data[2], 'proveedor' => $tarifa_proveedor->proveedor_nombre, @@ -107,6 +108,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel 'tarifa_nombre'=> $tarifa['tarifa_nombre'], 'proveedor' => lang('Presupuestos.no_disponible'), 'precio_unidad'=> 0, + 'tiempo' => null, 'total'=> 0, 'margen' => 0, ]); @@ -123,6 +125,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel 'tarifa_id'=> $tarifa_proveedor->tarifa_enc_id, 'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre, 'precio_unidad'=> $result_data[0], + 'tiempo' => null, 'total'=> $result_data[1], 'margen'=> $result_data[2], 'proveedor' => $tarifa_proveedor->proveedor_nombre, @@ -147,6 +150,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel 'tarifa_nombre'=> $tarifa['tarifa_nombre'], 'proveedor' => lang('Presupuestos.no_disponible'), 'precio_unidad'=> 0, + 'tiempo' => null, 'total'=> 0, 'margen' => 0, ]); @@ -201,6 +205,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel 'tarifa_id'=> $tarifa->tarifa_enc_id, 'tarifa_nombre'=> $tarifa->tarifa_enc_nombre, 'precio_unidad'=> $result_data[0], + 'tiempo' => null, 'total'=> $result_data[1], 'margen'=> $result_data[2], 'proveedor' => $tarifa->proveedor_nombre, @@ -223,6 +228,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel 'tarifa_nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre, 'proveedor' => lang('Presupuestos.no_disponible'), 'precio_unidad'=> 0, + 'tiempo' => null, 'total'=> 0, 'margen'=> 0, ]; @@ -256,6 +262,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel 'tarifa_id'=> $tarifa_proveedor->tarifa_enc_id, 'tarifa_nombre'=> $tarifa_proveedor->tarifa_enc_nombre, 'precio_unidad'=> $result_data[0], + 'tiempo' => $tiempo, 'total'=> $result_data[1], 'margen' => $result_data[2], 'proveedor' => $tarifa_proveedor->proveedor_nombre, @@ -279,12 +286,12 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel 'tarifa_nombre'=> $modelTarifa->getNombreTarifaEncuadernacion($tarifa_encuadernacion_id)[0]->nombre, 'proveedor' => lang('Presupuestos.no_disponible'), 'precio_unidad'=> 0, + 'tiempo' => null, 'total'=> 0, 'margen' => 0, ]; return $ret_array; } - return []; } @@ -355,6 +362,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel ->where('tarifa_encuadernado_id', $tarifa->tarifa_id) ->set('proveedor_id', $proveedor) ->set('precio_unidad', $tarifa->precio_unidad) + ->set('tiempo', $tarifa->tiempo) ->set('precio_total', $tarifa->precio_total) ->set('margen', $tarifa->margen) ->update(); @@ -368,6 +376,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel ->set('tarifa_encuadernado_id', $tarifa->tarifa_id) ->set('proveedor_id', $proveedor, false) ->set('precio_unidad', $tarifa->precio_unidad) + ->set('tiempo', $tarifa->tiempo) ->set('precio_total', $tarifa->precio_total) ->set('margen', $tarifa->margen) ->insert(); @@ -387,7 +396,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel $builder = $this->db ->table($this->table . " t1") ->select( - "t1.id AS id, t1.tarifa_encuadernado_id AS tarifa_encuadernado_id, t1.precio_unidad AS precio_unidad, + "t1.id AS id, t1.tarifa_encuadernado_id AS tarifa_encuadernado_id, t1.precio_unidad AS precio_unidad, t1.tiempo AS tiempo, t1.precio_total AS precio_total, t1.margen AS margen, t2.nombre AS nombre, t1.proveedor_id AS proveedor_id, t3.nombre AS proveedor" ); diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index 127f45c2..687bd03f 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -288,7 +288,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel "t1.id AS id, t1.created_at AS fecha, t1.titulo AS titulo, t1.autor AS autor, t1.ferro AS ferro, t1.ferro_digital AS ferro_digital, t1.prototipo AS prototipo, t1.solapas AS solapas, t1.solapas_sobrecubierta AS solapas_sobrecubierta, t1.lomo_cubierta AS lomo_cubierta, t1.lomo_sobrecubierta AS lomo_sobrecubierta, - t1.solapas_ancho AS solapas_ancho, t1.solapas_ancho_sobrecubierta AS solapas_ancho_sobrecubierta, t1.paginas AS paginas, t1.tirada AS tirada, t1.coleccion AS coleccion, + t1.solapas_ancho AS solapas_ancho, t1.solapas_sobrecubierta_ancho AS solapas_sobrecubierta_ancho, t1.paginas AS paginas, t1.tirada AS tirada, t1.coleccion AS coleccion, t1.retractilado AS retractilado, t1.guardas AS guardas, t1.marcapaginas AS marcapaginas, t1.comentarios_pdf AS comentarios_pdf, t1.tirada_alternativa_json_data AS tiradas_alternativas, t1.total_presupuesto AS total_presupuesto, t1.total_precio_unidad AS total_precio_unidad, diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index 4ba10898..512239ab 100755 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -1469,15 +1469,18 @@ class PresupuestoService extends BaseService // Si el presupuesto no es duplicado, se comprueba que // no ha cambiado el precio unidad if(round($nueva_tarifa[0]->precio_unidad, 2) != $servicio->precio_unidad || - $nueva_tarifa[0]->margen != $servicio->margen){ + $nueva_tarifa[0]->margen != $servicio->margen || + $nueva_tarifa[0]->tiempo != $servicio->tiempo){ $servicio->precio_unidad = round($nueva_tarifa[0]->precio_unidad, 2); + $servicio->tiempo = round($nueva_tarifa[0]->tiempo, 2); $servicio->precio_total = round($nueva_tarifa[0]->total, 2); $servicio->margen = round($nueva_tarifa[0]->margen); $cambio = true; } else if($input_data['is_duplicado'] && $nueva_tarifa[0]->proveedor_id != $servicio->proveedor_id){ $servicio->precio_unidad = round($nueva_tarifa[0]->precio_unidad, 2); + $servicio->tiempo = round($nueva_tarifa[0]->tiempo, 2); $servicio->precio_total = round($nueva_tarifa[0]->total, 2); $servicio->margen = round($nueva_tarifa[0]->margen); $servicio->proveedor = $nueva_tarifa[0]->proveedor; diff --git a/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php index 7d1fa307..66c48389 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php @@ -718,13 +718,6 @@ $(document).on('click', '.btn-remove', function(e) { } }); -// funcion para obtener el cliente id de la url -function getId(){ - var url = window.location.href; - var parts = url.split("/"); - return parts[parts.length-1]; -} - endSection() ?> @@ -775,11 +768,11 @@ function getId(){ editor.on( 'preSubmit', function ( e, d, type ) { if ( type === 'create'){ - d.data[0]['cliente_id'] = getId(); + d.data[0]['cliente_id'] = id; } else if(type === 'edit' ) { for (v in d.data){ - d.data[v]['cliente_id'] = getId(); + d.data[v]['cliente_id'] = id; } } }); @@ -855,7 +848,7 @@ function getId(){ ajax : $.fn.dataTable.pipeline( { url: '', data: { - id_cliente: getId(), + id_cliente: id, }, method: 'POST', headers: {'X-Requested-With': 'XMLHttpRequest'}, @@ -1019,11 +1012,11 @@ function getId(){ editorPrecios.on( 'preSubmit', function ( e, d, type ) { if ( type === 'create'){ - d.data[0]['cliente_id'] = getId(); + d.data[0]['cliente_id'] = id; } else if(type === 'edit' ) { for (v in d.data){ - d.data[v]['cliente_id'] = getId(); + d.data[v]['cliente_id'] = id; } } }); @@ -1083,7 +1076,7 @@ function getId(){ ajax : $.fn.dataTable.pipeline( { url: '', data: { - cliente_id: getId(), + cliente_id: id, }, method: 'POST', headers: {'X-Requested-With': 'XMLHttpRequest'}, @@ -1373,7 +1366,7 @@ var tableDirecciones = $('#tableOfDireccionesEnvio').DataTable( { ajax : $.fn.dataTable.pipeline( { url: '', data: function ( d ) { - d.cliente_id = getId(); + d.cliente_id = id; }, method: 'POST', headers: {'X-Requested-With': 'XMLHttpRequest'}, @@ -1468,7 +1461,7 @@ function delete_direccion_envio(dataId){ section('css') ?> "> - "> + "> endSection() ?> section('additionalExternalJs') ?> diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/buscador/viewBuscadorList.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/buscador/viewBuscadorList.php index 36ee8c64..d32bb435 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/buscador/viewBuscadorList.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/buscador/viewBuscadorList.php @@ -121,11 +121,6 @@ $('#tableOfPresupuestos thead tr:eq(1) th').each(function (i) { selector.append(''); selector.append(''); selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); selector.on('change', function () { var val = $.fn.dataTable.util.escapeRegex( @@ -212,26 +207,6 @@ theTable = $('#tableOfPresupuestos').DataTable({ return ''; break; - case "libroEspiralTapaDura": - return ''; - break; - - case "libroEspiralTapaBlanda": - return ''; - break; - - case "libroWireoTapaDura": - return ''; - break; - - case "libroWireoTapaBlanda": - return ''; - break; - - case "libroGrapado": - return ''; - break; - default: return data; // Debug break; diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.js index f5caabe8..2c6027a1 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.js @@ -39,41 +39,6 @@ $('#paginas').on("change", function () { }); -$('.solapas_cubierta').on('change', function(){ - - const ancho_libro = getDimensionLibro().ancho; - - // ancho_libro*2 + lomo + solapas*2 <= 640 - const limite_1 = ((640 - ancho_libro*2 - getLomoLineasPresupuesto()) / 2.0).toFixed(1); - // solapas <= ancho_libro - 10 - const limite_2 = ancho_libro - 10; - const limite = Math.min(limite_1, limite_2); - - if(parseInt($('#solapas_ancho').val()) > limite){ - $('#solapas_ancho').val(limite) - } - - $('#compGramajeCubierta').trigger('change') -}) - - -$('.solapas_sobrecubierta').on('change', function(){ - - const ancho_libro = getDimensionLibro().ancho; - - // ancho_libro*2 + lomo + solapas*2 <= 640 - const limite_1 = ((640 - ancho_libro*2 - getLomoLineasPresupuesto()) / 2.0).toFixed(1); - // solapas <= ancho_libro - 10 - const limite_2 = ancho_libro - 10; - const limite = Math.min(limite_1, limite_2); - - if(parseInt($('#solapas_ancho_sobrecubierta').val()) > limite){ - $('#solapas_ancho_sobrecubierta').val(limite) - } - - $('#compGramajeSobrecubierta').trigger('change') -}) - $('#tirada').on("change", function (update_tiradas_alternativas = true) { calcular_mermas() diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js index e4c137bc..a8860fa7 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js @@ -489,6 +489,7 @@ var tableServiciosEnc = new DataTable('#tableOfServiciosEncuadernacion',{ language: { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, + }); tableServiciosEnc.on('draw', function(){ @@ -523,6 +524,7 @@ function init_servicio_encuadernado(){ '' + '', '' + parseFloat(element.precio_unidad).toFixed(2) + '', + '' + convertirTiempo(element.tiempo) + '', '', '', '' @@ -584,6 +586,21 @@ function init_servicio_encuadernado(){ } +function convertirTiempo(horas){ + if(horas != null){ + + const seconds = parseFloat(horas) * 3600; + // se convierte a formato hh:mm:ss + const h = Math.floor(seconds / 3600); + const minutos = Math.floor((seconds % 3600) / 60); + const segundos = seconds % 60; + return h + ':' + minutos + ':' + segundos; + } + else{ + return ""; + } +} + function proveedor_enc_event(){ const dimension = getDimensionLibro(); if(parseInt($('#tirada').val())>0){ @@ -611,6 +628,7 @@ function proveedor_enc_event(){ success: function (data) { $('#precio_unidad_encuadernado_' + datos.tarifa_encuadernacion_id).text(parseFloat(data.values[0].precio_unidad).toFixed(2)) + $('#tiempo_encuadernado_' + datos.tarifa_encuadernacion_id).text(convertirTiempo(data.values[0].tiempo)) $('#precio_total_encuadernado_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2)) $('#enc_margen_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].margen).toFixed(2)) @@ -694,6 +712,7 @@ async function get_tarifas_enc(tipo=null, tarifa_id = -1){ '' + '', '' + parseFloat(row.precio_unidad).toFixed(2) + '', + '' + convertirTiempo(row.tiempo) + '', '', '', '' @@ -796,9 +815,15 @@ function get_datos_encuadernacion(){ values['precio_unidad'] = $(this).text() break case 4: - values['precio_total'] = $(this).children(":first").val() + values['tiempo'] = $(this).text() + // se pasa el string hh:mm:ss a horas + if(values['tiempo'] != null) + values['tiempo'] = parseInt(values['tiempo'].split(':')[0]) + parseInt(values['tiempo'].split(':')[1])/60 + parseInt(values['tiempo'].split(':')[2])/3600 break case 5: + values['precio_total'] = $(this).children(":first").val() + break + case 6: values['margen'] = $(this).text() break } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php index 985791d3..8160ebab 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php @@ -167,6 +167,7 @@ + @@ -311,5 +312,48 @@ init_servicio_preimpresion() init_servicio_extra() + + $('.solapas_cubierta').on('change', function(){ + + const ancho_libro = getDimensionLibro().ancho; + + // ancho_libro*2 + lomo + solapas*2 <= 640 + const limite_1 = ((640 - ancho_libro*2 - getLomoLineasPresupuesto()) / 2.0).toFixed(1); + // solapas <= ancho_libro - 10 + const limite_2 = ancho_libro - 10; + const limite = Math.min(limite_1, limite_2); + + if(parseInt($('#solapas_ancho').val()) > limite){ + $('#solapas_ancho').val(limite) + asyncMessageDialog( + window.Presupuestos.advertencia, + window.Presupuestos.actualizacionSolapasCubierta, + function(){}); + } + + $('#compGramajeCubierta').trigger('change') + }) + + + $('.solapas_sobrecubierta').on('change', function(){ + + const ancho_libro = getDimensionLibro().ancho; + + // ancho_libro*2 + lomo + solapas*2 <= 640 + const limite_1 = ((640 - ancho_libro*2 - getLomoLineasPresupuesto()) / 2.0).toFixed(1); + // solapas <= ancho_libro - 10 + const limite_2 = ancho_libro - 10; + const limite = Math.min(limite_1, limite_2); + + if(parseInt($('#solapas_ancho_sobrecubierta').val()) > limite){ + $('#solapas_ancho_sobrecubierta').val(limite) + asyncMessageDialog( + window.Presupuestos.advertencia, + window.Presupuestos.actualizacionSolapasSobrecubierta, + function(){}); + } + + $('#compGramajeSobrecubierta').trigger('change') + }) endSection() ?> diff --git a/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php b/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php index dbcd48f1..ae2649f7 100755 --- a/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php +++ b/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php @@ -134,19 +134,6 @@ if (!empty($token) && $tfa == false) { - - - - - -