Correction du bug #18267

This commit is contained in:
Rodolphe Quiedeville 2006-12-07 10:36:00 +00:00
parent 6e592b2e37
commit 199b01afef

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -22,62 +22,66 @@
*/ */
/** /**
\file htdocs/includes/modules/rapport/pdf_paiement.class.php \file htdocs/includes/modules/rapport/pdf_paiement.class.php
\ingroup banque \ingroup banque
\brief Fichier de la classe permettant de générer les rapports de paiement \brief Fichier de la classe permettant de générer les rapports de paiement
\version $Revision$ \version $Revision$
*/ */
require_once(FPDF_PATH.'fpdf.php'); require_once(FPDF_PATH.'fpdf.php');
/**
/** \class pdf_paiement \class pdf_paiement
\brief Classe permettant de générer les rapports de paiement \brief Classe permettant de générer les rapports de paiement
*/ */
class pdf_paiement class pdf_paiement
{ {
/**
/** \brief Constructeur \brief Constructeur
\param db handler accès base de donnée \param db handler accès base de donnée
*/ */
function pdf_paiement($db=0) function pdf_paiement($db=0)
{ {
global $langs; global $langs;
$langs->load("bills"); $langs->load("bills");
$this->db = $db; $this->db = $db;
$this->description = $langs->trans("ListOfCustomerPayments"); $this->description = $langs->trans("ListOfCustomerPayments");
$this->tab_top = 30; $this->tab_top = 30;
$this->line_height = 5; $this->line_height = 5;
$this->line_per_page = 25; $this->line_per_page = 25;
$this->tab_height = 230; //$this->line_height * $this->line_per_page; $this->tab_height = 230; //$this->line_height * $this->line_per_page;
} }
/**
\brief Generate Header
function Header(&$pdf, $page, $pages) \param pdf pdf object
{ \param page current page number
global $langs; \param pages number of pages
*/
$title=$this->description.' - '.dolibarr_print_date(mktime(0,0,0,$this->month),"%B"); function Header(&$pdf, $page, $pages)
$pdf->SetFont('Arial','B',12); {
$pdf->Text(76, 10, $title); global $langs;
$pdf->SetFont('Arial','B',12); $title=$this->description.' - '.dolibarr_print_date(mktime(0,0,0,$this->month),"%B");
$pdf->Text(11, 16, $langs->trans("Date")." : ".dolibarr_print_date(time(),"%d %b %Y")); $pdf->SetFont('Arial','B',12);
$pdf->Text(76, 10, $title);
$pdf->SetFont('Arial','',12);
$pdf->Text(11, 22, $langs->trans("Page")." : ".$page); $pdf->SetFont('Arial','B',12);
// $pdf->Text(11, 22, "Page " . $page . " sur " . $pages); $pdf->Text(11, 16, $langs->trans("Date")." : ".dolibarr_print_date(time(),"%d %b %Y"));
$pdf->SetFont('Arial','',12); $pdf->SetFont('Arial','',12);
$pdf->Text(11, 22, $langs->trans("Page")." : ".$page);
$pdf->Text(11,$this->tab_top + 6,'Date'); // $pdf->Text(11, 22, "Page " . $page . " sur " . $pages);
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); $pdf->SetFont('Arial','',12);
$pdf->Text(11,$this->tab_top + 6,'Date');
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
$pdf->Text(42, $this->tab_top + 6, $langs->trans("PaymentMode")); $pdf->Text(42, $this->tab_top + 6, $langs->trans("PaymentMode"));
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10); $pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
@ -154,24 +158,22 @@ class pdf_paiement
} }
} }
/** /**
\brief Fonction générant le rapport sur le disque \brief Fonction générant le rapport sur le disque
\param _dir repertoire \param _dir repertoire
\param month mois du rapport \param month mois du rapport
\param year annee du rapport \param year annee du rapport
*/ */
function write_pdf_file($_dir, $month, $year) function write_pdf_file($_dir, $month, $year)
{ {
global $langs; global $langs;
$this->month=$month;
$this->year=$year;
$dir=$_dir.'/'.$year;
$this->month=$month; if (! is_dir($dir))
$this->year=$year;
$dir=$_dir.'/'.$year;
if (! is_dir($dir))
{ {
$result=create_exdir($dir); $result=create_exdir($dir);
if ($result < 0) if ($result < 0)
@ -189,7 +191,8 @@ class pdf_paiement
$pdf->Open(); $pdf->Open();
$sql = "SELECT ".$this->db->pdate("p.datep")." as dp, f.facnumber"; $sql = "SELECT ".$this->db->pdate("p.datep")." as dp, f.facnumber";
$sql .= ", c.libelle as paiement_type, p.num_paiement"; //$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql .= ", c.code as paiement_code, p.num_paiement";
$sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount "; $sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
$sql .= ", pf.amount as pf_amount "; $sql .= ", pf.amount as pf_amount ";
$sql .= ", p.rowid as prowid"; $sql .= ", p.rowid as prowid";
@ -217,7 +220,8 @@ class pdf_paiement
$lines[$i][0] = $objp->facnumber; $lines[$i][0] = $objp->facnumber;
$lines[$i][1] = dolibarr_print_date($objp->dp,"%d %B %Y"); $lines[$i][1] = dolibarr_print_date($objp->dp,"%d %B %Y");
$lines[$i][2] = $objp->paiement_type ; //$lines[$i][2] = $objp->paiement_type ;
$lines[$i][2] = $langs->trans("PaymentTypeShort".$objp->paiement_code);
$lines[$i][3] = $objp->num_paiement; $lines[$i][3] = $objp->num_paiement;
$lines[$i][4] = price($objp->paiement_amount); $lines[$i][4] = price($objp->paiement_amount);
$lines[$i][5] = price($objp->facture_amount); $lines[$i][5] = price($objp->facture_amount);