diff --git a/htdocs/compta/prelevement/bon.php b/htdocs/compta/prelevement/bon.php new file mode 100644 index 00000000000..eb492099c6f --- /dev/null +++ b/htdocs/compta/prelevement/bon.php @@ -0,0 +1,153 @@ + + * Copyright (C) 2005 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +/** + \file htdocs/compta/prelevement/bon.php + \ingroup prelevement + \brief Fiche aperçu du bon de prelevement + \version $Revision$ +*/ + +require("./pre.inc.php"); + +$langs->load("bills"); + +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) accessforbidden(); + +llxHeader('','Bon de prélèvement'); + +$h = 0; +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("Card"); +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("Bon"); +$hselected = $h; +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("Lignes"); +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("Bills"); +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("Rejets"); +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("Statistics"); +$h++; + +$prev_id = $_GET["id"]; + +$html = new Form($db); + +if ($_GET["id"]) +{ + $bon = new BonPrelevement($db,""); + + if ($bon->fetch($_GET["id"]) == 0) + { + dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref); + + if ($_GET["action"] == 'credite') + { + $html->form_confirm("fiche.php?id=".$bon->id,"Classer comme crédité","Etes-vous sûr de vouloir classer ce bon de prélèvement comme crédité sur votre compte bancaire ?","confirm_credite"); + print '
'; + } + + print ''; + + print ''; + print ''; + print ''; + print '
'.$langs->trans("Ref").''.$bon->ref.'
'.$langs->trans("Amount").''.price($bon->amount).'
'.$langs->trans("File").''; + + $relativepath = 'bon/'.$bon->ref; + + print ''.$bon->ref.''; + + print '

'; + + $fileimage = DOL_DATA_ROOT.'/prelevement/bon/'.$bon->ref.'.ps.png.0'; + $fileps = DOL_DATA_ROOT.'/prelevement/bon/'.$bon->ref.'.ps'; + + // Conversion du PDF en image png si fichier png non existant + if (!file_exists($fileimage)) + { + print $fileimage; + if (function_exists(imagick_readimage)) + { + + $handle = imagick_readimage( $fileps ) ; + + if ( imagick_iserror( $handle ) ) + { + $reason = imagick_failedreason( $handle ) ; + $description = imagick_faileddescription( $handle ) ; + + print "handle failed!
\nReason: $reason
\nDescription: $description
\n"; + } + + imagick_convert( $handle, "PNG" ) ; + + if ( imagick_iserror( $handle ) ) + { + $reason = imagick_failedreason( $handle ) ; + $description = imagick_faileddescription( $handle ) ; + + print "handle failed!
\nReason: $reason
\nDescription: $description
\n"; + } + + imagick_writeimage( $handle, $fileps .".png"); + } + else + { + print "Les fonctions imagick ne sont pas disponibles sur ce PHP"; + } + + } + + if (file_exists($fileimage)) + { + print ''; + + } + } + else + { + dolibarr_print_error($db); + } +} + +print ""; + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>