00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
00040
00041
00042
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
00060
00061 function Header()
00062 {
00063
00064 $this->SetFont('DejaVu', 'B', 12);
00065
00066 $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
00067
00068 $this->Ln(20);
00069 $this->SetFont('DejaVu', 'B', 8);
00070
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
00089 $this->Cell(215,6,'report',0,0,'R');
00090 if ( $this->jrn_type != 'VEN')
00091 {
00092 $this->Cell(15,6,sprintf('%.2f',$this->rap_priv),0,0,'R');
00093 }
00094 $this->Cell(15,6,sprintf('%.2f',$this->rap_htva),0,0,'R');
00095
00096
00097
00098
00099 $this->Ln(6);
00100
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
00108
00109 function Footer()
00110 {
00111
00112 $this->SetY(-20);
00113
00114 $this->Cell(215,6,'Total page ','T',0,'R');
00115 if ( $this->jrn_type !='VEN')
00116 {
00117 $this->Cell(15,6,sprintf('%.2f',$this->tp_priv),'T',0,'R');
00118 }
00119 $this->Cell(15,6,sprintf('%.2f',$this->tp_htva),'T',0,'R');
00120 $this->Cell(0,6,'','T',0,'R');
00121 $this->Ln(2);
00122
00123 $this->Cell(215,6,'report',0,0,'R');
00124 if ( $this->jrn_type !='VEN')
00125 {
00126 $this->Cell(15,6,sprintf('%.2f',$this->rap_priv),0,0,'R');
00127 }
00128 $this->Cell(15,6,sprintf('%.2f',$this->rap_htva),0,0,'R');
00129 $this->Ln(2);
00130
00131
00132 $this->SetFont('Arial', 'I', 8);
00133
00134 $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
00135
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
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
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 }