From 5d82e90bff947f8b8f13118cb1f35ef5c4041071 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 31 Jan 2005 11:48:22 +0000 Subject: [PATCH] Synchro --- htdocs/telephonie/contrat/liste.php | 52 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/htdocs/telephonie/contrat/liste.php b/htdocs/telephonie/contrat/liste.php index b62ad389105..596b93ad60b 100644 --- a/htdocs/telephonie/contrat/liste.php +++ b/htdocs/telephonie/contrat/liste.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2005 Rodolphe Quiedeville * * 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 @@ -35,20 +35,14 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="c.statut"; -} - /* - * Recherche * * */ if ($page == -1) { $page = 0 ; } +if ($sortorder == "") $sortorder="ASC"; +if ($sortfield == "") $sortfield="c.statut"; $offset = $conf->liste_limit * $page ; $pageprev = $page - 1; @@ -60,15 +54,25 @@ $pagenext = $page + 1; * * */ -$sql = "SELECT c.rowid, c.ref, s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom"; +$sql = "SELECT c.rowid, c.ref, s.idp as socidp, s.nom "; +$sql .= ", sf.idp as sfidp, sf.nom as sfnom"; +$sql .= ", sa.idp as saidp, sa.nom as sanom"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; +$sql .= " , ".MAIN_DB_PREFIX."societe as sa"; +$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; + $sql .= " WHERE c.fk_client_comm = s.idp"; -$sql .= " AND c.fk_soc = sf.idp"; +$sql .= " AND c.fk_soc = sa.idp"; +$sql .= " AND c.fk_soc_facture = sf.idp"; +if ($socidp > 0) +{ + $sql .= " AND s.idp = ".$socidp; +} + if ($_GET["search_ligne"]) { $sel =urldecode($_GET["search_ligne"]); @@ -110,12 +114,11 @@ if ($result) print ''; print_liste_field_titre("Ref","liste.php","c.ref"); - print_liste_field_titre("Client (Agence/Filiale)","liste.php","s.nom"); + print_liste_field_titre("Client","liste.php","s.nom"); + print_liste_field_titre("Client (Agence/Filiale)","liste.php","sa.nom"); print 'Client facturé'; - print 'Statut'; - - print_liste_field_titre("Remise LMN","liste.php","l.remise","","",' align="center"'); + print '-'; print "\n"; @@ -123,25 +126,21 @@ if ($result) print '
'; print ''; print ''; + print ''; print ''; + print ''; - - print ' '; - print '
'; print ''; - $var=True; - $ligne = new LigneTel($db); - while ($i < min($num,$conf->liste_limit)) { - $obj = $db->fetch_object($i); + $obj = $db->fetch_object(); $var=!$var; print ""; @@ -153,12 +152,11 @@ if ($result) print ''.$obj->ref."\n"; print ''.stripslashes($obj->nom).''; - print ''.stripslashes($obj->nom_facture).''; - print ''.$ligne->statuts[$obj->statut]."\n"; - - print ''.$obj->remise." %\n"; + print ''.stripslashes($obj->sanom).''; + print ''.stripslashes($obj->sfnom).''; + print '-'; print "\n"; $i++; }