From af9668c1113a929ce05fb0e2d682c0cfa48f3251 Mon Sep 17 00:00:00 2001 From: loviuz Date: Wed, 2 Nov 2022 09:31:52 +0100 Subject: [PATCH] Fix divisione per zero --- modules/preventivi/plugins/preventivi.consuntivo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/preventivi/plugins/preventivi.consuntivo.php b/modules/preventivi/plugins/preventivi.consuntivo.php index d4f15f32d..a68cb729a 100755 --- a/modules/preventivi/plugins/preventivi.consuntivo.php +++ b/modules/preventivi/plugins/preventivi.consuntivo.php @@ -398,7 +398,7 @@ if ($diff > 0) { ksort($materiali_righe); foreach ($materiali_righe as $key => $materiale){ $margine = $materiale['ricavo'] - $materiale['costo']; - $margine_prc = (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100; + $margine_prc = ($materiale['ricavo']) ? (int)(1 - ($materiale['costo'] / $materiale['ricavo'])) * 100 : 0; $ricarico_prc = ($materiale['ricavo'] && $materiale['costo']) ? (int)((($materiale['ricavo'] / $materiale['costo']) - 1) * 100) : 100; echo '