noalyss Version-9
print_ledger_misc.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 print a listing of Miscelleaneous operation
25 */
26/**
27 * \class Print_Ledger_Misc
28 * \brief print a listing of Miscelleaneous operation
29 */
31{
32 function __construct(Database $p_cn,$p_jrn,$p_from,$p_to)
33 {
34 parent::__construct($p_cn,'P','mm','A4',$p_jrn,$p_from,$p_to,"all");
35 }
36 function Header()
37 {
38 //Arial bold 12
39 $this->SetFont('DejaVu', 'B', 12);
40 //Title
41 $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
42 //Line break
43 $this->Ln(20);
44 $this->SetFont('DejaVu', 'B', 7);
45 $this->Cell(10,6,_('Date'));
46 $this->Cell(30,6,_('Piece'));
47 $this->Cell(20,6,_('Interne'));
48 $this->Cell(25,6,_('Tiers'));
49 $this->Cell(60,6,_('Commentaire'));
50 $this->Cell(20,6,_('Devise'),0,0,'R');
51 $this->Cell(15,6,_('Montant'),0,0,'R');
52 $this->Ln(6);
53
54 }
55 function Footer()
56 {
57 //Position at 2 cm from bottom
58 $this->SetY(-20);
59 //Arial italic 8
60 $this->SetFont('Arial', 'I', 8);
61 //Page number
62 $this->Cell(0,6,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
63 $this->Ln(3);
64 // Created by NOALYSS
65 $this->Cell(0,6,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'C',false,'https://www.noalyss.eu');
66 }
67 /**
68 *@brief print the pdf
69 *@param
70 *@param
71 *@return
72 *@see
73 */
74 function export()
75 {
76 $a_jrn=$this->get_ledger()->get_rowSimple($this->get_from(),$this->get_to());
77
78 $this->SetFont('DejaVu', '', 6);
79 if ( $a_jrn == null ) return;
80 $ledger=$this->get_ledger();
81 for ( $i=0;$i<count($a_jrn);$i++)
82 {
83 $row=$a_jrn[$i];
84
85 $this->write_cell(10,5, smaller_date($row['date']));
86 $this->LongLine(30,5,$row['jr_pj_number']);
87 $this->write_cell(20,5,$row['jr_internal']);
88 $type=$this->cn->get_value("select jrn_def_type from jrn_def where jrn_def_id=$1",array($a_jrn[$i]['jr_def_id']));
89 $other=mb_substr($ledger->get_tiers($type,$a_jrn[$i]['jr_id']),0,25);
90 $this->LongLine(25,5,$other,0,'L');
91 $positive=$row['montant'];
92 $this->LongLine(60,5,$row['comment'],0,'L');
93 if ( $type == 'FIN' ) {
94 $positive = $this->cn->get_value("select qf_amount from quant_fin ".
95 " where jr_id=".$row['jr_id']);
96 }
97 if ( $row['currency_id'] != 0 ) {
98 $this->write_cell(20,5,nbm(bcadd($row['sum_ocvat_amount'],$row['sum_ocamount']),2).$row['cr_code_iso'],0,0,'R');
99 } else {
100 $this->write_cell(20,5,"");
101 }
102 $this->write_cell(15,5,nbm($positive),0,0,'R');
103 $this->line_new(5);
104
105 }
106 }
107}
smaller_date($p_date)
shrink the date, make a date shorter for the printing
Definition: ac_common.php:837
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
$input_from cn
Definition: balance.inc.php:66
contains the class for connecting to Noalyss
line_new($p_step=null)
Print all the cell stored and call Ln (new line)
LongLine($w, $h, $txt, $border=0, $align='', $fill=false)
write_cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
print a listing of Miscelleaneous operation
__construct(Database $p_cn, $p_jrn, $p_from, $p_to)
Parent class for the print_ledger class.
$ledger
concerned Ledger