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 '