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


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