Gestion de la date d'echeance des factures fournisseurs

This commit is contained in:
Rodolphe Quiedeville 2005-07-20 12:26:51 +00:00
parent dec2704ec7
commit 19cf54801e

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -29,7 +29,6 @@
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require("../../contact.class.php");
if (!$user->rights->fournisseur->facture->lire) if (!$user->rights->fournisseur->facture->lire)
accessforbidden(); 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 .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac ";
$sql .= " WHERE fac.fk_soc = s.idp"; $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); $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; $i = 0;
if ($socid) { if ($socid) {
@ -158,7 +157,7 @@ if ($result)
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),"index.php","facnumber","&amp;socid=$socid","","",$sortfield); print_liste_field_titre($langs->trans("Ref"),"index.php","facnumber","&amp;socid=$socid","","",$sortfield);
print_liste_field_titre($langs->trans("Date"),"index.php","fac.datef","&amp;socid=$socid","","",$sortfield); print_liste_field_titre($langs->trans("DateEcheance"),"index.php","fac.datef","&amp;socid=$socid","","",$sortfield);
print_liste_field_titre($langs->trans("Label"),"index.php","fac.libelle","&amp;socid=$socid","","",$sortfield); print_liste_field_titre($langs->trans("Label"),"index.php","fac.libelle","&amp;socid=$socid","","",$sortfield);
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","&amp;socid=$socid","","",$sortfield); print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","&amp;socid=$socid","","",$sortfield);
print_liste_field_titre($langs->trans("AmountHT"),"index.php","fac.total_ht","&amp;socid=$socid","",'align="right"',$sortfield); print_liste_field_titre($langs->trans("AmountHT"),"index.php","fac.total_ht","&amp;socid=$socid","",'align="right"',$sortfield);
@ -194,12 +193,12 @@ if ($result)
$total_ttc=0; $total_ttc=0;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object(); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td nowrap><a href=\"fiche.php?facid=$obj->facid\">".img_object($langs->trans("ShowBill"),"bill")." ".$obj->facnumber."</a></td>\n"; print "<td nowrap><a href=\"fiche.php?facid=$obj->facid\">".img_object($langs->trans("ShowBill"),"bill")." ".$obj->facnumber."</a></td>\n";
print "<td nowrap>".strftime("%d %b %Y",$obj->datef)."</td>\n"; print "<td nowrap>".strftime("%e %b %Y",$obj->date_echeance)."</td>\n";
print '<td>'.stripslashes("$obj->libelle").'</td>'; print '<td>'.stripslashes("$obj->libelle").'</td>';
print '<td>'; print '<td>';
print '<a href="../fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.$obj->nom.'</a</td>'; print '<a href="../fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.$obj->nom.'</a</td>';
@ -263,7 +262,7 @@ if ($result)
} }
print "</table>"; print "</table>";
$db->free(); $db->free($resql);
} }
else else
{ {
@ -274,5 +273,4 @@ $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date$ - $Revision$');
?> ?>