diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 261a384e68447be7cf8b1ecc459c2c913ce6f967..e3b133d71c9135da84442990644e8b50d3774e38 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -45,12 +45,12 @@ print '<br>'; 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 ' (<a href="clientfourn.php?year='.$year.'&modecompta=RECETTES-DEPENSES">Voir le rapport sur les factures effectivement pay�es uniquement</a>).<br>'; + print ' (Voir le rapport <a href="clientfourn.php?year='.$year.'&modecompta=RECETTES-DEPENSES">recettes-d�penses</a> pour n\'inclure que les factures effectivement pay�es).<br>'; print '<br>'; } else { print 'Il se base sur la date de validation des factures et n\'inclut que les factures effectivement pay�es'; - print ' (<a href="clientfourn.php?year='.$year.'&modecompta=CREANCES-DETTES">Voir le rapport en cr�ances-dettes qui inclut les factures non encore pay�e</a>).<br>'; + print ' (Voir le rapport en <a href="clientfourn.php?year='.$year.'&modecompta=CREANCES-DETTES">cr�ances-dettes</a> pour inclure les factures non encore pay�e).<br>'; print '<br>'; } @@ -59,13 +59,14 @@ print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print '<td width="10%"> </td><td>El�ment</td>'; print "<td align=\"right\">".$langs->trans("AmountHT")."</td>"; +print "<td align=\"right\">".$langs->trans("AmountTTC")."</td>"; print "</tr>\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 "<tr $bc[$var]><td> </td>"; print "<td>Factures <a href=\"../facture.php?socidp=$objp->idp\">$objp->nom</td>\n"; - print "<td align=\"right\">".price($objp->amount)."</td>\n"; + print "<td align=\"right\">".price($objp->amount_ht)."</td>\n"; + print "<td align=\"right\">".price($objp->amount_ttc)."</td>\n"; - $total = $total + $objp->amount; + $total_ht = $total_ht + $objp->amount_ht; + $total_ttc = $total_ttc + $objp->amount_ttc; print "</tr>\n"; $i++; } @@ -105,13 +108,16 @@ if ($result) { } else { dolibarr_print_error($db); } -print '<tr><td colspan="3" align="right">'.price($total).'</td></tr>'; +print '<tr>'; +print '<td colspan="3" align="right">'.price($total_ht).'</td>'; +print '<td align="right">'.price($total_ttc).'</td>'; +print '</tr>'; /* * 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 '<tr><td colspan="4">Facturation fournisseurs</td></tr>'; -$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 "<tr $bc[$var]><td> </td>"; print "<td>".$langs->trans("Bills")." <a href=\"../../fourn/facture/index.php?socid=".$objp->idp."\">$objp->nom</a></td>\n"; - print "<td align=\"right\">".price($objp->amount)."</td>\n"; + print "<td align=\"right\">".price($objp->amount_ht)."</td>\n"; + print "<td align=\"right\">".price($objp->amount_ttc)."</td>\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 "</tr>\n"; $i++; } @@ -150,7 +160,10 @@ if ($result) { } else { dolibarr_print_error($db); } -print '<tr><td colspan="3" align="right">'.price($subtotal).'</td></tr>'; +print '<tr>'; +print '<td colspan="3" align="right">'.price($subtotal_ht).'</td>'; +print '<td align="right">'.price($subtotal_ttc).'</td>'; +print '</tr>'; /* * 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 "<tr $bc[$var]><td> </td>"; @@ -187,9 +202,15 @@ if ( $db->query($sql) ) { } else { dolibarr_print_error($db); } -print '<tr><td colspan="3" align="right">'.price($subtotal).'</td></tr>'; +print '<tr>'; +print '<td colspan="3" align="right">'.price($subtotal_ht).'</td>'; +print '<td colspan="3" align="right">'.price($subtotal_ttc).'</td>'; +print '</tr>'; -print '<tr><td align="right" colspan="2">R�sultat</td><td class="border" align="right">'.price($total).'</td></tr>'; +print '<tr><td align="right" colspan="2">R�sultat</td>'; +print '<td class="border" align="right">'.price($total_ht).'</td>'; +print '<td class="border" align="right">'.price($total_ttc).'</td>'; +print '</tr>'; /* * 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 "<tr $bc[$var]><td> </td>"; print '<td>'.$obj->nom.'</td>'; print '<td align="right">'.price($obj->amount).'</td>'; + print '<td align="right">'.price($obj->amount).'</td>'; print '</tr>'; $i++; } } else { dolibarr_print_error($db); } -print '<tr><td colspan="3" align="right">'.price($subtotal).'</td></tr>'; +print '<tr>'; +print '<td colspan="3" align="right">'.price($subtotal_ht).'</td>'; +print '<td colspan="3" align="right">'.price($subtotal_ttc).'</td>'; +print '</tr>'; + -print '<tr><td align="right" colspan="2">R�sultat</td><td class="border" align="right">'.price($total).'</td></tr>'; +print '<tr><td align="right" colspan="2">R�sultat</td>'; +print '<td class="border" align="right">'.price($total_ht).'</td>'; +print '<td class="border" align="right">'.price($total_ttc).'</td>'; +print '</tr>'; print "</table>"; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index ac01b6edc0ff5ce830e20d1bc31124e6960756ea..b2b97e6ca972b90f3a83126882096ed3cb7d3389 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 ' (<a href="index.php?year='.$year.'&modecompta=RECETTES-DEPENSES">Voir le rapport sur les factures effectivement pay�es uniquement</a>).<br>'; + print ' (Voir le rapport <a href="index.php?year='.$year.'&modecompta=RECETTES-DEPENSES">recettes-d�penses</a> pour n\'inclure que les factures effectivement pay�es).<br>'; print '<br>'; } else { print 'Il se base sur la date de validation des factures et n\'inclut que les factures effectivement pay�es'; - print ' (<a href="index.php?year='.$year.'&modecompta=CREANCES-DETTES">Voir le rapport en cr�ances-dettes qui inclut les factures non encore pay�e</a>).<br>'; + print ' (Voir le rapport en <a href="index.php?year='.$year.'&modecompta=CREANCES-DETTES">cr�ances-dettes</a> pour inclure les factures non encore pay�e).<br>'; print '<br>'; } /* * 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++; } }