From 290a1b5e76b62641f7a13dd74ca0718f8ee921dd Mon Sep 17 00:00:00 2001 From: MatteoPistorello Date: Tue, 26 Oct 2021 10:29:10 +0200 Subject: [PATCH] Fix costo medio in fase di aggiunta riga --- include/common/riga.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/common/riga.php b/include/common/riga.php index 5e2306661..9f7a7d264 100755 --- a/include/common/riga.php +++ b/include/common/riga.php @@ -71,10 +71,13 @@ if ($options['dir'] == 'entrata') { var margine = (((prezzo - sconto) * 100) / costo_unitario) - 100; var parent = $("#costo_unitario").closest("div").parent(); var div = parent.find("div[id*=\"errors\"]"); + var mediaponderata = 0; margine = isNaN(margine) || !isFinite(margine) ? 0: margine; // Fix per magine NaN - var mediaponderata = parseFloat($("#idarticolo").selectData().media_ponderata); + if ($("#idarticolo").val()) { + mediaponderata = parseFloat($("#idarticolo").selectData().media_ponderata); + } div.html("\ \