diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php index 5fa56170..b5c3bef2 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php @@ -279,14 +279,14 @@ $('#paginas').on("change", function () { // Si es negro o color if ($('#tipoImpresion').select2('data')[0].id == 'negro' || $('#tipoImpresion').select2('data')[0].id == 'color') { - document.getElementById('compPaginasNegro').value = document.getElementById('paginas').value; - document.getElementById('compPaginasColor').value = 0; + $('#compPaginasNegro').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColor').val())); + $('#compPaginasNegro').trigger('change') } // Si es negrohq o colorhq if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' || $('#tipoImpresion').select2('data')[0].id == 'colorhq') { - document.getElementById('compPaginasNegrohq').value = document.getElementById('paginas').value; - document.getElementById('compPaginasColorhq').value = 0; + $('#compPaginasNegrohq').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColorhq').val())); + $('#compPaginasNegrohq').trigger('change'); } update_servicios(false) @@ -312,7 +312,11 @@ function calcular_mermas(){ merma_lineas = [] $('#tableLineasPresupuesto tbody tr:visible ').each(function(){ if(!this.id.includes('_data') && !this.id.endsWith('_cubierta') && !this.id.endsWith('_sobrecubierta')){ - merma_lineas.push(tirada%parseInt($('#' + this.id + '_formas').val())) + const formas_linea = parseInt($('#' + this.id + '_formas').val()) + if(formas_linea > tirada) + merma_lineas.push(formas_linea-tirada) + else + merma_lineas.push(tirada%formas_linea) } }) if(merma_lineas.length>0) diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php index 3442a4d1..14dc6b08 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosPresupuestoClienteItems.php @@ -829,7 +829,7 @@ - async function getLineasIntPlana(is_color, is_hq){ + async function getLineasIntPlana(is_color, is_hq, actualizarLinea){ const dimension = getDimensionLibro(); @@ -862,6 +862,28 @@ selectIntLineas(); $('#title_int_plana').html('' + ' (' + tableCompIntPlana.rows().count() + ')'); $('#insertarPlanaBtn').removeClass('d-none') + if(actualizarLinea){ + var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray(); + for(row of rows){ + + if(row['tipo'] =='bn' && !is_color && !is_hq){ + if($('#lp_bn').css('display')!='none') + fill_lp_bn(row, true); + } + else if(row['tipo'] =='bnhq' && !is_color && is_hq){ + if($('#lp_bnhq').css('display')!='none') + fill_lp_bnhq(row, true); + } + else if(row['tipo'] =='color' && is_color && !is_hq){ + if($('#lp_color').css('display')!='none') + fill_lp_color(row, true); + } + else if(row['tipo'] =='colorhq' && is_color && is_hq){ + if($('#lp_colorhq').css('display')!='none') + fill_lp_colorhq(row, true); + } + } + } } else{ $('#title_int_plana').html(''); @@ -878,7 +900,7 @@ return false; } - async function getLineasIntRot(is_hq){ + async function getLineasIntRot(is_hq, actualizarLinea=false){ const dimension = getDimensionLibro(); @@ -917,6 +939,19 @@ selectIntRotLineas(); $('#title_int_rot').html('' + ' (' + tableCompIntRotativa.rows().count() + ')'); $('#insertarRotativaBtn').removeClass('d-none') + if(actualizarLinea){ + var rows = $("#tableCompIntRotativa").DataTable().rows( '.selected' ).data().toArray(); + for(row of rows){ + if(row['paginasColor'] ==0){ + if($('#lp_rot_bn').css('display')!='none') + fill_lp_rot_bn(row, true); + } + else if(row['paginasColor'] >0){ + if($('#lp_rot_color').css('display')!='none') + fill_lp_rot_color(row, true); + } + } + } } else{ $('#title_int_rot').html(''); @@ -938,6 +973,12 @@ $('.comp_cubierta_items').on('change', function (){ + checkComparadorCubierta() + }); + + + function checkComparadorCubierta(actualizarLinea = false){ + if ($('#compCarasCubierta').select2('data').length > 0 && $('#compPapelCubierta').select2('data').length > 0 && $('#compGramajeCubierta').select2('data').length > 0 ){ @@ -974,7 +1015,12 @@ selectCubiertaLineas(); $('#title_cubierta').html('' + ' (' + tableCompCubierta.rows().count() + ')'); $('#insertarCubiertaBtn').removeClass('d-none') - + if(actualizarLinea){ + var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray(); + for(row of rows){ + fill_lp_cubierta(row, true); + } + } } else{ $('#title_cubierta').html(''); @@ -994,8 +1040,7 @@ else{ clearCubierta(); } - }); - + } $('.comp_negro_items').on('change', function (e) { @@ -1055,7 +1100,7 @@ }); - function checkComparadorInt(is_color, is_hq) { + function checkComparadorInt(is_color, is_hq, actualizarLinea=false) { try{ @@ -1072,11 +1117,11 @@ checkDatosPedidoForComp()) { - getLineasIntPlana(is_color, is_hq).then((result) =>{ + getLineasIntPlana(is_color, is_hq, actualizarLinea).then((result) =>{ // Para rotativa, si es color el papel y el gramaje tiene que ser igual if(!is_color) { - getLineasIntRot(is_hq); + getLineasIntRot(is_hq, actualizarLinea); } else { @@ -1087,7 +1132,7 @@ if(($('#compPapelNegro').select2('data')[0].id == $('#compPapelColor').select2('data')[0].id && $('#compGramajeNegro').select2('data')[0].text.trim() == $('#compGramajeColor').select2('data')[0].text.trim())) { - getLineasIntRot(is_hq); + getLineasIntRot(is_hq, actualizarLinea); } else { 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 a9333d0b..8e3fbfe5 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 @@ -527,8 +527,8 @@ + @@ -20,25 +20,25 @@ - +
- +
- +
- +
@@ -46,7 +46,7 @@ -