32 |
*/ |
*/ |
33 |
|
|
34 |
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; |
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; |
|
|
|
35 |
print '<tr><td width="30%" valign="top">'; |
print '<tr><td width="30%" valign="top">'; |
36 |
|
|
37 |
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php">'; |
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php">'; |
40 |
print "</tr>\n"; |
print "</tr>\n"; |
41 |
print "<tr $bc[1]>"; |
print "<tr $bc[1]>"; |
42 |
print '<td>Numéro <input name="search_ligne" size="12"><input type="submit"></td></tr>'; |
print '<td>Numéro <input name="search_ligne" size="12"><input type="submit"></td></tr>'; |
43 |
print '</table></form>'; |
print '</table></form><br />'; |
44 |
|
|
45 |
print '<br />'; |
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/contrat/liste.php">'; |
46 |
|
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; |
47 |
|
print '<tr class="liste_titre"><td>Recherche contrat</td>'; |
48 |
|
print "</tr>\n"; |
49 |
|
print "<tr $bc[1]>"; |
50 |
|
print '<td>Numéro <input name="search_contrat" size="12"></td></tr>'; |
51 |
|
print '</table></form><br />'; |
52 |
|
|
53 |
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/client/liste.php">'; |
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/client/liste.php">'; |
54 |
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; |
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; |
146 |
|
|
147 |
print '</td><td width="70%" valign="top">'; |
print '</td><td width="70%" valign="top">'; |
148 |
|
|
|
$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 '<table class="noborder" cellspacing="0" cellpadding="3" width="100%">'; |
|
|
print '<tr class="liste_titre"><td colspan="2">Factures clients impayées ('.$num.')</td><td align="right">Montant TTC</td><td align="right">Reçu</td></tr>'; |
|
|
$var = True; |
|
|
$total = $totalam = 0; |
|
|
while ($i < $num ) |
|
|
{ |
|
|
$obj = $db->fetch_object($resql); |
|
|
if ($obj->total_ttc <> $obj->am) |
|
|
{ |
|
|
$var=!$var; |
|
|
print '<tr '.$bc[$var].'><td width="20%"><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->rowid.'">'.img_file().'</a>'; |
|
|
print ' <a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->rowid.'">'.$obj->facnumber.'</a></td>'; |
|
|
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>'; |
|
|
print '<td align="right">'.price($obj->total_ttc).'</td>'; |
|
|
print '<td align="right">'.price($obj->am).'</td></tr>'; |
|
|
$total += $obj->total_ttc; |
|
|
$totalam += $obj->am; |
|
|
} |
|
|
$i++; |
|
|
} |
|
|
$var=!$var; |
|
|
print '<tr '.$bc[$var].'><td colspan="2" align="left">'.$langs->trans("RemainderToTake").' : '.price($total-$totalam).'</td><td align="right">'.price($total).'</td><td align="right">'.price($totalam).'</td></tr>'; |
|
|
print "</table><br>"; |
|
|
} |
|
|
$db->free($resql); |
|
|
} |
|
|
else |
|
|
{ |
|
|
print $sql; |
|
|
} |
|
|
|
|
149 |
print '</td></tr>'; |
print '</td></tr>'; |
150 |
print '</table>'; |
print '</table>'; |
151 |
|
|