noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
print_ledger_detail.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/*!
29 * \class Print_Ledger_Detail
30 * \brief this class extends PDF and let you export the detailled printing
31 * of any ledgers
32 */
33
34
36{
37 public function __construct (Database $p_cn , Acc_Ledger $ledger,$p_from,$p_to)
38 {
39
40 parent::__construct($p_cn,'P', 'mm', 'A4',$ledger,$p_from,$p_to,'all');
41
42 }
43
44 function setDossierInfo($dossier = "n/a")
45 {
46 $this->dossier = dossier::name()." ".$dossier;
47 }
48
49 function Header()
50 {
51 //Arial bold 12
52 $this->SetFont('DejaVu', 'B', 12);
53 //Title
54 $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
55 //Line break
56 $this->Ln(20);
57 }
58 function Footer()
59 {
60 //Position at 2 cm from bottom
61 $this->SetY(-20);
62 //Arial italic 8
63 $this->SetFont('Arial', 'I', 8);
64 //Page number
65 $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
66 // Created by NOALYSS
67 $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'R',false,'https://www.noalyss.eu');
68
69 }
70
71
72 function export()
73 {
74
75 // detailled printing
76 $rap_deb=0;
77 $rap_cred=0;
78 // take all operations from jrn
79 $array=$this->get_ledger()->get_operation($this->get_from(),$this->get_to());
80
81 $this->SetFont('DejaVu','BI',7);
82 $this->write_cell(155,7,'report Débit',0,0,'R');
83 $this->write_cell(30,7,nbm($rap_deb),0,0,'R');
84 $this->line_new(4);
85 $this->write_cell(155,7,'report Crédit',0,0,'R');
86 $this->write_cell(30,7,nbm($rap_cred),0,0,'R');
87 $this->line_new(10);
88
89 // print all operation
90 for ($i=0;$i< count($array);$i++)
91 {
92 $this->SetFont('DejaVuCond','B',7);
93 $row=$array[$i];
94
95 $this->write_multi(20, 4,$row['pj'],'T');
96 $this->write_cell(15,4,$row['date_fmt'],'T');
97 $this->write_cell(20,4,$row['internal'],'T');
98 $this->write_multi(100,4,$row['comment'],'T');
99 $this->write_cell(40,4,nbm($row['montant']),'T',0,'R');
100
101
102 $this->line_new(7);
103 // get the entries
104 $aEntry=$this->cn->get_array("select j_id,j_poste,j_qcode,j_montant,j_debit, j_text,".
105 " case when j_text='' or j_text is null then pcm_lib else j_text end as desc,".
106 " pcm_lib ".
107 " from jrnx join tmp_pcmn on (j_poste=pcm_val) where j_grpt = $1".
108 " order by j_debit desc,j_id",
109 array($row['jr_grpt_id']));
110 for ($j=0;$j<count($aEntry);$j++)
111 {
112 $this->SetFont('DejaVuCond','',7);
113 $entry=$aEntry[$j];
114 // $this->write_cell(15,6,$entry['j_id'],0,0,'R');
115 $this->write_cell(32,6,$entry['j_qcode'],0,0,'R');
116 $this->write_cell(23,6,$entry['j_poste'],0,0,'R');
117
118 // if j_qcode is not empty retrieve name
119 if ( $entry['j_text'] =='' && $entry['j_qcode'] != '')
120 {
121 $f_id=$this->cn->get_value('select f_id from vw_poste_qcode where j_qcode=$1',array($entry['j_qcode']));
122 if ($f_id != '')
123 $name=$this->cn->get_value('select ad_value from fiche_detail where f_id=$1 and ad_id=1',
124 array($f_id));
125 else
126 $name=$entry['pcm_lib'];
127 }
128 else
129 $name=$entry['desc'];
130 $this->write_cell(100,6,$name,0,0,'L');
131
132 // print amount
133 $str_amount=nbm($entry['j_montant']);
134 if ( $entry['j_debit']=='t')
135 {
136 $this->write_cell(20,6,$str_amount,0,0,'R');
137 $this->write_cell(20,6,'',0,0,'R');
138
139 }
140 else
141 {
142 $this->write_cell(20,6,'',0,0,'R');
143 $this->write_cell(20,6,$str_amount,0,0,'R');
144 }
145 $this->line_new(4);
146 }
147 $this->line_new(3);
148 }
149 }
150}
nbm($p_number, $p_dec=2)
format the number with a sep.
$input_from cn
Class for jrn, class acc_ledger for manipulating the ledger AND some acc.
contains the class for connecting to Noalyss
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
$dossier
Definition pdf.class.php:38
this class extends PDF and let you export the detailled printing of any ledgers
__construct(Database $p_cn, Acc_Ledger $ledger, $p_from, $p_to)
Parent class for the print_ledger class.
$ledger
concerned Ledger