diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index 9fae5970231..e239a23fe06 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2002-2005 Rodolphe Quiedeville * Copyright (C) 2004-2005 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -22,14 +22,13 @@ */ /** - \file htdocs/fourn/facture/index.php - \ingroup fournisseur,facture - \brief Lsite des factures fournisseurs - \version $Revision$ + \file htdocs/fourn/facture/index.php + \ingroup fournisseur,facture + \brief Lsite des factures fournisseurs + \version $Revision$ */ require("./pre.inc.php"); -require("../../contact.class.php"); if (!$user->rights->fournisseur->facture->lire) accessforbidden(); @@ -96,7 +95,7 @@ if ($_POST["mode"] == 'search') * */ -$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 = "SELECT s.idp as socid, s.nom, ".$db->pdate("fac.date_lim_reglement")." as date_echeance, fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle, 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"; @@ -141,11 +140,11 @@ if ($_GET["search_montant_ttc"]) $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit+1, $offset); -$result = $db->query($sql); +$resql = $db->query($sql); -if ($result) +if ($resql) { - $num = $db->num_rows($result); + $num = $db->num_rows($resql); $i = 0; if ($socid) { @@ -158,7 +157,7 @@ if ($result) print ''; print ''; print_liste_field_titre($langs->trans("Ref"),"index.php","facnumber","&socid=$socid","","",$sortfield); - print_liste_field_titre($langs->trans("Date"),"index.php","fac.datef","&socid=$socid","","",$sortfield); + print_liste_field_titre($langs->trans("DateEcheance"),"index.php","fac.datef","&socid=$socid","","",$sortfield); print_liste_field_titre($langs->trans("Label"),"index.php","fac.libelle","&socid=$socid","","",$sortfield); print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","&socid=$socid","","",$sortfield); print_liste_field_titre($langs->trans("AmountHT"),"index.php","fac.total_ht","&socid=$socid","",'align="right"',$sortfield); @@ -193,13 +192,13 @@ if ($result) $total=0; $total_ttc=0; while ($i < min($num,$limit)) - { - $obj = $db->fetch_object(); + { + $obj = $db->fetch_object($resql); $var=!$var; print ""; print "\n"; - print "\n"; + print "\n"; print ''; print ''; - + print "\n"; $i++; - + if ($i == min($num,$limit)) { - // Print total - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; + // Print total + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; } - } - + } + print "
facid\">".img_object($langs->trans("ShowBill"),"bill")." ".$obj->facnumber."".strftime("%d %b %Y",$obj->datef)."".strftime("%e %b %Y",$obj->date_echeance)."'.stripslashes("$obj->libelle").''; print ''.img_object($langs->trans("ShowSupplier"),"company").' '.$obj->nom.''; @@ -211,68 +210,67 @@ if ($result) // Affiche statut de la facture if ($obj->paye) { - $class = "normal"; + $class = "normal"; } else - { + { if ($obj->fk_statut == 0) - { + { $class = "normal"; - } + } else - { + { $class = "impayee"; - } - } - + } + } + print ''; if (! $obj->paye) { - if ($obj->fk_statut == 0) + if ($obj->fk_statut == 0) { - print $fac->PayedLibStatut($obj->paye,$obj->fk_statut); + print $fac->PayedLibStatut($obj->paye,$obj->fk_statut); } - elseif ($obj->fk_statut == 3) + elseif ($obj->fk_statut == 3) { - print $fac->PayedLibStatut($obj->paye,$obj->fk_statut); + print $fac->PayedLibStatut($obj->paye,$obj->fk_statut); } - else + else { - // \todo le montant deja payé obj->am n'est pas définie - print ''.($fac->PayedLibStatut($obj->paye,$obj->fk_statut,$obj->am)).''; + // \todo le montant deja payé obj->am n'est pas définie + print ''.($fac->PayedLibStatut($obj->paye,$obj->fk_statut,$obj->am)).''; } } else - { + { print $fac->PayedLibStatut($obj->paye,$obj->fk_statut); - } + } print '
'.$langs->trans("Total").''.price($total).''.price($total_ttc).' 
'.$langs->trans("Total").''.price($total).''.price($total_ttc).' 
"; - $db->free(); + $db->free($resql); } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } $db->close(); llxFooter('$Date$ - $Revision$'); - ?>