From e5389db7be4df6b208beab43a2c661a170060c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Fri, 30 May 2025 11:31:53 +0200 Subject: [PATCH] cuando la tirada es 1 la merma es 0 --- ci4/app/Services/PresupuestoService.php | 5 ++++- .../safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js | 7 ++++++- .../safekat/pages/presupuestoAdmin/sections/datosLibro.js | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ci4/app/Services/PresupuestoService.php b/ci4/app/Services/PresupuestoService.php index e23ca530..908999ad 100755 --- a/ci4/app/Services/PresupuestoService.php +++ b/ci4/app/Services/PresupuestoService.php @@ -2077,7 +2077,10 @@ class PresupuestoService extends BaseService $merma = 0; - if ($tirada > $POD) { + if ($tirada == 0) { + $merma = 0; + } + else if ($tirada > $POD) { $merma = $tirada * 0.1; } else { $merma_lineas = []; diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js index 5d4e7b9f..135d0d4f 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js @@ -162,7 +162,12 @@ class PresupuestoAdminAdd { const POD = parseInt($('#POD').val()); let merma = 0; - merma = tirada * 0.1 <= POD ? tirada * 0.1 : POD; + if (tirada == 1) { + merma = 0; + } + else if (tirada > POD) { + merma = tirada * 0.1 <= POD ? tirada * 0.1 : POD; + } $('#mermacubierta').val(parseInt(merma)) $('#merma').val(parseInt(merma)) diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js index 8c34316d..5c52998e 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js @@ -623,7 +623,10 @@ class DatosLibro { let merma = 0; let htmlString = ''; - if (tirada > POD) { + if (tirada == 1) { + merma = 0; + } + else if (tirada > POD) { merma = tirada * 0.1 <= POD ? tirada * 0.1 : POD; } else {