38 parent::__construct($p_cn,
'L',
'mm',
'A4',
$p_jrn,$p_from,$p_to,$p_filter_operation);
40 $this->a_Tva=$this->
get_ledger()->existing_vat();
41 foreach($this->a_Tva as $line_tva)
44 $tmp1=$line_tva[
'tva_id'];
45 $this->rap_tva[$tmp1]=0;
47 $this->rap_other_tax=0;
48 $this->jrn_type=
$p_jrn->get_type();
60 foreach($this->previous[
'tva'] as $line_tva)
63 $tmp1=$line_tva[
'tva_id'];
64 $this->rap_tva[$tmp1]=$line_tva[
'sum_vat'];
67 $this->rap_htva=$this->previous[
'price'];
68 $this->rap_tvac=bcadd($this->previous[
'price'],$this->previous[
'vat']);
69 $this->rap_tvac=bcadd($this->rap_tvac,$this->previous[
'tva_nd']);
70 $this->rap_tvac=bcsub($this->rap_tvac,$this->previous[
'tva_np']);
71 $this->rap_tvac=bcsub($this->rap_tvac,$this->previous[
'reversed']);
72 $this->rap_priv=$this->previous[
'priv'];
73 $this->rap_nd=$this->previous[
'tva_nd'];
74 $this->rap_tva_np=$this->previous[
'tva_np'];
75 $this->flag_other_tax=
false;
77 if ($this->jrn_type ==
'ACH' || $this->jrn_type==
'VEN') {
85 from jrn_tax join jrnx using (j_id)
86 join jrn on (j_grpt=jr_grpt_id) where
87 j_date >= to_date($1,'DD.MM.YYYY')
88 and j_date <= to_date($2,'DD.MM.YYYY')
90 array($first_date,$last_date,
$p_jrn->id));
91 if (
$count>0) { $this->flag_other_tax=
true;}
105 $this->SetFont(
'DejaVu',
'B', 12);
107 $this->Cell(0,10,$this->dossier,
'B', 0,
'C');
110 $this->SetFont(
'DejaVu',
'B', 8);
114 foreach($this->a_Tva as $line_tva)
117 $tmp1=$line_tva[
'tva_id'];
118 $this->rap_tva[$tmp1]=(isset($this->rap_tva[$tmp1]))?$this->rap_tva[$tmp1]:0;
120 $this->Cell(15,6,_(
'Pièce'));
121 $this->Cell(10,6,_(
'Date'));
122 $this->Cell(13,6,_(
'ref'));
123 if ( $this->jrn_type==
'ACH')
124 $this->Cell(40,6,_(
'Client'));
126 $this->Cell(40,6,_(
'Fournisseur'));
128 $flag_tva=(count($this->a_Tva) > 4)?
true:
false;
129 if ( !$flag_tva ) $this->Cell(65,6,_(
'Description'));
131 $this->Cell(15,6,_(
'HTVA'),0,0,
'R');
132 if ( $this->jrn_type==
'ACH')
134 $this->Cell(15,6,_(
'Priv/DNA'),0,0,
'R');
135 $this->Cell(15,6,_(
'TVA ND'),0,0,
'R');
137 $this->Cell(15,6,_(
'TVA NP'),0,0,
'R');
138 foreach($this->a_Tva as $line_tva)
140 $this->Cell(15,6,$line_tva[
'tva_label'],0,0,
'R');
142 if ($this->flag_other_tax) {
143 $this->Cell(15,6,
'Autre Tx',0,0,
'R');
146 $this->Cell(15,6,
'TVAC',0,0,
'R');
149 $this->SetFont(
'DejaVu',
'',6);
152 $this->Cell(143,6,
'report',0,0,
'R');
154 $this->Cell(78,6,
'report',0,0,
'R');
155 $this->Cell(15,6,
nbm($this->rap_htva),0,0,
'R');
156 if ( $this->jrn_type !=
'VEN')
158 $this->Cell(15,6,
nbm($this->rap_priv),0,0,
'R');
159 $this->Cell(15,6,
nbm($this->rap_nd),0,0,
'R');
161 $this->Cell(15,6,
nbm($this->rap_tva_np),0,0,
'R');
162 foreach($this->rap_tva as $line_tva)
163 $this->Cell(15,6,
nbm($line_tva),0,0,
'R');
164 if ($this->flag_other_tax) {
165 $this->Cell(15, 6,
nbm($this->rap_other_tax), 0, 0,
'R');
167 $this->Cell(15,6,
nbm($this->rap_tvac),0,0,
'R');
176 $this->tp_other_tax=0;
177 foreach($this->a_Tva as $line_tva)
180 $tmp1=$line_tva[
'tva_id'];
181 $this->tp_tva[$tmp1]=0.0;
192 $flag_tva=(count($this->a_Tva) > 4)?
true:
false;
194 $this->Cell(143,6,
'Total page ',
'T',0,
'R');
196 $this->Cell(78,6,
'Total page ',
'T',0,
'R');
198 $this->Cell(15,6,
nbm($this->tp_htva),
'T',0,
'R');
199 if ( $this->jrn_type !=
'VEN')
201 $this->Cell(15,6,
nbm($this->tp_priv),
'T',0,
'R');
202 $this->Cell(15,6,
nbm($this->tp_nd),
'T',0,
'R');
204 $this->Cell(15,6,
nbm($this->tp_tva_np),
'T',0,
'R');
205 foreach($this->a_Tva as $line_tva)
207 $l=$line_tva[
'tva_id'];
208 $this->Cell(15,6,
nbm($this->tp_tva[
$l]),
'T',0,
'R');
210 if ($this->flag_other_tax) {
211 $this->Cell(15, 6,
nbm($this->tp_other_tax),
'T', 0,
'R');
213 $this->Cell(15,6,
nbm($this->tp_tvac),
'T',0,
'R');
215 $flag_tva=(count($this->a_Tva) > 4)?
true:
false;
218 $this->Cell(143,6,
'report',0,0,
'R');
220 $this->Cell(78,6,
'report',0,0,
'R');
222 $this->Cell(15,6,
nbm($this->rap_htva),0,0,
'R');
223 if ( $this->jrn_type !=
'VEN')
225 $this->Cell(15,6,
nbm($this->rap_priv),0,0,
'R');
226 $this->Cell(15,6,
nbm($this->rap_nd),0,0,
'R');
228 $this->Cell(15,6,
nbm($this->rap_tva_np),0,0,
'R');
230 foreach($this->a_Tva as $line_tva)
232 $l=$line_tva[
'tva_id'];
233 $this->Cell(15,6,
nbm($this->rap_tva[
$l]),0,0,
'R');
235 if ($this->flag_other_tax) {
236 $this->Cell(15, 6,
nbm($this->rap_other_tax), 0, 0,
'R');
238 $this->Cell(15,6,
nbm($this->rap_tvac),0,0,
'R');
242 $this->SetFont(
'Arial',
'I', 8);
244 $this->Cell(0,8,
'Date '.$this->date.
" - Page ".$this->PageNo().
'/{nb}',0,0,
'L');
246 $this->Cell(0,8,
'Created by NOALYSS, online on https://www.noalyss.eu',0,0,
'R',
false,
'https://www.noalyss.eu');
262 $this->get_filter_operation());
263 $ledger_history->get_row();
264 $a_jrn=$ledger_history->get_data();
266 if ( $a_jrn ==
null )
return;
269 $flag_tva=(count($this->a_Tva) > 4)?
true:
false;
273 $prepared_query->prepare_reconcile_date();
275 for (
$i=0;
$i<count($a_jrn);
$i++)
278 for (
$f=0;
$f<count($this->a_Tva);
$f++)
280 $l=$this->a_Tva[
$f][
'tva_id'];
285 $aAmountVat=
$ledger->vat_operation($a_jrn[
$i][
'jr_grpt_id']);
288 for (
$f=0;
$f<count($aAmountVat);
$f++)
290 $l=$aAmountVat[
$f][
'tva_id'];
291 $atva_amount[
$l]=bcadd($atva_amount[
$l],$aAmountVat[
$f][
'sum_vat']);
292 $this->tp_tva[
$l]=bcadd($this->tp_tva[
$l],$aAmountVat[
$f][
'sum_vat']);
293 $this->rap_tva[
$l]=bcadd($this->rap_tva[
$l],$aAmountVat[
$f][
'sum_vat']);
305 $this->
LongLine(65,5,mb_substr(
$row[
'jr_comment'],0,150),0,
'L');
313 if ( $ledger_history->get_ledger_type() !=
'VEN')
321 foreach ($atva_amount as $row_atva_amount)
327 $l_tvac=bcadd($l_tvac,
$other[
'tva_nd']);
328 $l_tvac=bcadd($l_tvac,$a_jrn[
$i][
'other_tax_amount']);
329 if ($this->flag_other_tax) {
330 $this->
write_cell(15, 5,
nbm($a_jrn[
$i][
'other_tax_amount']), 0, 0,
'R');
342 $msg=(
$row[
'qcode_bank'] !=
"")?
"[".
$row[
'qcode_bank'].
"]".
$row[
'qcode_name']:
$row[
'jr_internal'];
343 $str_payment=
$row[
'jr_date'].$msg.$sep;
352 $this->tp_htva=bcadd($this->tp_htva,
$other[
'price']);
353 $this->tp_tvac=bcadd($this->tp_tvac,
$other[
'price']);
354 $this->tp_tvac=bcadd($this->tp_tvac,
$other[
'vat']);
355 $this->tp_tvac=bcadd($this->tp_tvac,
$other[
'tva_nd']);
356 $this->tp_tvac=bcsub($this->tp_tvac,
$other[
'tva_np']);
357 $this->tp_tva_np=bcadd($this->tp_tva_np,
$other[
'tva_np']);
358 $this->tp_priv=bcadd($this->tp_priv,
$other[
'priv']);
359 $this->tp_nd=bcadd($this->tp_nd,
$other[
'tva_nd']);
363 $this->rap_htva=bcadd($this->rap_htva,
$other[
'price']);
364 $this->rap_tvac=bcadd($this->rap_tvac,
$other[
'price']);
365 $this->rap_tvac=bcadd($this->rap_tvac,
$other[
'vat']);
366 $this->rap_tvac=bcsub($this->rap_tvac,
$other[
'tva_np']);
367 $this->rap_tvac=bcadd($this->rap_tvac,
$other[
'tva_nd']);
368 $this->rap_priv=bcadd($this->rap_priv,
$other[
'priv']);
369 $this->rap_nd=bcadd($this->rap_nd,
$other[
'tva_nd']);
370 $this->rap_tva_np=bcadd($this->rap_tva_np,
$other[
'tva_np']);
372 if ($this->flag_other_tax) {
373 $this->tp_other_tax = bcadd($this->tp_other_tax, $a_jrn[
$i][
'other_tax_amount']);
374 $this->rap_other_tax = bcadd($this->rap_other_tax, $a_jrn[
$i][
'other_tax_amount']);
nbm($p_number, $p_dec=2)
format the number with a sep.
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)
LongLine($w, $h, $txt, $border=0, $align='', $fill=false)
write_cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
get_tiers($p_jr_id, $p_jrn_type)
retrieve the client name and quick_code
For the periode tables parm_periode and jrn_periode.
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, Acc_Ledger $p_jrn, $p_from, $p_to, $p_filter_operation)
export()
export the ledger in PDF
setDossierInfo($dossier="n/a")
Header()
write the header of each page
Parent class for the print_ledger class.