[ 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/prelevement/ -> factures.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 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: factures.php,v 1.7 2005/09/10 14:24:10 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/factures.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/compta/prelevement/factures.php
  25          \ingroup    prelevement
  26          \brief      Page liste des factures prélevées
  27          \version    $Revision: 1.7 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
  32  require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
  33  
  34  // Sécurité accés client
  35  if ($user->societe_id > 0) accessforbidden();
  36  
  37  llxHeader('','Bon de prélèvement');
  38  
  39  $h = 0;
  40  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
  41  $head[$h][1] = $langs->trans("Card");
  42  $h++;      
  43  
  44  if ($conf->use_preview_tabs)
  45  {
  46      $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
  47      $head[$h][1] = $langs->trans("Preview");
  48      $h++;  
  49  }
  50  
  51  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
  52  $head[$h][1] = $langs->trans("Lines");
  53  $h++;  
  54  
  55  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
  56  $head[$h][1] = $langs->trans("Bills");
  57  $hselected = $h;
  58  $h++;  
  59  
  60  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
  61  $head[$h][1] = $langs->trans("Rejects");
  62  $h++;  
  63  
  64  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
  65  $head[$h][1] = $langs->trans("Statistics");
  66  $h++;  
  67  
  68  
  69  if ($_GET["id"])
  70  {
  71    $prev_id = $_GET["id"];
  72  
  73    $bon = new BonPrelevement($db,"");
  74  
  75    if ($bon->fetch($_GET["id"]) == 0)
  76      {
  77        dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref);
  78  
  79        print '<table class="border" width="100%">';
  80        print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</td></tr>';
  81        print '</table><br />';
  82      }
  83    else
  84      {
  85        print "Erreur";
  86      }
  87  }
  88  
  89  
  90  $page = $_GET["page"];
  91  $sortorder = (empty($_GET["sortorder"])) ? "DESC" : $_GET["sortorder"];
  92  $sortfield = (empty($_GET["sortfield"])) ? "p.datec" : $_GET["sortfield"];
  93  $offset = $conf->liste_limit * $page ;
  94  
  95  /*
  96   * Liste des factures
  97   */
  98  $sql = "SELECT pf.rowid";
  99  $sql .= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc";
 100  $sql .= " , s.idp, s.nom";
 101  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
 102  $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
 103  $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
 104  $sql .= " , ".MAIN_DB_PREFIX."facture as f";
 105  $sql .= " , ".MAIN_DB_PREFIX."societe as s";
 106  $sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
 107  $sql .= " AND pl.fk_prelevement_bons = p.rowid";
 108  $sql .= " AND f.fk_soc = s.idp";
 109  $sql .= " AND pf.fk_facture = f.rowid";
 110  if ($_GET["id"])
 111  {
 112    $sql .= " AND p.rowid=".$_GET["id"];
 113  }
 114  
 115  if ($_GET["socid"])
 116  {
 117    $sql .= " AND s.idp = ".$_GET["socid"];
 118  }
 119  
 120  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
 121  
 122  $result = $db->query($sql);
 123  
 124  if ($result)
 125  {
 126    $num = $db->num_rows($result);
 127    $i = 0;
 128    
 129    $urladd = "&amp;id=".$_GET["id"];
 130  
 131    print_barre_liste($langs->trans("Bills"), $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num);
 132  
 133    print"\n<!-- debut table -->\n";
 134    print '<table class="liste" width="100%">';
 135    print '<tr class="liste_titre">';
 136    print_liste_field_titre($langs->trans("Bill"),"factures.php","p.ref",'',$urladd,'class="liste_titre"');
 137    print_liste_field_titre($langs->trans("Company"),"factures.php","s.nom",'',$urladd,'class="liste_titre"');
 138    print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"');
 139    print '<td class="liste_titre" colspan="2">&nbsp;</td></tr>';
 140  
 141    $var=True;
 142  
 143    $total = 0;
 144  
 145    while ($i < min($num,$conf->liste_limit))
 146      {
 147        $obj = $db->fetch_object($result);    
 148  
 149        print "<tr $bc[$var]><td>";
 150  
 151        print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">';
 152        print img_object($langs->trans("ShowBill"),"bill");
 153        print '</a>&nbsp;';
 154  
 155        print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
 156  
 157        print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->idp.'">';
 158        print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."</a></td>\n";
 159  
 160        print '<td align="center">'.price($obj->total_ttc)."</td>\n";
 161  
 162        print '<td>';
 163  
 164        if ($obj->statut == 0)
 165      {
 166        print '-';
 167      }
 168        elseif ($obj->statut == 1)
 169      {
 170        print 'Crédité';
 171      }
 172        elseif ($obj->statut == 2)
 173      {
 174        print '<b>Rejeté</b>';
 175      }
 176  
 177        print "</td></tr>\n";
 178  
 179        $total += $obj->total_ttc;
 180        $var=!$var;
 181        $i++;
 182      }
 183  
 184    if($_GET["socid"])
 185      {
 186        print "<tr $bc[$var]><td>";
 187  
 188        print '<td>Total</td>';
 189  
 190        print '<td align="center">'.price($total)."</td>\n";
 191  
 192        print '<td>&nbsp;</td>';
 193  
 194        print "</tr>\n";
 195      }
 196  
 197    print "</table>";
 198    $db->free($result);
 199  }
 200  else 
 201  {
 202    dolibarr_print_error($db);
 203  }
 204  
 205  $db->close();
 206  
 207  llxFooter('$Date: 2005/09/10 14:24:10 $ - $Revision: 1.7 $');
 208  ?>


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