se modifica el calculo del factor ponderado y se añade orden al tamaño de papel

This commit is contained in:
Jaime Jiménez
2024-03-14 18:27:40 +01:00
parent da2a532336
commit 8eac04292d
3 changed files with 13 additions and 3 deletions

View File

@ -74,6 +74,8 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
margenImpresion = parseFloat($('#margenImpresion').text().replace('€', ''))
}
sumForFactorPonderado = sumForFactor;
if(updateServicios){
if ( typeof $("#tableOfServiciosEncuadernacion").DataTable() !== 'undefined' && $("#tableOfServiciosEncuadernacion").DataTable().rows().count() > 0){
@ -119,15 +121,21 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
}
totalServicios -= margenServicios;
sumForFactorPonderado += totalServicios;
var porcentajeMargenServicios = margenServicios/(margenServicios+totalServicios)*100
$('#porcentajeMargenServicios').text(isNaN(porcentajeMargenServicios.toFixed(0))?0:porcentajeMargenServicios.toFixed(0) + '%')
$('#totalServicios').text(totalServicios.toFixed(2) + '€')
$('#margenServicios').text(margenServicios.toFixed(2) + '€')
}
else{
totalServicios = parseFloat($('#totalServicios').text().replace('€', ''))
margenServicios = parseFloat($('#margenServicios').text().replace('€', ''))
sumForFactorPonderado += totalServicios;
}
if(updateEnvio){
@ -168,7 +176,7 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
$('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€')
$('#factor').text(((totalPresupuesto-totalEnvios-margenEnvios)/sumForFactor).toFixed(2))
$('#factor_ponderado').text(((totalPresupuesto-totalEnvios-margenEnvios)/totalCostes).toFixed(2))
$('#factor_ponderado').text(((totalPresupuesto-totalEnvios-margenEnvios)/sumForFactorPonderado).toFixed(2))
}
function getValuesResumenForm(){