From 591340a02e253034cb1de7dd5944a69c24cff934 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Jun 2004 12:29:27 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Corrections=20bugs=20divers=20sur=20fact?= =?UTF-8?q?ures=20fournisseurs,=20Look:=20Mise=20au=20format=20onglet=20de?= =?UTF-8?q?=20la=20fiche=20facture=20fournisseur,=20New:=20Possibilit=E9?= =?UTF-8?q?=20de=20tri=20et=20affichage=20statut=20facture=20fournisseur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/facture.php | 6 +-- htdocs/facturefourn.class.php | 18 ++++++++ htdocs/fourn/facture/fiche.php | 1 + htdocs/fourn/facture/index.php | 83 +++++++++++++++++++++++++--------- 4 files changed, 84 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index da6173e8266..69990b1aca6 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1353,9 +1353,9 @@ else if ($month > 0) $sql .= " AND date_format(f.datef, '%m') = $month"; - if ($filtre) + if ($_GET["filtre"]) { - $filtrearr = split(",", $filtre); + $filtrearr = split(",", $_GET["filtre"]); foreach ($filtrearr as $fil) { $filt = split(":", $fil); @@ -1404,7 +1404,7 @@ else print_liste_field_titre("Montant TTC",$PHP_SELF,"f.total_ttc","","&socidp=$socidp"); print ''; print_liste_field_titre("Reçu",$PHP_SELF,"am","","&socidp=$socidp"); - print ''; + print ''; print_liste_field_titre("Statut",$PHP_SELF,"fk_statut,paye","","&socidp=$socidp"); print ''; print "\n"; diff --git a/htdocs/facturefourn.class.php b/htdocs/facturefourn.class.php index 7e847670bad..94de20e9363 100644 --- a/htdocs/facturefourn.class.php +++ b/htdocs/facturefourn.class.php @@ -423,6 +423,24 @@ class FactureFourn { } + + /** + * Renvoi un libellé du statut + * + */ + Function LibStatut($paye,$statut) + { + if (! $paye) + { + if ($statut == 0) return 'Brouillon (à valider)'; + if ($statut == 3) return 'Annulée'; + return 'Validée (à payer)'; + } + else + { + return 'Payée'; + } + } } ?> diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 058d144223e..2aecfc32e77 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -420,6 +420,7 @@ else $authorfullname=$author->fullname; } print "Auteur$authorfullname"; + print "Statut:".$fac->LibStatut($fac->paye,$fac->statut).""; print "".' Total HT'.price($fac->total_ht).""; print 'TVA'.price($fac->total_tva).""; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index 85cfd090e75..12bbb7f581e 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -22,6 +22,7 @@ */ require("./pre.inc.php"); require("../../contact.class.php"); +require("../../facturefourn.class.php"); llxHeader(); @@ -34,12 +35,6 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -if ($action == 'note') -{ - $sql = "UPDATE societe SET note='$note' WHERE idp=$socid"; - $result = $db->query($sql); -} - if ($action == 'delete') { $fac = new FactureFourn($db); @@ -94,7 +89,7 @@ if ($sortfield == "") } -$sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.prefix_comm, fac.total_ht, fac.total_ttc, fac.paye, fac.libelle, ".$db->pdate("fac.datef")." as datef, fac.rowid as facid, fac.facnumber"; +$sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.prefix_comm, fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle, ".$db->pdate("fac.datef")." as datef, fac.rowid as facid, fac.facnumber"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac "; $sql .= " WHERE fac.fk_soc = s.idp"; @@ -102,6 +97,15 @@ if ($socid) { $sql .= " AND s.idp = $socid"; } +if ($_GET["filtre"]) + { + $filtrearr = split(",", $_GET["filtre"]); + foreach ($filtrearr as $fil) + { + $filt = split(":", $fil); + $sql .= " AND " . $filt[0] . " = " . $filt[1]; + } + } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit+1, $offset); @@ -116,23 +120,27 @@ if ($result) print ''; - print ''; - print ''; - print ''; + print ''; + print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; - print ''; - print "\n"; + print ''; + print "\n"; $var=True; while ($i < min($num,$limit)) { @@ -145,15 +153,48 @@ if ($result) print "\n"; print ''; print "\n"; - print ''; + print ''; print ''; - print ''; + // Affiche statut de la facture + if ($obj->paye) + { + $class = "normal"; + } + else + { + if ($obj->fk_statut == 0) + { + $class = "normal"; + } + else + { + $class = "impayee"; + } + } + if (! $obj->paye) + { + if ($obj->fk_statut == 0) + { + print ''; + } + elseif ($obj->fk_statut == 3) + { + print ''; + } + else + { + print ''; + } + } + else + { + print ''; + } - - print "\n"; + print "\n"; $i++; } - print "
Numéro'; + print '
'; + print_liste_field_titre("Numéro",$PHP_SELF,"facnumber"); + print ''; print_liste_field_titre("Date",$PHP_SELF,"fac.datef"); - print 'LibelléLibellé'; print_liste_field_titre("Société",$PHP_SELF,"s.nom"); print ''; + print ''; print_liste_field_titre("Montant HT",$PHP_SELF,"fac.total_ht"); print ''; + print ''; print_liste_field_titre("Montant TTC",$PHP_SELF,"fac.total_ttc"); print 'Payé
'; + print_liste_field_titre("Statut",$PHP_SELF,"fk_statut,paye"); + print '
".strftime("%d %b %Y",$obj->datef)."'.stripslashes("$obj->libelle").'socid\">$obj->nom'.price($obj->total_ht).''.price($obj->total_ht).''.price($obj->total_ttc).''.($obj->paye||$obj->total_ht==0?"":"").($obj->total_ht==0?"brouillon":$yn[$obj->paye]).($obj->paye||$obj->total_ht==0?"":"").'brouillonannulée'.($obj->am?"commencé":"impayée").'payée
"; + print ""; $db->free(); } else