[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/compta/paiement/ -> liste.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: liste.php,v 1.20 2005/11/19 02:38:29 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/paiement/liste.php,v $
  21   */
  22   
  23  /**
  24          \file       htdocs/compta/paiement/liste.php
  25          \ingroup    compta
  26          \brief      Page liste des paiements des factures clients
  27          \version    $Revision: 1.20 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  $langs->load("bills");
  33  
  34  $user->getrights("facture");
  35  
  36  // Sécurité accés client
  37  if (! $user->rights->facture->lire)
  38    accessforbidden();
  39  
  40  $socidp=0;
  41  if ($user->societe_id > 0) 
  42  {
  43    $action = '';
  44    $socidp = $user->societe_id;
  45  }
  46  
  47  
  48  /*
  49   * Affichage
  50   */
  51  
  52  llxHeader('',$langs->trans("ListPayment"));
  53  
  54  $page=$_GET["page"];
  55  $sortorder=$_GET["sortorder"];
  56  $sortfield=$_GET["sortfield"];
  57   
  58  $limit = $conf->liste_limit;
  59  $offset = $limit * $page ;
  60  if (! $sortorder) $sortorder="DESC";
  61  if (! $sortfield) $sortfield="p.rowid";
  62    
  63  $sql = "SELECT p.rowid,".$db->pdate("p.datep")." as dp, p.amount,";
  64  $sql.= " p.statut, p.num_paiement,";
  65  $sql.= " c.libelle as paiement_type,";
  66  $sql.= " ba.rowid as bid, ba.label";
  67  $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as c,";
  68  $sql.= " ".MAIN_DB_PREFIX."paiement as p";
  69  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
  70  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
  71  if ($socidp)
  72  {
  73      $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
  74      $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
  75  }
  76  $sql.= " WHERE p.fk_paiement = c.id";
  77  if ($socidp)
  78  {
  79      $sql.= " AND f.fk_soc = ".$socidp;
  80  }
  81  if ($_GET["search_montant"])
  82  {
  83    $sql .=" AND p.amount=".ereg_replace(",",".",$_GET["search_montant"]);
  84  }
  85  
  86  if ($_GET["orphelins"])     // Option qui ne sert qu'au debogage
  87  {
  88      // Paiements liés à aucune facture (pour aide au diagnostic)
  89      $sql = "SELECT p.rowid,".$db->pdate("p.datep")." as dp, p.amount,";
  90      $sql.= " p.statut, p.num_paiement,";
  91      $sql.= " c.libelle as paiement_type";
  92      $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p,";
  93      $sql.= " ".MAIN_DB_PREFIX."c_paiement as c";
  94      $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf";
  95      $sql.= " ON p.rowid = pf.fk_paiement";
  96      $sql.= " WHERE p.fk_paiement = c.id AND pf.rowid IS NULL";
  97  }
  98  $sql .= " ORDER BY $sortfield $sortorder";
  99  $sql .= $db->plimit( $limit+1 ,$offset);
 100  //print "$sql";
 101  
 102  $resql = $db->query($sql);
 103  
 104  if ($resql)
 105  {
 106      $num = $db->num_rows($resql);
 107      $i = 0;
 108      $var=True;
 109  
 110      $paramlist=($_GET["orphelins"]?"&orphelins=1":"");
 111      print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num);
 112  
 113      print '<table class="noborder" width="100%">';
 114      print '<tr class="liste_titre">';
 115      print_liste_field_titre($langs->trans("Ref"),"liste.php","p.rowid","",$paramlist,"",$sortfield);
 116      print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$paramlist,'align="center"',$sortfield);
 117      print_liste_field_titre($langs->trans("Type"),"liste.php","c.libelle","",$paramlist,"",$sortfield);
 118      print_liste_field_titre($langs->trans("Account"),"liste.php","ba.label","",$paramlist,"",$sortfield);
 119      print_liste_field_titre($langs->trans("Amount"),"liste.php","p.amount","",$paramlist,'align="right"',$sortfield);
 120      print_liste_field_titre($langs->trans("Status"),"liste.php","p.statut","",$paramlist,'align="center"',$sortfield);
 121      print "</tr>\n";
 122  
 123  
 124      // Lignes des champs de filtre
 125      print '<form method="get" action="liste.php">';
 126      print '<tr class="liste_titre">';
 127      print '<td colspan="4">&nbsp;</td>';
 128  
 129      print '<td align="right">';
 130      print '<input class="fat" type="text" size="6" name="search_montant" value="'.$_GET["search_montant"].'">';
 131  
 132      print '</td><td align="right">';
 133      print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
 134      print '</td>';
 135      print "</tr>\n";
 136      print '</form>';
 137  
 138  
 139      while ($i < min($num,$limit))
 140      {
 141          $objp = $db->fetch_object($resql);
 142          $var=!$var;
 143          print "<tr $bc[$var]>";
 144          print '<td width="40"><a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").'</a>';
 145  
 146          print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$objp->rowid.'">'.$objp->rowid.'</a></td>';
 147  
 148          print '<td align="center">'.dolibarr_print_date($objp->dp).'</td>';
 149          print '<td>'.$objp->paiement_type.' '.$objp->num_paiement.'</td>';
 150          print '<td>';
 151          if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>';
 152          else print '&nbsp;';
 153          print '</td>';
 154          print '<td align="right">'.price($objp->amount).'</td>';
 155          print '<td align="center">';
 156  
 157          if ($objp->statut == 0)
 158          {
 159              print '<a href="fiche.php?id='.$objp->rowid.'&amp;action=valide">'.$langs->trans("ToValidate").'</a>';
 160          }
 161          else
 162          {
 163              print img_tick();
 164          }
 165  
 166          print '</td></tr>';
 167          $i++;
 168      }
 169      print "</table>";
 170  }
 171  else
 172  {
 173    dolibarr_print_error($db);
 174  }
 175  
 176  $db->close();
 177  
 178  llxFooter('$Date: 2005/11/19 02:38:29 $ - $Revision: 1.20 $');
 179  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics