noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
class_print_ledger_simple_without_vat.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 this class extends PDF and let you export the detailled printing
00024  *  of any ledgers
00025  */
00026 require_once('class_pdf.php');
00027 
00028 class Print_Ledger_Simple_Without_Vat extends PDF
00029 {
00030     public function __construct ($p_cn,$p_jrn)
00031     {
00032 
00033         if($p_cn == null) die("No database connection. Abort.");
00034 
00035         parent::__construct($p_cn,'L', 'mm', 'A4');
00036         $this->ledger=$p_jrn;
00037         $this->jrn_type=$p_jrn->get_type();
00038         //----------------------------------------------------------------------
00039         /* report
00040          *
00041          * get rappel to initialize amount rap_xx
00042          *the easiest way is to compute sum from quant_
00043          */
00044         $this->previous=$this->ledger->previous_amount($_GET['from_periode']);
00045 
00046 
00047         $this->rap_htva=$this->previous['price'];
00048         $this->rap_tvac=$this->previous['price'];
00049         $this->rap_priv=$this->previous['priv'];
00050 
00051 
00052     }
00053 
00054     function setDossierInfo($dossier = "n/a")
00055     {
00056         $this->dossier = dossier::name()." ".$dossier;
00057     }
00058     /**
00059      *@brief write the header of each page
00060      */
00061     function Header()
00062     {
00063         //Arial bold 12
00064         $this->SetFont('DejaVu', 'B', 12);
00065         //Title
00066         $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
00067         //Line break
00068         $this->Ln(20);
00069         $this->SetFont('DejaVu', 'B', 8);
00070         /* column header */
00071         $this->Cell(15,6,'Pièce');
00072         $this->Cell(15,6,'Date');
00073         $this->Cell(20,6,'ref');
00074         if ( $this->jrn_type=='ACH')
00075             $this->Cell(60,6,'Client');
00076         else
00077             $this->Cell(60,6,'Fournisseur');
00078         $this->Cell(105,6,'Commentaire');
00079         if ( $this->jrn_type=='ACH')
00080         {
00081             $this->Cell(15,6,'Privé',0,0,'R');
00082         }
00083         $this->Cell(15,6,'Prix',0,0,'R');
00084 
00085         $this->Ln(5);
00086 
00087         $this->SetFont('DejaVu','',6);
00088         // page Header
00089         $this->Cell(215,6,'report',0,0,'R'); /* HTVA */
00090         if ( $this->jrn_type != 'VEN')
00091         {
00092             $this->Cell(15,6,sprintf('%.2f',$this->rap_priv),0,0,'R');  /* prive */
00093         }
00094         $this->Cell(15,6,sprintf('%.2f',$this->rap_htva),0,0,'R'); /* HTVA */
00095 
00096 
00097 
00098 
00099         $this->Ln(6);
00100         //total page
00101         $this->tp_htva=0.0;
00102         $this->tp_tvac=0.0;
00103         $this->tp_priv=0;
00104         $this->tp_nd=0;
00105     }
00106     /**
00107      *@brief write the Footer
00108      */
00109     function Footer()
00110     {
00111         //Position at 3 cm from bottom
00112         $this->SetY(-20);
00113         /* write reporting  */
00114         $this->Cell(215,6,'Total page ','T',0,'R'); /* HTVA */
00115         if ( $this->jrn_type !='VEN')
00116         {
00117             $this->Cell(15,6,sprintf('%.2f',$this->tp_priv),'T',0,'R');  /* prive */
00118         }
00119         $this->Cell(15,6,sprintf('%.2f',$this->tp_htva),'T',0,'R'); /* HTVA */
00120         $this->Cell(0,6,'','T',0,'R'); /* line */
00121         $this->Ln(2);
00122 
00123         $this->Cell(215,6,'report',0,0,'R'); /* HTVA */
00124         if ( $this->jrn_type !='VEN')
00125         {
00126             $this->Cell(15,6,sprintf('%.2f',$this->rap_priv),0,0,'R');  /* prive */
00127         }
00128         $this->Cell(15,6,sprintf('%.2f',$this->rap_htva),0,0,'R'); /* HTVA */
00129         $this->Ln(2);
00130 
00131         //Arial italic 8
00132         $this->SetFont('Arial', 'I', 8);
00133         //Page number
00134         $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
00135         // Created by NOALYSS
00136         $this->Cell(0,8,'Created by NOALYSS, online on http://www.aevalys.eu',0,0,'R',false,'http://www.aevalys.eu');
00137     }
00138 
00139     function Cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
00140     {
00141         $txt = str_replace("\\", "", $txt);
00142         return parent::Cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
00143     }
00144     /**
00145      *@brief export the ledger in  PDF
00146      */
00147     function export()
00148     {
00149 
00150         $a_jrn=$this->ledger->get_operation($_GET['from_periode'],
00151                                             $_GET['to_periode']);
00152 
00153         if ( $a_jrn == null ) return;
00154         for ( $i=0;$i<count($a_jrn);$i++)
00155         {
00156 
00157             $row=$a_jrn[$i];
00158             $this->LongLine(15,5,($row['pj']),0);
00159             $this->Cell(15,5,$row['date_fmt'],0,0);
00160             $this->Cell(20,5,$row['internal'],0,0);
00161             list($qc,$name)=$this->get_tiers($row['id'],$this->jrn_type);
00162             $this->Cell(20,5,$qc,0,0);
00163             $this->LongLine(40,5,$name,0,'L');
00164 
00165             $this->LongLine(105,5,$row['comment'],0,'L');
00166 
00167             /* get other amount (without vat, total vat included, private, ND */
00168             $other=$this->ledger->get_other_amount($a_jrn[$i]['jr_grpt_id']);
00169             $this->tp_htva+=$other['price'];
00170             $this->tp_priv+=$other['priv'];
00171             $this->rap_htva+=$other['price'];
00172             $this->rap_priv+=$other['priv'];
00173 
00174 
00175             if ( $this->jrn_type !='VEN')
00176             {
00177                 $this->Cell(15,6,sprintf("%.2f",$other['priv']),0,0,'R');
00178             }
00179 
00180             $this->Cell(15,6,sprintf("%.2f",$other['price']),0,0,'R');
00181             $this->Ln(5);
00182         }
00183     }
00184 
00185 }
 All Data Structures Namespaces Files Functions Variables Enumerations