dolibarr /htdocs/compta/prelevement/bon.php

Language PHP Lines 102
MD5 Hash f0f6ef12ecc2f1c8af06dd9c60e3ff35
Repository https://github.com/asterix14/dolibarr.git View Raw File
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
<?PHP
/* Copyright (C) 2005 	   Rodolphe Quiedeville <rodolphe@quiedeville.org>
 * Copyright (C) 2005 	   Laurent Destailleur  <eldy@users.sourceforge.net>
 * Copyright (C) 2010-2011 Juanjo Menent 	    <jmenent@2byte.es>
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

/**
 *      \file       htdocs/compta/prelevement/bon.php
 *      \ingroup    prelevement
 *      \brief      Fiche apercu du bon de prelevement
 */

require("../bank/pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/prelevement.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php";

$langs->load("bills");
$langs->load("categories");

// Security check
$socid=0;
$id = GETPOST("id");
$ref = GETPOST("ref");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement', $id);


llxHeader('','Bon de prelevement');

$form = new Form($db);

if ($id > 0 || ! empty($ref))
{
	$object = new BonPrelevement($db,"");

	if ($object->fetch($id) == 0)
    {
		$head = prelevement_prepare_head($object);	
		dol_fiche_head($head, 'preview', 'Prelevement : '. $object->ref);

		print '<table class="border" width="100%">';

		print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$object->ref.'</td></tr>';
		print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
		print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';

		$relativepath = 'bon/'.$object->ref;

		print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$object->ref.'</a>';

		print '</td></tr>';
		print '</table><br>';

		$fileimage = $conf->prelevement->dir_output.'/receipts/'.$object->ref.'.ps.png.0';
		$fileps = $conf->prelevement->dir_output.'/receipts/'.$object->ref.'.ps';

		// Conversion du PDF en image png si fichier png non existant
		if (!file_exists($fileimage))
        {
			if (class_exists("Imagick"))
			{
				$ret = dol_convert_file($file);
				if ($ret < 0) $error++;
			}
			else
			{
				$langs->load("errors");
				print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
			}
		}

		if (file_exists($fileimage))
		{
			print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=prelevement&file='.urlencode(basename($fileimage)).'">';

		}
	}
	else
	{
		dol_print_error($db);
    }
}

print "</div>";

llxFooter();
?>
Back to Top