';
@@ -141,52 +146,6 @@ else
print '';
-$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total_ttc, sum(pf.amount) as am";
-$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f ";
-$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
-$sql .= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
-$sql .= " GROUP BY f.facnumber,f.rowid,s.nom, s.idp, f.total_ttc";
-
-$resql = $db->query($sql);
-
-if ($resql)
-{
- $num = $db->num_rows($resql);
- $i = 0;
-
- if ($num)
- {
- print '';
- print '| Factures clients impayées ('.$num.') | Montant TTC | Reçu | ';
- $var = True;
- $total = $totalam = 0;
- while ($i < $num )
- {
- $obj = $db->fetch_object($resql);
- if ($obj->total_ttc <> $obj->am)
- {
- $var=!$var;
- print '| '.img_file().'';
- print ' '.$obj->facnumber.' | ';
- print ''.$obj->nom.' | ';
- print ''.price($obj->total_ttc).' | ';
- print ''.price($obj->am).' | ';
- $total += $obj->total_ttc;
- $totalam += $obj->am;
- }
- $i++;
- }
- $var=!$var;
- print '| '.$langs->trans("RemainderToTake").' : '.price($total-$totalam).' | '.price($total).' | '.price($totalam).' | ';
- print " ";
- }
- $db->free($resql);
-}
-else
-{
- print $sql;
-}
-
print ' | ';
print '
';