noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
print_ledger_simple_without_vat.class.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
22/*!
23 * \file
24 * \brief this class extends PDF and let you export the detailled printing
25 * of any ledgers
26 */
27/*!
28 * \class Print_Ledger_Simple_Without_Vat
29 * \brief this class extends PDF and let you export the detailled printing
30 * of any ledgers
31 */
32
34{
35 protected $tp_priv;
36 protected $tp_htva;
37 protected $tp_tvac;
38 protected $tp_nd;
39 public function __construct ($p_cn,$p_jrn,$p_from,$p_to,$p_filter_operation)
40 {
41
42
43 parent::__construct($p_cn,'L', 'mm', 'A4',$p_jrn,$p_from,$p_to,$p_filter_operation);
44 $this->jrn_type=$p_jrn->get_type();
45 //----------------------------------------------------------------------
46 /* report
47 *
48 * get rappel to initialize amount rap_xx
49 *the easiest way is to compute sum from quant_
50 */
51 $this->previous=$this->get_ledger()->previous_amount($p_from);
52
53
54 $this->rap_htva=$this->previous['price'];
55 $this->rap_tvac=$this->previous['price'];
56 $this->rap_priv=$this->previous['priv'];
57
58 }
59
60 function setDossierInfo($dossier = "n/a")
61 {
62 $this->dossier = dossier::name()." ".$dossier;
63 }
64 /**
65 *@brief write the header of each page
66 */
67 function Header()
68 {
69 //Arial bold 12
70 $this->SetFont('DejaVu', 'B', 12);
71 //Title
72 $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
73 //Line break
74 $this->Ln(20);
75 $this->SetFont('DejaVu', 'B', 8);
76 /* column header */
77 $this->Cell(15,6,'Pièce');
78 $this->Cell(15,6,'Date');
79 $this->Cell(20,6,'ref');
80 if ( $this->jrn_type=='ACH')
81 $this->Cell(60,6,'Client');
82 else
83 $this->Cell(60,6,'Fournisseur');
84 $this->Cell(105,6,'Commentaire');
85 if ( $this->jrn_type=='ACH')
86 {
87 $this->Cell(15,6,'Privé',0,0,'R');
88 }
89 $this->Cell(15,6,'Prix',0,0,'R');
90
91 $this->Ln(5);
92
93 $this->SetFont('DejaVu','',6);
94 // page Header
95 $this->Cell(215,6,'report',0,0,'R'); /* HTVA */
96 if ( $this->jrn_type != 'VEN')
97 {
98 $this->Cell(15,6,sprintf('%.2f',$this->rap_priv),0,0,'R'); /* prive */
99 }
100 $this->Cell(15,6,sprintf('%.2f',$this->rap_htva),0,0,'R'); /* HTVA */
101
102
103
104
105 $this->Ln(6);
106 //total page
107 $this->tp_htva=0.0;
108 $this->tp_tvac=0.0;
109 $this->tp_priv=0;
110 $this->tp_nd=0;
111 }
112 /**
113 *@brief write the Footer
114 */
115 function Footer()
116 {
117 //Position at 3 cm from bottom
118 $this->SetY(-20);
119 /* write reporting */
120 $this->Cell(215,6,'Total page ','T',0,'R'); /* HTVA */
121 if ( $this->jrn_type !='VEN')
122 {
123 $this->Cell(15,6,sprintf('%.2f',$this->tp_priv),'T',0,'R'); /* prive */
124 }
125 $this->Cell(15,6,sprintf('%.2f',$this->tp_htva),'T',0,'R'); /* HTVA */
126 $this->Cell(0,6,'','T',0,'R'); /* line */
127 $this->Ln(2);
128
129 $this->Cell(215,6,'report',0,0,'R'); /* HTVA */
130 if ( $this->jrn_type !='VEN')
131 {
132 $this->Cell(15,6,sprintf('%.2f',$this->rap_priv),0,0,'R'); /* prive */
133 }
134 $this->Cell(15,6,sprintf('%.2f',$this->rap_htva),0,0,'R'); /* HTVA */
135 $this->Ln(2);
136
137 //Arial italic 8
138 $this->SetFont('Arial', 'I', 8);
139 //Page number
140 $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
141 // Created by NOALYSS
142 $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'R',false,'https://www.noalyss.eu');
143 }
144
145 /**
146 *@brief export the ledger in PDF
147 */
148 function export()
149 {
150
151 $ledger_history=Acc_Ledger_History::factory($this->cn,
152 array($this->get_ledger()->id),
153 $this->get_from(),
154 $this->get_to(),
155 'D',
156 $this->get_filter_operation());
157
158 $ledger_history->get_row();
159 $a_jrn=$ledger_history->get_data();
160
161 if ( empty($a_jrn ) ) return;
162
163 // Prepare the query for reconcile date
164 $prepared_query=new Prepared_Query($this->cn);
165 $prepared_query->prepare_reconcile_date();
166
167 $ledger=$this->get_ledger();
168
169 for ( $i=0;$i<count($a_jrn);$i++)
170 {
171
172 $row=$a_jrn[$i];
173 $this->write_multi(15,3,($row['jr_pj_number']),0);
174 $this->write_cell(15,5,$row['str_date_short'],0,0);
175 $this->write_cell(20,5,$row['jr_internal'],0,0);
176 list($qc,$name)=$this->get_tiers($row['jr_id'],$this->jrn_type);
177 $this->write_cell(20,5,$qc,0,0);
178 $this->write_multi(40,3,$name,0,'L');
179
180 $this->write_multi(105,3,$row['jr_comment'],0,'L');
181
182 /* get other amount (without vat, total vat included, private, ND */
183 $other=$ledger->get_other_amount($a_jrn[$i]['jr_grpt_id']);
184 $this->tp_htva+=$other['price'];
185 $this->tp_priv+=$other['priv'];
186 $this->rap_htva+=$other['price'];
187 $this->rap_priv+=$other['priv'];
188
189
190 if ( $ledger_history->get_ledger_type() !='VEN')
191 {
192 $this->write_cell(15,5,sprintf("%.2f",$other['priv']),0,0,'R');
193 }
194
195 $this->write_cell(15,5,sprintf("%.2f",$other['price']),0,0,'R');
196 $ret_reconcile=$this->cn->execute('reconcile_date',array($row['jr_id']));
198 $str_payment="";
199 if ($max > 0) {
200 $sep="";
201 for ($e=0;$e<$max;$e++) {
203 $msg=( $row['qcode_bank'] != "")?"[".$row['qcode_bank']."]":$row['jr_internal'];
204 $str_payment=$row['jr_date'].$msg.$sep;
205 $sep=' , ';
206 }
207 $this->write_cell (50,5,$str_payment);
208 }
209 $this->line_new(5);
210 }
211 }
212
213}
$input_from cn
static factory(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode, $p_paid)
Build the right object.
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
line_new($p_step=null)
Print all the cell stored and call Ln (new line)
write_cell($width, $height=0, $txt='', $border=0, $interline=0, $align='', $fill=false, $link='')
add a cell the text is not cut and don't return to this line if too large
write_multi($width, $interline, $txt, $border=0, $align='', $fill=false)
add a cell with automatic return to the line if the text is too long
get_tiers($p_jr_id, $p_jrn_type)
retrieve the client name and quick_code
Definition pdf.class.php:84
$dossier
Definition pdf.class.php:38
contains prepared query used in different classes of the application
this class extends PDF and let you export the detailled printing of any ledgers
__construct($p_cn, $p_jrn, $p_from, $p_to, $p_filter_operation)
Parent class for the print_ledger class.
$ledger
concerned Ledger