diff --git a/ci4/.env b/ci4/.env index c6225611..7541e4d4 100755 --- a/ci4/.env +++ b/ci4/.env @@ -22,8 +22,8 @@ CI_ENVIRONMENT = development # APP #-------------------------------------------------------------------- -# app.baseURL = 'https://sk-jjo.imnavajas.es' -app.baseURL = 'https://sk-imn.imnavajas.es' +app.baseURL = 'https://sk-jjo.imnavajas.es' +# app.baseURL = 'https://sk-imn.imnavajas.es' # app.baseURL = "http://safekat.test/" # app.forceGlobalSecureRequests = false diff --git a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php index 77700dd7..2b83b03a 100755 --- a/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php +++ b/ci4/app/Controllers/Presupuestos/Cosidotapablanda.php @@ -144,13 +144,16 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController endif; // ($requestMethod === 'post') + $this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO $this->viewData['presupuestoEntity'] = isset($sanitizedData) ? new PresupuestoEntity($sanitizedData) : new PresupuestoEntity(); + $this->viewData['isCosido'] = (new TipoPresupuestoModel())->get_isCosido($this->viewData['tipo_impresion_id']); + $this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null); $this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo')); $this->viewData['paisList'] = $this->getPaisListItems(); $this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null); - $this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO + $this->viewData['formAction'] = route_to('createCosidotapablanda'); @@ -648,11 +651,15 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController continue; } - $linea['fields']['precio_hora'] = $precio_hora; + $linea['fields']['tipo_maquina'] = $maquina->is_tinta?'inkjet':'toner'; + $linea['fields']['precio_hora'] = $precio_hora*$margen_precio_hora/100.0; $linea['fields']['precio_hora_margen'] = $margen_precio_hora; $linea['fields']['horas_maquina'] = $tiempo; $linea['fields']['precio_impresion_horas'] = $precio_hora*$tiempo*1.0; $linea['fields']['margen_impresion_horas'] = $precio_hora*$tiempo*1.0*$margen_precio_hora/100.0; + + $linea['fields']['total_impresion'] = $linea['fields']['precio_pedido'] + // papel + $linea['fields']['precio_impresion_horas']; // impresion array_push($lineas, $linea); } @@ -766,6 +773,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController $linea['fields']['maquina'] = $maquina->maquina; $linea['fields']['maquina_id'] = $maquina->maquina_id; $linea['fields']['maquina_velocidad'] = $maquina->velocidad; + $linea['fields']['tipo_maquina'] = 'inkjet'; $linea['fields']['papel_impresion'] = $papel->nombre; $linea['fields']['papel_impresion_id'] = $papel->id; $linea['fields']['paginas'] = $datosPedido->paginas; @@ -808,7 +816,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController continue; } - $linea['fields']['precio_hora'] = $precio_hora; + $linea['fields']['precio_hora'] = $precio_hora*$margen_precio_hora/100.0; $linea['fields']['precio_hora_margen'] = $margen_precio_hora; $linea['fields']['horas_maquina'] = $tiempo; $linea['fields']['precio_impresion_horas'] = $precio_hora*$tiempo*1.0; diff --git a/ci4/app/Language/en/Presupuestos.php b/ci4/app/Language/en/Presupuestos.php index 2b4b89f9..3626c567 100755 --- a/ci4/app/Language/en/Presupuestos.php +++ b/ci4/app/Language/en/Presupuestos.php @@ -76,12 +76,14 @@ return [ 'click' => 'Click', 'totalClicks' => 'Total clicks', 'horas' => 'Machine hours', + 'precioHora' => 'Price hour', 'precioImpresion' => 'Print price', 'precioPagNegro' => 'Pages black price', 'precioPagColor' => 'Pages color price', 'totalTinta' => 'Total ink', 'totalCorte' => 'Total cut', 'total' => 'Total', + 'totalLinea' => 'Row Total', 'aFavorFibra' => 'In fiber direction', 'cubierta' => 'Cover', 'sobrecubierta' => 'Dust jacket', diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index 9ed161c8..cd1ff429 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -69,18 +69,20 @@ return [ 'pliegosPedido' => 'Pliegos pedido', 'precioPliego' => 'Precio pliegos', 'libro' => 'Libro', - 'totalPapelPedido' => 'Total papel pedido', + 'totalPapelPedido' => 'Papel pedido', 'lomo' => 'Lomo', 'peso' => 'Peso', 'click' => 'Click', 'totalClicks' => 'Total clicks', 'horas' => 'Horas máquina', + 'precioHora' => 'Precio hora', 'precioImpresion' => 'Precio impresión', 'precioPagNegro' => 'Precio pág. negro', 'precioPagColor' => 'Precio pág. color', 'totalTinta' => 'Total tinta', 'totalCorte' => 'Total corte', 'total' => 'Total', + 'totalLinea' => 'Total Precio Línea', 'aFavorFibra' => 'A favor de fibra', 'cubierta' => 'Cubierta', 'sobrecubierta' => 'Sobrecubierta', @@ -106,7 +108,7 @@ return [ 'porDefecto' => 'Por defecto', 'tipoImpresion' => 'Impresion', - 'numPagColor' => 'Nº Paginas Color', + 'numPagColor' => 'Nº Pag. Color', 'saturacion' => 'Saturación', 'cobNegro' => 'Cob. % Negro', 'cobCyan' => 'Cob. % Cyan', diff --git a/ci4/app/Models/Configuracion/MaquinaModel.php b/ci4/app/Models/Configuracion/MaquinaModel.php index f9cb6f52..25fa6b61 100755 --- a/ci4/app/Models/Configuracion/MaquinaModel.php +++ b/ci4/app/Models/Configuracion/MaquinaModel.php @@ -353,7 +353,7 @@ class MaquinaModel extends \App\Models\GoBaseModel ->groupEnd(); } - public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $uso_tarifa = 'interior', $tirada, $papel_impresion_id = -1) + public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $uso_tarifa , $tirada, $papel_impresion_id = -1) { /* 1.-> tarifa_Tipo impresion diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php index a75db67d..81885369 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php @@ -135,10 +135,6 @@ $(document).on('click', '.btn-edit-add', function(e) { $('#add_entregaPieCalle').prop('checked', data.entregaPieCalle==1?true:false) $newAddDialog.modal('show') - - - console.log(data) - console.log() }) 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 7f23f7a1..d7800441 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 @@ -249,8 +249,6 @@ }) - const POD = ; - $('#serv_default').on('click', function(){ get_tarifas_enc('default').then( get_tarifas_manipulado('default') diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php index e6a5b498..54c898ee 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php @@ -16,884 +16,37 @@ + + + + + + + + + + - + - + - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ +
@@ -923,37 +76,609 @@ section("additionalInlineJs") ?> +const papelGenericoNegroList = ; -$('#lp_bn_papel').val(''); -$('#lp_bnhq_papel').val(''); -$('#lp_color_papel').val(''); -$('#lp_colorhq_papel').val(''); -$('#lp_rot_bn_papel').val(''); -$('#lp_rot_color_papel').val(''); -$('#lp_cubierta_papel').val(''); -$('#lp_sobrecubierta_papel').val(''); +// Formatting function for row details - modify as you need +function format(d) { + var value = ''+ + ''+ + ''+ + ''+ + ''+ + '
' + + '
' + + "" + + ''+ + '
'+ + '
' + + "" + + ''+ + '
'+ + '
' + + "" + + ''+ + '
'+ + '
' + + "" + + ''+ + '
'+ + '
' + + "" + + ''+ + '
'+ + '' + + '
' + + '' + + '
'+ + '
' + + "" + + ''+ + '
'+ + '
' + + "" + + ''+ + '
'+ + '
' + + "" + + ''+ + '
'+ + '
' + + "" + + ''+ + '
'+ + '
' + + "" + + ''+ + '
'+ + '
' + + '' + + '
'+ + '' + + '
' + + '' + + + + + value += '' + + if(d.maquinaTipo=='inkjet'){ + value += + ''+ + ''+ + ''+ + ''+ + ''+ + '
' + + '
' + + '' + + '
'+ + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '
' + + '
' + + + '' + + '' + + ''+ + ''+ + ''+ + ''+ + ''+ + '
' + + (d.row_id.includes('rot')?'
': '' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + ''+ + ''+ + ''+ + ''+ + ''+ + '
' + + (d.row_id.includes('rot')?'
': '' + + (d.row_id.includes('rot')?'
': '' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + (d.row_id.includes('rot')?'
': '' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + ''+ + ''+ + ''+ + ''+ + ''+ + '
' + + (d.row_id.includes('rot')?'
': '' + + (d.row_id.includes('rot')?'
': '' + + (d.row_id.includes('rot')?'
': '' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + ''+ + '
' + + '
' + + '' + + '' + } + + return $(value).toArray(); +} + +const lastColNr_lp = $('#tableLineasPresupuesto').find("tr:first th").length - 1; + +const actionBtns_lp = function(data) { + return ` + + `; +}; + +var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{ + scrollX: true, + searching: false, + paging: false, + info: false, + ordering: false, + responsive: true, + select: false, + rowId: 'row_id', + language: { + url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" + }, + columnDefs: [ + { + targets: 0, + className: 'dt-control', + orderable: false, + data: null, + defaultContent: '' + }, + { + targets: [1,2,3,4,5,6,7,8,9], + orderable: false, + visible: false, + }, + { + orderable: false, + searchable: false, + targets: [lastColNr_lp] + }, + ], + columns: [ + {data: null}, + {data: 'tarifa_impresion_id'}, + {data: 'maquina_ancho'}, + {data: 'maquina_alto'}, + {data: 'maquina_impresion_ancho'}, + {data: 'maquina_impresion_alto'}, + {data: 'formas'}, + {data: 'formas_v'}, + {data: 'formas_h'}, + {data: 'formas_orientacion'}, + {data: 'icon', + render: function ( data, type, row, meta ){ + return '' + } + }, + {data: 'paginas', + render: function ( data, type, row, meta ) { + return ''; + } + }, + {data: 'papel', + render: function ( data, type, row, meta ) { + var select = $('') + .attr('id', row.row_id + '_gramaje') + .attr('name', row.row_id + '_gramaje') + .addClass('form-control form-select-sm lp-cell lp-select ' + row.class + '-select') + .css('min-width', '40px') + + var option = ''; + select.append(option); + + return select[0].outerHTML + } + }, + {data: 'papel_impresion', + render: function ( data, type, row, meta ) { + var select = $('') + .attr('id', row.row_id + '_maquina') + .attr('name', row.row_id + '_maquina') + .addClass('form-control form-select-sm lp-cell lp-select ' + row.class + '-select') + .css('min-width', '110px') + + var option = ''; + select.append(option); + + return select[0].outerHTML + } + }, + {data: 'tiempo', + render: function ( data, type, row, meta ) { + return ''; + } + }, + {data: 'lomo', + render: function ( data, type, row, meta ) { + return ''; + } + }, + {data: 'peso', + render: function ( data, type, row, meta ) { + return ''; + } + }, + {data: 'total_linea', + render: function ( data, type, row, meta ) { + return ''; + } + }, + { + data: actionBtns_lp, + className: 'row-edit dt-center' + } + ] +}); + + +// Add event listener for opening and closing details +tableLineasPresupuesto.on('click', 'td.dt-control', function (e) { + let tr = e.target.closest('tr'); + let row = tableLineasPresupuesto.row(tr); + + if (row.child.isShown()) { + // This row is already open - close it + row.child.hide(); + } + else { + // Open this row + row.child(format(row.data())).show(); + } +}); + + +function processRowData(row, rowId, rowClass){ + + $('#lp_bn_numeroPliegos').val() + $('#lp_bn_pliegosPedido').val() + $('#lp_bn_precioPliego').val() + $('#lp_bn_libro').val() + $('#lp_bn_totalPapelPedido').val() + $('#lp_bn_margenPapelPedido').val() + $('#lp_bn_lomo').val() + $('#lp_bn_peso').val() + $('#lp_bn_click').val() + $('#lp_bn_totalClicks').val() + + var icon = "" + if(rowId=='lp_bn'){ + if(row.tipo_maquina=='toner') + icon = '' + else + icon = '' + } + + else if(rowId=='lp_bnhq'){ + if(row.tipo_maquina=='toner') + icon = '' + else + icon = '' + } + + else if(rowId=='lp_color') + icon = '' + else if(rowId=='lp_colorhq') + icon = '' + else if(rowId=='lp_cubierta') + icon = '' + else if(rowId=='lp_sobrecubierta') + icon = '' + else if(rowId=='lp_rot_bn') + icon = '' + else if(rowId=='lp_rot_color') + icon = '' + + var data = { + 'row_id': rowId, + 'class': rowClass, + + 'tarifa_impresion_id': isNaN(parseInt(row.tarifa_impresion_id)) ? "" : parseInt(row.tarifa_impresion_id), + 'maquina_ancho': isNaN(parseFloat(row.dimensiones_maquina[0])) ? "" : parseFloat(row.dimensiones_maquina[0]), + 'maquina_alto': isNaN(parseFloat(row.dimensiones_maquina[1])) ? "" : parseFloat(row.dimensiones_maquina[1]), + 'maquina_impresion_ancho': isNaN(parseFloat(row.dimensiones_maquina_impresion[0])) ? "" : parseFloat(row.dimensiones_maquina_impresion[0]), + 'maquina_impresion_alto': isNaN(parseFloat(row.dimensiones_maquina_impresion[1])) ? "" : parseFloat(row.dimensiones_maquina_impresion[1]), + 'formas': isNaN(parseInt(row.num_formas.value)) ? 0 : parseInt(row.num_formas.value), + 'formas_v': isNaN(parseInt(row.num_formas.num_formas_horizontales)) ? 0 : parseInt(row.num_formas.num_formas_horizontales), + 'formas_h': isNaN(parseInt(row.num_formas.num_formas_verticales)) ? 0 : parseInt(row.num_formas.num_formas_verticales), + 'formas_orientacion': row.num_formas.posicion_formas, + + 'icon': icon, + 'paginas': row.paginas, + 'papel': row.papel_generico_id, + 'gramaje': row.gramaje, + 'papel_impresion': row.papel_impresion, + 'papel_impresion_id': row.papel_impresion_id, + 'maquina': row.maquina, + 'maquina_id': row.maquina_id, + + 'tiempo': row.tiempo_maquina, + 'lomo': isNaN(parseFloat(row.mano)) ? "" : parseFloat(row.mano).toFixed(2), + 'peso': isNaN(parseFloat(row.peso)) ? "" : parseFloat(row.peso).toFixed(2), + + 'total_linea': isNaN(parseFloat(row.total_impresion)) ? "" : parseFloat(row.total_impresion).toFixed(2), + + 'numeroPliegos':isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(2), + 'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(2), + 'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6), + 'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2), + 'totalPapelPedido': isNaN(parseFloat(row.precio_pedido)) ? "" : parseFloat(row.precio_pedido).toFixed(2), + 'margenPapelPedido': isNaN(parseFloat(row.margen_papel_pedido)) ? "": parseFloat(row.margen_papel_pedido).toFixed(2), + 'click': isNaN(parseFloat(row.precio_click)) ? "" : parseFloat(row.precio_click).toFixed(6), + 'totalClicks': isNaN(parseFloat(row.precio_click_pedido)) ? "" : parseFloat(row.precio_click_pedido).toFixed(2), + 'horasMaquina': isNaN(parseFloat(row.horas_maquina)) ? "" : parseFloat(row.horas_maquina).toFixed(2), + 'precioHora': isNaN(parseFloat(row.precio_hora)) ? "" : parseFloat(row.precio_hora).toFixed(2), + 'precioImpresion': isNaN(parseFloat(row.precio_impresion_horas)) ? "" : parseFloat(row.precio_impresion_horas).toFixed(2), + 'maquinaTipo': row.tipo_maquina, + } + + return data +} + +$('#test').on('click', function(){ + var data = { + 'row_id': 'lp_bn', + 'class': 'lp-bn', + 'tarifa_impresion_id': 1, + 'maquina_ancho': 350, + 'maquina_alto': 450, + 'maquina_impresion_ancho': 350, + 'maquina_impresion_alto': 450, + 'formas': 8, + 'formas_v': 4, + 'formas_h': 3, + 'formas_orientacion': 'v', + 'icon': '', + 'paginas': '2', + 'papel': 1, + 'gramaje': 90, + 'papel_impresion': "ivory", + 'papel_impresion_id': "10", + 'maquina': "VP iX (500x350)", + 'maquina_id': "4", + 'tiempo': "01:02:04", + 'lomo': 2.23, + 'peso': 12.23, + 'total_linea': 22.34, + 'numeroPliegos':222, + 'pliegosPedido': 123, + 'precioPliego': 456, + 'libro': 789, + 'totalPapelPedido': 555, + 'margenPapelPedido': 123, + 'click': 111, + 'totalClicks': 222, + 'horasMaquina': 333.3, + 'precioHora': 99, + 'precioImpresion': 44.44, + 'maquinaTipo': 'inkjet', + } + + tableLineasPresupuesto.row.add(data).draw(true) + + let row = tableLineasPresupuesto.row('#lp_bn'); + row.child(format(row.data())).show(); + + $('#lp_bn_papel').bind("focus", {clear_selectors: true}, clear_lp_bn); + $('#lp_bn_gramaje').bind("focus", set_lp_bn_gramaje); + $('#lp_bn_papelImpresion').focus("focus", set_lp_bn_papelImpresion); + $('#lp_bn_maquina').bind("focus", set_lp_bn_maquina); + $('#lp_bn_maquina').bind("change", change_lp_bn_maquina); + $('#lp_bn_paginas').bind("change", change_lp_bn_paginas); + $('#lp_bn_paginas').bind("change", change_lp_bn_paginas); + $('#lp_bn_vercalculos').bind("click", {rowId: 'lp_bn'}, verCalculosInkjet); +}) + $('#addLineasPresupuesto').val(''); $('.paginas-lp').on('change', function(){ checkPaginasPresupuesto() }) -$('#lp_rot_color_vercalculos').on("click", function () { - if($( ".calculos_rot_color" ).css('display') == 'none') - $( ".calculos_rot_color" ).css('display', 'flex') - else{ - $( ".calculos_rot_color" ).css('display', 'none') - } -}); -$('#lp_rot_bn_vercalculos').on("click", function () { - if($( ".calculos_rot_bn" ).css('display') == 'none') - $( ".calculos_rot_bn" ).css('display', 'flex') +function verCalculosInkjet(e){ + if($( ".calculos_" + e.data.rowId ).css('display') == 'none') + $( ".calculos_" + e.data.rowId ).css('display', 'table-row') else{ - $( ".calculos_rot_bn" ).css('display', 'none') + $( ".calculos_" + e.data.rowId ).css('display', 'none') } -}); +}; + // Delete row @@ -1272,21 +997,16 @@ function clear_lp_bn(clear_selectors){ } -$('#lp_bn_papel').bind("focus", {clear_selectors: true}, clear_lp_bn); -$('#lp_bn_gramaje').bind("focus", set_lp_bn_gramaje); -$('#lp_bn_papelImpresion').focus("focus", set_lp_bn_papelImpresion); -$('#lp_bn_maquina').bind("focus", set_lp_bn_maquina); - - -$('#lp_bn_maquina').on("change", function () { +function change_lp_bn_maquina(){ if(parseInt($('#lp_bn_paginas').val())>0){ calcularPresupuesto_bn(); } -}) +} -$('#lp_bn_paginas').on("change", function () { + +function change_lp_bn_paginas(){ if( parseInt($('#lp_bn_paginas').val())>0 && parseInt($('#lp_bn_papel option:selected').val())>0 && @@ -1296,24 +1016,36 @@ $('#lp_bn_paginas').on("change", function () { calcularPresupuesto_bn(); } -}) +} -function calcularPresupuesto_bn(){ +function calcularPresupuesto_bn(input_data={}){ const dimension = getDimensionLibro(); + if(Object.keys(input_data).lengt == 0){ + + input_data = { + paginas:parseInt($('#lp_bn_paginas').val()), + papel_generico_id: $('#lp_bn_papel option:selected').val(), + papel_generico: $('#lp_bn_papel option:selected').text().trim(), + gramaje: $('#lp_bn_gramaje option:selected').text().trim(), + maquina_id: $('#lp_bn_maquina option:selected').val(), + papel_impresion_id: $('#lp_bn_papelImpresion option:selected').val() + } + } + var datos = { type: 'interior', color: 0, hq: 0, - paginas: parseInt($('#lp_bn_paginas').val()), + paginas: input_data.paginas, tirada: parseInt($('#tirada').val()), merma: parseInt($('#merma').val()), ancho: dimension.ancho, alto: dimension.alto, - papel_generico_id: $('#lp_bn_papel option:selected').val() , - papel_generico: $('#lp_bn_papel option:selected').text().trim(), - gramaje: $('#lp_bn_gramaje option:selected').text().trim(), + papel_generico_id: input_data.papel_generico_id, + papel_generico: input_data.papel_generico, + gramaje: input_data.gramaje, cliente_id: $('#clienteId').find(":selected").val(), : v }; @@ -1329,9 +1061,9 @@ function calcularPresupuesto_bn(){ $.each(data.lineas, function(key, value) { // Se cogen los valores de la linea con los datos correspondientes - if(value.fields.maquina_id === $('#lp_bn_maquina option:selected').val() && - value.fields.papel_generico_id === datos.papel_generico_id && - value.fields.papel_impresion_id === $('#lp_bn_papelImpresion option:selected').val() ) { + if(value.fields.maquina_id === input_data.maquina_id && + value.fields.papel_generico_id === input_data.papel_generico_id && + value.fields.papel_impresion_id === input_data.papel_impresion_id) { fill_lp_bn(value.fields); return false; @@ -1358,6 +1090,7 @@ function calcularPresupuesto_bn(){ function fill_lp_bn(row, fromComparator=false){ if(fromComparator){ + /* $('#lp_bn_paginas').val(row.paginas) $('#lp_bn_papel').val(row.papelGenericoId) $('#lp_bn_gramaje').empty() @@ -1372,32 +1105,34 @@ function fill_lp_bn(row, fromComparator=false){ $('#lp_bn_maquina').append(``); - - calcularPresupuesto_bn(false) + */ + var input_data = { + paginas: row.paginas, + papel_generico_id: row.papelGenericoId, + gramaje: row.gramaje, + papel_impresion_id: row.papelImpresionId, + maquina_id: row.maquinaId, + } + calcularPresupuesto_bn(input_data) } else{ // Si viene de hacerlo a mano... - $('#lp_bn_tiempo').val(row.tiempo_maquina) - $('#lp_bn_numeroPliegos').val(isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(2)) - $('#lp_bn_pliegosPedido').val(isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(2)) - $('#lp_bn_precioPliego').val(isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6)) - $('#lp_bn_libro').val(isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2)) - $('#lp_bn_totalPapelPedido').val(isNaN(parseFloat(row.precio_pedido)) ? "" : parseFloat(row.precio_pedido).toFixed(2)) - $('#lp_bn_margenPapelPedido').val(isNaN(parseFloat(row.margen_papel_pedido)) ? "": parseFloat(row.margen_papel_pedido).toFixed(2)) - $('#lp_bn_lomo').val(isNaN(parseFloat(row.mano)) ? "" : parseFloat(row.mano).toFixed(2)) - $('#lp_bn_peso').val(isNaN(parseFloat(row.peso)) ? "" : parseFloat(row.peso).toFixed(2)) - $('#lp_bn_click').val(isNaN(parseFloat(row.precio_click)) ? "" : parseFloat(row.precio_click).toFixed(6)) - $('#lp_bn_totalClicks').val(isNaN(parseFloat(row.precio_click_pedido)) ? "" : parseFloat(row.precio_click_pedido).toFixed(2)) + console.log(row) + data = processRowData(row, 'lp_bn', 'lp-bn'); - $('#lp_bn_tarifa_impresion_id').val(isNaN(parseInt(row.tarifa_impresion_id)) ? "" : parseInt(row.tarifa_impresion_id)) - $('#lp_bn_maquina_ancho').val(isNaN(parseFloat(row.dimensiones_maquina[0])) ? "" : parseFloat(row.dimensiones_maquina[0])) - $('#lp_bn_maquina_alto').val(isNaN(parseFloat(row.dimensiones_maquina[1])) ? "" : parseFloat(row.dimensiones_maquina[1])) - $('#lp_bn_maquina_impresion_ancho').val(isNaN(parseFloat(row.dimensiones_maquina_impresion[0])) ? "" : parseFloat(row.dimensiones_maquina_impresion[0])) - $('#lp_bn_maquina_impresion_alto').val(isNaN(parseFloat(row.dimensiones_maquina_impresion[1])) ? "" : parseFloat(row.dimensiones_maquina_impresion[1])) - $('#lp_bn_formas').val(isNaN(parseInt(row.num_formas.value)) ? "" : parseInt(row.num_formas.value)) - $('#lp_bn_formas_h').val(isNaN(parseInt(row.num_formas.num_formas_horizontales)) ? "" : parseInt(row.num_formas.num_formas_horizontales)) - $('#lp_bn_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales)) - $('#lp_bn_formas_orientacion').val(row.num_formas.posicion_formas) + tableLineasPresupuesto.row.add(data).draw(true) + + var row = tableLineasPresupuesto.row('#lp_bn'); + row.child(format(row.data())).show(); + + $('#lp_bn_papel').bind("focus", {clear_selectors: true}, clear_lp_bn); + $('#lp_bn_gramaje').bind("focus", set_lp_bn_gramaje); + $('#lp_bn_papelImpresion').focus("focus", set_lp_bn_papelImpresion); + $('#lp_bn_maquina').bind("focus", set_lp_bn_maquina); + $('#lp_bn_maquina').bind("change", change_lp_bn_maquina); + $('#lp_bn_paginas').bind("change", change_lp_bn_paginas); + $('#lp_bn_paginas').bind("change", change_lp_bn_paginas); + $('#lp_bn_vercalculos').bind("click", {rowId: 'lp_bn'}, verCalculosInkjet); calcular_mermas() updateTotales() @@ -1406,7 +1141,7 @@ function fill_lp_bn(row, fromComparator=false){ $('#lp_bn').css('display', '') $("#tableLineasPresupuesto").DataTable().columns.adjust(); - getVisibleTabs(); // Update preview UI + // getVisibleTabs(); // Update preview UI } endSection() ?> @@ -1648,7 +1383,7 @@ function fill_lp_color(row, fromComparator=false){ $('#lp_color').css('display', '') $("#tableLineasPresupuesto").DataTable().columns.adjust(); - getVisibleTabs(); // Update preview UI + // getVisibleTabs(); // Update preview UI } endSection() ?> @@ -1889,7 +1624,7 @@ function fill_lp_bnhq(row, fromComparator=false){ $('#lp_bnhq').css('display', '') $("#tableLineasPresupuesto").DataTable().columns.adjust(); - getVisibleTabs(); // Update preview UI + // getVisibleTabs(); // Update preview UI } endSection() ?> @@ -2131,7 +1866,7 @@ function fill_lp_colorhq(row, fromComparator=false){ $('#lp_colorhq').css('display', '') $("#tableLineasPresupuesto").DataTable().columns.adjust(); - getVisibleTabs(); // Update preview UI + // getVisibleTabs(); // Update preview UI } endSection() ?> @@ -2482,7 +2217,7 @@ function fill_lp_rot_bn(row, fromComparador=false){ $('.lp_rot_bn').css('display', '') $("#tableLineasPresupuesto").DataTable().columns.adjust(); - getVisibleTabs(); // Update preview UI + // getVisibleTabs(); // Update preview UI } endSection() ?> @@ -2843,7 +2578,7 @@ function fill_lp_rot_color(row, fromComparador=false){ $('.lp_rot_color').css('display', '') $("#tableLineasPresupuesto").DataTable().columns.adjust(); - getVisibleTabs(); // Update preview UI + // getVisibleTabs(); // Update preview UI } endSection() ?> @@ -2853,19 +2588,6 @@ function fill_lp_rot_color(row, fromComparador=false){ section("additionalInlineJs") ?> -var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{ - scrollX: true, - searching: false, - paging: false, - info: false, - ordering: false, - responsive: true, - select: false, - language: { - url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" - }, -}); - async function set_lp_cubierta_gramaje(){ await $.ajax({ @@ -3127,7 +2849,7 @@ function fill_lp_cubierta(row, fromComparador=false){ $('.lp_cubierta').css('display', '') $("#tableLineasPresupuesto").DataTable().columns.adjust(); - getVisibleTabs(); // Update preview UI + // getVisibleTabs(); // Update preview UI } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php index 55eae983..40ade0a3 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php @@ -22,7 +22,7 @@ - + @@ -109,8 +109,6 @@ - - endSection() ?> @@ -120,6 +118,8 @@ section("additionalInlineJs") ?> +const POD = ; + if(url_parts[url_parts.length-2] == 'edit'){ id = url_parts[url_parts.length-1]; diff --git a/httpdocs/themes/vuexy/css/sk-datatables.css b/httpdocs/themes/vuexy/css/sk-datatables.css index 6884a44c..96880eb5 100755 --- a/httpdocs/themes/vuexy/css/sk-datatables.css +++ b/httpdocs/themes/vuexy/css/sk-datatables.css @@ -60,7 +60,7 @@ table.dataTable.table-hover>tbody>tr.selected:hover>* { padding-top: 2px; padding-bottom: 2px; width: 100%; - font-size:0.8rem !important; + /*font-size:0.8rem !important;*/ } .lp-td { @@ -83,7 +83,7 @@ table.dataTable.table-hover>tbody>tr.selected:hover>* { } .lp-button{ - font-size: 1.1em; + /*font-size: 1.1em;*/ padding-left: 3px; padding-right: 3px; width: 100%; diff --git a/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_inkjet_bn.png b/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_inkjet_bn.png new file mode 100644 index 00000000..2dc707c7 Binary files /dev/null and b/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_inkjet_bn.png differ diff --git a/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_inkjet_color.png b/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_inkjet_color.png new file mode 100644 index 00000000..98256a67 Binary files /dev/null and b/httpdocs/themes/vuexy/img/safekat/presupuestos/icon_inkjet_color.png differ