diff --git a/modules/contratti/plugins/contratti.consuntivo.php b/modules/contratti/plugins/contratti.consuntivo.php
index 978c28c7b..5dc95078d 100644
--- a/modules/contratti/plugins/contratti.consuntivo.php
+++ b/modules/contratti/plugins/contratti.consuntivo.php
@@ -268,13 +268,15 @@ if (!empty($rsi)) {
/*
Bilancio del contratto
*/
-$rs = $dbo->fetchArray('SELECT SUM(subtotale) AS budget FROM co_righe2_contratti WHERE idcontratto='.prepare($id_record));
+$rs = $dbo->fetchArray('SELECT SUM(subtotale - sconto) AS budget FROM co_righe2_contratti WHERE idcontratto='.prepare($id_record));
$budget = $rs[0]['budget'];
$rs = $dbo->fetchArray("SELECT SUM(qta) AS totale_ore FROM `co_righe2_contratti` WHERE um='ore' AND idcontratto=".prepare($id_record));
$contratto_tot_ore = $rs[0]['totale_ore'];
-$diff = floatval($budget) - floatval($totale);
+$diff = sum($budget, -$totale_addebito);
+
+
if ($diff > 0) {
$bilancio = ''.Translator::numberToLocale($diff).' €';
} elseif ($diff < 0) {
diff --git a/modules/preventivi/plugins/preventivi.consuntivo.php b/modules/preventivi/plugins/preventivi.consuntivo.php
index 9c87623f2..9559fc7e8 100644
--- a/modules/preventivi/plugins/preventivi.consuntivo.php
+++ b/modules/preventivi/plugins/preventivi.consuntivo.php
@@ -270,7 +270,7 @@ if (!empty($rsi)) {
/*
Bilancio del preventivo
*/
-$diff = sum($budget, -$totale);
+$diff = sum($budget, -$totale_addebito);
echo '
diff --git a/templates/contratti_cons/body.php b/templates/contratti_cons/body.php
index 4cac9d0fe..13fd906bc 100644
--- a/templates/contratti_cons/body.php
+++ b/templates/contratti_cons/body.php
@@ -464,7 +464,7 @@ $imponibile = sum($imponibile);
$totale = $imponibile - $sconto;
-$rs = $dbo->fetchArray('SELECT SUM(subtotale) as budget FROM `co_righe2_contratti` WHERE idcontratto = '.prepare($id_record));
+$rs = $dbo->fetchArray('SELECT SUM(subtotale-sconto) as budget FROM `co_righe2_contratti` WHERE idcontratto = '.prepare($id_record));
$budget = $rs[0]['budget'];
$rs = $dbo->fetchArray("SELECT SUM(qta) AS totale_ore FROM `co_righe2_contratti` WHERE um='ore' AND idcontratto = ".prepare($id_record));
diff --git a/templates/preventivi_cons/body.php b/templates/preventivi_cons/body.php
index 932412c11..b58fbc4da 100644
--- a/templates/preventivi_cons/body.php
+++ b/templates/preventivi_cons/body.php
@@ -3,7 +3,7 @@
include_once __DIR__.'/../../core.php';
include_once $docroot.'/modules/interventi/modutil.php';
-
+include_once $docroot.'/modules/preventivi/modutil.php';
$report_name = 'preventivo_'.$records[0]['numero'].'_cons.pdf';
echo '
@@ -457,10 +457,12 @@ $imponibile = sum($imponibile);
$totale = $imponibile - $sconto;
-$rs = $dbo->fetchArray('SELECT SUM(subtotale) as budget FROM `co_righe_preventivi` WHERE idpreventivo = '.prepare($id_record));
-$budget = $rs[0]['budget'];
+//$rs = $dbo->fetchArray('SELECT SUM(subtotale) as budget FROM `co_righe_preventivi` WHERE idpreventivo = '.prepare($id_record));
+//$budget = $rs[0]['budget'];
+$budget = get_imponibile_preventivo($id_record);
-$rapporto = $budget - $totale;
+
+$rapporto = floatval($budget) - floatval($totale);
// Totale imponibile
echo '