terminado

This commit is contained in:
2025-02-20 19:01:16 +01:00
parent cf74749889
commit 91796e993c
4 changed files with 28 additions and 13 deletions

View File

@ -2867,7 +2867,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$sumForFactor += round($linea['precio_pedido'], 2); $sumForFactor += round($linea['precio_pedido'], 2);
$sumForFactor -= round($linea['precio_pedido'], 2); $sumForFactor -= round($linea['precio_pedido'], 2);
$totalImpresion += round($linea['precio_impresion_horas'], 2);
$totalImpresion += round($linea['precio_click_pedido'], 2); $totalImpresion += round($linea['precio_click_pedido'], 2);
$sumForFactor += round($linea['precio_click_pedido'], 2); $sumForFactor += round($linea['precio_click_pedido'], 2);
@ -2878,6 +2877,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$sumForFactor += round($linea['total_corte'], 2); $sumForFactor += round($linea['total_corte'], 2);
} }
} }
$margenImpresion += round($linea['precio_impresion_horas'], 2); // coste de maquina y magen son MARGEN, no COSTE
$margenImpresion += round($linea['margen_impresion_horas'], 2); $margenImpresion += round($linea['margen_impresion_horas'], 2);
$margenImpresion += round($linea['margen_click_pedido'], 2); $margenImpresion += round($linea['margen_click_pedido'], 2);
$sumForFactor -= round($linea['margen_click_pedido'], 2); $sumForFactor -= round($linea['margen_click_pedido'], 2);

View File

@ -155,7 +155,7 @@ return [
'totalClicks' => 'Total clicks', 'totalClicks' => 'Total clicks',
'horas' => 'Horas máquina', 'horas' => 'Horas máquina',
'precioHora' => 'Precio hora', 'precioHora' => 'Precio hora',
'precioImpresion' => 'Precio impresión', 'precioImpresion' => 'Coste máquina',
'precioPagNegro' => 'Precio pág. negro', 'precioPagNegro' => 'Precio pág. negro',
'precioPagColor' => 'Precio pág. color', 'precioPagColor' => 'Precio pág. color',
'totalTinta' => 'Total tinta', 'totalTinta' => 'Total tinta',

View File

@ -404,7 +404,9 @@ class PresupuestoAdminEdit {
} }
// Funciones para detectar cambios en el formulario // Funciones para detectar cambios en el formulario
this.#checkChangesPresupuesto(); setTimeout(() => {
this.#checkChangesPresupuesto();
}, 500);
$('#bc-save').on("click", function () { $('#bc-save').on("click", function () {
showBreadCrumbSaveButton(false); showBreadCrumbSaveButton(false);
$('#saveForm').trigger('click'); $('#saveForm').trigger('click');
@ -530,45 +532,57 @@ class PresupuestoAdminEdit {
#checkChangesPresupuesto() { #checkChangesPresupuesto() {
const self = this;
// Detectar cambios en inputs de texto // Detectar cambios en inputs de texto
$('input[type="text"]').on('change', function () { $('input[type="text"]').on('change', function () {
showBreadCrumbSaveButton(true); if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
}); });
// Detectar cambios en inputs de texto // Detectar cambios en inputs de texto
$('input[type="number"]').on('change', function () { $('input[type="number"]').on('change', function () {
showBreadCrumbSaveButton(true); if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
}); });
// Detectar cambios en select // Detectar cambios en select
$('select').on('change', function () { $('select').on('change', function () {
showBreadCrumbSaveButton(true); if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
}); });
$('.select2bs').on('change', function (e) { $('.select2bs').on('change', function (e) {
showBreadCrumbSaveButton(true); if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
}); });
// Detectar cambios en checkboxes // Detectar cambios en checkboxes
$('input[type="checkbox"]').change(function () { $('input[type="checkbox"]').change(function () {
showBreadCrumbSaveButton(true); if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
}); });
// Detectar cambios en textareas // Detectar cambios en textareas
$('textarea').on('input', function () { $('textarea').on('input', function () {
showBreadCrumbSaveButton(true); if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
}); });
// Detectar cambios en otros tipos de input // Detectar cambios en otros tipos de input
$('input[type="radio"]').change(function () { $('input[type="radio"]').change(function () {
showBreadCrumbSaveButton(true); if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
}); });
// Detectar cambios en otros tipos de input // Detectar cambios en otros tipos de input
$('input:not([type])').on('input', function () { $('input:not([type])').on('input', function () {
showBreadCrumbSaveButton(true); if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
}); });
} }
downloadPreviewImage() { downloadPreviewImage() {
$(document).on("click", ".download-shape", (event) => { $(document).on("click", ".download-shape", (event) => {
let parentDiv = $(event.currentTarget).parent().parent(); let parentDiv = $(event.currentTarget).parent().parent();

View File

@ -104,6 +104,7 @@ class Resumen {
let sumForFactorPonderado = 0.0; let sumForFactorPonderado = 0.0;
let costeMaquinaHoras = 0.0;
let margenPorHoras = 0.0; let margenPorHoras = 0.0;
if (updateLP) { if (updateLP) {
@ -122,7 +123,7 @@ class Resumen {
} }
if (rowData.check_impresion_total) { if (rowData.check_impresion_total) {
totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val()) costeMaquinaHoras += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
margenPorHoras += parseFloat($('#' + rowData.row_id + '_margenImpresion').val()) margenPorHoras += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val()) totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val()) margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val())
@ -148,7 +149,7 @@ class Resumen {
totalImpresion -= parseFloat(margenImpresion); totalImpresion -= parseFloat(margenImpresion);
totalPapel -= parseFloat(margenPapel); totalPapel -= parseFloat(margenPapel);
margenImpresion += parseFloat(margenPorHoras); margenImpresion += parseFloat(margenPorHoras) + parseFloat(costeMaquinaHoras);
let porcentajeMargenPapel = isNaN(margenPapel / (totalPapel) * 100.0) ? 0 : margenPapel / (totalPapel) * 100.0 let porcentajeMargenPapel = isNaN(margenPapel / (totalPapel) * 100.0) ? 0 : margenPapel / (totalPapel) * 100.0
$('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%') $('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%')