Merge branch 'bug/reunion_madrid' into 'main'

arreglados bug al actualizar la tabla de lineas (vuelta a lo anterior). el...

See merge request jjimenez/safekat!182
This commit is contained in:
2024-03-06 17:03:49 +00:00
8 changed files with 99 additions and 54 deletions

View File

@ -496,8 +496,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
'magenta' => floatval($reqData['magenta']) ?? 0,
'amarillo' => floatval($reqData['amarillo']) ?? 0,
'cg' => floatval($reqData['cg']) ?? 0,
'gota_negro' => intval($reqData['gota_negro']) ?? 0,
'gota_color' => intval($reqData['gota_color']) ?? 0,
'gota_negro' => floatval($reqData['gota_negro']) ?? 0,
'gota_color' => floatval($reqData['gota_color']) ?? 0,
);
array_push($datosTipolog, $data);
}
@ -541,8 +541,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
'cyan' => floatval($reqData['cyan']) ?? 0,
'magenta' => floatval($reqData['magenta']) ?? 0,
'amarillo' => floatval($reqData['amarillo']) ?? 0,
'gota_negro' => intval($reqData['gota_negro']) ?? 0,
'gota_color' => intval($reqData['gota_color']) ?? 0,
'gota_negro' => floatval($reqData['gota_negro']) ?? 0,
'gota_color' => floatval($reqData['gota_color']) ?? 0,
);
array_push($datosTipolog, $data);
}

View File

@ -156,12 +156,12 @@ class Presupuestotiradasalternativas extends \App\Controllers\GoBaseResourceCont
'rotativa_gota_negro' => 0,
'rotativa_gota_color' => 0,
);
$parametrosRotativa->rotativa_gota_negro = intval($linea['gotaNegro']?? 0);
$parametrosRotativa->rotativa_gota_color = intval($linea['gotaColor']?? 0);
$parametrosRotativa->rotativa_negro = intval($linea['cobNegro'] ?? 0);
$parametrosRotativa->rotativa_cyan = intval($linea['cobCyan'] ?? 0);
$parametrosRotativa->rotativa_magenta = intval($linea['cobMagenta']?? 0);
$parametrosRotativa->rotativa_amarillo = intval($linea['cobAmarillo']?? 0);
$parametrosRotativa->rotativa_gota_negro = floatval($linea['gotaNegro']?? 0);
$parametrosRotativa->rotativa_gota_color = floatval($linea['gotaColor']?? 0);
$parametrosRotativa->rotativa_negro = floatval($linea['cobNegro'] ?? 0);
$parametrosRotativa->rotativa_cyan = floatval($linea['cobCyan'] ?? 0);
$parametrosRotativa->rotativa_magenta = floatval($linea['cobMagenta']?? 0);
$parametrosRotativa->rotativa_amarillo = floatval($linea['cobAmarillo']?? 0);
break;
case 'lp_cubierta':
$uso = 'cubierta';
@ -195,13 +195,13 @@ class Presupuestotiradasalternativas extends \App\Controllers\GoBaseResourceCont
if (!is_null($datosTipolog)) {
$datosTipolog = [];
$data_temp = (object)array(
'negro' => intval($linea['cobNegro'] ?? 0),
'cyan' => intval($linea['cobCyan'] ?? 0),
'magenta' => intval($linea['cobMagenta']?? 0),
'amarillo' => intval($linea['cobAmarillo']?? 0),
'cg' => intval($linea['cobCG'] ?? 0),
'gota_negro' => intval($linea['gotaNegro']?? 0),
'gota_color' => intval($linea['gotaColor']?? 0),
'negro' => floatval($linea['cobNegro'] ?? 0),
'cyan' => floatval($linea['cobCyan'] ?? 0),
'magenta' => floatval($linea['cobMagenta']?? 0),
'amarillo' => floatval($linea['cobAmarillo']?? 0),
'cg' => floatval($linea['cobCG'] ?? 0),
'gota_negro' => floatval($linea['gotaNegro']?? 0),
'gota_color' => floatval($linea['gotaColor']?? 0),
);
array_push($datosTipolog, $data_temp);
}

View File

