diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 261a384e684..e3b133d71c9 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -45,12 +45,12 @@ print '
'; if ($modecompta=="CREANCES-DETTES") { print 'Il se base sur la date de validation des factures et inclut les factures dues, qu\'elles soient payées ou non'; - print ' (Voir le rapport sur les factures effectivement payées uniquement).
'; + print ' (Voir le rapport recettes-dépenses pour n\'inclure que les factures effectivement payées).
'; print '
'; } else { print 'Il se base sur la date de validation des factures et n\'inclut que les factures effectivement payées'; - print ' (Voir le rapport en créances-dettes qui inclut les factures non encore payée).
'; + print ' (Voir le rapport en créances-dettes pour inclure les factures non encore payée).
'; print '
'; } @@ -59,13 +59,14 @@ print ''; print ''; print ''; print ""; +print ""; print "\n"; /* * Factures clients */ -$sql = "SELECT s.nom,s.idp,sum(f.total) as amount"; +$sql = "SELECT s.nom, s.idp, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql .= " WHERE f.fk_soc = s.idp AND f.fk_statut = 1"; if ($year) { @@ -94,9 +95,11 @@ if ($result) { print ""; print "\n"; - print "\n"; + print "\n"; + print "\n"; - $total = $total + $objp->amount; + $total_ht = $total_ht + $objp->amount_ht; + $total_ttc = $total_ttc + $objp->amount_ttc; print "\n"; $i++; } @@ -105,13 +108,16 @@ if ($result) { } else { dolibarr_print_error($db); } -print ''; +print ''; +print ''; +print ''; +print ''; /* * Frais, factures fournisseurs. */ -$sql = "SELECT s.nom,s.idp,sum(f.total_ht) as amount"; +$sql = "SELECT s.nom, s.idp, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.fk_soc = s.idp"; if ($year) { @@ -123,7 +129,8 @@ if ($modecompta != 'CREANCES-DETTES') { $sql .= " GROUP BY s.nom ASC, s.idp"; print ''; -$subtotal = 0; +$subtotal_ht = 0; +$subtotal_ttc = 0; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); @@ -138,10 +145,13 @@ if ($result) { print ""; print "\n"; - print "\n"; + print "\n"; + print "\n"; - $total = $total - $objp->amount; - $subtotal = $subtotal + $objp->amount; + $total_ht = $total_ht - $objp->amount_ht; + $total_ttc = $total_ttc - $objp->amount_ttc; + $subtotal_ht = $subtotal_ht + $objp->amount_ht; + $subtotal_ttc = $subtotal_ttc + $objp->amount_ttc; print "\n"; $i++; } @@ -150,7 +160,10 @@ if ($result) { } else { dolibarr_print_error($db); } -print ''; +print ''; +print ''; +print ''; +print ''; /* * Charges sociales @@ -174,8 +187,10 @@ if ( $db->query($sql) ) { while ($i < $num) { $obj = $db->fetch_object(); - $total = $total - $obj->amount; - $subtotal = $subtotal + $obj->amount; + $total_ht = $total_ht - $obj->amount; + $total_ttc = $total_ttc - $obj->amount; + $subtotal_ht = $subtotal_ht + $obj->amount; + $subtotal_ttc = $subtotal_ttc + $obj->amount; $var = !$var; print ""; @@ -187,9 +202,15 @@ if ( $db->query($sql) ) { } else { dolibarr_print_error($db); } -print ''; +print ''; +print ''; +print ''; +print ''; -print ''; +print ''; +print ''; +print ''; +print ''; /* * Charges sociales non déductibles @@ -213,22 +234,32 @@ if ( $db->query($sql) ) { while ($i < $num) { $obj = $db->fetch_object(); - $total = $total - $obj->amount; - $subtotal = $subtotal + $obj->amount; + $total_ht = $total_ht - $obj->amount; + $total_ttc = $total_ttc - $obj->amount; + $subtotal_ht = $subtotal_ht + $obj->amount; + $subtotal_ttc = $subtotal_ttc + $obj->amount; $var = !$var; print ""; print ''; print ''; + print ''; print ''; $i++; } } else { dolibarr_print_error($db); } -print ''; +print ''; +print ''; +print ''; +print ''; -print ''; + +print ''; +print ''; +print ''; +print ''; print "
 Elément".$langs->trans("AmountHT")."".$langs->trans("AmountTTC")."
 Factures idp\">$objp->nom".price($objp->amount)."".price($objp->amount_ht)."".price($objp->amount_ttc)."
'.price($total).'
'.price($total_ht).''.price($total_ttc).'
Facturation fournisseurs
 ".$langs->trans("Bills")." idp."\">$objp->nom".price($objp->amount)."".price($objp->amount_ht)."".price($objp->amount_ttc)."
'.price($subtotal).'
'.price($subtotal_ht).''.price($subtotal_ttc).'
 
'.price($subtotal).'
'.price($subtotal_ht).''.price($subtotal_ttc).'
Résultat'.price($total).'
Résultat'.price($total_ht).''.price($total_ttc).'
 '.$obj->nom.''.price($obj->amount).''.price($obj->amount).'
'.price($subtotal).'
'.price($subtotal_ht).''.price($subtotal_ttc).'
Résultat'.price($total).'
Résultat'.price($total_ht).''.price($total_ttc).'
"; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index ac01b6edc0f..b2b97e6ca97 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -48,19 +48,19 @@ print "Ce rapport pr if ($modecompta=="CREANCES-DETTES") { print 'Il se base sur la date de validation des factures et inclut les factures dues, qu\'elles soient payées ou non'; - print ' (Voir le rapport sur les factures effectivement payées uniquement).
'; + print ' (Voir le rapport recettes-dépenses pour n\'inclure que les factures effectivement payées).
'; print '
'; } else { print 'Il se base sur la date de validation des factures et n\'inclut que les factures effectivement payées'; - print ' (Voir le rapport en créances-dettes qui inclut les factures non encore payée).
'; + print ' (Voir le rapport en créances-dettes pour inclure les factures non encore payée).
'; print '
'; } /* * Factures clients */ -$sql = "SELECT sum(f.total) as amount, date_format(f.datef,'%Y-%m') as dm"; +$sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql .= " WHERE f.fk_soc = s.idp AND f.fk_statut = 1"; if ($_GET["year"]) { @@ -80,8 +80,9 @@ if ($db->query($sql)) $i = 0; while ($i < $num) { - $row = $db->fetch_row($i); - $encaiss[$row[1]] = $row[0]; + $row = $db->fetch_object($i); + $encaiss[$row->dm] = $row->amount_ht; + $encaiss_ttc[$row->dm] = $row->amount_ttc; $i++; } } @@ -92,7 +93,7 @@ else { /* * Frais, factures fournisseurs. */ -$sql = "SELECT sum(f.total_ht) as amount, date_format(f.datef,'%Y-%m') as dm"; +$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.fk_soc = s.idp AND f.fk_statut = 1"; if ($_GET["year"]) { @@ -113,8 +114,9 @@ if ($db->query($sql)) $i = 0; while ($i < $num) { - $row = $db->fetch_row($i); - $decaiss[$row[1]] = $row[0]; + $row = $db->fetch_object($i); + $decaiss[$row->dm] = $row->amount_ht; + $decaiss_ttc[$row->dm] = $row->amount_ttc; $i++; } }