From 034d3c3bc7bc84565f86247a746f421b729a1f30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Jan 2004 19:09:04 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20montant=20du=20montant=20d=E9j=E0?= =?UTF-8?q?=20re=E7u=20et=20du=20statut=20de=20la=20facture=20dans=20le=20?= =?UTF-8?q?listing=20des=20factures.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/facture.php | 85 ++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f184134436f..42e112ce762 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -198,7 +198,7 @@ if ($action == 'add_paiement') $fac->fetch($HTTP_POST_VARS["facid"]); $fac->fetch_client(); - $label = "Règlement facture " . $fac->ref; + $label = "Réglement facture".($fac->ref?" ".$fac->ref:"")." client".($fac->client->nom?" ".$fac->client->nom:""); //On ajoute une ligne dans la table llx_bank pour qu'ensuite on puisse rapprocher le compte ! $acc = new Account($db, $HTTP_POST_VARS["accountid"]); @@ -491,7 +491,7 @@ if ($_GET["action"] == 'create') } else { - print 'Services/Produits'; + print ' '; print ''; /* * @@ -522,7 +522,7 @@ if ($_GET["action"] == 'create') } print ''; - print ''; + print ''; for ($i = 1 ; $i < 5 ; $i++) { print ''; @@ -944,7 +944,8 @@ else */ if ($fac->statut == 0 && $user->rights->facture->creer) { - print ''; + + print "id\" method=\"post\">"; // echo '
ProduitQuan.Remise
Services/Produits prédéfinisQuan.Remise
'; print ""; print ''; @@ -1164,9 +1165,9 @@ else $form->select_array("destinataire",$soc->contact_email_array()); print ""; - print ""; - print ""; - print "
Descriptionemail\">
Expéditeur$from_name$from_mail
Reply-to$replytoname$replytomail
"; + print "Expéditeur$from_name$from_mail  "; + print "Reply-to$replytoname$replytomail  "; + print ""; print ""; } @@ -1278,8 +1279,8 @@ else if ($sortfield == "") $sortfield="f.datef"; - $sql = "SELECT s.nom,s.idp,f.facnumber,f.total,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid, f.fk_statut"; - $sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp"; + $sql = "SELECT s.nom,s.idp,f.facnumber,f.total,f.total_ttc,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid, f.fk_statut, sum(p.amount) as am"; + $sql .= " FROM llx_societe as s,llx_facture as f left join llx_paiement as p on f.rowid=p.fk_facture WHERE f.fk_soc = s.idp"; if ($socidp) $sql .= " AND s.idp = $socidp"; @@ -1305,8 +1306,10 @@ else $sql .= " AND f.facnumber like '%".$HTTP_POST_VARS["sf_ref"] . "%'"; } + $sql .= " GROUP BY f.facnumber"; + + $sql .= " ORDER BY $sortfield $sortorder, f.rowid DESC "; - $sql .= " ORDER BY $sortfield $sortorder, rowid DESC"; $sql .= $db->plimit($limit + 1,$offset); $result = $db->query($sql); @@ -1314,23 +1317,35 @@ else if ($result) { $num = $db->num_rows(); - print_barre_liste("Factures",$page,$PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num); + print_barre_liste("Factures clients",$page,$PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num); $i = 0; print ""; print ''; print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; print "\n"; if ($num > 0) { $var=True; + $total=0; + $totalrecu=0; + while ($i < min($num,$limit)) { $objp = $db->fetch_object($i); @@ -1353,28 +1368,30 @@ else } } - print '\n"; - print ''; if ($objp->df > 0 ) { - print "\n"; } else { - print "\n"; + print "\n"; } + print ''; - print "\n"; + print ""; + print ""; + print ""; if (! $objp->paye) { @@ -1384,17 +1401,31 @@ else } else { - print ''; + print ''; } } else { - print ''; + print ''; } print "\n"; + $total+=$objp->total; + $total_ttc+=$objp->total_ttc; + $totalrecu+=$objp->am; $i++; } + + if ($num <= $limit) { + // Print total + print ""; + print ""; + print ""; + print ""; + print ""; + print ''; + print "\n"; + } } print "
Numéro'; - print_liste_field_titre("Société",$PHP_SELF,"s.nom","","&socidp=$socidp"); - print ''; - print_liste_field_titre("Date",$PHP_SELF,"f.datef","","&socidp=$socidp"); - print 'Montant '; + print_liste_field_titre("Date facturation",$PHP_SELF,"f.datef","","&socidp=$socidp"); + print ''; + print_liste_field_titre("Société",$PHP_SELF,"s.nom","","&socidp=$socidp"); + print ''; + print_liste_field_titre("Montant HT",$PHP_SELF,"s.nom","","&socidp=$socidp"); + print ''; + print_liste_field_titre("Montant TTC",$PHP_SELF,"s.nom","","&socidp=$socidp"); + print 'ReçuStatus
' . $objp->facnumber; + print '' . $objp->facnumber; print "'.$objp->nom.'"; + print ""; $y = strftime("%Y",$objp->df); $m = strftime("%m",$objp->df); print strftime("%d",$objp->df)."\n"; - print ' '; - print strftime("%B",$objp->df)."\n"; - print ' '; + print ' '; + print substr(strftime("%B",$objp->df),0,3)."\n"; + print ' '; print strftime("%Y",$objp->df)."!!!!!!'.$objp->nom.'".price($objp->total)."".price($objp->total)."".price($objp->total_ttc)."".price($objp->am)."impayée'.($objp->am?"commencé":"impayée").' payée
Total : ".price($total)."".price($total_ttc)."".price($totalrecu)." 
";