Merge branch 'fix/resumen_presupuesto' into 'main'

cambiado el margen de servicios para que coincida con las tarifas. Las horas...

See merge request jjimenez/safekat!331
This commit is contained in:
2024-09-19 07:13:47 +00:00

View File

@ -16,7 +16,11 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
var sumForFactor = 0.0
var sumForFactorPonderado = 0.0
var margenPorHoras = 0.0;
if(updateLP){
if(typeof $("#tableLineasPresupuesto").DataTable() !== 'undefined'){
$("#tableLineasPresupuesto").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
var rowData = this.data();
@ -30,7 +34,8 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
}
if(rowData.check_impresion_total){
totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
//totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
margenPorHoras += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
sumForFactor += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
@ -41,8 +46,10 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
sumForFactor += (parseFloat(rowData.totalTinta) + parseFloat(rowData.totalCorte))
}
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
//margenImpresion += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
margenPorHoras += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val())
sumForFactor -= parseFloat($('#' + rowData.row_id + '_margenClicks').val())
@ -56,6 +63,8 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
totalImpresion -= margenImpresion
totalPapel -= margenPapel
margenImpresion += margenPorHoras
var porcentajeMargenPapel = isNaN(margenPapel/(totalPapel)*100.0)?0:margenPapel/(totalPapel)*100.0
$('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%')
@ -150,7 +159,7 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
sumForFactorPonderado += totalServicios;
var porcentajeMargenServicios = margenServicios/(margenServicios+totalServicios)*100
var porcentajeMargenServicios = margenServicios/(totalServicios)*100
$('#porcentajeMargenServicios').text(isNaN(porcentajeMargenServicios.toFixed(0))?0:porcentajeMargenServicios.toFixed(0) + '%')
$('#totalServicios').text((addSeparatorsNF(totalServicios.toFixed(2), ".", ",", ".")) + "€")
$('#margenServicios').text((addSeparatorsNF(margenServicios.toFixed(2), ".", ",", ".")) + "€")