From dd158984cd5fccd20527d82880e6bdb6b3556408 Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 15 Mar 2005 09:19:52 +0000 Subject: [PATCH] =?UTF-8?q?am=E9lioration=20de=20la=20page=20d'index=20pou?= =?UTF-8?q?r=20le=20module=20compta.=20On=20pr=E9sente=20maintenant=20la?= =?UTF-8?q?=20liste=20des=20commandes=20=E0=20facturer=20avec=20le=20monta?= =?UTF-8?q?nt=20restant=20=E0=20facturer=20(HT=20et=20TTC).=20Plus=20un=20?= =?UTF-8?q?total=20en=20fin=20de=20liste.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/index.php | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index eaf78c514d0..a3e44fea630 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -222,8 +222,14 @@ if ($conf->commande->enabled && $user->rights->commande->lire) { $langs->load("orders"); - $sql = "SELECT p.rowid, p.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as p, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut >= 1 AND p.facture = 0"; + $sql = "SELECT sum(f.total) as tot_fht,sum(f.total_ttc) as tot_fttc, p.rowid, p.ref, s.nom, s.idp, p.total_ht, p.total_ttc + FROM ".MAIN_DB_PREFIX."commande AS p, llx_societe AS s + LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid + LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid + WHERE p.fk_soc = s.idp + AND p.fk_statut >=1 + AND p.facture =0 + GROUP BY p.rowid"; if ($socidp) { $sql .= " AND p.fk_soc = $socidp"; @@ -237,20 +243,30 @@ if ($conf->commande->enabled && $user->rights->commande->lire) $i = 0; print ''; print ""; - print ''; + print ''; + print ''; $var = True; + $tot_ht=0; + $tot_ttc=0; while ($i < $num) { $var=!$var; $obj = $db->fetch_object(); - print ""; - print "'; - - print ''; - $i++; + if ($obj->total_ht-$obj->tot_fht) { + print ""; + print "'; + + print ''; + print ''; + print ''; + $tot_ht += $obj->total_ht-$obj->tot_fht; + $tot_ttc += $obj->total_ttc-$obj->tot_fttc; + } + $i++; } + print '"; print "
'.$langs->trans("OrdersToBill").' ('.$num.')
'.$langs->trans("OrdersToBill").' ('.$num.')'.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").' 
rowid\">".img_object($langs->trans("ShowOrder"),"order").' '; - print "rowid\">".$obj->ref.''.img_object($langs->trans("ShowCompany"),"company").' '; - print ''.$obj->nom.'
rowid\">".img_object($langs->trans("ShowOrder"),"order").' '; + print "rowid\">".$obj->ref.''.img_object($langs->trans("ShowCompany"),"company").' '; + print ''.$obj->nom.''.price($obj->total_ht-$obj->tot_fht).''.price($obj->total_ttc-$obj->tot_fttc).'
'.$langs->trans("Total").'   (Reste à facturer : '.price($tot_ttc).')'.price($tot_ht)."".price($tot_ttc)."

"; } }