mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into feat/sk-31
This commit is contained in:
@ -0,0 +1,432 @@
|
||||
import ClassSelect from '../../components/select2.js';
|
||||
import Ajax from '../../components/ajax.js';
|
||||
|
||||
class Importador {
|
||||
|
||||
constructor() {
|
||||
|
||||
this.cliente = new ClassSelect($("#clienteId"), '/importador/clientlist', "Seleccione un cliente");
|
||||
this.presupuesto = new ClassSelect($("#presupuesto"), '/importador/presupuestoslist', "Seleccione un presupuesto", false, { clienteId: () => $("#clienteId").val() });
|
||||
this.encuadernacion = new ClassSelect($("#encuadernacion"), '/importador/getencuadernacion', "Seleccione una encuadernación");
|
||||
|
||||
this.compPapelNegroSelected = new ClassSelect($("#compPapelNegroSelected"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false,
|
||||
{
|
||||
|
||||
tipo_impresion: () => this.encuadernacion.getVal(),
|
||||
tirada: () => $('#tirada').val(),
|
||||
ancho: () => this.getDimensionLibro().ancho,
|
||||
alto: () => this.getDimensionLibro().alto,
|
||||
sopalas: 0,
|
||||
lomo: 0,
|
||||
tipo: () => $('#hq').val() ? 'negrohq' : 'negro',
|
||||
});
|
||||
this.compPapelColorSelected = new ClassSelect($("#compPapelColorSelected"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false,
|
||||
{
|
||||
tipo_impresion: () => this.encuadernacion.getVal(),
|
||||
tirada: () => $('#tirada').val(),
|
||||
ancho: () => this.getDimensionLibro().ancho,
|
||||
alto: () => this.getDimensionLibro().alto,
|
||||
sopalas: 0,
|
||||
lomo: 0,
|
||||
tipo: () => $('#hq').val() ? 'colorhq' : 'color',
|
||||
});
|
||||
this.compPapelCubiertaSelected = new ClassSelect($("#compPapelCubiertaSelected"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false,
|
||||
{
|
||||
tipo_impresion: this.encuadernacion.getVal(),
|
||||
tirada: () => $('#tirada').val(),
|
||||
ancho: () => this.getDimensionLibro().ancho,
|
||||
alto: () => this.getDimensionLibro().alto,
|
||||
sopalas: () => $('#compSolapasCubierta').val(),
|
||||
lomo: () => 0,
|
||||
tipo: 'colorhq',
|
||||
uso: 'cubierta',
|
||||
});
|
||||
this.compSobrecubiertaSelected = new ClassSelect($("#compPapelSobrecubiertaSelected"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false,
|
||||
{
|
||||
tipo_impresion: this.encuadernacion.getVal(),
|
||||
tirada: () => $('#tirada').val(),
|
||||
ancho: () => this.getDimensionLibro().ancho,
|
||||
alto: () => this.getDimensionLibro().alto,
|
||||
sopalas: () => $('#compSolapasSobrecubierta').val(),
|
||||
lomo: () => 0,
|
||||
tipo: 'colorhq',
|
||||
uso: 'sobrecubierta',
|
||||
});
|
||||
|
||||
this.acabadoCubierta = new ClassSelect($("#compAcabadoCubiertaSelected"),
|
||||
'/serviciosacabados/getacabados',
|
||||
'',
|
||||
false,
|
||||
{
|
||||
"cubierta": 1
|
||||
}
|
||||
);
|
||||
this.acabadosSobrecubierta = new ClassSelect($("#compAcabadoSobrecubiertaSelected"),
|
||||
'/serviciosacabados/getacabados',
|
||||
'',
|
||||
false,
|
||||
{
|
||||
"sobrecubierta": 1
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
this.openBtn = $('#openOld');
|
||||
this.initImport = $('#initImport');
|
||||
this.makeImport = $('#makeImport');
|
||||
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
// Fuerza el foco en el campo de búsqueda de select2
|
||||
$(document).on('select2:open', () => {
|
||||
document.querySelector('.select2-search__field').focus();
|
||||
});
|
||||
|
||||
this.cliente.init();
|
||||
this.presupuesto.init();
|
||||
this.encuadernacion.init();
|
||||
|
||||
this.compPapelNegroSelected.init();
|
||||
this.compPapelColorSelected.init();
|
||||
this.compPapelCubiertaSelected.init();
|
||||
this.compSobrecubiertaSelected.init();
|
||||
|
||||
this.acabadoCubierta.init();
|
||||
this.acabadosSobrecubierta.init();
|
||||
|
||||
this.cliente.item.on('change', () => {
|
||||
this.presupuesto.item.val('').trigger('change');
|
||||
this.presupuesto.item.prop('disabled', false);
|
||||
this.openBtn.prop('disabled', true);
|
||||
this.initImport.prop('disabled', true);
|
||||
});
|
||||
|
||||
|
||||
this.presupuesto.item.on('change', () => {
|
||||
this.openBtn.prop('disabled', false);
|
||||
this.initImport.prop('disabled', false);
|
||||
});
|
||||
|
||||
|
||||
this.openBtn.on('click', function () {
|
||||
if ($("#clienteId").val() != '' && $("#presupuesto").val() != '') {
|
||||
|
||||
window.open('https://gestion.safekat.es/presupuesto/edit/' + $("#presupuesto").val());
|
||||
}
|
||||
});
|
||||
|
||||
this.initImport.on('click', () => {
|
||||
if ($("#clienteId").val() != '' && $("#presupuesto").val() != '') {
|
||||
this.getPresupuestoData.bind(this)();
|
||||
}
|
||||
});
|
||||
|
||||
this.makeImport.on('click', this.importPresupuesto.bind(this));
|
||||
}
|
||||
|
||||
importPresupuesto() {
|
||||
|
||||
if ($("#clienteId").val() != '' && $("#presupuesto").val() != '') {
|
||||
let data = this.collectData();
|
||||
new Ajax(
|
||||
'/importador/importar',
|
||||
data,
|
||||
{},
|
||||
(response) => {
|
||||
if (response.success) {
|
||||
const urlObj = new URL(window.location.href);
|
||||
Swal.fire({
|
||||
title: 'Atención!',
|
||||
text: 'Esto es una importación básica, por favor revisa los datos para comprobar que no hay errores. ' +
|
||||
'Tenga en cuenta que no todos los servicios se pueden importar.',
|
||||
icon: 'warning',
|
||||
showCancelButton: false,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
}).then(() => {
|
||||
window.open(`${urlObj.origin}` + '/presupuestoadmin/edit/' + response.id);
|
||||
});
|
||||
}
|
||||
else {
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: 'No ha sido posible importar el presupuesto. Póngase en contacto con el administrador.',
|
||||
icon: 'error',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: 'Ha habido un error al intentar importar el presupuesto. Asegúrese de que están todos los campos rellenos.',
|
||||
icon: 'error',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
}
|
||||
).post();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
collectData() {
|
||||
|
||||
let data = {};
|
||||
|
||||
data.id = $("#presupuesto").val();
|
||||
data.cliente_id = $("#clienteId").val();
|
||||
|
||||
data.paginas = $('#paginas').val();
|
||||
data.tirada = $('#tirada').val();
|
||||
data.papel_formato_id = $('#tamanio').val();
|
||||
data.papel_formato_personalizado = $('#papelFormatoPersonalizado').prop('checked') ? 1 : 0;
|
||||
data.papel_formato_ancho = $('#papelFormatoAncho').val();
|
||||
data.papel_formato_alto = $('#papelFormatoAlto').val();
|
||||
|
||||
data.encuadernacion = this.encuadernacion.getVal();
|
||||
data.isHq = $('#hq').val();
|
||||
|
||||
data.paginas_bn = $('#compPaginasNegro').val();
|
||||
data.papel_bn = this.compPapelNegroSelected.getVal();
|
||||
data.gramaje_bn = $('#compGramajeNegro').val();
|
||||
|
||||
data.paginas_color = $('#compPaginasColor').val();
|
||||
data.papel_color = this.compPapelColorSelected.getVal();
|
||||
data.gramaje_color = $('#compGramajeColor').val();
|
||||
|
||||
data.paginas_cubierta = $('#compCarasCubierta').val();
|
||||
data.papel_cubierta = this.compPapelCubiertaSelected.getVal();
|
||||
data.gramaje_cubierta = $('#compGramajeCubierta').val();
|
||||
data.solapas_cubierta = $('#compSolapasCubierta').val();
|
||||
data.acabado_cubierta = this.acabadoCubierta.getVal();
|
||||
|
||||
data.sobrecubierta = $('#compSobrecubierta').val();
|
||||
data.papel_sobrecubierta = this.compSobrecubiertaSelected.getVal();
|
||||
data.gramaje_sobrecubierta = $('#compGramajeSobrecubierta').val();
|
||||
data.solapas_sobrecubierta = $('#compSolapasSobrecubierta').val();
|
||||
data.acabado_sobrecubierta = this.acabadosSobrecubierta.getVal();
|
||||
|
||||
data.servicios = {
|
||||
marcapaginas: $('#marcapaginas').prop('checked') ? 1 : 0,
|
||||
serviciosExtra: []
|
||||
};
|
||||
|
||||
if ($('#ferro').prop('checked')) {
|
||||
data.servicios.serviciosExtra.push(30);
|
||||
}
|
||||
if ($('#ferroDigital').prop('checked')) {
|
||||
data.servicios.serviciosExtra.push(29);
|
||||
}
|
||||
if ($('#prototipo').prop('checked')) {
|
||||
data.servicios.serviciosExtra.push(9);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
getPresupuestoData() {
|
||||
|
||||
new Ajax(
|
||||
'/importador/getpresupuestodata',
|
||||
{ id: $("#presupuesto").val() },
|
||||
{},
|
||||
(response) => {
|
||||
if (response.success) {
|
||||
|
||||
this.fillInitialData(response.data);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
console.error(error);
|
||||
}
|
||||
).get();
|
||||
}
|
||||
|
||||
|
||||
getDimensionLibro() {
|
||||
let ancho = 0;
|
||||
let alto = 0;
|
||||
if ($('#papelFormatoPersonalizado').prop('checked')) {
|
||||
ancho = $('#papelFormatoAncho').val();
|
||||
alto = $('#papelFormatoAlto').val();
|
||||
}
|
||||
else {
|
||||
const text = $('#tamanio').text();
|
||||
ancho = text.split('x')[0];
|
||||
alto = text.split('x')[1];
|
||||
}
|
||||
return { ancho, alto };
|
||||
}
|
||||
|
||||
|
||||
fillInitialData(data) {
|
||||
|
||||
$('#paginas').val(data.datosGenerales.paginas);
|
||||
$('#tirada').val(data.datosGenerales.tirada);
|
||||
if (data.datosGenerales.papel_formato_personalizado) {
|
||||
$('#papelFormatoPersonalizado').prop('checked', true);
|
||||
$('#tamanio').addClass('d-none');
|
||||
$('#formatoPersonalizado').removeClass('d-none');
|
||||
$('#papelFormatoAncho').val(data.datosGenerales.papel_formato_ancho);
|
||||
$('#papelFormatoAlto').val(data.datosGenerales.papel_formato_alto);
|
||||
}
|
||||
else {
|
||||
$('#tamanio').removeClass('d-none');
|
||||
$('#formatoPersonalizado').addClass('d-none');
|
||||
$('#papelFormatoPersonalizado').prop('checked', false);
|
||||
$('#tamanio').append('<option value="' + data.datosGenerales.papel_formato_id + '" selected>' + data.datosGenerales.papel_formato_texto + '</option>');
|
||||
$('#tamanio').val(data.datosGenerales.papel_formato_id).trigger('change');
|
||||
}
|
||||
|
||||
if (data.encuadernacion) {
|
||||
$('#encuadernacion_old').val(data.encuadernacion.encuadernacionOld);
|
||||
// check if data.encuadernacion.encuadernacion exists and is not empty
|
||||
if (data.encuadernacion.encuadernacion) {
|
||||
this.encuadernacion.setOption(data.encuadernacion.encuadernacion.id, data.encuadernacion.encuadernacion.encuadernacion);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.lineas) {
|
||||
if (data.lineas.isHq) {
|
||||
$('#hq').val(data.lineas.hq);
|
||||
}
|
||||
|
||||
if (data.lineas.bn && data.lineas.bn.paginas) {
|
||||
$('#compPaginasNegro').val(data.lineas.bn.paginas);
|
||||
$('#compPapelNegroOrigen').val(data.lineas.bn.papel_nombre);
|
||||
$('#compGramajeNegro').val(parseFloat(data.lineas.bn.gramaje).toFixed(0));
|
||||
this.compPapelNegroSelected.item.prop('disabled', false);
|
||||
this.compPapelNegroSelected.setOption(data.lineas.bn.new_papel_id, data.lineas.bn.new_papel_nombre);
|
||||
}
|
||||
else {
|
||||
$('#compPaginasNegro').val(0);
|
||||
$('#compPapelNegroOrigen').val("");
|
||||
$('#compGramajeNegro').val("");
|
||||
this.compPapelNegroSelected.empty();
|
||||
this.compPapelNegroSelected.item.prop('disabled', true);
|
||||
}
|
||||
|
||||
if (data.lineas.color && data.lineas.color.paginas) {
|
||||
$('#compPaginasColor').val(data.lineas.color.paginas);
|
||||
$('#compPapelColorOrigen').val(data.lineas.color.papel_nombre);
|
||||
$('#compGramajeColor').val(parseFloat(data.lineas.color.gramaje).toFixed(0));
|
||||
this.compPapelColorSelected.item.prop('disabled', false);
|
||||
this.compPapelColorSelected.setOption(data.lineas.color.new_papel_id, data.lineas.color.new_papel_nombre);
|
||||
}
|
||||
else {
|
||||
$('#compPaginasColor').val(0);
|
||||
$('#compPapelColorOrigen').val("");
|
||||
$('#compGramajeColor').val("");
|
||||
this.compPapelColorSelected.empty();
|
||||
this.compPapelColorSelected.item.prop('disabled', true);
|
||||
}
|
||||
|
||||
if (data.lineas.cubierta && data.lineas.cubierta.paginas) {
|
||||
$('#compPaginasCubierta').val(data.lineas.cubierta.paginas);
|
||||
$('#compPapelCubiertaOrigen').val(data.lineas.cubierta.papel_nombre);
|
||||
$('#compGramajeCubierta').val(parseFloat(data.lineas.cubierta.gramaje).toFixed(0));
|
||||
$('#compSolapasCubierta').val(parseFloat(data.lineas.cubierta.solapas).toFixed(0));
|
||||
this.compPapelCubiertaSelected.item.prop('disabled', false);
|
||||
this.compPapelCubiertaSelected.setOption(data.lineas.cubierta.new_papel_id, data.lineas.cubierta.new_papel_nombre);
|
||||
}
|
||||
else {
|
||||
$('#compPaginasCubierta').val(0);
|
||||
$('#compPapelCubiertaOrigen').val("");
|
||||
$('#compGramajeCubierta').val("");
|
||||
$('#compSolapasCubierta').val("");
|
||||
this.compPapelCubiertaSelected.empty();
|
||||
this.compPapelCubiertaSelected.item.prop('disabled', true);
|
||||
}
|
||||
|
||||
if (data.lineas.sobrecubierta && data.lineas.sobrecubierta.paginas) {
|
||||
$('#compSobrecubierta').val(1);
|
||||
$('#compPapelSobrecubiertaOrigen').val(data.lineas.sobrecubierta.papel_nombre);
|
||||
$('#compGramajeSobrecubierta').val(parseFloat(data.lineas.sobrecubierta.gramaje).toFixed(0));
|
||||
$('#compSolapasSobrecubierta').val(parseFloat(data.lineas.sobrecubierta.solapas).toFixed(0));
|
||||
this.compSobrecubiertaSelected.item.prop('disabled', false);
|
||||
this.compSobrecubiertaSelected.setOption(data.lineas.sobrecubierta.new_papel_id, data.lineas.sobrecubierta.new_papel_nombre);
|
||||
}
|
||||
else {
|
||||
$('#compSobrecubierta').val(0);
|
||||
$('#compPapelSobrecubiertaOrigen').val("");
|
||||
$('#compGramajeSobrecubierta').val("");
|
||||
$('#compSolapasSobrecubierta').val("");
|
||||
this.compSobrecubiertaSelected.empty();
|
||||
this.compSobrecubiertaSelected.item.prop('disabled', true);
|
||||
}
|
||||
|
||||
if (data.acabados) {
|
||||
if (data.acabados.cubierta && data.acabados.cubierta.acabadoOld) {
|
||||
$('#compAcabadoCubiertaOrigen').val(data.acabados.cubierta.acabadoOld);
|
||||
this.acabadoCubierta.setOption(data.acabados.cubierta.acabado.id, data.acabados.cubierta.acabado.name);
|
||||
this.acabadoCubierta.item.prop('disabled', false);
|
||||
}
|
||||
else {
|
||||
$('#compAcabadoCubiertaOrigen').val("");
|
||||
this.acabadoCubierta.empty();
|
||||
this.acabadoCubierta.item.prop('disabled', true);
|
||||
}
|
||||
|
||||
if (data.acabados.sobrecubierta && data.acabados.sobrecubierta.acabadoOld) {
|
||||
$('#compAcabadoSobrecubiertaOrigen').val(data.acabados.sobrecubierta.acabadoOld);
|
||||
this.acabadosSobrecubierta.setOption(data.acabados.sobrecubierta.acabado.id, data.acabados.sobrecubierta.acabado.name);
|
||||
this.acabadosSobrecubierta.item.prop('disabled', false);
|
||||
}
|
||||
else {
|
||||
$('#compAcabadoSobrecubiertaOrigen').val("");
|
||||
this.acabadosSobrecubierta.empty();
|
||||
this.acabadosSobrecubierta.item.prop('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.servicios.ferro == 1) {
|
||||
$('#ferro').prop('checked', true);
|
||||
}
|
||||
else {
|
||||
$('#ferro').prop('checked', false);
|
||||
}
|
||||
if (data.servicios.ferroDigital == 1) {
|
||||
$('#ferroDigital').prop('checked', true);
|
||||
}
|
||||
else {
|
||||
$('#ferroDigital').prop('checked', false);
|
||||
}
|
||||
if (data.servicios.marcapaginas == 1) {
|
||||
$('#marcapaginas').prop('checked', true);
|
||||
}
|
||||
else {
|
||||
$('#marcapaginas').prop('checked', false);
|
||||
}
|
||||
if (data.servicios.prototipo == 1) {
|
||||
$('#prototipo').prop('checked', true);
|
||||
}
|
||||
else {
|
||||
$('#prototipo').prop('checked', false);
|
||||
}
|
||||
}
|
||||
this.makeImport.prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
let importador = new Importador();
|
||||
importador.init();
|
||||
});
|
||||
|
||||
export default Importador;
|
||||
@ -284,7 +284,8 @@ class PresupuestoAdminEdit {
|
||||
|
||||
datos.comentarios_cliente = $('#comentariosCliente').val();
|
||||
datos.comentarios_safekat = $('#comentariosSafekat').val();
|
||||
datos.comentarios_presupuesto = $('#comentariosPdf').val();
|
||||
datos.comentarios_pdf = $('#comentariosPdf').val();
|
||||
datos.comentarios_presupuesto = $('#comentariosPresupuesto').val();
|
||||
datos.comentarios_produccion = $('#comentariosProduccion').val();
|
||||
|
||||
datos = { ...datos, ...this.resumen.getData() };
|
||||
@ -369,6 +370,11 @@ class PresupuestoAdminEdit {
|
||||
self.tipo_impresion.val(response.data.tipo_impresion);
|
||||
self.POD.val(response.data.POD);
|
||||
|
||||
$('#created_by').html(response.data.created_by);
|
||||
$('#updated_by').html(response.data.updated_by);
|
||||
$('#created_at').html(response.data.created_at);
|
||||
$('#updated_at_footer').html(response.data.updated_at);
|
||||
|
||||
self.calcularPresupuesto = false;
|
||||
|
||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
@ -383,13 +389,15 @@ class PresupuestoAdminEdit {
|
||||
|
||||
$('#comentariosCliente').val(response.data.comentarios_cliente);
|
||||
$('#comentariosSafekat').val(response.data.comentarios_safekat);
|
||||
$('#comentariosPdf').val(response.data.comentarios_presupuesto);
|
||||
$('#comentariosPresupuesto').val(response.data.comentarios_presupuesto);
|
||||
$('#comentariosPdf').val(response.data.comentarios_pdf);
|
||||
$('#comentariosProduccion').val(response.data.comentarios_produccion);
|
||||
$("textarea[name^='comentarios_']").trigger("input");
|
||||
|
||||
self.tiradasAlternativas.cargar(response.data.tiradasAlternativas);
|
||||
|
||||
self.resumen.cargar(response.data.resumen);
|
||||
|
||||
self.datosLibro.calcular_mermas();
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
@ -56,6 +56,8 @@ class Resumen {
|
||||
$("#totalAceptado").val(resumen.total_aceptado.toString().replace('.', ',') + "€" || "0€");
|
||||
}
|
||||
|
||||
$('#ivaReducido').val(resumen.iva_reducido ? 1: 0);
|
||||
|
||||
}
|
||||
|
||||
update() {
|
||||
@ -208,9 +210,10 @@ class Resumen {
|
||||
$('#tableOfServiciosPreimpresion').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
let rowData = this.data();
|
||||
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
|
||||
let coste_servicio = self.roundToTwoDecimals(parseFloat(rowData.coste));
|
||||
let base = (parseFloat(rowData.precio / (1 + parseFloat(rowData.margen) / 100.0)).toFixed(2));
|
||||
base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
|
||||
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
|
||||
totalServicios += total_servicio
|
||||
margenServicios += total_servicio - coste_servicio;
|
||||
});
|
||||
}
|
||||
|
||||
@ -218,9 +221,10 @@ class Resumen {
|
||||
$('#tableOfServiciosExtra').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
let rowData = this.data();
|
||||
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
|
||||
let coste_servicio = self.roundToTwoDecimals(parseFloat(rowData.margen));
|
||||
totalServicios += total_servicio
|
||||
margenServicios += total_servicio - coste_servicio;
|
||||
let base = (parseFloat(rowData.precio / (1 + parseFloat(rowData.margen) / 100.0)).toFixed(2));
|
||||
base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
|
||||
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
|
||||
totalServicios += total_servicio;
|
||||
});
|
||||
}
|
||||
|
||||
@ -345,7 +349,9 @@ class Resumen {
|
||||
'total_precio_unidad': $('#precioUnidadPresupuesto').text().replace('€', '').replace(',', '.'),
|
||||
|
||||
'total_factor': $('#factor').text().replace(/,/g, '.'),
|
||||
'total_factor_ponderado': $('#factor_ponderado').text().replace(/,/g, '.')
|
||||
'total_factor_ponderado': $('#factor_ponderado').text().replace(/,/g, '.'),
|
||||
|
||||
'iva_reducido': $('#ivaReducido').val()
|
||||
};
|
||||
|
||||
if($('#confirmar_presupuesto').prop('checked')){
|
||||
|
||||
@ -172,7 +172,7 @@ class TiradasAlernativas {
|
||||
|
||||
let datos = {
|
||||
id: id,
|
||||
tirada: this.tirada.val(),
|
||||
tirada: tirada,
|
||||
peso_libro: this.get_peso_libro(),
|
||||
tirada_base: $('#tirada').val(),
|
||||
paginas: $('#paginas').val(),
|
||||
@ -224,19 +224,7 @@ class TiradasAlernativas {
|
||||
margen_servicios += data.servicios.margen;
|
||||
|
||||
}
|
||||
|
||||
$('#tableOfServiciosPreimpresion').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
var rowData = this.data();
|
||||
costes_servicios += parseFloat(rowData.coste);
|
||||
margen_servicios += parseFloat(rowData.precio) - parseFloat(rowData.coste);
|
||||
});
|
||||
|
||||
$('#tableOfServiciosExtra').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
var rowData = this.data();
|
||||
costes_servicios += parseFloat(rowData.coste);
|
||||
margen_servicios += parseFloat(rowData.precio) - parseFloat(rowData.coste);
|
||||
});
|
||||
|
||||
|
||||
if (data.envios) {
|
||||
coste_envio += data.envios.coste;
|
||||
margen_envio += data.envios.margen;
|
||||
|
||||
Reference in New Issue
Block a user