solucionados los bugs

This commit is contained in:
2023-12-23 10:49:41 +01:00
parent 0da8ae9715
commit 1befc4c4c5
4 changed files with 94 additions and 40 deletions

View File

@ -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)

View File

@ -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('<?= lang("Presupuestos.compInteriorPlana") ?>' + ' (' + 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('<?= lang("Presupuestos.compInteriorPlana") ?>');
@ -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('<?= lang("Presupuestos.compInteriorRotativa") ?>' + ' (' + 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('<?= lang("Presupuestos.compInteriorRotativa") ?>');
@ -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('<?= lang("Presupuestos.cubierta") ?>' + ' (' + 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('<?= lang("Presupuestos.cubierta") ?>');
@ -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
{

View File

@ -527,8 +527,8 @@
<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)) :
foreach ($papelGenericoColorHQList as $k => $v) : ?>
<?php if (isset($papelGenericoRotativaColorList) && is_array($papelGenericoRotativaColorList) && !empty($papelGenericoRotativaColorList)) :
foreach ($papelGenericoRotativaColorList as $k => $v) : ?>
<?php if($v->id != 0): ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
@ -1080,6 +1080,7 @@ $('.insertarLinea').on("click", function (e) {
fill_lp_cubierta(row, true);
}
}
checkPaginasPresupuesto()
});
@ -1298,7 +1299,7 @@ function calcularPresupuesto_bn(){
const dimension = getDimensionLibro();
let datos = {
var datos = {
type: 'interior',
color: 0,
hq: 0,
@ -1320,8 +1321,10 @@ function calcularPresupuesto_bn(){
success: function (data) {
if(data.lineas.length >0){
// Se cogen los valores de la linea con los datos correspondientes
$.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() ) {
@ -1332,7 +1335,7 @@ function calcularPresupuesto_bn(){
else{
clear_lp_bn(false);
}
});
}
@ -2717,7 +2720,7 @@ $('#lp_rot_color_defecto').on("click", function () {
function fill_lp_rot_color(row, fromComparador=false){
if(fromComparador){
console.log(row)
$('#lp_rot_color_paginas').val(row.paginas)
$('#lp_rot_color_papel').val(row.papelGenericoId)
$('#lp_rot_color_gramaje').empty()
@ -3342,25 +3345,25 @@ function updateLineasPresupuesto(){
$('#tableLineasPresupuesto tbody tr:visible ').each(function(){
if(!this.id.includes('_data')){
if(this.id.endsWith('_bn')){
calcularPresupuesto_bn()
checkComparadorInt(false, false, true);
}
else if(this.id.endsWith('_bnhq')){
calcularPresupuesto_bnhq()
checkComparadorInt(false, true, true);
}
else if(this.id.endsWith('_color')){
calcularPresupuesto_color()
checkComparadorInt(true, false, true);
}
else if(this.id.endsWith('_colorhq')){
calcularPresupuesto_colorhq()
checkComparadorInt(true, true, true);
}
else if(this.id.endsWith('_rot_bn')){
calcularPresupuesto_rot_bn()
checkComparadorInt(false, false, true)
}
else if(this.id.endsWith('_rot_color')){
calcularPresupuesto_rot_color()
checkComparadorInt(false,true, true);
}
else if(this.id.endsWith('_cubierta')){
calcularPresupuesto_cubierta()
checkComparadorCubierta(true)
}
}
})
@ -3392,4 +3395,6 @@ function checkPaginasPresupuesto(){
$('#divAlarmasLineasPresupuesto').html(htmlString)
}
checkPaginasPresupuesto()
<?= $this->endSection() ?>

View File

@ -11,7 +11,7 @@
<label for="add_clientedAdd" class="form-label">
<?=lang('PresupuestosDirecciones.clientedAdd') ?>*
</label>
<select id="add_clientedAdd" tabindex="0" class="form-control select2bs" style="width: 100%;" >
<select id="add_clientedAdd" class="form-control select2bs" style="width: 100%;" >
</select>
</div><!--//.mb-3 -->
@ -20,25 +20,25 @@
<label for="add_cantidad" class="form-label">
<?= lang('PresupuestosDirecciones.cantidad') ?>*
</label>
<input type="number" id="add_cantidad" tabindex="1" class="form-control">
<input type="number" id="add_cantidad" class="form-control">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_att" class="form-label">
<?= lang('PresupuestosDirecciones.att') ?>*
</label>
<input type="text" id="add_att" tabindex="1" maxLength="100" class="form-control new-address">
<input type="text" id="add_att" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_email" class="form-label">
<?= lang('PresupuestosDirecciones.email') ?>*
</label>
<input type="text" id="add_email" tabindex="2" maxLength="100" class="form-control new-address">
<input type="text" id="add_email" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_direccion" class="form-label">
<?= lang('PresupuestosDirecciones.direccion') ?>*
</label>
<input type="text" id="add_direccion" tabindex="3" maxLength="255" class="form-control new-address">
<input type="text" id="add_direccion" maxLength="255" class="form-control new-address">
</div><!--//.mb-3 -->
@ -46,7 +46,7 @@
<label for="add_pais_id" class="form-label">
<?=lang('PresupuestosDirecciones.pais') ?>*
</label>
<select id="add_pais_id" tabindex="4" class="form-control select2bs new-address" style="width: 100%;" >
<select id="add_pais_id" class="form-control select2bs new-address" style="width: 100%;" >
<option value="" disabled selected><?=lang('PresupuestosDirecciones.selectPais') ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==1 ? ' selected':'' ?>>
@ -65,7 +65,7 @@
<label for="add_municipio" class="form-label">
<?=lang('PresupuestosDirecciones.municipio') ?>*
</label>
<input type="text" id="add_municipio" tabindex="6" maxLength="100" class="form-control new-address">
<input type="text" id="add_municipio" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
</div>
@ -74,7 +74,7 @@
<label for="add_provincia" class="form-label">
<?=lang('PresupuestosDirecciones.provincia') ?>*
</label>
<input type="text" id="add_provincia" tabindex="7" maxLength="100" class="form-control new-address">
<input type="text" id="add_provincia" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
</div>
@ -87,7 +87,7 @@
<label for="add_cp" class="form-label">
<?=lang('PresupuestosDirecciones.cp') ?>*
</label>
<input type="text" id="add_cp" tabindex="8" maxLength="100" class="form-control new-address">
<input type="text" id="add_cp" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
</div>
@ -96,7 +96,7 @@
<label for="add_telefono" class="form-label">
<?=lang('PresupuestosDirecciones.telefono') ?>*
</label>
<input type="text" id="add_telefono" tabindex="9" maxLength="100" class="form-control new-address"></input>
<input type="text" id="add_telefono" maxLength="100" class="form-control new-address"></input>
</div><!--//.mb-3 -->
</div>
@ -104,14 +104,14 @@
<div class="col-md-12 col-lg-6 pl-4">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="add_entregaPieCalle" name="add_entregaPieCalle" tabindex="10" value="1" >
<input class="form-check-input" type="checkbox" id="add_entregaPieCalle" name="add_entregaPieCalle" value="1" >
<label class="form-check-label" for="add_entregaPieCalle"><?= lang('PresupuestosDirecciones.entregaPieCalle') ?></label>
</div>
</div>
<div class="col-md-12 col-lg-6 pl-4">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="add_saveDirection" name="add_saveDirection" tabindex="10" value="1" >
<input class="form-check-input" type="checkbox" id="add_saveDirection" name="add_saveDirection" value="1" >
<label class="form-check-label" for="add_saveDirection"><?= lang('PresupuestosDirecciones.saveDirection') ?></label>
</div>
</div>
@ -120,7 +120,7 @@
<label style="display:none" for="add_alias" class="form-label save-alias">
<?= lang('PresupuestosDirecciones.alias') ?>*
</label>
<input type="text" id="add_alias" tabindex="1" maxLength="100" class="form-control new-address save-alias" style='display: none;'>
<input type="text" id="add_alias" maxLength="100" class="form-control new-address save-alias" style='display: none;'>
</div><!--//.mb-3 -->
</div>