@ -140,7 +140,8 @@ function updateTablaEnvios(){
})
.draw();
checkInsertar()
checkInsertar()
updateTotales(false, false, true)
}
else{
popErrorAlert('<?= lang('PresupuestosDirecciones.validation.no_tarifa') ?>', 'error-tarifa')
@ -154,6 +155,8 @@ $(document).on('click', '.delete-add-row', function(e) {
.remove()
.draw();
checkInsertar()
updateTotales(false, false, true)
})
$(document).on('click', '.btn-edit-add', function(e) {

View File

@ -521,6 +521,10 @@
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
"drawCallback": function(settings ) {
updateTotales(false, true, false)
}
});
function init_servicio_acabado(){
@ -727,7 +731,11 @@
select: false,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
},
"drawCallback": function(settings ) {
updateTotales(false, true, false)
}
});
@ -1001,6 +1009,10 @@
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
"drawCallback": function(settings ) {
updateTotales(false, true, false)
}
});
function init_servicio_manipulado(){
@ -1155,6 +1167,10 @@
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
"drawCallback": function(settings ) {
updateTotales(false, true, false)
}
});

View File

@ -87,6 +87,20 @@ const papelGenericoRotativaColorList = <?php echo json_encode($papelGenericoRota
const papelGenericoGuardasList = <?php echo json_encode($papelGenericoGuardasList); ?>;
<?php endif; ?>
// variable para controlar el foco en los inputs
let focused = 0;
function change_focus(){
// se comprueba que el elemento es un input
if($('#'+focused).is('input')){
if(focused){
$('#'+focused).focus();
$('#'+focused).select();
focused = 0;
}
}
}
// Formatting function for row details - modify as you need
function format(d) {
@ -165,7 +179,7 @@ function format(d) {
'</div>'+
'<div class="col-md-12 col-lg-1">' +
'<?= lang('Presupuestos.numPagColor') ?>' +
'<input type="text" id="' + d.row_id +'_numPagColor" name="' + d.row_id +'_numPagColor" class="lp-cell lp-input' + (d.row_id.includes('color')?'" ':' lp-cell-disabled" readonly ') + ' value="' + d.numPagColor +'">' +
'<input type="number" id="' + d.row_id +'_numPagColor" name="' + d.row_id +'_numPagColor" class="lp-cell lp-input no-spinner' + (d.row_id.includes('color')?'" ':' lp-cell-disabled" readonly ') + ' value="' + d.numPagColor +'">' +
'</div>' +
((d.row_id.includes('rot'))?'<div class="col-md-12 col-lg-1">' +
'<?= lang('Presupuestos.saturacion') ?>' +
@ -173,32 +187,32 @@ function format(d) {
'</div>':'') +
'<div class="col-md-12 col-lg-1">' +
'<?= lang('Presupuestos.cobNegro') ?>' +
'<input type="text" id="' + d.row_id +'_cobNegro" name="' + d.row_id +'_cobNegro" class="lp-cell lp-input ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobNegro +'">' +
'<input type="number" id="' + d.row_id +'_cobNegro" name="' + d.row_id +'_cobNegro" class="lp-cell lp-input no-spinner ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobNegro +'">' +
'</div>' +
'<div class="col-md-12 col-lg-1">' +
'<?= lang('Presupuestos.cobCyan') ?>' +
'<input type="text" id="' + d.row_id +'_cobCyan" name="' + d.row_id +'_cobCyan" class="lp-cell lp-input ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobCyan +'">' +
'<input type="number" id="' + d.row_id +'_cobCyan" name="' + d.row_id +'_cobCyan" class="lp-cell lp-input no-spinner ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobCyan +'">' +
'</div>' +
'<div class="col-md-12 col-lg-1">' +
'<?= lang('Presupuestos.cobMagenta') ?>' +
'<input type="text" id="' + d.row_id +'_cobMagenta" name="' + d.row_id +'_cobMagenta" class="lp-cell lp-input ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobMagenta +'">' +
'<input type="number" id="' + d.row_id +'_cobMagenta" name="' + d.row_id +'_cobMagenta" class="lp-cell lp-input no-spinner ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobMagenta +'">' +
'</div>' +
'<div class="col-md-12 col-lg-1">' +
'<?= lang('Presupuestos.cobAmarillo') ?>' +
'<input type="text" id="' + d.row_id +'_cobAmarillo" name="' + d.row_id +'_cobAmarillo" class="lp-cell lp-input ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobAmarillo +'">' +
'<input type="number" id="' + d.row_id +'_cobAmarillo" name="' + d.row_id +'_cobAmarillo" class="lp-cell lp-input no-spinner ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobAmarillo +'">' +
'</div>' +
((!d.row_id.includes('rot'))?
'<div class="col-md-12 col-lg-1">' +
'<?= lang('Presupuestos.cobCG') ?>' +
'<input type="text" id="' + d.row_id +'_cobCG" name="' + d.row_id +'_cobCG" class="lp-cell lp-input ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobCG +'">' +
'<input type="number" id="' + d.row_id +'_cobCG" name="' + d.row_id +'_cobCG" class="lp-cell lp-input no-spinner ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.cobCG +'">' +
'</div>':'') +
'<div class="col-md-12 col-lg-1">' +
'<?= lang('Presupuestos.gotaNegro') ?>' +
'<input type="text" id="' + d.row_id +'_gotaNegro" name="' + d.row_id +'_gotaNegro" class="lp-cell lp-input ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.gotaNegro +'">' +
'<input type="number" id="' + d.row_id +'_gotaNegro" name="' + d.row_id +'_gotaNegro" class="lp-cell lp-input no-spinner ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.gotaNegro +'">' +
'</div>' +
'<div class="col-md-12 col-lg-1 ">' +
'<?= lang('Presupuestos.gotaColor') ?>' +
'<input type="text" id="' + d.row_id +'_gotaColor" name="' + d.row_id +'_gotaColor" class="lp-cell lp-input ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.gotaColor +'">' +
'<input type="number" id="' + d.row_id +'_gotaColor" name="' + d.row_id +'_gotaColor" class="lp-cell lp-input no-spinner ' + d.row_class +'-input ' + d.row_class +'-tipologia" value="' + d.gotaColor +'">' +
'</div>' +
'<div class="col-md-12 col-lg-1" style="display: grid;" >' +
'<?= lang('Presupuestos.aFavorFibra') ?>' +
@ -610,7 +624,7 @@ var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
.addClass('form-control form-select-sm lp-cell lp-select ' + row.row_class + '-select')
.css('min-width', '40px')
var option = '<option value="" selected>'+data+'</option>';
var option = '<option value="" selected>'+ parseInt(data)+'</option>';
select.append(option);
return select[0].outerHTML
@ -810,8 +824,8 @@ function processRowData(row, rowId, rowClass){
data.cobCyan = isNaN(parseFloat(row.datosTipologias.cyan)) ? "" : parseFloat(row.datosTipologias.cyan).toFixed(2)
data.cobMagenta = isNaN(parseFloat(row.datosTipologias.magenta)) ? "" : parseFloat(row.datosTipologias.magenta).toFixed(2)
data.cobAmarillo = isNaN(parseFloat(row.datosTipologias.amarillo)) ? "" : parseFloat(row.datosTipologias.amarillo).toFixed(2)
data.gotaNegro = isNaN(parseFloat(row.datosTipologias.gota_negro)) ? "" : parseFloat(row.datosTipologias.gota_negro).toFixed(0)
data.gotaColor = isNaN(parseFloat(row.datosTipologias.gota_color)) ? "" : parseFloat(row.datosTipologias.gota_color).toFixed(0)
data.gotaNegro = isNaN(parseFloat(row.datosTipologias.gota_negro)) ? "" : parseFloat(row.datosTipologias.gota_negro).toFixed(2)
data.gotaColor = isNaN(parseFloat(row.datosTipologias.gota_color)) ? "" : parseFloat(row.datosTipologias.gota_color).toFixed(2)
data.resolucion = isNaN(parseFloat(row.resolucion)) ? "" : parseFloat(row.resolucion).toFixed(0)
data.areaPaginas = isNaN(parseFloat(row.superficie)) ? "" : parseFloat(row.superficie).toFixed(2)
@ -857,7 +871,7 @@ function processRowData(row, rowId, rowClass){
if(!rowId.includes('rot')){
data.cobCG = isNaN(parseFloat(row.datosTipologias.cg)) ? "" : parseFloat(row.datosTipologias.cg).toFixed(2)
data.gotasCG = isNaN(parseFloat(row.num_gotas_cg)) ? "" : parseFloat(row.num_gotas_cg).toFixed(0)
data.gotasCG = isNaN(parseFloat(row.num_gotas_cg)) ? "" : parseFloat(row.num_gotas_cg).toFixed(2)
data.gTintaCG = isNaN(parseFloat(row.peso_gotas_cg)) ? "" : parseFloat(row.peso_gotas_cg).toFixed(2)
data.gTintaCGPed = isNaN(parseFloat(row.peso_gotas_cg_pedido)) ? "" : parseFloat(row.peso_gotas_cg_pedido).toFixed(2)
}
@ -1548,6 +1562,7 @@ function fill_lp_bn(row, fromComparator=false){
$('#lp_bn_checkPapel').change()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()
@ -1877,6 +1892,7 @@ function fill_lp_color(row, fromComparator=false){
$('#lp_color_checkPapel').change()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()
@ -2188,7 +2204,8 @@ function fill_lp_bnhq(row, fromComparator=false){
mostrar_calculos = ($( ".calculos_lp_bnhq").css('display') == 'table-row')
// Si viene de hacerlo a mano...
data = processRowData(row, 'lp_bnhq', 'lp-bnhq');
focused = $(':focus').attr('id');
var row = tableLineasPresupuesto.row('#lp_bnhq');
if(row.length>0)
tableLineasPresupuesto.row('#lp_bnhq').data(data).draw()
@ -2203,6 +2220,7 @@ function fill_lp_bnhq(row, fromComparator=false){
$('#lp_bnhq_checkPapel').change()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()
@ -2215,6 +2233,7 @@ function fill_lp_bnhq(row, fromComparator=false){
}
$("#tableLineasPresupuesto").DataTable().columns.adjust();
change_focus();
}
function eventos_lp_bnhq(isInkjet = false){
@ -2366,6 +2385,9 @@ function change_lp_colorhq_paginas(){
function change_lp_colorhq_tipologia(){
// Se obtiene el id del elemento que ha disparado el evento
var id = $(this).attr('id')
if( parseInt($('#lp_colorhq_paginas').val())>0 &&
parseInt($('#lp_colorhq_papel option:selected').val())>0 &&
$('#lp_colorhq_gramaje option:selected').text().length>0 &&
@ -2373,6 +2395,7 @@ function change_lp_colorhq_tipologia(){
){
calcularPresupuesto_colorhq({},true);
}
}
@ -2499,6 +2522,7 @@ function calcularPresupuesto_colorhq(input_data={}, updatedTipologias = false){
})
}
function fill_lp_colorhq(row, fromComparator=false){
if(fromComparator){
@ -2514,6 +2538,7 @@ function fill_lp_colorhq(row, fromComparator=false){
else{
// Se guarda el estado de "ver calculos"
mostrar_calculos = ($( ".calculos_lp_colorhq").css('display') == 'table-row')
focused = $(':focus').attr('id');
// Si viene de hacerlo a mano...
data = processRowData(row, 'lp_colorhq', 'lp-colorhq');
@ -2532,6 +2557,7 @@ function fill_lp_colorhq(row, fromComparator=false){
$('#lp_colorhq_checkPapel').change()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()
@ -2540,11 +2566,11 @@ function fill_lp_colorhq(row, fromComparator=false){
if(mostrar_calculos){
$( ".calculos_lp_colorhq").css('display','table-row')
}
}
}
$("#tableLineasPresupuesto").DataTable().columns.adjust();
change_focus();
}
function eventos_lp_colorhq(isInkjet = false){
@ -2565,6 +2591,7 @@ function eventos_lp_colorhq(isInkjet = false){
$('#lp_colorhq_checkPapel').bind("change", {id_linea: 'lp_colorhq'}, update_total_linea);
$('#lp_colorhq_checkClicks').bind("change", {id_linea: 'lp_colorhq'}, update_total_linea);
}
<?= $this->endSection() ?>
@ -2853,6 +2880,7 @@ function fill_lp_rot_bn(row, fromComparador=false){
else{
// Se guarda el estado de "ver calculos"
mostrar_calculos = ($( ".calculos_lp_rot_bn").css('display') == 'table-row')
focused = $(':focus').attr('id');
// Si viene de hacerlo a mano...
data = processRowData(row, 'lp_rot_bn', 'lp-rot-bn');
@ -2871,6 +2899,7 @@ function fill_lp_rot_bn(row, fromComparador=false){
$('#lp_rot_bn_checkPapel').change()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()
@ -2884,7 +2913,7 @@ function fill_lp_rot_bn(row, fromComparador=false){
$('.lp_rot_bn').css('display', '')
$("#tableLineasPresupuesto").DataTable().columns.adjust();
change_focus();
}
function eventos_lp_rot_bn(){
@ -3195,8 +3224,9 @@ function fill_lp_rot_color(row, fromComparador=false){
}
else{
// Se guarda el estado de "ver calculos"
mostrar_calculos = ($( ".calculos_lp_rot_color").css('display') == 'table-row')
mostrar_calculos = ($( ".calculos_lp_rot_color").css('display') == 'table-row')
focused = $(':focus').attr('id');
// Si viene de hacerlo a mano...
data = processRowData(row, 'lp_rot_color', 'lp-rot-color');
@ -3214,6 +3244,7 @@ function fill_lp_rot_color(row, fromComparador=false){
$('#lp_rot_color_checkPapel').change()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()
@ -3226,7 +3257,7 @@ function fill_lp_rot_color(row, fromComparador=false){
}
$("#tableLineasPresupuesto").DataTable().columns.adjust();
change_focus();
}
function eventos_lp_rot_color(){
@ -3474,6 +3505,7 @@ function fill_lp_cubierta(row, fromComparador=false){
// Si viene de hacerlo a mano...
data = processRowData(row, 'lp_cubierta', 'lp-cubierta');
focused = $(':focus').attr('id');
var row = tableLineasPresupuesto.row('#lp_cubierta');
if(row.length>0)
@ -3491,13 +3523,14 @@ function fill_lp_cubierta(row, fromComparador=false){
check_update_sobrecubierta()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()
}
$("#tableLineasPresupuesto").DataTable().columns.adjust();
change_focus();
}
function eventos_lp_cubierta(){
@ -3754,6 +3787,7 @@ function fill_lp_sobrecubierta(row, fromComparador=false){
$('#lp_sobrecubierta_checkPapel').change()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()
@ -3949,6 +3983,7 @@ function fill_lp_guardas(row, fromComparador=false){
$('#lp_guardas_checkPapel').change()
calcular_mermas()
updateTotales(true, false, false);
updateTablaEnvios()

View File

@ -83,17 +83,6 @@
<?= $this->section("additionalInlineJs") ?>
$('.update-resumen-presupuesto').each(function() {
if ($(this).is('table')) {
if($(this).attr('id') == 'tableLineasPresupuesto')
$(this).bind('draw.dt',{updateLP:true, updateServicios:false, updateEnvio:false}, updateTotales);
else if ($(this).attr('id') == 'tableOfServiciosAcabado' || $(this).attr('id') == 'tableOfServiciosPreimpresion' ||
$(this).attr('id') == 'tableOfServiciosEncuadernacion' || $(this).attr('id') == 'tableOfServiciosManipulado')
$(this).bind('draw.dt',{updateLP:false, updateServicios:true, updateEnvio:false}, updateTotales);
else if ($(this).attr('id') == 'tableOfDireccionesEnvio')
$(this).bind('draw.dt',{updateLP:false, updateServicios:false, updateEnvio:true}, updateTotales);
}
});
function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
var totalPapel = 0
@ -113,11 +102,13 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
if(typeof tableLineasPresupuesto !== 'undefined'){
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
var rowData = this.data();
if($('#' + rowData.row_id + '_checkPapel').prop('checked')){
if(rowData.check_papel_total){
totalPapel += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val())
margenPapel += parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val())
}
if($('#' + rowData.row_id + '_checkClicks').prop('checked')){
if(rowData.check_impresion_total){
totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())

View File

@ -18,7 +18,7 @@
<p><?= lang('Presupuestos.tiradasInfoIVA') ?></p>
<input type="hidden" name="tirada_alternativa_json_data" id="tirada_alternativa_json_data" class="form-control" value='<?= isset($presupuestoEntity->tirada_alternativa_json_data)?$presupuestoEntity->tirada_alternativa_json_data:'' ?>'></input>
<div class='d-flex justify-content-end '>
<input id="tirada_alt" type="number" style="width: 10% !important; display: inline-flex !important" class="form-control" value="1" min="1" step="1">
<input id="tirada_alt" type="number" style="width: 120px !important; display: inline-flex !important" class="form-control" value="1" min="1" step="1">
<button id="add_tirada_alt" type="button" class="btn btn-secondary waves-effect waves-light"><i class="ti ti-circle-plus"></i></button>
</div>
<table id="tableTiradas" class="comparator-table table dt-responsive dataTable" style="width: 100%;">

View File

@ -116,7 +116,7 @@ div.draw-rot-shapes {
}
/* CSS class to remove number input spinner */
.no-spinner {
.no-spinner {
/* For Firefox */
-moz-appearance: textfield;
}