desglosados costes y margenes impresion

This commit is contained in:
2025-07-01 11:02:03 +02:00
parent 34701e5960
commit 594da68b3a
3 changed files with 89 additions and 20 deletions

View File

@ -1122,7 +1122,7 @@ class LineasPresupuesto {
'</div>' +
'<div class="lp-cell-auto">' +
'<label>' + window.language.Presupuestos.precioImpresion + '</label>' +
'<input readonly id="' + d.row_id + '_precioImpresion" name="' + d.row_id + '_precioImpresion" class="lp-input lp-cell lp-cell-margen ' + d.row_class + '-input" type="text" value="' + (parseFloat(d.precioImpresion) - parseFloat(d.margenImpresion)).toFixed(2) + '">' +
'<input readonly id="' + d.row_id + '_precioImpresion" name="' + d.row_id + '_precioImpresion" class="lp-input lp-cell lp-cell-coste ' + d.row_class + '-input" type="text" value="' + (parseFloat(d.precioImpresion) - parseFloat(d.margenImpresion)).toFixed(2) + '">' +
'</div>' +
'<div class="lp-cell-auto">' +
'<label>' + window.language.Presupuestos.precioImpresionMargen + '</label>' +

View File

@ -107,6 +107,7 @@ class Resumen {
async updateTotales(data = {}, ajustar = false) {
const self = this;
const MARGEN_TINTA_CORTE = 0.23;
let updateLP = data.updateLP || true;
let updateServicios = data.updateServicios || true;
@ -115,8 +116,15 @@ class Resumen {
let margenPapel = 0;
let totalImpresion = 0;
let totalImpresionforMargen = 0;
let totalCosteClicks = 0;
let totalCosteHoras = 0;
let totalCosteTinta = 0;
let totalCosteCorte = 0;
let margenImpresion = 0;
let totalMargenClicks = 0;
let totalMargenHoras = 0;
let totalMargenTinta = 0;
let totalMargenCorte = 0;
let totalServicios = parseFloat(0);
let margenServicios = parseFloat(0);
@ -129,9 +137,6 @@ class Resumen {
let sumForFactorPonderado = 0.0;
let costeMaquinaHoras = 0.0;
let margenPorHoras = 0.0;
if (updateLP) {
if (typeof $("#tableLineasPresupuesto").DataTable() !== 'undefined') {
@ -148,16 +153,21 @@ class Resumen {
}
if (rowData.check_impresion_total) {
costeMaquinaHoras += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
margenPorHoras += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val())
totalCosteHoras += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
totalMargenHoras += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
totalCosteClicks += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
totalMargenClicks += parseFloat($('#' + rowData.row_id + '_margenClicks').val())
//sumForFactor += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
if (rowData.maquinaTipo == 'inkjet') {
totalImpresion += parseFloat(rowData.totalTinta)
totalImpresion += parseFloat(rowData.totalCorte) ?? 0;
let tinta = parseFloat($('#' + rowData.row_id + '_totalTinta').val()) || 0;
let corte = parseFloat($('#' + rowData.row_id + '_totalCorte').val()) || 0;
totalCosteTinta += tinta/(1+ MARGEN_TINTA_CORTE);
totalCosteCorte += corte/(1+ MARGEN_TINTA_CORTE);
totalMargenTinta += (tinta - tinta/(1+ MARGEN_TINTA_CORTE));
totalMargenCorte += (corte - corte/(1+ MARGEN_TINTA_CORTE));
//sumForFactor += (parseFloat(rowData.totalTinta) + parseFloat(rowData.totalCorte))
}
@ -174,7 +184,8 @@ class Resumen {
//totalImpresion -= parseFloat(margenImpresion);
totalPapel -= parseFloat(margenPapel);
margenImpresion += parseFloat(margenPorHoras) + parseFloat(costeMaquinaHoras);
totalImpresion += totalCosteClicks + totalCosteHoras + totalCosteTinta + totalCosteCorte;
margenImpresion += totalMargenClicks + totalMargenHoras + totalMargenTinta + totalMargenCorte;
sumForFactor += totalImpresion;
sumForFactor += totalPapel;
@ -187,10 +198,18 @@ class Resumen {
$('#margenPapel').val(margenPapel.toFixed(2))
$('#margenPapel').html(margenPapel)
let porcentajeMargenImpresion = isNaN(margenImpresion / (totalImpresion) * 100.0) ? 0 : margenImpresion / (totalImpresion) * 100.0
$('#porcentajeMargenImpresion').html(porcentajeMargenImpresion).val(porcentajeMargenImpresion.toFixed(2))
$('#totalCosteImpresion').html(totalImpresion).val(totalImpresion.toFixed(2))
$('#margenImpresion').html(margenImpresion).val(margenImpresion.toFixed(2))
let porcentajeMargenImpresion = isNaN(margenImpresion / (totalImpresion) * 100.0) ? 0 : margenImpresion / (totalImpresion) * 100.0;
$('#porcentajeMargenImpresion').html(porcentajeMargenImpresion).val(porcentajeMargenImpresion.toFixed(2));
$('#totalCosteImpresion').html(totalImpresion).val(totalImpresion.toFixed(2));
$('#totalCosteClicks').html(totalCosteClicks).val(totalCosteClicks.toFixed(2));
$('#totalCosteHoras').html(totalCosteHoras).val(totalCosteHoras.toFixed(2));
$('#totalCosteTinta').html(totalCosteTinta).val(totalCosteTinta.toFixed(2));
$('#totalCosteCorte').html(totalCosteCorte).val(totalCosteCorte.toFixed(2));
$('#margenImpresion').html(margenImpresion).val(margenImpresion.toFixed(2));
$('#totalMargenClicks').html(totalMargenClicks).val(totalMargenClicks.toFixed(2));
$('#totalMargenHoras').html(totalMargenHoras).val(totalMargenHoras.toFixed(2));
$('#totalMargenTinta').html(totalMargenTinta).val(totalMargenTinta.toFixed(2));
$('#totalMargenCorte').html(totalMargenCorte).val(totalMargenCorte.toFixed(2));
}