Skip to content
Snippets Groups Projects
Commit 206a3ba7 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Corrections mauvais résultat du ca par utilisateur et support des 2 modes comptables.

parent 0750fe75
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@ $html=new Form($db);
// Affiche en-tte du rapport
if ($modecompta=="CREANCES-DETTES")
{
$nom="Chiffre d'affaire (".$conf->monnaie." HT)";
$nom="Chiffre d'affaire";
$nom.=' (Voir le rapport <a href="index.php?year_start='.($year_start).'&modecompta=RECETTES-DEPENSES">recettes-dpenses</a> pour n\'inclure que les factures effectivement payes)';
$period=($year_start?"<a href='index.php?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='index.php?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCADue");
......@@ -68,7 +68,7 @@ if ($modecompta=="CREANCES-DETTES")
$exportlink=$langs->trans("NotYetAvailable");
}
else {
$nom="Chiffre d'affaire (".$conf->monnaie." TTC)";
$nom="Chiffre d'affaire";
$nom.=' (Voir le rapport en <a href="index.php?year_start='.($year_start).'&modecompta=CREANCES-DETTES">crances-dettes</a> pour inclure les factures non encore paye)';
$period=($year_start?"<a href='index.php?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='index.php?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCAIn");
......@@ -87,7 +87,7 @@ if ($modecompta == 'CREANCES-DETTES') {
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
* vieilles versions, ils n'taient pas lis via paiement_facture. On les ajoute plus loin)
*/
$sql = "SELECT sum(pf.amount) as amount, date_format(p.datep,'%Y-%m') as dm";
$sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
$sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid";
}
......@@ -102,8 +102,8 @@ if ($result)
while ($i < $num)
{
$obj = $db->fetch_object($result);
$cum[$obj->dm] = $obj->amount;
if ($obj->amount)
$cum[$obj->dm] = $obj->amount_ttc;
if ($obj->amount_ttc)
{
$minyearmonth=($minyearmonth?min($minyearmonth,$obj->dm):$obj->dm);
$maxyearmonth=max($maxyearmonth,$obj->dm);
......@@ -118,7 +118,7 @@ else {
// On ajoute les paiements anciennes version, non lis par paiement_facture
if ($modecompta != 'CREANCES-DETTES') {
$sql = "SELECT sum(p.amount) as amount, date_format(p.datep,'%Y-%m') as dm";
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql .= " WHERE pf.rowid IS NULL";
......@@ -132,8 +132,8 @@ if ($modecompta != 'CREANCES-DETTES') {
while ($i < $num)
{
$obj = $db->fetch_object($result);
$cum[$obj->dm] += $obj->amount;
if ($obj->amount)
$cum[$obj->dm] += $obj->amount_ttc;
if ($obj->amount_ttc)
{
$minyearmonth=($minyearmonth?min($minyearmonth,$obj->dm):$obj->dm);
$maxyearmonth=max($maxyearmonth,$obj->dm);
......@@ -163,7 +163,7 @@ print '</tr>';
print '<tr class="liste_titre">';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
print '<td align="right">'.$langs->trans("Amount").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="center">'.$langs->trans("Delta").'</td>';
print '<td width="15">&nbsp;</td>';
}
......@@ -403,6 +403,6 @@ print "</table>";
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment