noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
class_print_ledger_fin.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  * \brief print a listing of financial
00024  */
00025 require_once('class_pdf.php');
00026 class Print_Ledger_Financial extends PDF
00027 {
00028     private $rap_amount; /* amount from begining exercice */
00029     private $tp_amount; /* amount total page */
00030     
00031     function __construct($p_cn,  Acc_Ledger $p_jrn)
00032     {
00033         parent::__construct($p_cn,'P','mm','A4');
00034         $this->ledger=$p_jrn;
00035         $this->jrn_type=$p_jrn->get_type();
00036         
00037         // report from begin exercice
00038         $this->rap_amount=0; 
00039         
00040         // total page
00041         $this->tp_amount=0;
00042         
00043         $amount=$this->ledger->previous_amount($_GET['from_periode']);
00044         $this->rap_amount=$amount['amount'];
00045     }
00046     function Header()
00047     {
00048         //Arial bold 12
00049         $this->SetFont('DejaVu', 'B', 12);
00050         //Title
00051         $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
00052         //Line break
00053         $this->SetFont('DejaVu', 'B', 7);
00054         $this->Ln(10);
00055         $this->Cell(40,6,_('report'),0,0,'R');
00056         $this->Cell(40,6,nbm($this->rap_amount),0,0,'R');
00057         $this->Ln(6);
00058         $this->SetFont('DejaVu', 'B', 7);
00059         $this->Cell(15,6,'Piece');
00060         $this->Cell(10,6,'Date');
00061         $this->Cell(15,6,'Interne');
00062         $this->Cell(40,6,'Dest/Orig');
00063         $this->Cell(80,6,'Commentaire');
00064         $this->Cell(20,6,'Montant');
00065         $this->Ln(6);
00066         
00067     }
00068     function Footer()
00069     {
00070         $this->SetFont('DejaVu', 'B', 7);
00071 
00072         $this->Cell(40,6,_('Total page'),0,0,'R');
00073         $this->Cell(40,6,nbm($this->tp_amount),0,0,'R');
00074         bcscale(2);
00075         $this->rap_amount=bcadd($this->rap_amount,$this->tp_amount);
00076         $this->Cell(40,6,_('Total à reporter'),0,0,'R');
00077         $this->Cell(40,6,nbm($this->rap_amount),0,0,'R');
00078         $this->tp_amount=0;
00079         //Position at 2 cm from bottom
00080         $this->SetY(-20);
00081         //Arial italic 8
00082         $this->SetFont('Arial', 'I', 8);
00083         //Page number
00084         $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
00085         $this->Ln(3);
00086         // Created by NOALYSS
00087         $this->Cell(0,8,'Created by NOALYSS, online on http://www.aevalys.eu',0,0,'C',false,'http://www.aevalys.eu');
00088 
00089     }
00090     /**
00091      *@brief print the pdf for a financial ledger
00092      */
00093     function export()
00094     {
00095         $a_jrn=$this->ledger->get_operation($_GET['from_periode'],
00096                                             $_GET['to_periode']);
00097         $this->SetFont('DejaVu', '', 6);
00098         if ( $a_jrn == null ) return;
00099         bcscale(2);
00100         for ( $i=0;$i<count($a_jrn);$i++)
00101         {
00102             $row=$a_jrn[$i];
00103             $this->LongLine(15,5,$row['pj']);
00104             $this->Cell(10,5,$row['date_fmt']);
00105             $this->Cell(15,5,$row['internal']);
00106 
00107             $name=$this->ledger->get_tiers($this->jrn_type,$row['id']);
00108             $this->LongLine(40,5,$name,0,'L');
00109 
00110 
00111             $this->LongLine(80,5,$row['comment'],0,'L');
00112             $amount=$this->cn->get_value('select qf_amount from quant_fin where jr_id=$1',array( $row['id']));
00113             $this->Cell(20,5,sprintf('%s',nbm($amount)),0,0,'R');
00114             $this->Ln(5);
00115             $this->tp_amount=bcadd($this->tp_amount,$amount);
00116 
00117         }
00118     }
00119 }
 All Data Structures Namespaces Files Functions Variables Enumerations