[ 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/ -> fiche-rejet.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: fiche-rejet.php,v 1.5 2005/11/03 10:30:35 rodolphe Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/fiche-rejet.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 - Rejet');
  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  $h++;  
  47  
  48  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
  49  $head[$h][1] = $langs->trans("Bills");
  50  $h++;  
  51  
  52  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
  53  $head[$h][1] = $langs->trans("Rejects");
  54  $hselected = $h;
  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        dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref);
  70  
  71        print '<table class="border" width="100%">';
  72        print '<tr><td width="20%">Référence</td><td>'.$bon->ref.'</td></tr>';
  73        print '</table><br />';
  74      }
  75    else
  76      {
  77        print "Erreur";
  78      }
  79  }
  80  
  81  $page = $_GET["page"];
  82  $rej = new RejetPrelevement($db, $user);
  83  /*
  84   * Liste des factures
  85   *
  86   *
  87   */
  88  $sql = "SELECT pl.rowid, pl.amount, pl.statut";
  89  $sql .= " , s.idp, s.nom";
  90  $sql .= " , pr.motif, pr.afacturer, pr.fk_facture";
  91  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
  92  $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
  93  $sql .= " , ".MAIN_DB_PREFIX."societe as s";
  94  $sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
  95  $sql .= " WHERE p.rowid=".$prev_id;
  96  $sql .= " AND pl.fk_prelevement_bons = p.rowid";
  97  $sql .= " AND pl.fk_soc = s.idp";
  98  $sql .= " AND pl.statut = 3 ";
  99  $sql .= " AND pr.fk_prelevement_lignes = pl.rowid";
 100  
 101  if ($_GET["socid"])
 102  {
 103    $sql .= " AND s.idp = ".$_GET["socid"];
 104  }
 105  
 106  $sql .= " ORDER BY pl.amount DESC";
 107  
 108  $resql = $db->query($sql);
 109  if ($resql)
 110  {
 111    $num = $db->num_rows($resql);
 112    $i = 0;
 113    
 114    print_barre_liste("Lignes de prélèvement rejetées", $page, "fiche-rejet.php", $urladd, $sortfield, $sortorder, '', $num);
 115    print"\n<!-- debut table -->\n";
 116    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 117    print '<tr class="liste_titre">';
 118    print '<td>Ligne</td><td>Société</td><td align="right">Montant</td><td>Motif</td><td align="center">A Facturer</td><td align="center">Facture</td></tr>';
 119  
 120    $var=True;
 121    $total = 0;
 122  
 123    while ($i < $num)
 124      {
 125        $obj = $db->fetch_object($resql);    
 126  
 127        print "<tr $bc[$var]><td>";
 128        print '<img border="0" src="./statut'.$obj->statut.'.png"></a>&nbsp;';
 129        print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
 130  
 131        print substr('000000'.$obj->rowid, -6);
 132        print '</a></td>';
 133        print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->idp.'">'.stripslashes($obj->nom)."</a></td>\n";
 134  
 135        print '<td align="right">'.price($obj->amount)."</td>\n";
 136        print '<td>'.$rej->motifs[$obj->motif].'</td>';
 137  
 138        print '<td align="center">'.$langs->trans($yesno[$obj->afacturer]).'</td>';
 139        print '<td align="center">'.$obj->fk_facture.'</td>';
 140        print "</tr>\n";
 141  
 142        $total += $obj->amount;
 143        $var=!$var;
 144        $i++;
 145      }
 146  
 147    print "<tr $bc[$var]><td>&nbsp;</td>";
 148    print "<td>Total</td>\n";
 149    print '<td align="right">'.price($total)."</td>\n";
 150    print '<td>&nbsp;</td>';
 151    print "</tr>\n</table>\n";
 152    $db->free($resql);
 153  }
 154  else 
 155  {
 156    dolibarr_print_error($db);
 157  }
 158  
 159  $db->close();
 160  
 161  llxFooter('$Date: 2005/11/03 10:30:35 $ - $Revision: 1.5 $');
 162  ?>


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