From e13df824684a43f808e757436860ec7409af09a2 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 1 Mar 2005 10:58:23 +0000 Subject: [PATCH] Nouveau fichier --- htdocs/compta/prelevement/liste_factures.php | 155 +++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 htdocs/compta/prelevement/liste_factures.php diff --git a/htdocs/compta/prelevement/liste_factures.php b/htdocs/compta/prelevement/liste_factures.php new file mode 100644 index 00000000000..1db9b3e29e7 --- /dev/null +++ b/htdocs/compta/prelevement/liste_factures.php @@ -0,0 +1,155 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php"); + +require_once DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php"; +require_once DOL_DOCUMENT_ROOT."/paiement.class.php"; +require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php"; + +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) accessforbidden(); + +llxHeader('','Bon de prélèvement'); + +$page = $_GET["page"]; +$sortorder = (empty($_GET["sortorder"])) ? "DESC" : $_GET["sortorder"]; +$sortfield = (empty($_GET["sortfield"])) ? "p.datec" : $_GET["sortfield"]; +$offset = $conf->liste_limit * $page ; + +/* + * Liste des factures + * + * + */ +$sql = "SELECT p.rowid, p.ref, p.statut"; +$sql .= " ,f.rowid as facid, f.facnumber, f.total_ttc"; +$sql .= " , s.idp, s.nom"; +$sql .= " , pl.statut as statut_ligne"; +$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; +$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; +$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; +$sql .= " , ".MAIN_DB_PREFIX."facture as f"; +$sql .= " , ".MAIN_DB_PREFIX."societe as s"; +$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid"; +$sql .= " AND pl.fk_prelevement_bons = p.rowid"; +$sql .= " AND f.fk_soc = s.idp"; +$sql .= " AND pf.fk_facture = f.rowid"; + +if ($_GET["socid"]) +{ + $sql .= " AND s.idp = ".$_GET["socid"]; +} + +if ($_GET["search_fac"]) +{ + $sql .= " AND f.facnumber like '%".$_GET["search_fac"]."%'"; +} + +if ($_GET["search_nom"]) +{ + $sql .= " AND s.nom like '%".$_GET["search_nom"]."%'"; +} + +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); + +$result = $db->query($sql); + +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + + $urladd = "&socid=".$_GET["socid"]; + + print_barre_liste("Factures prélevées", $page, "liste_factures.php", $urladd, $sortfield, $sortorder, '', $num); + print"\n\n"; + print ''; + print ''; + print_liste_field_titre("Facture","liste_factures.php","f.facnumber",'',$urladd); + print_liste_field_titre("Société","liste_factures.php","s.nom",'',$urladd); + print_liste_field_titre("Montant","liste_factures.php","f.total_ttc","",$urladd,'align="center"'); + print_liste_field_titre("Bon","liste_factures.php","p.rowid","",$urladd,'align="center"'); + print ''; + + print ''; + print ''; + print ''; + print "\n"; + print ''; + + $var=True; + + $total = 0; + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object($i); + + print "\n"; + + print '\n"; + + print '\n"; + + print '\n"; + + print ''; + + $total += $obj->total_ttc; + $var=!$var; + $i++; + } + + print "
'; + print ''; + print ''; + print ''; + + print ''; + print ''; + print '
"; + + + print ' '; + + print ''; + print img_object($langs->trans("ShowBill"),"bill"); + print ' '; + + print ''.$obj->facnumber."'; + print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."'.price($obj->total_ttc)."'; + print ' '; + print ''; + print $obj->ref."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>