mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'dev/criba_tabla_presupuestos'
# Conflicts: # ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php
This commit is contained in:
@ -31,7 +31,7 @@
|
||||
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="solapas" name="solapas" tabindex="6" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.solapasCubierta') ?></label>
|
||||
<label class="form-check-label" for="solapas"><?= lang('Presupuestos.solapasCubierta') ?></label>
|
||||
</div>
|
||||
|
||||
</div><!--//.mb-3 -->
|
||||
@ -70,13 +70,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="mb-3">
|
||||
<input style="display: none" type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
|
||||
<input <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="0.01" class="form-control" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="mb-3">
|
||||
<input style="display: none" type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
|
||||
<div class="mb-3">
|
||||
<input <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?> type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="0.01" class="form-control" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
</div>
|
||||
@ -341,6 +341,13 @@ $('#papelFormatoId').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
let initTamanioPersonalizado = <?php echo ($presupuestoEntity->papel_formato_personalizado==true?1:0); ?>;
|
||||
if(initTamanioPersonalizado != null){
|
||||
if ( initTamanioPersonalizado){
|
||||
$('#papelFormatoId').next(".select2-container").hide();
|
||||
}
|
||||
}
|
||||
|
||||
$('#papelFormatoPersonalizado').on("click",function(){
|
||||
var checkbox = document.getElementById('papelFormatoPersonalizado');
|
||||
if(checkbox.checked == true){
|
||||
|
||||
@ -995,6 +995,7 @@
|
||||
color: 1,
|
||||
ancho: dimension.ancho,
|
||||
alto: dimension.alto,
|
||||
lomo: getLomoLineasPresupuesto(),
|
||||
solapas: $('#solapas').is(':checked')?1:0,
|
||||
solapas_ancho: parseInt($('#solapas_ancho').val()),
|
||||
papel_generico_id: $('#compPapelCubierta').select2('data')[0].id,
|
||||
@ -1082,6 +1083,10 @@
|
||||
$('#compPaginasNegrohq').val('0');
|
||||
$('#compPaginasNegro').val($('#paginas').val())
|
||||
|
||||
if($('#tipoImpresion').select2('data')[0].id == 'negro'){
|
||||
$('#compGramajeColor').val('').trigger('change')
|
||||
$('#compPapelColor').val(0).trigger('change')
|
||||
}
|
||||
|
||||
if( $('#tableCompIntPlana').DataTable().rows().count() > 0 &&
|
||||
$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
|
||||
@ -1101,6 +1106,11 @@
|
||||
$('#compPaginasColor').val('0')
|
||||
$('#compPaginasNegro').val('0')
|
||||
$('#compPaginasNegrohq').val($('#paginas').val())
|
||||
|
||||
if($('#tipoImpresion').select2('data')[0].id == 'negrohq'){
|
||||
$('#compGramajeColorhq').val('').trigger('change')
|
||||
$('#compPapelColorhq').val(0).trigger('change')
|
||||
}
|
||||
|
||||
if($('#tableCompIntPlana').DataTable().rows().count() > 0 &&
|
||||
!$('#tableCompIntPlana').DataTable().cell(0, 0).data().includes('hq')) {
|
||||
@ -1117,7 +1127,7 @@
|
||||
})
|
||||
|
||||
|
||||
function checkComparadorInt(is_color, is_hq, actualizarLinea=false) {
|
||||
function checkComparadorInt(is_color, is_hq, actualizarLineaPlana=false, actualizarLineaRot=false) {
|
||||
|
||||
try{
|
||||
|
||||
@ -1130,26 +1140,26 @@
|
||||
|
||||
if ($(''+ elementos.papel).select2('data').length > 0 &&
|
||||
$(''+ elementos.gramaje).select2('data').length > 0 &&
|
||||
parseInt($(''+ elementos.paginas).val()) > 0 &&
|
||||
parseInt($(''+ elementos.paginas).val()) >= 0 &&
|
||||
checkDatosPedidoForComp()) {
|
||||
|
||||
|
||||
getLineasIntPlana(is_color, is_hq, actualizarLinea).then((result) =>{
|
||||
getLineasIntPlana(is_color, is_hq, actualizarLineaPlana).then((result) =>{
|
||||
// Para rotativa, si es color el papel y el gramaje tiene que ser igual
|
||||
if(!is_color)
|
||||
{
|
||||
getLineasIntRot(is_hq, actualizarLinea);
|
||||
getLineasIntRot(is_hq, actualizarLineaRot);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!is_hq){
|
||||
if ($('#compPapelNegro').select2('data')>0 && $('#compPapelColor').select2('data')>0 &&
|
||||
$('#compGramajeNegro').select2('data')>0 && $('#compGramajeColor').select2('data')>0)
|
||||
if ($('#compPapelNegro').select2('data').length>0 && $('#compPapelColor').select2('data').length>0 &&
|
||||
$('#compGramajeNegro').select2('data').length>0 && $('#compGramajeColor').select2('data').length>0)
|
||||
{
|
||||
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, actualizarLinea);
|
||||
getLineasIntRot(is_hq, actualizarLineaRot);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th class="lp-header" width="33px"></th>
|
||||
<th class="lp-header" style="max-width:80px;"><?= lang('Presupuestos.paginas') ?></th>
|
||||
<th class="lp-header"><?= lang('Presupuestos.papel') ?></th>
|
||||
@ -158,7 +159,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 lp-cell-disabled" readonly value="' + d.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 +'">' +
|
||||
'</div>' +
|
||||
'<div class="col-md-12 col-lg-1">' +
|
||||
'<?= lang('Presupuestos.saturacion') ?>' +
|
||||
@ -365,7 +366,7 @@ const actionBtns_lp = function(data) {
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
ordering: false,
|
||||
ordering: true,
|
||||
responsive: true,
|
||||
select: false,
|
||||
rowId: 'row_id',
|
||||
@ -385,6 +386,15 @@ const actionBtns_lp = function(data) {
|
||||
orderable: false,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
targets: [11,12,13,14,15,16,17,18,19,20],
|
||||
orderable: false,
|
||||
},
|
||||
{
|
||||
targets: [10],
|
||||
orderable: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
@ -402,6 +412,23 @@ const actionBtns_lp = function(data) {
|
||||
{data: 'formas_v'},
|
||||
{data: 'formas_h'},
|
||||
{data: 'formas_orientacion'},
|
||||
{data: 'position',
|
||||
type: "num" ,
|
||||
render: function (data, type, row, meta){
|
||||
if(row.row_id.includes('_bn')){
|
||||
return 0;
|
||||
}
|
||||
else if(row.row_id.includes('_color')){
|
||||
return 1;
|
||||
}
|
||||
else if(row.row_id.includes('_cubierta')){
|
||||
return 2;
|
||||
}
|
||||
else if(row.row_id.includes('_sobrecubierta')){
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
},
|
||||
{data: 'icon',
|
||||
render: function ( data, type, row, meta ){
|
||||
return '<img style="padding: 0; margin:0;" src="' + data + '" />'
|
||||
@ -537,7 +564,8 @@ const actionBtns_lp = function(data) {
|
||||
data: actionBtns_lp,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
]
|
||||
],
|
||||
"order": [ 10, 'asc' ]
|
||||
});
|
||||
|
||||
tableLineasPresupuesto.on( 'draw.dt', function () {
|
||||
@ -554,6 +582,9 @@ $(document).on('click', '.btn-delete-lp', function(e) {
|
||||
.draw();
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
})
|
||||
|
||||
|
||||
@ -861,7 +892,7 @@ $('.insertarLinea').on("click", function (e) {
|
||||
|
||||
$('#addLineasPresupuesto').on("change", function (e) {
|
||||
|
||||
var data = tableLineasPresupuesto
|
||||
var dataRows = tableLineasPresupuesto
|
||||
.rows()
|
||||
.data();
|
||||
|
||||
@ -870,101 +901,148 @@ $('#addLineasPresupuesto').on("change", function (e) {
|
||||
// (solo una de cada en interior)
|
||||
|
||||
case 'lp_bn':
|
||||
if(data.length>0){
|
||||
if( data.filter(x => x.row_id === 'lp_bn').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_bnhq').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_rot_bn').length>0 )
|
||||
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
if(dataRows[number].row_id == 'lp_bn' ||
|
||||
dataRows[number].row_id == 'lp_bnhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_bn'){
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
else{
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_bn', 'lp-bn');
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
eventos_lp_bn()
|
||||
|
||||
if(hayLinea){
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_bn', 'lp-bn');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_bn()
|
||||
break
|
||||
|
||||
case 'lp_bnhq':
|
||||
if(data.length>0){
|
||||
if( data.filter(x => x.row_id === 'lp_bn').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_bnhq').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_rot_bn').length>0 )
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
if(dataRows[number].row_id == 'lp_bn' ||
|
||||
dataRows[number].row_id == 'lp_bnhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_bn'){
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
}
|
||||
else{
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_bnhq', 'lp-bnhq');
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
eventos_lp_bnhq()
|
||||
if(hayLinea){
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_bnhq', 'lp-bnhq');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_bnhq()
|
||||
break
|
||||
|
||||
case 'lp_color':
|
||||
if(data.length>0){
|
||||
if( data.filter(x => x.row_id === 'lp_color').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_colorhq').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_rot_color').length>0 )
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
if(dataRows[number].row_id == 'lp_color' ||
|
||||
dataRows[number].row_id == 'lp_colorhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_color'){
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
}
|
||||
else{
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_color', 'lp-color');
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
eventos_lp_color()
|
||||
if(hayLinea){
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_color', 'lp-color');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_color()
|
||||
break
|
||||
|
||||
case 'lp_colorhq':
|
||||
if(data.length>0){
|
||||
if( data.filter(x => x.row_id === 'lp_color').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_colorhq').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_rot_color').length>0 )
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
if(dataRows[number].row_id == 'lp_color' ||
|
||||
dataRows[number].row_id == 'lp_colorhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_color'){
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
}
|
||||
else{
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_colorhq', 'lp-colorhq');
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
eventos_lp_colorhq()
|
||||
if(hayLinea){
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_colorhq', 'lp-colorhq');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_colorhq()
|
||||
break
|
||||
|
||||
case 'lp_rot_bn':
|
||||
if(data.length>0){
|
||||
if( data.filter(x => x.row_id === 'lp_bn').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_bnhq').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_rot_bn').length>0 )
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
if(dataRows[number].row_id == 'lp_bn' ||
|
||||
dataRows[number].row_id == 'lp_bnhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_bn'){
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
}
|
||||
else{
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_rot_bn', 'lp-rot-bn');
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
eventos_lp_rot_bn()
|
||||
if(hayLinea){
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_rot_bn', 'lp-rot-bn');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_rot_bn()
|
||||
break
|
||||
|
||||
case 'lp_rot_color':
|
||||
if(data.length>0){
|
||||
if( data.filter(x => x.row_id === 'lp_color').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_colorhq').length>0 ||
|
||||
data.filter(x => x.row_id === 'lp_rot_color').length>0 )
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
if(dataRows[number].row_id == 'lp_color' ||
|
||||
dataRows[number].row_id == 'lp_colorhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_color'){
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
}
|
||||
else{
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_rot_color', 'lp-rot-color');
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
eventos_lp_rot_color()
|
||||
if(hayLinea){
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_rot_color', 'lp-rot-color');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_rot_color()
|
||||
break
|
||||
case 'lp_cubierta':
|
||||
if(data.length>0){
|
||||
if( data.filter(x => x.row_id === 'lp_cubierta').length>0)
|
||||
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
case 'lp_cubierta':
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
if(dataRows[number].row_id == 'lp_cubierta'){
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
else{
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_cubierta', 'lp-cubierta');
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
eventos_lp_cubierta()
|
||||
|
||||
if(hayLinea){
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_cubierta', 'lp-cubierta');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_cubierta()
|
||||
break
|
||||
default:
|
||||
break
|
||||
@ -1240,9 +1318,9 @@ function fill_lp_bn(row, fromComparator=false){
|
||||
|
||||
var row = tableLineasPresupuesto.row('#lp_bn');
|
||||
if(row.length>0)
|
||||
tableLineasPresupuesto.row('#lp_bn').data(data).draw(true)
|
||||
tableLineasPresupuesto.row('#lp_bn').data(data).draw()
|
||||
else{
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row('#lp_bn');
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
@ -1254,6 +1332,9 @@ function fill_lp_bn(row, fromComparator=false){
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
}
|
||||
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
@ -1531,9 +1612,9 @@ function fill_lp_color(row, fromComparator=false){
|
||||
|
||||
var row = tableLineasPresupuesto.row('#lp_color');
|
||||
if(row.length>0)
|
||||
tableLineasPresupuesto.row('#lp_color').data(data).draw(true)
|
||||
tableLineasPresupuesto.row('#lp_color').data(data).draw()
|
||||
else{
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row('#lp_color');
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
@ -1545,6 +1626,9 @@ function fill_lp_color(row, fromComparator=false){
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
}
|
||||
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
@ -1825,9 +1909,9 @@ function fill_lp_bnhq(row, fromComparator=false){
|
||||
|
||||
var row = tableLineasPresupuesto.row('#lp_bnhq');
|
||||
if(row.length>0)
|
||||
tableLineasPresupuesto.row('#lp_bnhq').data(data).draw(true)
|
||||
tableLineasPresupuesto.row('#lp_bnhq').data(data).draw()
|
||||
else{
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row('#lp_bnhq');
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
@ -1839,6 +1923,9 @@ function fill_lp_bnhq(row, fromComparator=false){
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
}
|
||||
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
@ -2119,9 +2206,9 @@ function fill_lp_colorhq(row, fromComparator=false){
|
||||
|
||||
var row = tableLineasPresupuesto.row('#lp_colorhq');
|
||||
if(row.length>0)
|
||||
tableLineasPresupuesto.row('#lp_colorhq').data(data).draw(true)
|
||||
tableLineasPresupuesto.row('#lp_colorhq').data(data).draw()
|
||||
else{
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row('#lp_colorhq');
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
@ -2133,6 +2220,9 @@ function fill_lp_colorhq(row, fromComparator=false){
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
}
|
||||
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
@ -2268,7 +2358,7 @@ function clear_lp_rot_bn(clear_selectors){
|
||||
function change_lp_rot_bn_maquina(){
|
||||
|
||||
if(parseInt($('#lp_rot_bn_paginas').val())>0){
|
||||
calcularPresupuesto_rot_bn();
|
||||
calcularPresupuesto_rot_bn(true,false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2294,6 +2384,10 @@ function change_lp_rot_bn_aFavorFibra(){
|
||||
$('#lp_rot_bn_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_rot_bn_papelImpresion option:selected').val())>0
|
||||
){
|
||||
var rowData = tableLineasPresupuesto.row('#lp_rot_bn').data()
|
||||
rowData.aFavorFibra = $('#lp_rot_bn_aFavorFibra').prop('checked')
|
||||
tableLineasPresupuesto.row('#lp_rot_bn').data(rowData).draw(false)
|
||||
|
||||
|
||||
calcularPresupuesto_rot_bn(false, true);
|
||||
}
|
||||
@ -2313,7 +2407,7 @@ function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=fals
|
||||
gramaje: $('#lp_rot_bn_gramaje option:selected').text().trim(),
|
||||
maquina_id: $('#lp_rot_bn_maquina option:selected').val(),
|
||||
papel_impresion_id: $('#lp_rot_bn_papelImpresion option:selected').val(),
|
||||
fibra: $('#lp_rot_bn_aFavorFibra').prop('checked')
|
||||
fibra: fromComparador==false? ($('#lp_rot_bn_aFavorFibra').prop('checked')?1:0):1
|
||||
}
|
||||
}
|
||||
|
||||
@ -2332,6 +2426,7 @@ function calcularPresupuesto_rot_bn(fromComparador=false, updatedTipologias=fals
|
||||
papel_generico: input_data.papel_generico,
|
||||
gramaje: input_data.gramaje,
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
a_favor_fibra: fromComparador==false? ($('#lp_rot_bn_aFavorFibra').prop('checked')?1:0):1,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -2429,7 +2524,7 @@ function fill_lp_rot_bn(row, fromComparador=false){
|
||||
gramaje: row.gramaje,
|
||||
papel_impresion_id: row.papelImpresionId,
|
||||
maquina_id: row.maquinaId,
|
||||
fibra: row.aFavorFibra=='no'?false:true
|
||||
fibra: row.aFavorFibra=='no'?0:1
|
||||
}
|
||||
|
||||
calcularPresupuesto_rot_bn(true, false, input_data);
|
||||
@ -2442,9 +2537,9 @@ function fill_lp_rot_bn(row, fromComparador=false){
|
||||
|
||||
var row = tableLineasPresupuesto.row('#lp_rot_bn');
|
||||
if(row.length>0)
|
||||
tableLineasPresupuesto.row('#lp_rot_bn').data(data).draw(true)
|
||||
tableLineasPresupuesto.row('#lp_rot_bn').data(data).draw()
|
||||
else{
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row('#lp_rot_bn');
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
@ -2456,6 +2551,9 @@ function fill_lp_rot_bn(row, fromComparador=false){
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
}
|
||||
|
||||
$('.lp_rot_bn').css('display', '')
|
||||
@ -2592,7 +2690,8 @@ function clear_lp_rot_color(clear_selectors){
|
||||
function change_lp_rot_color_maquina(){
|
||||
|
||||
if(parseInt($('#lp_rot_color_paginas').val())>0){
|
||||
calcularPresupuesto_rot_color();
|
||||
|
||||
calcularPresupuesto_rot_color(true,false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2617,7 +2716,10 @@ function change_lp_rot_color_aFavorFibra(){
|
||||
$('#lp_rot_color_gramaje option:selected').text().length>0 &&
|
||||
parseInt($('#lp_rot_color_papelImpresion option:selected').val())>0
|
||||
){
|
||||
|
||||
var rowData = tableLineasPresupuesto.row('#lp_rot_color').data()
|
||||
rowData.aFavorFibra = $('#lp_rot_color_aFavorFibra').prop('checked')
|
||||
tableLineasPresupuesto.row('#lp_rot_color').data(rowData).draw(false)
|
||||
|
||||
calcularPresupuesto_rot_color(false, true);
|
||||
}
|
||||
}
|
||||
@ -2636,17 +2738,19 @@ function calcularPresupuesto_rot_color(fromComparador=false, updatedTipologias=f
|
||||
gramaje: $('#lp_rot_color_gramaje option:selected').text().trim(),
|
||||
maquina_id: $('#lp_rot_color_maquina option:selected').val(),
|
||||
papel_impresion_id: $('#lp_rot_color_papelImpresion option:selected').val(),
|
||||
fibra: $('#lp_rot_bn_aFavorFibra').prop('checked')
|
||||
fibra: fromComparador==false? ($('#lp_rot_color_aFavorFibra').prop('checked')?1:0):1
|
||||
}
|
||||
}
|
||||
|
||||
paginas_color = isNaN(parseInt($('#lp_rot_color_numPagColor').val()))?input_data.paginas:parseInt($('#lp_rot_color_numPagColor').val())
|
||||
|
||||
let datos = {
|
||||
type: 'interior_rot',
|
||||
color: 1,
|
||||
hq: 0,
|
||||
hq: 0,
|
||||
paginas: input_data.paginas,
|
||||
paginas_negro: input_data.paginas-parseInt($('#lp_rot_color_numPagColor').val()),
|
||||
paginas_color: parseInt($('#lp_rot_color_numPagColor').val()),
|
||||
paginas_negro: input_data.paginas-paginas_color,
|
||||
paginas_color: paginas_color,
|
||||
tirada: parseInt($('#tirada').val()),
|
||||
merma: parseInt($('#merma').val()),
|
||||
ancho: dimension.ancho,
|
||||
@ -2655,6 +2759,7 @@ function calcularPresupuesto_rot_color(fromComparador=false, updatedTipologias=f
|
||||
papel_generico: input_data.papel_generico,
|
||||
gramaje: input_data.gramaje,
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
a_favor_fibra: fromComparador==false? ($('#lp_rot_color_aFavorFibra').prop('checked')?1:0):1,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
@ -2699,7 +2804,7 @@ function calcularPresupuesto_rot_color(fromComparador=false, updatedTipologias=f
|
||||
value.fields.a_favor_fibra == input_data.fibra) {
|
||||
|
||||
value.fields.check_papel_total = $('#lp_rot_color' + '_checkPapel').is(":checked")?1:0
|
||||
value.fields.check_impresion_total = $('#lp_rot_bn' + '_checkClicks').is(":checked")?1:0
|
||||
value.fields.check_impresion_total = $('#lp_rot_color' + '_checkClicks').is(":checked")?1:0
|
||||
|
||||
fill_lp_rot_color(value.fields);
|
||||
return false;
|
||||
@ -2756,7 +2861,7 @@ function fill_lp_rot_color(row, fromComparador=false){
|
||||
gramaje: row.gramaje,
|
||||
papel_impresion_id: row.papelImpresionId,
|
||||
maquina_id: row.maquinaId,
|
||||
fibra: row.aFavorFibra=='no'?false:true
|
||||
fibra: row.aFavorFibra=='no'?0:1
|
||||
}
|
||||
|
||||
calcularPresupuesto_rot_color(true, false, input_data);
|
||||
@ -2768,9 +2873,9 @@ function fill_lp_rot_color(row, fromComparador=false){
|
||||
|
||||
var row = tableLineasPresupuesto.row('#lp_rot_color');
|
||||
if(row.length>0)
|
||||
tableLineasPresupuesto.row('#lp_rot_color').data(data).draw(true)
|
||||
tableLineasPresupuesto.row('#lp_rot_color').data(data).draw()
|
||||
else{
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row('#lp_rot_color');
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
@ -2782,6 +2887,9 @@ function fill_lp_rot_color(row, fromComparador=false){
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
}
|
||||
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
@ -2795,6 +2903,7 @@ function eventos_lp_rot_color(){
|
||||
$('#lp_rot_color_maquina').bind("focus", set_lp_rot_color_maquina);
|
||||
$('#lp_rot_color_maquina').bind("change", change_lp_rot_color_maquina);
|
||||
$('#lp_rot_color_paginas').bind("change", change_lp_rot_color_paginas);
|
||||
$('#lp_rot_color_numPagColor').bind("change", change_lp_rot_color_paginas);
|
||||
$('#lp_rot_color_vercalculos').bind("click", {rowId: 'lp_rot_color'}, verCalculosInkjet);
|
||||
$('#lp_rot_color_aFavorFibra').bind("change", change_lp_rot_color_aFavorFibra);
|
||||
$('.lp-rot-color-tipologia').bind("change", change_lp_rot_color_tipologia);
|
||||
@ -2949,6 +3058,7 @@ function calcularPresupuesto_cubierta(fromComparador=false, input_data={}){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let datos = {
|
||||
type: 'cubierta',
|
||||
color: 1,
|
||||
@ -2962,6 +3072,7 @@ function calcularPresupuesto_cubierta(fromComparador=false, input_data={}){
|
||||
merma: parseInt($('#mermacubierta').val()),
|
||||
ancho: dimension.ancho,
|
||||
alto: dimension.alto,
|
||||
lomo: getLomoLineasPresupuesto(),
|
||||
papel_generico_id: input_data.papel_generico_id,
|
||||
papel_generico: input_data.papel_generico,
|
||||
gramaje: input_data.gramaje,
|
||||
@ -3040,9 +3151,9 @@ function fill_lp_cubierta(row, fromComparador=false){
|
||||
|
||||
var row = tableLineasPresupuesto.row('#lp_cubierta');
|
||||
if(row.length>0)
|
||||
tableLineasPresupuesto.row('#lp_cubierta').data(data).draw(true)
|
||||
tableLineasPresupuesto.row('#lp_cubierta').data(data).draw()
|
||||
else{
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row('#lp_cubierta');
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
@ -3074,6 +3185,35 @@ function eventos_lp_cubierta(){
|
||||
$('#lp_cubierta_checkClicks').bind("change", {id_linea: 'lp_cubierta'}, update_total_linea);
|
||||
}
|
||||
|
||||
|
||||
function check_update_cubierta(){
|
||||
let row = tableLineasPresupuesto.row('#lp_cubierta');
|
||||
if(row.length>0){
|
||||
calcularPresupuesto_cubierta()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getLomoLineasPresupuesto(){
|
||||
let lomoTotal = 0
|
||||
try{
|
||||
tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
||||
var rowData = this.data();
|
||||
lomoTotal += parseFloat(rowData.lomo)
|
||||
})
|
||||
}
|
||||
catch(error){
|
||||
lomoTotal = 0
|
||||
}
|
||||
return lomoTotal
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fill_lp_from_bbdd()
|
||||
|
||||
function fill_lp_from_bbdd(){
|
||||
@ -3170,7 +3310,7 @@ function fill_lp_from_bbdd(){
|
||||
|
||||
var row = tableLineasPresupuesto.row("#" + lp.tipo);
|
||||
|
||||
tableLineasPresupuesto.row.add(data).draw(true)
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row("#" + lp.tipo);
|
||||
|
||||
row.child(format(row.data())).show();
|
||||
@ -3314,6 +3454,7 @@ async function fill_bbdd_from_lp(presupuesto_id){
|
||||
linea_data.rotativa_precio_hora_corte = rowData.precioHoraCorte
|
||||
linea_data.rotativa_tiempo_corte = rowData.tiempoCorte
|
||||
linea_data.rotativa_total_corte = rowData.totalCorte
|
||||
linea_data.rotativa_a_favor_fibra = rowData.aFavorFibra==true?1:0
|
||||
}
|
||||
|
||||
data.push(linea_data)
|
||||
@ -3347,23 +3488,23 @@ function updateLineasPresupuesto(){
|
||||
|
||||
$('#tableLineasPresupuesto tbody tr:visible ').each(function(){
|
||||
|
||||
if(this.id.endsWith('_bn')){
|
||||
checkComparadorInt(false, false, true);
|
||||
if(this.id.endsWith('lp_bn')){
|
||||
checkComparadorInt(false, false, true, false);
|
||||
}
|
||||
else if(this.id.endsWith('_bnhq')){
|
||||
checkComparadorInt(false, true, true);
|
||||
else if(this.id.endsWith('lp_bnhq')){
|
||||
checkComparadorInt(false, true, true, false);
|
||||
}
|
||||
else if(this.id.endsWith('_color')){
|
||||
checkComparadorInt(true, false, true);
|
||||
else if(this.id.endsWith('lp_color')){
|
||||
checkComparadorInt(true, false, true, false);
|
||||
}
|
||||
else if(this.id.endsWith('_colorhq')){
|
||||
checkComparadorInt(true, true, true);
|
||||
else if(this.id.endsWith('lp_colorhq')){
|
||||
checkComparadorInt(true, true, true, false);
|
||||
}
|
||||
else if(this.id.endsWith('_rot_bn')){
|
||||
checkComparadorInt(false, false, true)
|
||||
else if(this.id.endsWith('lp_rot_bn')){
|
||||
checkComparadorInt(false, false, false, true)
|
||||
}
|
||||
else if(this.id.endsWith('_rot_color')){
|
||||
checkComparadorInt(false,true, true);
|
||||
else if(this.id.endsWith('lp_rot_color')){
|
||||
checkComparadorInt(false,true, false, true);
|
||||
}
|
||||
else if(this.id.endsWith('_cubierta')){
|
||||
checkComparadorCubierta(true)
|
||||
|
||||
@ -37,10 +37,10 @@
|
||||
value="<?= lang("Basic.global.Save") ?>"
|
||||
/>
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
<?= anchor(route_to("presupuestoToPdf"), lang("Basic.global.Print"), ["class" => "btn btn-dark float-start me-sm-3 me-1",]) ?>
|
||||
<?= anchor(route_to("presupuestoToPdf", $presupuestoId), lang("Basic.global.Print"), ["class" => "btn btn-dark float-start me-sm-3 me-1",'target' => '_blank']) ?>
|
||||
<?= anchor(route_to("#"), lang("Basic.global.Clone"), ["class" => "btn btn-info float-start me-sm-3 me-1",]) ?>
|
||||
<?php endif; ?>
|
||||
<?= anchor(route_to("cosidotapablandaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||
<?= anchor(route_to("cosidotapablandaList", $tipo_impresion_id), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -142,17 +142,20 @@
|
||||
type: "POST",
|
||||
url: "<?php echo $formAction; ?>",
|
||||
data: form,
|
||||
success: function(data) {
|
||||
yeniden(data. < ? = csrf_token() ? > )
|
||||
popSuccessAlert(data.mensaje)
|
||||
success: function (data) {
|
||||
yeniden(data.<?= csrf_token() ?>)
|
||||
if('errorMensaje' in data)
|
||||
popErrorAlert(data.errorMensaje)
|
||||
else
|
||||
popSuccessAlert(data.mensaje)
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, error) {
|
||||
}).fail(function (jqXHR, textStatus, error) {
|
||||
// Handle error here
|
||||
console.log(jqXHR)
|
||||
});;
|
||||
}))
|
||||
|
||||
return false; //stop the actual form post !important!
|
||||
return false; //stop the actual form post !important!
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user