diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php
index 209cdba9563..bf31220ddaf 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -118,6 +118,7 @@ if ($result)
while ($i < $num)
{
$obj = $db->fetch_object($result);
+ $cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0;
$cum[$obj->dm] = $obj->amount_ttc;
if ($obj->amount_ttc)
{
@@ -180,7 +181,8 @@ print '
| | ';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
- print '';
+ if ($modecompta == 'CREANCES-DETTES') print ' | ';
+ else print ' | ';
print '';
print $annee;
if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1);
@@ -192,6 +194,7 @@ print ' |
';
print '| '.$langs->trans("Month").' | ';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
+ if ($modecompta == 'CREANCES-DETTES') print ''.$langs->trans("AmountHT").' | ';
print ''.$langs->trans("AmountTTC").' | ';
print ''.$langs->trans("Delta").' | ';
if ($annee != $year_end) print ' | ';
@@ -224,6 +227,22 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
$case = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage),"%Y-%m");
$caseprev = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage-1),"%Y-%m");
+ if ($modecompta == 'CREANCES-DETTES') {
+ // Valeur CA du mois w/o VAT
+ print '';
+ if ($cum_ht[$case])
+ {
+ $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre.
+ print ''.price($cum_ht[$case],1).'';
+ }
+ else
+ {
+ if ($minyearmonth < $case && $case <= max($maxyearmonth,$nowyearmonth)) { print '0'; }
+ else { print ' '; }
+ }
+ print " | ";
+ }
+
// Valeur CA du mois
print '';
if ($cum[$case])
@@ -273,6 +292,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
print ' | ';
}
+ $total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0;;
$total[$annee]+=$cum[$case];
if ($annee_decalage != $year_end) print ' | ';
}
@@ -349,6 +369,18 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
print '
| '.$langs->trans("Total").' | ';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
+ if ($modecompta == 'CREANCES-DETTES') {
+ // Montant total HT
+ if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear,$maxyear)))
+ {
+ print ''.($total_ht[$annee]?price($total_ht[$annee]):"0")." | ";
+ }
+ else
+ {
+ print ' | ';
+ }
+ }
+
// Montant total
if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear,$maxyear)))
{