noalyss Version-9
pdf_operation.class.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21// Copyright Author Dany De Bontridder dany@alchimerys.be(2003-2016)
22
23/**
24 * @file
25 * @brief Detail Operation ACC + ANC , it will use Acc_Operation and Anc_Operation
26 *
27 */
28/**
29 * @class PDF_Operation
30 * @brief Detail Operation ACC + ANC , it will use Acc_Operation and Anc_Operation
31 *
32 */
33class PDF_Operation extends PDF {
34
35 private $acc_detail; //!< Acc_Operation object
36 private $jr_id; //!< jrn.jr_id operation
37 private $pdf;
38 var $cn;
39 function __construct($p_cn, $pjr_id) {
40 $this->cn = $p_cn;
41 $this->jr_id = $pjr_id;
42 $this->pdf = null;
43 $acc_detail= new Acc_Operation($p_cn,$pjr_id);
44 $acc_detail->set_id($pjr_id);
45 $this->acc_detail=$acc_detail->get_quant();
46 }
47 /*!
48 * @brief return the name of the ledger of the operation
49 */
50 private function print_ledger_name() {
51 $ledger = new Jrn_Def_sql($this->cn, $this->acc_detail->det->jr_def_id);
52 return $ledger->jrn_def_name;
53 }
54 /**
55 * @brief print info (jrn_info)
56 */
57 private function print_info() {
58 $a_type=array(
59 'OTHER'=>_("Autre"),
60 'BON_COMMANDE'=>_("Bon de commande")
61 );
62 foreach ($a_type as $key=>$label){
63 $other_info=$this->cn->get_value("select ji_value from jrn_info where jr_id=$1 and id_type=$2",
64 [$this->acc_detail->jr_id,$key]);
65
66 $this->pdf->write_cell(50, 6,$label);
67 $this->pdf->write_cell(100, 6, $other_info);
68 $this->pdf->line_new(4);
69 }
70 }
71 /**
72 * @brief Write basic information about the operation : date , ledger ,
73 * receipt , comment , document name if any
74 */
75 private function print_operation_info() {
76 $this->pdf->SetFont('DejaVu', '', 6);
77 $this->pdf->write_cell(50, 6, _('Journal'));
78 $this->pdf->write_cell(100, 6, $this->print_ledger_name());
79 $this->pdf->line_new(4);
80
81
82 $this->pdf->write_cell(50, 6, _("Date"));
83 $this->pdf->write_cell(100, 6, $this->acc_detail->det->jr_date);
84 $this->pdf->line_new(4);
85 $this->pdf->write_cell(50, 6, _("Echéance"));
86 $this->pdf->write_cell(100, 6, $this->acc_detail->det->jr_ech);
87 $this->pdf->line_new(4);
88 $this->pdf->write_cell(50, 6, _("Paiement"));
89 $this->pdf->write_cell(100, 6, $this->acc_detail->det->jr_date_paid);
90 $this->pdf->line_new(4);
91 $this->pdf->write_cell(50, 6, _("Numéro interne"));
92 $this->pdf->write_cell(100, 6, $this->acc_detail->det->jr_internal);
93 $this->pdf->line_new(4);
94 $this->pdf->write_cell(50, 6, _("Pièce"));
95 $this->pdf->write_cell(100, 6, $this->acc_detail->det->jr_pj_number);
96 $this->pdf->line_new(4);
97 $this->pdf->write_cell(50, 6, _("Commentaire"));
98 $this->pdf->LongLine(130, 3 , $this->acc_detail->det->jr_comment);
99 $this->pdf->line_new(4);
100 $this->pdf->write_cell(50, 6, _("Nom document"));
101 $this->pdf->write_cell(100, 6, $this->acc_detail->det->jr_pj_name);
102 if ($this->acc_detail->det->currency_id != 0)
103 {
104 $currency=new Acc_Currency($this->cn,$this->acc_detail->det->currency_id);
105 $this->pdf->line_new(4);
106 $this->pdf->write_cell(50, 6, _("Devise"));
107 $this->pdf->write_cell(50, 6, $currency->get_code());
108 $this->pdf->write_cell(25, 6, _("Taux utilisé"));
109 $this->pdf->write_cell(30, 6,nb($this->acc_detail->det->currency_rate,4));
110 $this->pdf->write_cell(25, 6, _("Taux référence"));
111 $this->pdf->write_cell(30, 6,nbm($this->acc_detail->det->currency_rate_ref,4));
112 $this->pdf->line_new(4);
113 $this->pdf->write_cell(50, 6, _("Montant Devise"));
114 $this->pdf->write_cell(50, 6, nb($this->acc_detail->get_currency_amount(),4));
115
116 }
117 $this->pdf->line_new(4);
118 $this->print_info();
119 $this->pdf->line_new(8);
120 }
121 /**
122 * @brief For SALE and PURCHASE , print the customer or supplier and calls
123 * a function for the detail (VAT , quantity ...)
124 * @return type
125 */
126 private function print_operation_quant() {
127 if ( $this->acc_detail->signature=='FIN' ||
128 $this->acc_detail->signature=="ODS") {
129 return;
130 }
131 if ($this->acc_detail->signature=="ACH") {
132 $tiers=_("Fournisseur");
133 $tiers_id=$this->acc_detail->det->array[0]['qp_supplier'];
134 } else {
135 $tiers=_("Client");
136 $tiers_id=$this->acc_detail->det->array[0]['qs_client'];
137 }
138 $this->pdf->SetFont('DejaVu', 'B', 10);
139 $this->print_section(_("Résumé"));
140 $fiche=new Fiche($this->cn,$tiers_id);
141
142 $this->pdf->SetFont('DejaVu', 'B', 6);
143 $this->pdf->write_cell(50, 6, $tiers);
144 $this->pdf->write_cell(140, 6, $fiche->getName().
145 " ".$fiche->get_quick_code());
146 $this->pdf->line_new(4);
147 if ($this->acc_detail->signature=="ACH") {
148 $this->print_purchase();
149 } else {
150 $this->print_sale();
151 }
152
153
154 }
155 /**
156 * @brief returns a string with info about tva
157 * @see print_sale print_purchase
158 * @param integer $p_tva_id id of TVA_RATE (tva_rate.tva_id)
159 * @return type
160 */
161 private function str_vat($p_tva_id) {
162 $tva=new Acc_Tva($this->cn, $p_tva_id);
163 $tva->load();
164 $auto="";
165 if ( $tva->tva_both_side==1) {
166 $auto="(=0.0)";
167 }
168 $ret=sprintf("%d %s %s",$p_tva_id,$tva->tva_label,$auto);
169 return $ret;
170
171 }
172 private function print_sale() {
173 // quick_code , label , montant hors tva,code tva,montant tva
174 $nb=count($this->acc_detail->det->array);
175 $width=array(10,30,50,25,25,25,25);
176 $sum_amount=0;
177 $sum_vat=0;
178 bcscale(4);
179 $this->pdf->SetFont('DejaVu', 'B', 6);
180 $this->pdf->write_cell($width[0],6,_("n°"),"B");
181 $this->pdf->write_cell($width[1],6,_("code"),"B");
182 $this->pdf->write_cell($width[2],6,_("Libellé"),"B");
183 $this->pdf->write_cell($width[3],6,_("Montant HTVA"),"B",0,"R");
184 $this->pdf->write_cell($width[4],6,_("TVA"),"B");
185 $this->pdf->write_cell($width[5],6,_("Montant TVA"),"B",0,"R");
186 $this->pdf->write_cell($width[6],6,_("Total"),"B",0,"R");
187 $this->pdf->line_new(6);
188 $this->pdf->SetFont('DejaVu', '', 6);
189 for ( $i=0;$i<$nb;$i++) {
190 $row=$this->acc_detail->det->array[$i];
191 $fiche_id=$row['qs_fiche'];
192 $fiche=new Fiche($this->cn,$fiche_id);
193 $this->pdf->write_cell($width[0],6,$i+1);
194 $this->pdf->write_cell($width[1],6,$fiche->get_quick_code());
195 $this->pdf->LongLine($width[2],6,$row['j_text']);
196 $this->pdf->write_cell($width[3],6,nbm($row["qs_price"],2),"",0,"R");
197 $str=$this->str_vat($row["qs_vat_code"]);
198 $this->pdf->write_cell($width[4],6,$str);
199 $this->pdf->write_cell($width[5],6,nbm($row["qs_vat"],2),"",0,"R");
200 $this->pdf->write_cell($width[6],6,nbm(bcadd($row["qs_price"],$row["qs_vat"]),2),"",0,"R");
201 $this->pdf->line_new(6);
202
203 $sum_amount=bcadd($sum_amount,$row["qs_price"]);
204 $sum_vat=bcadd($sum_vat,$row["qs_vat"]);
205 }
206 /* print addition Tax */
207 $a=$b=0;
208 $sum_other_tax=$this->print_other_tax();
209
210 $this->pdf->SetFont('DejaVu', 'B', 6);
211 $this->pdf->write_cell($width[0],6,"");
212 $this->pdf->write_cell($width[1],6,"");
213 $this->pdf->write_cell($width[2],6,"");
214 $this->pdf->write_cell($width[3],6,nbm($sum_amount,2),"",0,"R");
215 $this->pdf->write_cell($width[4],6,nbm($sum_other_tax,2),"",0,"R"); // additional tax
216 $this->pdf->write_cell($width[5],6,nbm($sum_vat,2),"",0,"R");
217 // add sum_other_ax to total
218 $sum_amount=bcadd($sum_other_tax,$sum_amount);
219 $this->pdf->write_cell($width[6],6,nbm(bcadd($sum_amount,$sum_vat),2),"",0,"R");
220 $this->pdf->line_new(4);
221
222 }
223 private function print_purchase(){
224 // quick_code , label , montant hors tva,code tva,montant tva
225 $nb=count($this->acc_detail->det->array);
226 $width=array(10,30,50,25,25,25,25);
227 $sum_amount=0;
228 $sum_vat=0;
229 bcscale(4);
230 $this->pdf->SetFont('DejaVu', 'B', 6);
231 $this->pdf->write_cell($width[0],6,_("n°"),"B");
232 $this->pdf->write_cell($width[1],6,_("code"),"B");
233 $this->pdf->write_cell($width[2],6,_("Libellé"),"B");
234 $this->pdf->write_cell($width[3],6,_("Montant HTVA"),"B",0,"R");
235 $this->pdf->write_cell($width[4],6,_("TVA"),"B");
236 $this->pdf->write_cell($width[5],6,_("Montant TVA"),"B",0,"R");
237 $this->pdf->write_cell($width[6],6,_("Total"),"B",0,"R");
238 $this->pdf->line_new(6);
239 $this->pdf->SetFont('DejaVu', '', 6);
240 for ( $i=0;$i<$nb;$i++) {
241 $row=$this->acc_detail->det->array[$i];
242 $fiche_id=$row['qp_fiche'];
243 $fiche=new Fiche($this->cn,$fiche_id);
244 $this->pdf->write_cell($width[0],6,$i+1);
245 $this->pdf->write_cell($width[1],6,$fiche->get_quick_code());
246 $this->pdf->LongLine($width[2],6,$row['j_text']);
247 $this->pdf->write_cell($width[3],6,nbm($row["qp_price"],2),"",0,"R");
248 $str=$this->str_vat($row["qp_vat_code"]);
249 $this->pdf->write_cell($width[4],6,$str);
250 $this->pdf->write_cell($width[5],6,nbm($row["qp_vat"],2),"",0,"R");
251 $this->pdf->write_cell($width[6],6,nbm(bcadd($row["qp_price"],$row["qp_vat"]),2),"",0,"R");
252 $this->pdf->line_new(6);
253
254 $sum_amount=bcadd($sum_amount,$row["qp_price"]);
255 $sum_vat=bcadd($sum_vat,$row["qp_vat"]);
256 }
257 /* print addition Tax */
258 $a=$b=0;
259 $sum_other_tax=$this->print_other_tax();
260
261 $this->pdf->SetFont('DejaVu', 'B', 6);
262 $this->pdf->write_cell($width[0],6,"");
263 $this->pdf->write_cell($width[1],6,"");
264 $this->pdf->write_cell($width[2],6,"");
265 $this->pdf->write_cell($width[3],6,nbm($sum_amount,2),"",0,"R");
266 $this->pdf->write_cell($width[4],6,"");
267 $this->pdf->write_cell($width[5],6,nbm($sum_vat,2),"",0,"R");
268 $this->pdf->write_cell($width[4],6,nbm($sum_other_tax,2),"",0,"R"); // additional tax
269 $sum_amount=bcadd($sum_other_tax,$sum_amount);
270 $this->pdf->write_cell($width[6],6,nbm(bcadd($sum_amount,$sum_vat),2),"",0,"R");
271 $this->pdf->line_new(10);
272
273 }
274 private function print_section($p_section) {
275 $this->pdf->SetFont('DejaVu', 'B', 10);
276 $this->pdf->write_cell(60,8,$p_section,"1");
277 $this->pdf->line_new(8);
278 }
279 private function print_other_tax()
280 {
281 $width=array(10,80,25,25,25,25);
282 $aOther_tax=Additional_Tax::get_by_operation($this->jr_id,$a,$b);
283 $total=0;
284 foreach ($aOther_tax as $other_tax)
285 {
286 $amount=$other_tax->getTaxAmount();
287 $total=bcadd($amount,$total,2);
288 $this->pdf->write_cell($width[0],6,"");
289 $this->pdf->write_cell($width[1],6,$other_tax->getAcLabel(). " ".$other_tax->getAcRate()."%");
290
291 $this->pdf->write_cell($width[3],6,"");
292 $this->pdf->write_cell($width[2],6,nbm($amount,2),"",0,"R");
293 $this->pdf->write_cell($width[4],6,"");
294 $this->pdf->write_cell($width[5],6,$total,"",0,"R");
295 $this->pdf->line_new(6);
296 }
297 return $total;
298 }
299 private function print_acc_writing(){
300 $obj1=new Acc_Operation($this->cn);
301 $obj1->set_id($this->jr_id);
302 $obj=$obj1->get();
303 $nb=count($obj->det->array);
304 $this->print_section(_("Ecriture comptable"));
305
306 bcscale(4);
307 $width=array(10,40,40,50,30,10);
308 $this->pdf->SetFont('DejaVu', 'B', 6);
309 $this->pdf->write_cell($width[0],6,_("n°"),"B");
310 $this->pdf->write_cell($width[1],6,_("Poste comptable"),"B");
311 $this->pdf->write_cell($width[2],6,_("code"),"B");
312 $this->pdf->write_cell($width[3],6,_("Libellé"),"B");
313 $this->pdf->write_cell($width[4],6,_("Montant"),"B",0,"R");
314 $this->pdf->write_cell($width[5],6,_("D/C"),"B");
315 $this->pdf->line_new(6);
316 $this->pdf->SetFont('DejaVu', '', 6);
317 for ($i=0;$i<$nb;$i++){
318 $row=$obj->det->array[$i];
319 $this->pdf->write_cell($width[0],6,$row['j_id']);
320 $this->pdf->write_cell($width[1],6,$row['j_poste']);
321 $this->pdf->write_cell($width[2],6,$row["j_qcode"]);
322 $str=$row["j_text"];
323 if (empty($str)){
324 if (empty($row["j_qcode"])) {
325 $str=$this->cn->get_value("select pcm_lib from tmp_pcmn where pcm_val=$1",
326 array($row["j_poste"]));
327 } else {
328 $str=$this->cn->get_value("select ad_value from fiche_detail where ad_id=1 and f_id=$1",
329 array($row["f_id"]));
330 }
331 }
332 $this->pdf->write_cell($width[3],6,$str);
333 $this->pdf->write_cell($width[4],6,nbm($row["j_montant"],2),"",0,"R");
334 $deb=($row["j_debit"]=="t")?"D":"C";
335 $this->pdf->write_cell($width[5],6,$deb);
336 $this->pdf->line_new(6);
337 }
338 }
339 /**
340 * print reconcilied operations
341 */
343 {
344 // find the reconcilied operations
345 $a_reconcilied_operation=$this->cn->get_array("select jr_id,jra_concerned from jrn_rapt where jra_concerned=$1 or jr_id=$1",
346 [$this->jr_id]);
347 if ( empty ($a_reconcilied_operation)) {
348 return;
349 }
350 $this->print_section(_("Opérations rapprochées"));
351 // for each operation , print info (amount, ledger,... )
352 foreach ($a_reconcilied_operation as $reconcilied_operation) {
353 $op=($reconcilied_operation['jr_id']==$this->jr_id)?$reconcilied_operation['jra_concerned']:$reconcilied_operation['jr_id'];
354 $operation=new PDF_Operation($this->cn,$op);
356 $operation->print_operation_info();
357 }
358
359 }
360 private function print_anc_header($pa_plan) {
361 $nb=count($pa_plan);
362 $this->pdf->SetFont('DejaVu', 'B', 8);
363 $width=25;
364 $this->pdf->SetFillColor(220,221,255);
365 for ($i = 0; $i<$nb; $i++) {
366 $this->pdf->write_cell($width,8,$pa_plan[$i]['pa_name'],1,"C",1);
367 }
368 $this->pdf->write_cell($width,8,_('Montant'),1,"C",1);
369 $this->pdf->SetFillColor(0,0,0);
370 $this->pdf->line_new(8);
371 }
372 private function print_anc_detail($p_j_id, $pa_plan) {
373 // get info from jrnx
374 $row_jrnx = $this->cn->get_row("select j_text , j_montant,j_qcode,j_poste from public.jrnx where j_id=$1", array($p_j_id));
375
376 // print row
377 $this->pdf->SetFont('DejaVu', 'B', 7);
378 $this->pdf->write_cell(25, 8,$p_j_id);
379 $this->pdf->write_cell(40, 8,$row_jrnx["j_poste"]);
380 $this->pdf->write_cell(40, 8,$row_jrnx["j_qcode"]);
381 $this->pdf->write_cell(40, 8,nbm($row_jrnx["j_montant"],2));
382 $this->pdf->line_new(8);
383 // . Display a table with the plan (axis) name in the header
384 $this->print_anc_header($pa_plan);
385
386 // get all the rows from operation_analytique for this jrnx.j_id
387 $a_operation_analytique = $this->cn->get_array(
388 "select oa_row,oa_positive,po_name,pa_id,po_id,oa_debit,
389 case when oa_positive='N' then oa_amount*(-1)
390 else oa_amount end as signed_amount
391 from OPeration_analytique
392 left join public.poste_analytique using(po_id)
393 left join public.plan_analytique using (pa_id)
394 where
395 j_id =$1
396 order by oa_row,pa_id
397 ", array($p_j_id));
398 $this->pdf->SetFont('DejaVu', '', 6);
399 $width = 25;
400 // For each row print the result for each plan (=col)
401 $old_row = null;
402 $nb_operation = count($a_operation_analytique);
403 $idx_plan = 0;
404 $cnt_plan = count($pa_plan);
405 bcscale(4);
406 $tot_anc=0;
407 for ($i = 0; $i<$nb_operation; $i++) {
408 $current_row = $a_operation_analytique[$i];
409 if ($old_row==null)
410 $old_row = $current_row;
411 if ($old_row['oa_row']!=$current_row['oa_row']) {
412 if($idx_plan!=0) {
413 for ($e = $idx_plan; $e<$cnt_plan; $e++)
414 $this->pdf->write_cell($width, 8, "", 1, "C", 0);
415 }
416 // print last column
417 $this->pdf->write_cell($width, 8, nbm($old_row["signed_amount"],2), 1, "R", 0);
418 // Add to total
419 $tot_anc= bcadd($tot_anc, $old_row["signed_amount"]);
420 // we start a new line
421 $this->pdf->line_new(8);
422 // reset plan
423 $idx_plan = 0;
424 }
425 if ($current_row['pa_id']==$pa_plan[$idx_plan]['pa_id']) {
426 $this->pdf->write_cell($width, 8, $current_row['po_name'], 1, "L", 0);
427 } else {
428 // print the post code in the right column
429 for ($e = $idx_plan; $e<$cnt_plan; $e++) {
430 if ($current_row['pa_id']==$pa_plan[$e]['pa_id']) {
431 $this->pdf->write_cell($width, 8, $current_row['po_name'], 1, "L", 0);
432 $idx_plan=$e;
433 // $idx_plan--;
434 break;
435 } else {
436 $this->pdf->write_cell($width, 8, "", 1, "C", 0);
437 }
438 }
439 }
440 $idx_plan++;
441 if ($idx_plan == $cnt_plan ) $idx_plan=0;
442 $old_row = $current_row;
443 }
444 // End
445 // print last column
446 if($idx_plan!=0) {
447 $this->pdf->write_cell($width, 8, "", 1, "C", 0);
448 }
449 $this->pdf->write_cell($width, 8,nbm($old_row["signed_amount"],2), 1, "R", 0);
450 $this->pdf->line_new(8);
451
452 // Add to total
453 $tot_anc= bcadd($tot_anc, $old_row["signed_amount"]);
454
455 // Total
456 $this->pdf->write_cell(40, 6,_("Comptabilité"));
457 $this->pdf->write_cell(40, 6,nbm($row_jrnx["j_montant"],2),"","R",0);
458 $this->pdf->line_new();
459 $this->pdf->write_cell(40, 6,_("Analytique"));
460 $this->pdf->write_cell(40, 6,nbm($tot_anc,2),"","R",0);
461 $this->pdf->line_new();
462
463 $this->pdf->write_cell(40, 6,_("Diff"));
464 $this->pdf->write_cell(40, 6,nbm( bcsub($row_jrnx['j_montant'], $tot_anc),2),0,"R",0);
465 $this->pdf->line_new();
466 }
467
468 private function print_anc_writing() {
469 // . Get all the existing plans and store them in an array
470 $a_plan=$this->cn->get_array("select pa_id,pa_name
471 from public.plan_analytique order by pa_id");
472
473
474
475 // . Take all the j_id of the concern operation
476 $a_jrnxId=$this->cn->get_array(
477 "select j_id from jrnx join jrn on (jr_grpt_id=j_grpt)
478 where
479 jr_id=$1",array($this->jr_id));
480
481 // . For each j_id print all the concerned rows ordered by plan
482 $nb=count($a_jrnxId);
483 $flag_print_section=0;
484 for ($index = 0; $index<$nb; $index++) {
485 $count_ana=$this->cn->get_value("select count(*)
486 from public.operation_analytique
487 where j_id=$1
488 ",array($a_jrnxId[$index]["j_id"]));
489 if ($count_ana == 0 ) continue;
490 if ($flag_print_section==0) $this->print_section (_("Détail analytique"));
491 $flag_print_section=1;
492 $this->print_anc_detail($a_jrnxId[$index]["j_id"],$a_plan);
493 }
494
495
496 }
497 /**
498 * @brief export operation into a PDF
499 *
500 * @param Array $p_option containing [acc anc] or a combination
501 */
502
503 function export_pdf($p_option) {
504 // create a PDF
505 $this->pdf = new PDF($this->cn);
506 $this->pdf->Setdossierinfo(_("Détail opération"));
507 $this->pdf->setTitle(_("Détail opération"), true);
508 $this->pdf->SetAuthor('NOALYSS');
509 $this->pdf->AliasNbPages();
510 $this->pdf->AddPage();
511
512 //write date + ledger + detail items + total
513 $this->print_operation_info();
514
515
516
517 // Write only for Sale or purchase summary (QCode, label,amount,tva...)
518 $this->print_operation_quant();
519
520 // if option contains ACC or $this->acc_detail is FIN or ODS
521 if ($this->acc_detail->signature=="ODS" ||
522 $this->acc_detail->signature=="FIN" ||
523 array_search("acc", $p_option) !== false
524 ){
525 $this->print_acc_writing();
526 }
527 // ANC only if exists
528 if (array_search("anc", $p_option) !== false )
529 $this->print_anc_writing();
530
531 // write information for reconcilied operations
533 // if option contains EXTEND add document name + comment + action name
534 // if options contains ANC export ANC plan table
535 }
536 function get_pdf() {
537 return $this->pdf;
538 }
539 /**
540 * @brief export the PDF to a file and returns the filename
541 * @retun String filename
542 */
543 function get_pdf_filename() {
544 $file_name=$_ENV['TMP']."/"."acc_op".$this->acc_detail->det->jr_internal.".pdf";
545 $this->pdf->Output($file_name, "F");
546 return $file_name;
547 }
548 function download_pdf() {
549 $this->pdf->Output("acc_op".$this->acc_detail->det->jr_internal.".pdf","D");
550 }
551 /**
552 * @brief unlink the file if exists
553 */
554 function unlink() {
555 $file=$this->get_pdf_filename();
556 if ( is_file($file)) unlink ($file);
557 }
558}
nb($p_number)
format the number for the CSV export
Definition: ac_common.php:107
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
$op
Definition: ajax_admin.php:38
$op jr_id
Definition: ajax_ledger.php:83
$input_from cn
Definition: balance.inc.php:66
display currency , convert to euro , and save them if used.
this file match the tables jrn & jrnx the purpose is to remove or save accountant writing to these ta...
Acc_Tva is used for to map the table tva_rate parameter are.
static get_by_operation($p_jrn_id, &$sum_euro, &$sum_currency)
create an array of Additional_Tax
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:38
Detail Operation ACC + ANC , it will use Acc_Operation and Anc_Operation.
__construct($p_cn, $pjr_id)
$jr_id
jrn.jr_id operation
get_pdf_filename()
export the PDF to a file and returns the filename @retun String filename
str_vat($p_tva_id)
returns a string with info about tva
print_ledger_name()
return the name of the ledger of the operation
print_anc_detail($p_j_id, $pa_plan)
$acc_detail
Acc_Operation object.
print_section($p_section)
print_operation_quant()
For SALE and PURCHASE , print the customer or supplier and calls a function for the detail (VAT ,...
print_info()
print info (jrn_info)
print_anc_header($pa_plan)
print_operation_info()
Write basic information about the operation : date , ledger , receipt , comment , document name if an...
export_pdf($p_option)
export operation into a PDF
unlink()
unlink the file if exists
print_reconcilied_operation()
print reconcilied operations
API for creating PDF, unicode, based on tfpdf.
Definition: pdf.class.php:34
if( $t !=-1 &&isNumber($t)==1) $total
Definition: compute.php:79
$width
$str
Definition: fiche.inc.php:91
$a_type
Definition: menu_detail.php:15
for($i=0;$i< $nb_jrn;$i++) $deb
$nb_operation