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();
|
.draw();
|
||||||
|
|
||||||
checkInsertar()
|
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{
|
else{
|
||||||
popErrorAlert('<?= lang('PresupuestosDirecciones.validation.no_tarifa') ?>', 'error-tarifa')
|
popErrorAlert('<?= lang('PresupuestosDirecciones.validation.no_tarifa') ?>', 'error-tarifa')
|
||||||
@ -155,7 +162,14 @@ $(document).on('click', '.delete-add-row', function(e) {
|
|||||||
.remove()
|
.remove()
|
||||||
.draw();
|
.draw();
|
||||||
checkInsertar()
|
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();
|
.draw();
|
||||||
checkInsertar()
|
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'){
|
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||||
|
|
||||||
checkPaginasPresupuesto()
|
checkPaginasPresupuesto()
|
||||||
updateLineasPresupuesto()
|
|
||||||
// Si es negro o color
|
// Si es negro o color
|
||||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||||
@ -349,7 +349,15 @@ $('#paginas').on("change", function () {
|
|||||||
$('#compPaginasNegrohq').trigger('change');
|
$('#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('/');
|
const url_parts2 = url2.split('/');
|
||||||
|
|
||||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
if(url_parts2[url_parts2.length-2] == 'edit'){
|
||||||
update_servicios(false)
|
//update_servicios(false)
|
||||||
updateLineasPresupuesto()
|
//updateLineasPresupuesto()
|
||||||
|
updatePresupuesto({
|
||||||
|
update_lineas: true,
|
||||||
|
update_servicios: true,
|
||||||
|
update_envios: true,
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: false
|
||||||
|
})
|
||||||
checkInsertar()
|
checkInsertar()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -493,8 +508,7 @@ function event_change_formato(){
|
|||||||
ancho_libro = getDimensionLibro().ancho;
|
ancho_libro = getDimensionLibro().ancho;
|
||||||
alto_libro = getDimensionLibro().alto;
|
alto_libro = getDimensionLibro().alto;
|
||||||
|
|
||||||
checkPaginasPresupuesto()
|
|
||||||
updateLineasPresupuesto()
|
|
||||||
// Si es negro o color
|
// Si es negro o color
|
||||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||||
@ -509,7 +523,17 @@ function event_change_formato(){
|
|||||||
$('#compPapelCubierta').trigger('change');
|
$('#compPapelCubierta').trigger('change');
|
||||||
$('#compPapelSobrecubierta').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; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
@ -52,22 +52,25 @@ async function get_servAcabados_tiradasAlternativas(tirada){
|
|||||||
tirada: parseInt(tirada),
|
tirada: parseInt(tirada),
|
||||||
POD: $('#POD').val()
|
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/presupuestoacabados/update/" + id , {
|
json_data = Object.assign(json_data, window.token_ajax);
|
||||||
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);
|
const response = await fetch(window.location.origin + "/presupuestos/presupuestoacabados/update/" + id , {
|
||||||
serviciosAcabados.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
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;
|
return serviciosAcabados;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,21 +126,24 @@ async function get_servEncuadernacion_tiradasAlternativas(tirada, paginas, ancho
|
|||||||
alto: alto,
|
alto: alto,
|
||||||
POD: $('#POD').val()
|
POD: $('#POD').val()
|
||||||
}
|
}
|
||||||
json_data = Object.assign(json_data, window.token_ajax);
|
|
||||||
|
|
||||||
const response = await fetch(window.location.origin + "/presupuestos/presupuestoencuadernaciones/update/" + id , {
|
if(json_data.datos.length>0){
|
||||||
method: "POST",
|
json_data = Object.assign(json_data, window.token_ajax);
|
||||||
body: JSON.stringify(json_data),
|
|
||||||
headers: {
|
const response = await fetch(window.location.origin + "/presupuestos/presupuestoencuadernaciones/update/" + id , {
|
||||||
"Content-type": "application/json; charset=UTF-8"
|
method: "POST",
|
||||||
}
|
body: JSON.stringify(json_data),
|
||||||
})
|
headers: {
|
||||||
const values = await response.json();
|
"Content-type": "application/json; charset=UTF-8"
|
||||||
yeniden(values[window.csrf_token]);
|
}
|
||||||
values.lines.forEach((line) => {
|
})
|
||||||
serviciosEncuadernacion.coste += parseFloat(line[0].total);
|
const values = await response.json();
|
||||||
serviciosEncuadernacion.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
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;
|
return serviciosEncuadernacion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,21 +194,23 @@ async function get_servManipulado_tiradasAlternativas(tirada){
|
|||||||
tirada: parseInt(tirada),
|
tirada: parseInt(tirada),
|
||||||
POD: $('#POD').val()
|
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 , {
|
const response = await fetch(window.location.origin + "/presupuestos/presupuestomanipulados/update/" + id , {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(json_data),
|
body: JSON.stringify(json_data),
|
||||||
headers: {
|
headers: {
|
||||||
"Content-type": "application/json; charset=UTF-8"
|
"Content-type": "application/json; charset=UTF-8"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const values = await response.json();
|
const values = await response.json();
|
||||||
yeniden(values[window.csrf_token]);
|
yeniden(values[window.csrf_token]);
|
||||||
values.lines.forEach((line) => {
|
values.lines.forEach((line) => {
|
||||||
serviciosManipulado.coste += parseFloat(line[0].total);
|
serviciosManipulado.coste += parseFloat(line[0].total);
|
||||||
serviciosManipulado.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
serviciosManipulado.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return serviciosManipulado;
|
return serviciosManipulado;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,20 +255,23 @@ async function get_servPreimpresion_tiradasAlternativas(){
|
|||||||
datos: get_datos_preimpresion(),
|
datos: get_datos_preimpresion(),
|
||||||
POD: $('#POD').val()
|
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 , {
|
json_data = Object.assign(json_data, window.token_ajax);
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify(json_data),
|
const response = await fetch(window.location.origin + "/presupuestos/presupuestopreimpresiones/update/" + id , {
|
||||||
headers: {
|
method: "POST",
|
||||||
"Content-type": "application/json; charset=UTF-8"
|
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) => {
|
const values = await response.json();
|
||||||
serviciosPreimpresion.coste += parseFloat(line[0].precio);
|
yeniden(values[window.csrf_token]);
|
||||||
serviciosPreimpresion.margen += parseFloat(line[0].precio)*parseFloat(line[0].margen)/100.0;
|
values.lines.forEach((line) => {
|
||||||
});
|
serviciosPreimpresion.coste += parseFloat(line[0].precio);
|
||||||
|
serviciosPreimpresion.margen += parseFloat(line[0].precio)*parseFloat(line[0].margen)/100.0;
|
||||||
|
});
|
||||||
|
}
|
||||||
return serviciosPreimpresion;
|
return serviciosPreimpresion;
|
||||||
}
|
}
|
||||||
@ -298,6 +298,14 @@
|
|||||||
check_serv_acabado_error()
|
check_serv_acabado_error()
|
||||||
check_serv_preimpresion_error()
|
check_serv_preimpresion_error()
|
||||||
check_serv_manipulado_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 domain = window.location.origin
|
||||||
const dimension = getDimensionLibro();
|
const dimension = getDimensionLibro();
|
||||||
|
|
||||||
@ -448,6 +457,7 @@
|
|||||||
$('#proveedor_enc_' + line[0].tarifa_id).on('change', proveedor_enc_event)
|
$('#proveedor_enc_' + line[0].tarifa_id).on('change', proveedor_enc_event)
|
||||||
});
|
});
|
||||||
check_serv_enc_error()
|
check_serv_enc_error()
|
||||||
|
//updateTotales(false, true, false)
|
||||||
yeniden(data.<?= csrf_token() ?>);
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
}).then(
|
}).then(
|
||||||
fetch(domain + "/presupuestos/presupuestomanipulados/update/" + id , {
|
fetch(domain + "/presupuestos/presupuestomanipulados/update/" + id , {
|
||||||
@ -470,6 +480,7 @@
|
|||||||
$('#manipulado_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
|
$('#manipulado_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
|
||||||
});
|
});
|
||||||
check_serv_manipulado_error()
|
check_serv_manipulado_error()
|
||||||
|
//updateTotales(false, true, false)
|
||||||
yeniden(data.<?= csrf_token() ?>);
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
}).then(function(){
|
}).then(function(){
|
||||||
if(update_preimpresion){
|
if(update_preimpresion){
|
||||||
@ -492,6 +503,7 @@
|
|||||||
});
|
});
|
||||||
check_serv_preimpresion_error()
|
check_serv_preimpresion_error()
|
||||||
yeniden(data.<?= csrf_token() ?>);
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
|
//updateTotales(false, true, false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -521,9 +533,9 @@
|
|||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
"drawCallback": function(settings ) {
|
/*"drawCallback": function(settings ) {
|
||||||
updateTotales(false, true, false)
|
updateTotales(false, true, false)
|
||||||
}
|
}*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -554,6 +566,15 @@
|
|||||||
'<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>'
|
'<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)
|
]).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()
|
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>'
|
'<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)
|
]).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()
|
check_serv_acabado_error()
|
||||||
yeniden(data.<?= csrf_token() ?>);
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
@ -732,9 +763,9 @@
|
|||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
"drawCallback": function(settings ) {
|
/*"drawCallback": function(settings ) {
|
||||||
updateTotales(false, true, false)
|
updateTotales(false, true, false)
|
||||||
}
|
}*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -806,6 +837,14 @@
|
|||||||
$('#proveedor_enc_' + element.tarifa_encuadernado_id).on('change', proveedor_enc_event)
|
$('#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()
|
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_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))
|
$('#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))
|
$('#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() ?>);
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
return true;
|
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()
|
check_serv_enc_error()
|
||||||
yeniden(data.<?= csrf_token() ?>);
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
return true;
|
return true;
|
||||||
@ -1009,9 +1066,9 @@
|
|||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
"drawCallback": function(settings ) {
|
/*"drawCallback": function(settings ) {
|
||||||
updateTotales(false, true, false)
|
updateTotales(false, true, false)
|
||||||
}
|
}*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1104,6 +1161,16 @@
|
|||||||
]).draw(false)
|
]).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()
|
check_serv_manipulado_error()
|
||||||
yeniden(data.<?= csrf_token() ?>);
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
return true;
|
return true;
|
||||||
@ -1167,9 +1234,9 @@
|
|||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
"drawCallback": function(settings ) {
|
/*"drawCallback": function(settings ) {
|
||||||
updateTotales(false, true, false)
|
updateTotales(false, true, false)
|
||||||
}
|
}*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1194,6 +1261,14 @@
|
|||||||
]).draw(false)
|
]).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()
|
check_serv_preimpresion_error()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,6 +1318,16 @@
|
|||||||
]).draw(false)
|
]).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()
|
check_serv_preimpresion_error()
|
||||||
yeniden(data.<?= csrf_token() ?>);
|
yeniden(data.<?= csrf_token() ?>);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -1049,9 +1049,8 @@ $('.insertarLinea').on("click", function (e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
update_servicios().then(function(){
|
update_servicios()
|
||||||
update_tiradas_alternativas()
|
|
||||||
})
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1562,9 +1561,16 @@ function fill_lp_bn(row, fromComparator=false){
|
|||||||
$('#lp_bn_checkPapel').change()
|
$('#lp_bn_checkPapel').change()
|
||||||
|
|
||||||
calcular_mermas()
|
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
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
@ -1889,9 +1895,15 @@ function fill_lp_color(row, fromComparator=false){
|
|||||||
$('#lp_color_checkPapel').change()
|
$('#lp_color_checkPapel').change()
|
||||||
|
|
||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
updateTotales(true, false, false);
|
//updateTotales(true, false, false);
|
||||||
|
//updateTablaEnvios()
|
||||||
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
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
@ -2214,9 +2226,15 @@ function fill_lp_bnhq(row, fromComparator=false){
|
|||||||
$('#lp_bnhq_checkPapel').change()
|
$('#lp_bnhq_checkPapel').change()
|
||||||
|
|
||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
updateTotales(true, false, false);
|
//updateTotales(true, false, false);
|
||||||
|
//updateTablaEnvios()
|
||||||
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
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
@ -2548,9 +2566,15 @@ function fill_lp_colorhq(row, fromComparator=false){
|
|||||||
$('#lp_colorhq_checkPapel').change()
|
$('#lp_colorhq_checkPapel').change()
|
||||||
|
|
||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
updateTotales(true, false, false);
|
//updateTotales(true, false, false);
|
||||||
|
//updateTablaEnvios()
|
||||||
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
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
@ -2887,9 +2911,15 @@ function fill_lp_rot_bn(row, fromComparador=false){
|
|||||||
$('#lp_rot_bn_checkPapel').change()
|
$('#lp_rot_bn_checkPapel').change()
|
||||||
|
|
||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
updateTotales(true, false, false);
|
//updateTotales(true, false, false);
|
||||||
|
//updateTablaEnvios()
|
||||||
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
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
@ -3230,9 +3260,15 @@ function fill_lp_rot_color(row, fromComparador=false){
|
|||||||
$('#lp_rot_color_checkPapel').change()
|
$('#lp_rot_color_checkPapel').change()
|
||||||
|
|
||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
updateTotales(true, false, false);
|
//updateTotales(true, false, false);
|
||||||
|
//updateTablaEnvios()
|
||||||
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
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
@ -3507,9 +3543,15 @@ function fill_lp_cubierta(row, fromComparador=false){
|
|||||||
check_update_sobrecubierta()
|
check_update_sobrecubierta()
|
||||||
|
|
||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
updateTotales(true, false, false);
|
//updateTotales(true, false, false);
|
||||||
|
//updateTablaEnvios()
|
||||||
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()
|
$('#lp_sobrecubierta_checkPapel').change()
|
||||||
|
|
||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
updateTotales(true, false, false);
|
//updateTotales(true, false, false);
|
||||||
|
//updateTablaEnvios()
|
||||||
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()
|
$('#lp_guardas_checkPapel').change()
|
||||||
|
|
||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
updateTotales(true, false, false);
|
//updateTotales(true, false, false);
|
||||||
|
//updateTablaEnvios()
|
||||||
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
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
check_update_cubierta()
|
check_update_cubierta()
|
||||||
|
|||||||
@ -250,7 +250,14 @@ $('#saveDireccionEnvio').on('click', function(){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
checkInsertar()
|
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");
|
$('#addressForm').modal("hide");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -236,7 +236,6 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
|||||||
$('#descuentoTotal').text((totalDescuento).toFixed(2) + '€')
|
$('#descuentoTotal').text((totalDescuento).toFixed(2) + '€')
|
||||||
$('#totalDespuesDecuento').text((totalPresupuesto).toFixed(2) + '€')
|
$('#totalDespuesDecuento').text((totalPresupuesto).toFixed(2) + '€')
|
||||||
$('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€')
|
$('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getValuesResumenForm(){
|
function getValuesResumenForm(){
|
||||||
@ -272,7 +271,13 @@ function getValuesResumenForm(){
|
|||||||
|
|
||||||
|
|
||||||
$(".update-totales").on("change", function(){
|
$(".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() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|||||||
@ -23,7 +23,7 @@ var tableTiradas;
|
|||||||
initTableTiradas();
|
initTableTiradas();
|
||||||
fill_tiradas_alternativas();
|
fill_tiradas_alternativas();
|
||||||
|
|
||||||
$('.tiradas-alternativas').each(function() {
|
/*$('.tiradas-alternativas').each(function() {
|
||||||
if ($(this).is('input')) {
|
if ($(this).is('input')) {
|
||||||
$(this).bind('change', update_tiradas_alternativas);
|
$(this).bind('change', update_tiradas_alternativas);
|
||||||
} else if ($(this).is('button')) {
|
} else if ($(this).is('button')) {
|
||||||
@ -35,12 +35,12 @@ var tableTiradas;
|
|||||||
// para los botones de borrar
|
// para los botones de borrar
|
||||||
$(this).bind('click', update_tiradas_alternativas);
|
$(this).bind('click', update_tiradas_alternativas);
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
function update_tiradas_alternativas(){
|
function actualizar_tiradas_alternativas(){
|
||||||
// se obtiene la primera columna de la tabla de tiradas
|
// se obtiene la primera columna de la tabla de tiradas
|
||||||
const data = tableTiradas.rows().data().toArray();
|
const data = tableTiradas.rows().data().toArray();
|
||||||
// se borra la tabla de tiradas
|
// se borra la tabla de tiradas
|
||||||
|
|||||||
@ -298,6 +298,70 @@ const url_parts = url.split('/');
|
|||||||
<?php endif; ?>
|
<?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 -->
|
<!-- Variables generales usadas en los ficheros js -->
|
||||||
<!------------------------------------------->
|
<!------------------------------------------->
|
||||||
|
|||||||
Reference in New Issue
Block a user