mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ya se meten las lineas de sobrecubierta
This commit is contained in:
@ -1344,7 +1344,8 @@
|
||||
if(actualizarLinea){
|
||||
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||
for(row of rows){
|
||||
fill_lp_cubierta(row, true);
|
||||
if (row.tipo=='cubierta')
|
||||
fill_lp_cubierta(row, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1424,10 +1425,11 @@
|
||||
$('#title_cubierta').html('<?= lang("Presupuestos.compCubiertaSobrecubierta") ?>' + (tableCompCubierta.rows().count()>0 ?(' (' + tableCompCubierta.rows().count() + ')'):''));
|
||||
$('#insertarCubiertaBtn').removeClass('d-none')
|
||||
if(actualizarLinea){
|
||||
/*var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||
for(row of rows){
|
||||
fill_lp_cubierta(row, true);
|
||||
}*/
|
||||
if (row.tipo=='sobrecubierta')
|
||||
fill_lp_sobrecubierta(row, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
@ -58,6 +58,7 @@
|
||||
<option value="lp_rot_bn"><?= lang('Presupuestos.rotativa_bn') ?></option>
|
||||
<option value="lp_rot_color"><?= lang('Presupuestos.rotativa_color') ?></option>
|
||||
<option value="lp_cubierta"><?= lang('Presupuestos.cubierta') ?></option>
|
||||
<option value="lp_sobrecubierta"><?= lang('Presupuestos.sobrecubierta') ?></option>
|
||||
<option value="lp_guardas"><?= lang('Presupuestos.Guardas') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
@ -81,6 +82,7 @@ const papelGenericoCubiertaList = <?php echo json_encode($papelGenericoCubiertaL
|
||||
const papelGenericoSobrecubiertaList = <?php echo json_encode($papelGenericoSobrecubiertaList); ?>;
|
||||
const papelGenericoRotativaNegroList = <?php echo json_encode($papelGenericoRotativaNegroList); ?>;
|
||||
const papelGenericoRotativaColorList = <?php echo json_encode($papelGenericoRotativaColorList); ?>;
|
||||
|
||||
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||
const papelGenericoGuardasList = <?php echo json_encode($papelGenericoGuardasList); ?>;
|
||||
<?php endif; ?>
|
||||
@ -545,6 +547,9 @@ var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
||||
return select;
|
||||
|
||||
}
|
||||
else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
{data: 'papel',
|
||||
@ -947,6 +952,9 @@ function clear_cubierta(){
|
||||
clear_lp_cubierta(true);
|
||||
}
|
||||
|
||||
function clear_sobrecubierta(){
|
||||
clear_lp_sobrecubierta(true);
|
||||
}
|
||||
|
||||
|
||||
$('.insertarLinea').on("click", function (e) {
|
||||
@ -995,7 +1003,15 @@ $('.insertarLinea').on("click", function (e) {
|
||||
|
||||
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||
for(row of rows){
|
||||
fill_lp_cubierta(row, true);
|
||||
if(row.tipo == 'cubierta')
|
||||
fill_lp_cubierta(row, true);
|
||||
}
|
||||
|
||||
clear_sobrecubierta();
|
||||
|
||||
for(row of rows){
|
||||
if(row.tipo == 'sobrecubierta')
|
||||
fill_lp_sobrecubierta(row, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1168,6 +1184,25 @@ $('#btn_addLinea').on("click", function (e) {
|
||||
eventos_lp_cubierta()
|
||||
break
|
||||
|
||||
case 'lp_sobrecubierta':
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
if(dataRows[number].row_id == 'lp_sobrecubierta'){
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if(hayLinea){
|
||||
popErrorAlert('<?=lang('Presupuestos.errores.lineaDuplicada') ?>', 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({tipo_maquina: 'toner'}, 'lp_sobrecubierta', 'lp-sobrecubierta');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_sobrecubierta()
|
||||
break
|
||||
|
||||
case 'lp_guardas':
|
||||
var hayLinea = false
|
||||
for(let number=0;number<dataRows.length;number++){
|
||||
@ -3486,6 +3521,269 @@ function check_update_cubierta(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS para sobrecubierta. -->
|
||||
<!------------------------------------------->
|
||||
|
||||
async function set_lp_sobrecubierta_gramaje(){
|
||||
|
||||
await $.ajax({
|
||||
type: 'post',
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
beforeSend: function() {
|
||||
clear_lp_sobrecubierta(true)
|
||||
},
|
||||
data: {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
uso: 'sobrecubierta',
|
||||
datos: $('#lp_sobrecubierta_papel option:selected').val() ,
|
||||
tipoLinea: "colorhq",
|
||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
$.each(data.menu, function(item){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_sobrecubierta_gramaje').append(option);
|
||||
});
|
||||
$('#lp_sobrecubierta_gramaje').val('')
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function set_lp_sobrecubierta_papelImpresion(){
|
||||
|
||||
await $.ajax({
|
||||
type: 'post',
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
beforeSend: function() {
|
||||
$('#lp_sobrecubierta_papelImpresion').empty()
|
||||
$('#lp_sobrecubierta_maquina').empty()
|
||||
clear_lp_sobrecubierta(false)
|
||||
},
|
||||
data: {
|
||||
tipo: 'papelImpresion',
|
||||
uso: 'sobrecubierta',
|
||||
datos: $('#lp_sobrecubierta_papel option:selected').val() ,
|
||||
gramaje: $('#lp_sobrecubierta_gramaje option:selected').text().trim() ,
|
||||
tipoLinea: "colorhq",
|
||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
$.each(data.menu, function(item){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_sobrecubierta_papelImpresion').append(option);
|
||||
});
|
||||
$('#lp_sobrecubierta_papelImpresion').val('')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function set_lp_sobrecubierta_maquina(){
|
||||
|
||||
await $.ajax({
|
||||
type: 'post',
|
||||
url: '<?= route_to("menuItemsOfCosidotapablanda") ?>',
|
||||
beforeSend: function() {
|
||||
$('#lp_sobrecubierta_maquina').empty()
|
||||
clear_lp_sobrecubierta(false)
|
||||
},
|
||||
data: {
|
||||
tipo: 'maquina',
|
||||
uso: 'colorhq',
|
||||
tipoLinea: "sobrecubierta",
|
||||
uso_tarifa: "sobrecubierta",
|
||||
is_rotativa: 0,
|
||||
ancho: getDimensionLibro().ancho,
|
||||
alto: getDimensionLibro().alto,
|
||||
datos: parseInt($('#tirada').val()) + parseInt($('#merma').val()),
|
||||
papel_impresion: $('#lp_sobrecubierta_papelImpresion option:selected').val() ,
|
||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
$.each(data.menu, function(item){
|
||||
var option = $('<option/>', {'value':data.menu[item].maquina_id, 'text':data.menu[item].maquina})
|
||||
$('#lp_sobrecubierta_maquina').append(option);
|
||||
});
|
||||
$('#lp_sobrecubierta_maquina').val('')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function clear_lp_sobrecubierta(clear_selectors){
|
||||
$(".lp-sobrecubierta-input" ).val("0")
|
||||
if(clear_selectors)
|
||||
$( ".lp-sobrecubierta-select").empty()
|
||||
}
|
||||
|
||||
|
||||
function change_lp_sobrecubierta_maquina(){
|
||||
|
||||
calcularPresupuesto_sobrecubierta();
|
||||
}
|
||||
|
||||
|
||||
function calcularPresupuesto_sobrecubierta(fromComparador=false, input_data={}){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
if(Object.keys(input_data).length == 0){
|
||||
|
||||
input_data = {
|
||||
paginas:4,
|
||||
papel_generico_id: $('#lp_sobrecubierta_papel option:selected').val(),
|
||||
papel_generico: $('#lp_sobrecubierta_papel option:selected').text().trim(),
|
||||
gramaje: $('#lp_sobrecubierta_gramaje option:selected').text().trim(),
|
||||
maquina_id: $('#lp_sobrecubierta_maquina option:selected').val(),
|
||||
papel_impresion_id: $('#lp_sobrecubierta_papelImpresion option:selected').val()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'sobrecubierta',
|
||||
color: 1,
|
||||
hq: 1,
|
||||
paginas: input_data.paginas,
|
||||
paginas_negro: 0,
|
||||
paginas_color: 0,
|
||||
solapas: $('#solapas').is(':checked')?1:0,
|
||||
solapas_ancho: parseInt($('#solapas_ancho').val()),
|
||||
tirada: parseInt($('#tirada').val()),
|
||||
merma: parseInt($('#mermacubierta').val()),
|
||||
ancho: dimension.ancho,
|
||||
alto: dimension.alto,
|
||||
lomo: getLomoLineasPresupuesto(),
|
||||
lomo_cubierta: getLomoCubiertaLineasPresupuesto(),
|
||||
papel_generico_id: input_data.papel_generico_id,
|
||||
papel_generico: input_data.papel_generico,
|
||||
gramaje: input_data.gramaje,
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
data: datos,
|
||||
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) {
|
||||
if(value.fields.maquina_id === input_data.maquina_id &&
|
||||
value.fields.papel_generico_id === input_data.papel_generico_id &&
|
||||
value.fields.papel_impresion_id === input_data.papel_impresion_id) {
|
||||
|
||||
if(Object.keys(input_data).length == 0){
|
||||
value.fields.check_papel_total = $('#lp_sobrecubierta' + '_checkPapel').is(":checked")?1:0
|
||||
value.fields.check_impresion_total = $('#lp_sobrecubierta' + '_checkClicks').is(":checked")?1:0
|
||||
}
|
||||
else{
|
||||
value.fields.check_papel_total = 1
|
||||
value.fields.check_impresion_total = 1
|
||||
}
|
||||
fill_lp_sobrecubierta(value.fields);
|
||||
return false;
|
||||
}
|
||||
clear_lp_sobrecubierta(false);
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
|
||||
},
|
||||
error: function(e){
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function fill_lp_sobrecubierta(row, fromComparador=false){
|
||||
|
||||
if(fromComparador){
|
||||
|
||||
var input_data = {
|
||||
paginas: row.paginas,
|
||||
papel_generico_id: row.papelGenericoId,
|
||||
gramaje: row.gramaje,
|
||||
papel_impresion_id: row.papelImpresionId,
|
||||
maquina_id: row.maquinaId,
|
||||
}
|
||||
|
||||
calcularPresupuesto_sobrecubierta(false, input_data);
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
var portadaObjeto = {
|
||||
anchoLibro:row.dimensiones_libro[0],
|
||||
altoLibro:row.dimensiones_libro[1],
|
||||
solapas:$('#solapas_ancho').val(),
|
||||
lomo:row.mano};
|
||||
|
||||
// Si viene de hacerlo a mano...
|
||||
data = processRowData(row, 'lp_sobrecubierta', 'lp-sobrecubierta');
|
||||
|
||||
var row = tableLineasPresupuesto.row('#lp_sobrecubierta');
|
||||
if(row.length>0)
|
||||
tableLineasPresupuesto.row('#lp_sobrecubierta').data(data).draw()
|
||||
else{
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
row = tableLineasPresupuesto.row('#lp_sobrecubierta');
|
||||
}
|
||||
row.child(format(row.data())).show();
|
||||
|
||||
eventos_lp_sobrecubierta()
|
||||
|
||||
$('#lp_sobrecubierta_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false)
|
||||
updateTablaEnvios()
|
||||
|
||||
}
|
||||
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
|
||||
}
|
||||
|
||||
function eventos_lp_sobrecubierta(){
|
||||
|
||||
$('#lp_sobrecubierta_papel').bind("focus", {clear_selectors: true}, clear_lp_sobrecubierta);
|
||||
$('#lp_sobrecubierta_gramaje').bind("focus", set_lp_sobrecubierta_gramaje);
|
||||
$('#lp_sobrecubierta_papelImpresion').focus("focus", set_lp_sobrecubierta_papelImpresion);
|
||||
$('#lp_sobrecubierta_maquina').bind("focus", set_lp_sobrecubierta_maquina);
|
||||
$('#lp_sobrecubierta_maquina').bind("change", change_lp_sobrecubierta_maquina);
|
||||
$('#lp_sobrecubierta_vercalculos').bind("click", {rowId: 'lp_sobrecubierta'}, verCalculosInkjet);
|
||||
$('#lp_sobrecubierta_checkPapel').bind("change", {id_linea: 'lp_sobrecubierta'}, update_total_linea);
|
||||
$('#lp_sobrecubierta_checkClicks').bind("change", {id_linea: 'lp_sobrecubierta'}, update_total_linea);
|
||||
}
|
||||
|
||||
|
||||
function check_update_sobrecubierta(){
|
||||
let row = tableLineasPresupuesto.row('#lp_sobrecubierta');
|
||||
if(row.length>0){
|
||||
calcularPresupuesto_sobrecubierta()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getLomoLineasPresupuesto(){
|
||||
let lomoTotal = 0
|
||||
try{
|
||||
@ -3919,6 +4217,9 @@ function fill_lp_from_bbdd(){
|
||||
case 'lp_cubierta':
|
||||
eventos_lp_cubierta()
|
||||
break
|
||||
case 'lp_sobrecubierta':
|
||||
eventos_lp_sobrecubierta()
|
||||
break
|
||||
case 'lp_guardas':
|
||||
eventos_lp_guardas()
|
||||
lp['paginas_impresion'] = lp.paginas_impresion
|
||||
|
||||
@ -181,8 +181,8 @@
|
||||
<!------------------------------------------->
|
||||
<!-- Acciones antes de submit... -->
|
||||
<!------------------------------------------->
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
Reference in New Issue
Block a user