diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems.php
index 26574a53..2dcd7588 100644
--- a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems.php
+++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems.php
@@ -47,7 +47,7 @@
Total Costes
= old('0', $presupuestoEntity->total_costes) ?>€
Total Margen
- = old('0', round(100*$presupuestoEntity->total_margenes/($presupuestoEntity->total_costes+$presupuestoEntity->total_margenes),0)) ?>%
+ = old('0', round(($presupuestoEntity->total_costes+$presupuestoEntity->total_margenes)>0? 100*$presupuestoEntity->total_margenes/($presupuestoEntity->total_costes+$presupuestoEntity->total_margenes) : 0,0)) ?>%
= old('0', $presupuestoEntity->total_margenes) ?>€
@@ -64,9 +64,9 @@
Precio unidad
= old('0', $presupuestoEntity->total_precio_unidad) ?>€
Factor
- = old('0', $presupuestoEntity->total_factor) ?>
+ = old('0', is_numeric($presupuestoEntity->total_factor) ? $presupuestoEntity->total_factor : 0) ?>
Factor Ponderado
- = old('0', $presupuestoEntity->total_factor_ponderado) ?>
+ = old('0', is_numeric($presupuestoEntity->total_factor_ponderado) ? $presupuestoEntity->total_factor_ponderado : 0) ?>
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js
index 1e6180d3..4e3c8088 100644
--- a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js
+++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js
@@ -198,7 +198,7 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
var totalCostes = parseFloat(totalPapel.toFixed(2)) + parseFloat(totalImpresion.toFixed(2)) + parseFloat(totalServicios.toFixed(2)) + parseFloat(totalEnvios.toFixed(2))
var totalMargenes = parseFloat(margenPapel.toFixed(2)) + parseFloat(margenImpresion.toFixed(2)) + parseFloat(margenServicios.toFixed(2)) + parseFloat(margenEnvios.toFixed(2))
- var porcentajeMargen = (100*totalMargenes/(totalCostes+totalMargenes)).toFixed(0)
+ var porcentajeMargen = totalCostes+totalMargenes>0? (100*totalMargenes/(totalCostes+totalMargenes)).toFixed(0) : 0
$('#totalCostes').text((addSeparatorsNF(totalCostes.toFixed(2), ".", ",", ".")) + "€")
$('#totalMargenes').text((addSeparatorsNF(totalMargenes.toFixed(2), ".", ",", ".")) + "€")
$('#totalCostes').attr('val',(totalCostes).toFixed(2) + '€')