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

   1  <?php
   2  /* Copyright (C) 2004-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: index.php,v 1.17 2005/09/10 14:24:10 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/index.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/compta/prelevement/index.php
  25          \brief      Prelevement
  26          \version    $Revision: 1.17 $
  27  */
  28  
  29  require ("./pre.inc.php");
  30  require_once DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php";
  31  
  32  if (!$user->rights->prelevement->bons->lire)
  33    accessforbidden();
  34  
  35  
  36  
  37  /*
  38   * Affichage page
  39   *
  40   */
  41  
  42  llxHeader();
  43  
  44  
  45  print_fiche_titre($langs->trans("StandingOrdersArea"));
  46  
  47  print '<table border="0" width="100%" class="notopnoleftnoright">';
  48  
  49  print '<tr><td valign="top" width="30%" class="notopnoleft">';
  50  
  51  
  52  $bprev = new BonPrelevement($db);
  53  $var=true;
  54  
  55  print '<table class="noborder" width="100%">';
  56  print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
  57  $var=!$var;
  58  print '<tr '.$bc[$var].'><td>Nb de facture à prélever</td>';
  59  print '<td align="right">';
  60  print $bprev->NbFactureAPrelever();
  61  print '</td></tr>';
  62  $var=!$var;
  63  print '<tr '.$bc[$var].'><td>Somme à prélever</td>';
  64  print '<td align="right">';
  65  print price($bprev->SommeAPrelever());
  66  print '</td></tr></table><br>';
  67  
  68  
  69  /*
  70   * Bon de prélèvement
  71   *
  72   */
  73  $sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec";
  74  $sql .= " ,p.statut ";
  75  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
  76  $sql .= " ORDER BY datec DESC LIMIT 5";
  77  
  78  $result = $db->query($sql);
  79  if ($result)
  80  {
  81    $num = $db->num_rows($result);
  82    $i = 0;  
  83    $var=True;
  84  
  85    print"\n<!-- debut table -->\n";
  86    print '<table class="noborder" width="100%">';
  87    print '<tr class="liste_titre"><td>'.$langs->trans("WithdrawalReceiptShort").'</td><td>'.$langs->trans("Date").'</td>';
  88    print '<td align="right">'.$langs->trans("Amount").'</td>';
  89    print '</tr>';
  90  
  91    while ($i < $num)
  92      {
  93        $obj = $db->fetch_object($result);    
  94        $var=!$var;
  95  
  96        print "<tr $bc[$var]><td>";
  97  
  98        print '<img border="0" src="./statut'.$obj->statut.'.png"></a>&nbsp;';
  99  
 100        print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
 101  
 102        print '<td>'.dolibarr_print_date($obj->datec,"%d/%m/%Y %H:%M")."</td>\n";
 103  
 104        print '<td align="right">'.price($obj->amount)."</td>\n";
 105  
 106        print "</tr>\n";
 107        $i++;
 108      }
 109    print "</table>";
 110    $db->free($result);
 111  }
 112  else 
 113  {
 114    dolibarr_print_error($db);
 115  }
 116  
 117  print '</td><td valign="top" width="70%">';
 118  
 119  /*
 120   * Factures
 121   *
 122   */
 123  $sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp";
 124  $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
 125  $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
 126  $sql .= " WHERE s.idp = f.fk_soc";
 127  $sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
 128  
 129  if ($socidp)
 130  {
 131    $sql .= " AND f.fk_soc = $socidp";
 132  }
 133  
 134  if ( $db->query($sql) )
 135  {
 136    $num = $db->num_rows();
 137    $i = 0;
 138    
 139    if ($num)
 140      {
 141        print '<table class="noborder" width="100%">';
 142        print '<tr class="liste_titre">';
 143        print '<td colspan="2">Factures en attente de prélèvement ('.$num.')</td></tr>';
 144        $var = True;
 145        while ($i < $num && $i < 20)
 146      {
 147        $obj = $db->fetch_object();
 148        $var=!$var;
 149        print '<tr '.$bc[$var].'><td>';
 150        print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>';
 151        print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'</a></td>';
 152        print '</tr>';
 153        $i++;
 154      }
 155        
 156        print "</table><br>";
 157  
 158      }
 159  }
 160  else
 161  {
 162    dolibarr_print_error($db);
 163  }  
 164  
 165  print '</td></tr></table>';
 166  
 167  llxFooter('$Date: 2005/09/10 14:24:10 $ - $Revision: 1.17 $');
 168  
 169  ?>


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