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

   1  <?php
   2  /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004      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: rapport.php,v 1.12 2005/10/08 19:13:59 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/paiement/rapport.php,v $
  21   *
  22   */
  23   
  24  /**     \file       htdocs/compta/paiement/rapport.php
  25          \ingroup    facture
  26          \brief      Rapports de paiements
  27          \version    $Revision: 1.12 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  $user->getrights("facture");
  33  
  34  
  35  // Sécurité accés
  36  if (! $user->rights->facture->lire)
  37    accessforbidden();
  38  
  39  $socidp=0;
  40  if ($user->societe_id > 0) 
  41  {
  42      $action = '';
  43      $socidp = $user->societe_id;
  44  }
  45  
  46  
  47  
  48  $year = $_GET["year"];
  49  if (! $year) { $year=date("Y"); }
  50  
  51  require ("../../includes/modules/rapport/pdf_paiement.class.php");
  52  
  53  $dir = $conf->compta->dir_output;
  54  
  55  
  56  /*
  57   * Action générer fichier rapport paiements
  58   */
  59  if ($_POST["action"] == 'gen')
  60  {
  61    $rap = new pdf_paiement($db);
  62    $rap->write_pdf_file($dir, $_POST["remonth"], $_POST["reyear"]);
  63    
  64    $year = $_POST["reyear"];
  65  }
  66  
  67  llxHeader();
  68  
  69  
  70  /*
  71   * Affichage liste des paiements
  72   *
  73   */
  74  $titre=($year?$langs->trans("PaymentsReportsForYear",$year):$langs->trans("PaymentsReports"));
  75  print_titre($titre);
  76  
  77  // Formulaire de génération
  78  print '<br><form method="post" action="rapport.php?year='.$year.'">';
  79  print '<input type="hidden" name="action" value="gen">';
  80  $cmonth = date("n", time());
  81  $syear = date("Y", time());
  82      
  83  $strmonth[1] = "Janvier";
  84  $strmonth[2] = "F&eacute;vrier";
  85  $strmonth[3] = "Mars";
  86  $strmonth[4] = "Avril";
  87  $strmonth[5] = "Mai";
  88  $strmonth[6] = "Juin";
  89  $strmonth[7] = "Juillet";
  90  $strmonth[8] = "Ao&ucirc;t";
  91  $strmonth[9] = "Septembre";
  92  $strmonth[10] = "Octobre";
  93  $strmonth[11] = "Novembre";
  94  $strmonth[12] = "D&eacute;cembre";
  95  
  96  print '<select name="remonth">';    
  97  for ($month = 1 ; $month < 13 ; $month++)
  98  {
  99    if ($month == $cmonth)
 100      {
 101        print "<option value=\"$month\" selected=\"true\">" . $strmonth[$month];
 102      }
 103    else
 104      {
 105        print "<option value=\"$month\">" . $strmonth[$month];
 106      }
 107  }
 108  print "</select>";
 109      
 110  print '<select name="reyear">';
 111  
 112  for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++)
 113  {
 114    if ($formyear == $syear)
 115      {
 116        print "<option value=\"$formyear\" selected=\"true\">$formyear";
 117      }
 118    else
 119      {
 120        print "<option value=\"$formyear\">$formyear";
 121      }
 122  }
 123  print "</select>\n";
 124  print '<input type="submit" value="'.$langs->trans("Create").'">';
 125  print '</form>';
 126  
 127  
 128  clearstatcache();
 129  
 130  
 131  if (is_dir($dir)) {
 132      $handle=opendir($dir);
 133      while (($file = readdir($handle))!==false)
 134      {
 135        if (is_dir($dir.$file) && substr($file, 0, 1) <> '.')
 136          {
 137            print '<a href="rapport.php?year='.$file.'">'.$file.'</a> ';
 138          }
 139      }
 140  }
 141  
 142  if ($year)
 143  {
 144    if (is_dir($dir.'/'.$year)) {
 145        $handle=opendir($dir.'/'.$year);
 146        print '<br>';
 147        print '<table width="100%" class="noborder">';
 148        print '<tr class="liste_titre"><td>Rapport</td><td align="right">'.$langs->trans("Size").'</td><td align="right">'.$langs->trans("Date").'</td></tr>';
 149        $var=true;
 150        while (($file = readdir($handle))!==false)
 151          {
 152            if (substr($file, 0, 8) == 'paiement')
 153          {
 154            $var=!$var;
 155            $tfile = $dir . '/'.$year.'/'.$file;
 156            $relativepath = $year.'/'.$file;
 157            print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
 158            print '<td align="right">'.filesize($tfile). ' bytes</td>';
 159            print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($tfile)).'</td></tr>';
 160          }
 161          }
 162        print '</table>';
 163      }
 164  }
 165  $db->close();
 166   
 167  llxFooter("<em>Derni&egrave;re modification $Date: 2005/10/08 19:13:59 $ r&eacute;vision $Revision: 1.12 $</em>");
 168  ?>


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