mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta actualizar linea completa cuando cambia tirada
This commit is contained in:
@ -95,7 +95,7 @@
|
||||
<label for="merma" class="form-label">
|
||||
<?= lang('Presupuestos.merma') ?>*
|
||||
</label>
|
||||
<input type="number" id="merma" name="merma" maxLength="8" tabindex="4" step="1" placeholder="10" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="merma" name="merma" maxLength="8" tabindex="4" step="1" placeholder="10" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
<label for="mermacubierta" class="form-label">
|
||||
<?= lang('Presupuestos.mermacubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="mermacubierta" name="merma_cubierta" tabindex="5" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
|
||||
<input readonly style="background: #E8E8E8;" id="mermacubierta" name="merma_cubierta" tabindex="5" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -273,6 +273,9 @@
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
$('#paginas').on("change", function () {
|
||||
checkPaginasPresupuesto()
|
||||
updateLineasPresupuesto()
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
@ -292,9 +295,36 @@ $('#paginas').on("change", function () {
|
||||
$('#tirada').on("change", function () {
|
||||
|
||||
update_servicios(false)
|
||||
calcular_mermas()
|
||||
updateLineasPresupuesto()
|
||||
checkInsertar()
|
||||
})
|
||||
|
||||
function calcular_mermas(){
|
||||
|
||||
const tirada = parseInt($('#tirada').val())
|
||||
var merma = 0
|
||||
|
||||
if(tirada>POD){
|
||||
merma = tirada*0.1<=30 ? tirada*0.1 : 30
|
||||
}
|
||||
else{
|
||||
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()))
|
||||
}
|
||||
})
|
||||
if(merma_lineas.length>0)
|
||||
merma = Math.max(...merma_lineas)
|
||||
else
|
||||
merma = 0
|
||||
}
|
||||
$('#mermacubierta').val(parseInt(merma))
|
||||
$('#merma').val(parseInt(merma))
|
||||
}
|
||||
|
||||
|
||||
$('#papelFormatoId').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
<input type="hidden" name="lp_bn_formas_h" id="lp_bn_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_bn_formas_orientacion" id="lp_bn_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_bn.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_bn_paginas" name="lp_bn_paginas" class="lp-cell lp-input lp-bn-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_bn_paginas" name="lp_bn_paginas" class="lp-cell lp-input lp-bn-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_bn_papel" name="lp_bn_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoNegroList) && is_array($papelGenericoNegroList) && !empty($papelGenericoNegroList)) :
|
||||
@ -104,7 +104,7 @@
|
||||
<input type="hidden" name="lp_bnhq_formas_h" id="lp_bnhq_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_bnhq_formas_orientacion" id="lp_bnhq_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_bnhq.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_bnhq_paginas" name="lp_bnhq_paginas" class="lp-cell lp-input lp-bnhq-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_bnhq_paginas" name="lp_bnhq_paginas" class="lp-cell lp-input lp-bnhq-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_bnhq_papel" name="lp_bnhq_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoNegroHQList) && is_array($papelGenericoNegroHQList) && !empty($papelGenericoNegroHQList)) :
|
||||
@ -157,7 +157,7 @@
|
||||
<input type="hidden" name="lp_color_formas_h" id="lp_color_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_color_formas_orientacion" id="lp_color_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_color.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_color_paginas" name="lp_color_paginas" class="lp-cell lp-input lp-color-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_color_paginas" name="lp_color_paginas" class="lp-cell lp-input lp-color-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_color_papel" name="lp_color_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoColorList) && is_array($papelGenericoColorList) && !empty($papelGenericoColorList)) :
|
||||
@ -211,7 +211,7 @@
|
||||
<input type="hidden" name="lp_colorhq_formas_h" id="lp_colorhq_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_colorhq_formas_orientacion" id="lp_colorhq_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_colorhq.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_colorhq_paginas" name="lp_colorhq_paginas" class="lp-cell lp-input lp-colorhq-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_colorhq_paginas" name="lp_colorhq_paginas" class="lp-cell lp-input lp-colorhq-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_colorhq_papel" name="lp_colorhq_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoColorHQList) && is_array($papelGenericoColorHQList) && !empty($papelGenericoColorHQList)) :
|
||||
@ -264,7 +264,7 @@
|
||||
<input type="hidden" name="lp_rot_bn_formas_h" id="lp_rot_bn_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_rot_bn_formas_orientacion" id="lp_rot_bn_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_rot_bn_paginas" name="lp_rot_bn_paginas" class="lp-cell lp-input lp-rotbn-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_rot_bn_paginas" name="lp_rot_bn_paginas" class="lp-cell lp-input lp-rotbn-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_rot_bn_papel" name="lp_rot_bn_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoRotativaNegroList) && is_array($papelGenericoRotativaNegroList) && !empty($papelGenericoRotativaNegroList)) :
|
||||
@ -524,7 +524,7 @@
|
||||
<input type="hidden" name="lp_rot_color_formas_h" id="lp_rot_color_formas_h" class="form-control" value="0"></input>
|
||||
<input type="hidden" name="lp_rot_color_formas_orientacion" id="lp_rot_color_formas_orientacion" class="form-control" value="0"></input>
|
||||
<td class="lp-td"> <img style="padding: 0; margin:0;" src="<?= site_url('themes/vuexy/img/safekat/presupuestos/icon_rotativa_color.png') ?>" /></td>
|
||||
<td class="lp-td"><input id="lp_rot_color_paginas" name="lp_rot_color_paginas" class="lp-cell lp-input lp-rotcolor-input" type="text" value="0"></td>
|
||||
<td class="lp-td"><input id="lp_rot_color_paginas" name="lp_rot_color_paginas" class="lp-cell lp-input lp-rotcolor-input paginas-lp" type="text" value="0"></td>
|
||||
<td class="lp-td">
|
||||
<select id="lp_rot_color_papel" name="lp_rot_color_papel" class="form-control form-select-sm lp-cell lp-select" style="min-width: 150px;">
|
||||
<?php if (isset($papelGenericoColorHQList) && is_array($papelGenericoColorHQList) && !empty($papelGenericoColorHQList)) :
|
||||
@ -933,6 +933,9 @@ $('#lp_cubierta_papel').val('');
|
||||
$('#lp_sobrecubierta_papel').val('');
|
||||
$('#addLineasPresupuesto').val('');
|
||||
|
||||
$('.paginas-lp').on('change', function(){
|
||||
checkPaginasPresupuesto()
|
||||
})
|
||||
|
||||
$('#lp_rot_color_vercalculos').on("click", function () {
|
||||
if($( ".calculos_rot_color" ).css('display') == 'none')
|
||||
@ -1389,6 +1392,7 @@ function fill_lp_bn(row, fromComparator=false){
|
||||
$('#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)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -1626,6 +1630,7 @@ function fill_lp_color(row, fromComparator=false){
|
||||
$('#lp_color_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_color_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -1862,6 +1867,7 @@ function fill_lp_bnhq(row, fromComparator=false){
|
||||
$('#lp_bnhq_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_bnhq_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -2100,6 +2106,7 @@ function fill_lp_colorhq(row, fromComparator=false){
|
||||
$('#lp_colorhq_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_colorhq_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -2444,6 +2451,7 @@ function fill_lp_rot_bn(row, fromComparador=false){
|
||||
$('#lp_rot_bn_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_rot_bn_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -2798,6 +2806,7 @@ function fill_lp_rot_color(row, fromComparador=false){
|
||||
$('#lp_rot_color_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_rot_color_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -3078,6 +3087,7 @@ function fill_lp_cubierta(row, fromComparador=false){
|
||||
$('#lp_cubierta_formas_v').val(isNaN(parseInt(row.num_formas.num_formas_verticales)) ? "" : parseInt(row.num_formas.num_formas_verticales))
|
||||
$('#lp_cubierta_formas_orientacion').val(row.num_formas.posicion_formas)
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales()
|
||||
}
|
||||
|
||||
@ -3327,6 +3337,59 @@ async function fill_bbdd_from_lp(presupuesto_id){
|
||||
});
|
||||
}
|
||||
|
||||
function updateLineasPresupuesto(){
|
||||
|
||||
$('#tableLineasPresupuesto tbody tr:visible ').each(function(){
|
||||
if(!this.id.includes('_data')){
|
||||
if(this.id.endsWith('_bn')){
|
||||
calcularPresupuesto_bn()
|
||||
}
|
||||
else if(this.id.endsWith('_bnhq')){
|
||||
calcularPresupuesto_bnhq()
|
||||
}
|
||||
else if(this.id.endsWith('_color')){
|
||||
calcularPresupuesto_color()
|
||||
}
|
||||
else if(this.id.endsWith('_colorhq')){
|
||||
calcularPresupuesto_colorhq()
|
||||
}
|
||||
else if(this.id.endsWith('_rot_bn')){
|
||||
calcularPresupuesto_rot_bn()
|
||||
}
|
||||
else if(this.id.endsWith('_rot_color')){
|
||||
calcularPresupuesto_rot_color()
|
||||
}
|
||||
else if(this.id.endsWith('_cubierta')){
|
||||
calcularPresupuesto_cubierta()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function checkPaginasPresupuesto(){
|
||||
|
||||
cantidad_total = 0
|
||||
|
||||
$('#tableLineasPresupuesto tbody tr:visible ').each(function(){
|
||||
if(!this.id.includes('_data') && !this.id.endsWith('_cubierta') && !this.id.endsWith('_sobrecubierta')){
|
||||
cantidad_total += parseInt($('#' + this.id + '_paginas').val() )
|
||||
}
|
||||
} );
|
||||
htmlString = ''
|
||||
|
||||
if(cantidad_total != parseInt($('#paginas').val())){
|
||||
htmlString = `
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-bell ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2"><?= lang("Presupuestos.errores.paginasLP") ?></h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
$('#divAlarmasLineasPresupuesto').html(htmlString)
|
||||
}
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
Reference in New Issue
Block a user