[ 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/ -> bon.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: bon.php,v 1.3 2005/09/10 14:24:10 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/bon.php,v $
  21   *
  22   */
  23   
  24  /**
  25          \file       htdocs/compta/prelevement/bon.php
  26          \ingroup    prelevement
  27          \brief      Fiche aperçu du bon de prelevement
  28          \version    $Revision: 1.3 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  
  33  $langs->load("bills");
  34  
  35  /*
  36   * Sécurité accés client
  37   */
  38  if (!$user->rights->prelevement->bons->lire) accessforbidden();
  39  
  40  
  41  llxHeader('','Bon de prélèvement');
  42  
  43  $h = 0;
  44  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
  45  $head[$h][1] = $langs->trans("Card");
  46  $h++;      
  47  
  48  if ($conf->use_preview_tabs)
  49  {
  50      $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
  51      $head[$h][1] = $langs->trans("Preview");
  52      $hselected = $h;
  53      $h++;  
  54  }
  55  
  56  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
  57  $head[$h][1] = $langs->trans("Lines");
  58  $h++;  
  59  
  60  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
  61  $head[$h][1] = $langs->trans("Bills");
  62  $h++;  
  63  
  64  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
  65  $head[$h][1] = $langs->trans("Rejets");
  66  $h++;  
  67  
  68  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
  69  $head[$h][1] = $langs->trans("Statistics");
  70  $h++;  
  71  
  72  $prev_id = $_GET["id"];
  73  
  74  $html = new Form($db);
  75  
  76  if ($_GET["id"])
  77  {
  78    $bon = new BonPrelevement($db,"");
  79  
  80    if ($bon->fetch($_GET["id"]) == 0)
  81      {
  82        dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref);
  83  
  84        print '<table class="border" width="100%">';
  85  
  86        print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</td></tr>';
  87        print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
  88        print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
  89  
  90        $relativepath = 'bon/'.$bon->ref;
  91  
  92        print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$bon->ref.'</a>';
  93  
  94        print '</td></tr>';
  95        print '</table><br />';
  96  
  97        $fileimage = DOL_DATA_ROOT.'/prelevement/bon/'.$bon->ref.'.ps.png.0';
  98        $fileps = DOL_DATA_ROOT.'/prelevement/bon/'.$bon->ref.'.ps';
  99  
 100        // Conversion du PDF en image png si fichier png non existant
 101        if (!file_exists($fileimage))
 102          {
 103        print $fileimage;
 104        if (function_exists(imagick_readimage))
 105          {
 106  
 107            $handle = imagick_readimage( $fileps ) ;
 108            
 109            if ( imagick_iserror( $handle ) )
 110          {
 111            $reason      = imagick_failedreason( $handle ) ;
 112            $description = imagick_faileddescription( $handle ) ;
 113            
 114            print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
 115          }
 116            
 117            imagick_convert( $handle, "PNG" ) ;
 118            
 119            if ( imagick_iserror( $handle ) )
 120          {
 121            $reason      = imagick_failedreason( $handle ) ;
 122            $description = imagick_faileddescription( $handle ) ;
 123            
 124            print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
 125          }
 126            
 127            imagick_writeimage( $handle, $fileps .".png");
 128          }
 129        else
 130          {
 131            print "Les fonctions <i>imagick</i> ne sont pas disponibles sur ce PHP";
 132          }
 133          }
 134  
 135        if (file_exists($fileimage))
 136      {
 137        print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=prelevement&file='.urlencode(basename($fileimage)).'">';
 138        
 139      }
 140      }
 141    else
 142      {
 143        dolibarr_print_error($db);
 144      }
 145  }
 146  
 147  print "</div>";
 148  
 149  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/10 14:24:10 $ r&eacute;vision $Revision: 1.3 $</em>");
 150  ?>


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