mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
mejorando actualizacion de presupuesto
This commit is contained in:
@ -141,7 +141,14 @@ function updateTablaEnvios(){
|
||||
.draw();
|
||||
|
||||
checkInsertar()
|
||||
updateTotales(false, false, true)
|
||||
//updateTotales(false, false, true)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
}
|
||||
else{
|
||||
popErrorAlert('<?= lang('PresupuestosDirecciones.validation.no_tarifa') ?>', 'error-tarifa')
|
||||
@ -155,7 +162,14 @@ $(document).on('click', '.delete-add-row', function(e) {
|
||||
.remove()
|
||||
.draw();
|
||||
checkInsertar()
|
||||
updateTotales(false, false, true)
|
||||
//updateTotales(false, false, true)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@ -382,9 +396,16 @@ function load_datos_envios(){
|
||||
})
|
||||
.draw();
|
||||
checkInsertar()
|
||||
updateTotales(false, false, true)
|
||||
//updateTotales(false, false, true)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
});
|
||||
$('#tableOfDireccionesEnvio').bind('draw.dt', update_tiradas_alternativas);
|
||||
//$('#tableOfDireccionesEnvio').bind('draw.dt', update_tiradas_alternativas);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -335,7 +335,7 @@ $('#paginas').on("change", function () {
|
||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||
|
||||
checkPaginasPresupuesto()
|
||||
updateLineasPresupuesto()
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
@ -349,7 +349,15 @@ $('#paginas').on("change", function () {
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
|
||||
update_servicios(false)
|
||||
//update_servicios(false)
|
||||
//updateLineasPresupuesto()
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
@ -369,8 +377,15 @@ $('#tirada').on("change", function () {
|
||||
const url_parts2 = url2.split('/');
|
||||
|
||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||
update_servicios(false)
|
||||
updateLineasPresupuesto()
|
||||
//update_servicios(false)
|
||||
//updateLineasPresupuesto()
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
checkInsertar()
|
||||
}
|
||||
})
|
||||
@ -493,8 +508,7 @@ function event_change_formato(){
|
||||
ancho_libro = getDimensionLibro().ancho;
|
||||
alto_libro = getDimensionLibro().alto;
|
||||
|
||||
checkPaginasPresupuesto()
|
||||
updateLineasPresupuesto()
|
||||
|
||||
// Si es negro o color
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
@ -509,7 +523,17 @@ function event_change_formato(){
|
||||
$('#compPapelCubierta').trigger('change');
|
||||
$('#compPapelSobrecubierta').trigger('change');
|
||||
|
||||
update_servicios(false)
|
||||
checkPaginasPresupuesto()
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
//updateLineasPresupuesto()
|
||||
//update_servicios(false)
|
||||
}
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
@ -52,22 +52,25 @@ async function get_servAcabados_tiradasAlternativas(tirada){
|
||||
tirada: parseInt(tirada),
|
||||
POD: $('#POD').val()
|
||||
}
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
if(json_data.datos.length>0){
|
||||
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
|
||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestoacabados/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
const values = await response.json();
|
||||
yeniden(values[window.csrf_token]);
|
||||
values.lines.forEach((line) => {
|
||||
|
||||
serviciosAcabados.coste += parseFloat(line[0].total);
|
||||
serviciosAcabados.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestoacabados/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
const values = await response.json();
|
||||
yeniden(values[window.csrf_token]);
|
||||
values.lines.forEach((line) => {
|
||||
|
||||
serviciosAcabados.coste += parseFloat(line[0].total);
|
||||
serviciosAcabados.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
}
|
||||
return serviciosAcabados;
|
||||
}
|
||||
|
||||
@ -123,21 +126,24 @@ async function get_servEncuadernacion_tiradasAlternativas(tirada, paginas, ancho
|
||||
alto: alto,
|
||||
POD: $('#POD').val()
|
||||
}
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
|
||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestoencuadernaciones/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
const values = await response.json();
|
||||
yeniden(values[window.csrf_token]);
|
||||
values.lines.forEach((line) => {
|
||||
serviciosEncuadernacion.coste += parseFloat(line[0].total);
|
||||
serviciosEncuadernacion.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
if(json_data.datos.length>0){
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
|
||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestoencuadernaciones/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
const values = await response.json();
|
||||
yeniden(values[window.csrf_token]);
|
||||
values.lines.forEach((line) => {
|
||||
serviciosEncuadernacion.coste += parseFloat(line[0].total);
|
||||
serviciosEncuadernacion.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
}
|
||||
return serviciosEncuadernacion;
|
||||
}
|
||||
|
||||
@ -188,21 +194,23 @@ async function get_servManipulado_tiradasAlternativas(tirada){
|
||||
tirada: parseInt(tirada),
|
||||
POD: $('#POD').val()
|
||||
}
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
if(json_data.datos.length>0){
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
|
||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestomanipulados/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
const values = await response.json();
|
||||
yeniden(values[window.csrf_token]);
|
||||
values.lines.forEach((line) => {
|
||||
serviciosManipulado.coste += parseFloat(line[0].total);
|
||||
serviciosManipulado.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestomanipulados/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
const values = await response.json();
|
||||
yeniden(values[window.csrf_token]);
|
||||
values.lines.forEach((line) => {
|
||||
serviciosManipulado.coste += parseFloat(line[0].total);
|
||||
serviciosManipulado.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
}
|
||||
return serviciosManipulado;
|
||||
}
|
||||
|
||||
@ -247,20 +255,23 @@ async function get_servPreimpresion_tiradasAlternativas(){
|
||||
datos: get_datos_preimpresion(),
|
||||
POD: $('#POD').val()
|
||||
}
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
if(json_data.datos.length>0){
|
||||
|
||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestopreimpresiones/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
const values = await response.json();
|
||||
yeniden(values[window.csrf_token]);
|
||||
values.lines.forEach((line) => {
|
||||
serviciosPreimpresion.coste += parseFloat(line[0].precio);
|
||||
serviciosPreimpresion.margen += parseFloat(line[0].precio)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
|
||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestopreimpresiones/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
const values = await response.json();
|
||||
yeniden(values[window.csrf_token]);
|
||||
values.lines.forEach((line) => {
|
||||
serviciosPreimpresion.coste += parseFloat(line[0].precio);
|
||||
serviciosPreimpresion.margen += parseFloat(line[0].precio)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
}
|
||||
return serviciosPreimpresion;
|
||||
}
|
||||
@ -298,6 +298,14 @@
|
||||
check_serv_acabado_error()
|
||||
check_serv_preimpresion_error()
|
||||
check_serv_manipulado_error()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
//updateTotales(false, true, false)
|
||||
|
||||
});
|
||||
|
||||
@ -374,7 +382,8 @@
|
||||
)
|
||||
}
|
||||
|
||||
function update_servicios(update_preimpresion=false){
|
||||
function actualizar_servicios(update_preimpresion=false){
|
||||
|
||||
const domain = window.location.origin
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
@ -448,6 +457,7 @@
|
||||
$('#proveedor_enc_' + line[0].tarifa_id).on('change', proveedor_enc_event)
|
||||
});
|
||||
check_serv_enc_error()
|
||||
//updateTotales(false, true, false)
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
}).then(
|
||||
fetch(domain + "/presupuestos/presupuestomanipulados/update/" + id , {
|
||||
@ -470,6 +480,7 @@
|
||||
$('#manipulado_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
|
||||
});
|
||||
check_serv_manipulado_error()
|
||||
//updateTotales(false, true, false)
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
}).then(function(){
|
||||
if(update_preimpresion){
|
||||
@ -492,6 +503,7 @@
|
||||
});
|
||||
check_serv_preimpresion_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
//updateTotales(false, true, false)
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -521,9 +533,9 @@
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
"drawCallback": function(settings ) {
|
||||
/*"drawCallback": function(settings ) {
|
||||
updateTotales(false, true, false)
|
||||
}
|
||||
}*/
|
||||
|
||||
});
|
||||
|
||||
@ -553,6 +565,15 @@
|
||||
'<span style="display: none;" class="update-totales" id="acabado_margen_' + element.tarifa_acabado_id + '">' + parseFloat(element.margen).toFixed(2) + '</span>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + element.tarifa_acabado_id +'" data-text="' + nombre_completo + '"></i></a>'
|
||||
]).draw(false)
|
||||
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
|
||||
})
|
||||
check_serv_acabado_error()
|
||||
@ -616,6 +637,16 @@
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2 tiradas-alternativas" data-id="' + row.tarifa_id +'" data-text="' + nombre +'"></i></a>'
|
||||
]).draw(false)
|
||||
});
|
||||
if(data.values.lenght > 0){
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
}
|
||||
|
||||
check_serv_acabado_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
@ -732,9 +763,9 @@
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
"drawCallback": function(settings ) {
|
||||
/*"drawCallback": function(settings ) {
|
||||
updateTotales(false, true, false)
|
||||
}
|
||||
}*/
|
||||
|
||||
});
|
||||
|
||||
@ -806,6 +837,14 @@
|
||||
$('#proveedor_enc_' + element.tarifa_encuadernado_id).on('change', proveedor_enc_event)
|
||||
});
|
||||
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
check_serv_enc_error()
|
||||
|
||||
}
|
||||
@ -839,6 +878,14 @@
|
||||
$('#precio_unidad_encuadernado_' + datos.tarifa_encuadernacion_id).text(parseFloat(data.values[0].precio_unidad).toFixed(2))
|
||||
$('#precio_total_encuadernado_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2))
|
||||
$('#enc_margen_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].margen).toFixed(2))
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
},
|
||||
@ -964,6 +1011,16 @@
|
||||
|
||||
});
|
||||
|
||||
if(data.values.lenght > 0){
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
}
|
||||
check_serv_enc_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
@ -1009,9 +1066,9 @@
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
"drawCallback": function(settings ) {
|
||||
/*"drawCallback": function(settings ) {
|
||||
updateTotales(false, true, false)
|
||||
}
|
||||
}*/
|
||||
|
||||
});
|
||||
|
||||
@ -1104,6 +1161,16 @@
|
||||
]).draw(false)
|
||||
});
|
||||
|
||||
if(data.values.lenght > 0){
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
}
|
||||
check_serv_manipulado_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
@ -1167,9 +1234,9 @@
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
"drawCallback": function(settings ) {
|
||||
/*"drawCallback": function(settings ) {
|
||||
updateTotales(false, true, false)
|
||||
}
|
||||
}*/
|
||||
|
||||
});
|
||||
|
||||
@ -1194,6 +1261,14 @@
|
||||
]).draw(false)
|
||||
|
||||
})
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
check_serv_preimpresion_error()
|
||||
}
|
||||
|
||||
@ -1243,6 +1318,16 @@
|
||||
]).draw(false)
|
||||
});
|
||||
|
||||
if(data.values.lenght > 0){
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: false
|
||||
})
|
||||
}
|
||||
check_serv_preimpresion_error()
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
|
||||
@ -1049,10 +1049,9 @@ $('.insertarLinea').on("click", function (e) {
|
||||
}
|
||||
|
||||
|
||||
update_servicios().then(function(){
|
||||
update_tiradas_alternativas()
|
||||
})
|
||||
|
||||
update_servicios()
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -1562,9 +1561,16 @@ function fill_lp_bn(row, fromComparator=false){
|
||||
$('#lp_bn_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
@ -1889,9 +1895,15 @@ function fill_lp_color(row, fromComparator=false){
|
||||
$('#lp_color_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
@ -2214,9 +2226,15 @@ function fill_lp_bnhq(row, fromComparator=false){
|
||||
$('#lp_bnhq_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
@ -2548,9 +2566,15 @@ function fill_lp_colorhq(row, fromComparator=false){
|
||||
$('#lp_colorhq_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
@ -2887,9 +2911,15 @@ function fill_lp_rot_bn(row, fromComparador=false){
|
||||
$('#lp_rot_bn_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
@ -3230,9 +3260,15 @@ function fill_lp_rot_color(row, fromComparador=false){
|
||||
$('#lp_rot_color_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
@ -3507,9 +3543,15 @@ function fill_lp_cubierta(row, fromComparador=false){
|
||||
check_update_sobrecubierta()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@ -3769,9 +3811,15 @@ function fill_lp_sobrecubierta(row, fromComparador=false){
|
||||
$('#lp_sobrecubierta_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@ -3963,9 +4011,15 @@ function fill_lp_guardas(row, fromComparador=false){
|
||||
$('#lp_guardas_checkPapel').change()
|
||||
|
||||
calcular_mermas()
|
||||
updateTotales(true, false, false);
|
||||
|
||||
updateTablaEnvios()
|
||||
//updateTotales(true, false, false);
|
||||
//updateTablaEnvios()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||
check_update_cubierta()
|
||||
|
||||
@ -250,7 +250,14 @@ $('#saveDireccionEnvio').on('click', function(){
|
||||
})
|
||||
}
|
||||
checkInsertar()
|
||||
updateTotales(false, false, true)
|
||||
//updateTotales(false, false, true)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: true,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
$('#addressForm').modal("hide");
|
||||
|
||||
}
|
||||
|
||||
@ -235,8 +235,7 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
||||
$('#totalAntesDescuento').text((totalAntesDescuento).toFixed(2) + '€')
|
||||
$('#descuentoTotal').text((totalDescuento).toFixed(2) + '€')
|
||||
$('#totalDespuesDecuento').text((totalPresupuesto).toFixed(2) + '€')
|
||||
$('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€')
|
||||
|
||||
$('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€')
|
||||
}
|
||||
|
||||
function getValuesResumenForm(){
|
||||
@ -272,7 +271,13 @@ function getValuesResumenForm(){
|
||||
|
||||
|
||||
$(".update-totales").on("change", function(){
|
||||
updateTotales(true, true, true)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
})
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -23,7 +23,7 @@ var tableTiradas;
|
||||
initTableTiradas();
|
||||
fill_tiradas_alternativas();
|
||||
|
||||
$('.tiradas-alternativas').each(function() {
|
||||
/*$('.tiradas-alternativas').each(function() {
|
||||
if ($(this).is('input')) {
|
||||
$(this).bind('change', update_tiradas_alternativas);
|
||||
} else if ($(this).is('button')) {
|
||||
@ -35,12 +35,12 @@ var tableTiradas;
|
||||
// para los botones de borrar
|
||||
$(this).bind('click', update_tiradas_alternativas);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
})();
|
||||
|
||||
|
||||
function update_tiradas_alternativas(){
|
||||
function actualizar_tiradas_alternativas(){
|
||||
// se obtiene la primera columna de la tabla de tiradas
|
||||
const data = tableTiradas.rows().data().toArray();
|
||||
// se borra la tabla de tiradas
|
||||
|
||||
@ -298,6 +298,70 @@ const url_parts = url.split('/');
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Control de actualización de presupuesto -->
|
||||
<!------------------------------------------->
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
function updatePresupuesto({update_lineas = false, update_servicios = false, update_envios = false,update_resumen = false, update_tiradas_alternativas = false}) {
|
||||
|
||||
new Promise(
|
||||
function(resolve, reject){
|
||||
if(update_lineas){
|
||||
updateLineasPresupuesto()
|
||||
}
|
||||
else
|
||||
resolve()
|
||||
}
|
||||
).then(function(){
|
||||
new Promise(
|
||||
function(resolve, reject){
|
||||
if(update_servicios){
|
||||
actualizar_servicios()
|
||||
}
|
||||
else
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
}).then(function(){
|
||||
new Promise(
|
||||
function(resolve, reject){
|
||||
if(update_envios){
|
||||
updateTablaEnvios()
|
||||
}
|
||||
else
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
}).then(function(){
|
||||
new Promise(
|
||||
function(resolve, reject){
|
||||
if(update_resumen){
|
||||
updateTotales()
|
||||
}
|
||||
else
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
}).then(function(){
|
||||
new Promise(
|
||||
function(resolve, reject){
|
||||
if(update_tiradas_alternativas){
|
||||
actualizar_tiradas_alternativas()
|
||||
}
|
||||
else
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Variables generales usadas en los ficheros js -->
|
||||
<!------------------------------------------->
|
||||
|
||||
Reference in New Issue
Block a user