40 parent::__construct($p_cn,
'L',
'mm',
'A4',
$p_jrn,$p_from,$p_to,$p_filter_operation);
42 $this->a_Tva=$this->
get_ledger()->existing_vat();
43 foreach($this->a_Tva as $line_tva)
46 $tmp1=$line_tva[
'tva_id'];
47 $this->rap_tva[$tmp1]=0;
49 $this->rap_other_tax=0;
50 $this->jrn_type=
$p_jrn->get_type();
62 foreach($this->previous[
'tva'] as $line_tva)
65 $tmp1=$line_tva[
'tva_id'];
66 $this->rap_tva[$tmp1]=$line_tva[
'sum_vat'];
69 $this->rap_htva=$this->previous[
'price'];
70 $this->rap_tvac=bcadd($this->previous[
'price'],$this->previous[
'vat']);
71 $this->rap_tvac=bcadd($this->rap_tvac,$this->previous[
'tva_nd']);
72 $this->rap_tvac=bcsub($this->rap_tvac,$this->previous[
'tva_np']);
73 $this->rap_tvac=bcsub($this->rap_tvac,$this->previous[
'reversed']);
74 $this->rap_priv=$this->previous[
'priv'];
75 $this->rap_nd=$this->previous[
'tva_nd'];
76 $this->rap_tva_np=$this->previous[
'tva_np'];
77 $this->flag_other_tax=
false;
79 if ($this->jrn_type ==
'ACH' || $this->jrn_type==
'VEN') {
87 from jrn_tax join jrnx using (j_id)
88 join jrn on (j_grpt=jr_grpt_id) where
89 j_date >= to_date($1,'DD.MM.YYYY')
90 and j_date <= to_date($2,'DD.MM.YYYY')
92 array($first_date,$last_date,
$p_jrn->id));
93 if (
$count>0) { $this->flag_other_tax=
true;}
107 $this->SetFont(
'DejaVu',
'B', 12);
109 $this->Cell(0,10,$this->dossier,
'B', 0,
'C');
112 $this->SetFont(
'DejaVu',
'B', 8);
116 foreach($this->a_Tva as $line_tva)
119 $tmp1=$line_tva[
'tva_id'];
120 $this->rap_tva[$tmp1]=(isset($this->rap_tva[$tmp1]))?$this->rap_tva[$tmp1]:0;
122 $this->Cell(15,6,
_(
'Pièce'));
123 $this->Cell(10,6,
_(
'Date'));
124 $this->Cell(13,6,
_(
'ref'));
125 if ( $this->jrn_type==
'ACH')
126 $this->Cell(40,6,
_(
'Client'));
128 $this->Cell(40,6,
_(
'Fournisseur'));
130 $flag_tva=(count($this->a_Tva) > 4)?
true:
false;
131 if ( !$flag_tva ) $this->Cell(65,6,
_(
'Description'));
133 $this->Cell(15,6,
_(
'HTVA'),0,0,
'R');
134 if ( $this->jrn_type==
'ACH')
136 $this->Cell(15,6,
_(
'Priv/DNA'),0,0,
'R');
137 $this->Cell(15,6,
_(
'TVA ND'),0,0,
'R');
139 $this->Cell(15,6,
_(
'TVA NP'),0,0,
'R');
140 foreach($this->a_Tva as $line_tva)
142 $this->Cell(15,6,$line_tva[
'tva_label'],0,0,
'R');
144 if ($this->flag_other_tax) {
145 $this->Cell(15,6,
'Autre Tx',0,0,
'R');
148 $this->Cell(15,6,
'TVAC',0,0,
'R');
151 $this->SetFont(
'DejaVu',
'',6);
154 $this->Cell(143,6,
'report',0,0,
'R');
156 $this->Cell(78,6,
'report',0,0,
'R');
157 $this->Cell(15,6,
nbm($this->rap_htva),0,0,
'R');
158 if ( $this->jrn_type !=
'VEN')
160 $this->Cell(15,6,
nbm($this->rap_priv),0,0,
'R');
161 $this->Cell(15,6,
nbm($this->rap_nd),0,0,
'R');
163 $this->Cell(15,6,
nbm($this->rap_tva_np),0,0,
'R');
164 foreach($this->rap_tva as $line_tva)
165 $this->Cell(15,6,
nbm($line_tva),0,0,
'R');
166 if ($this->flag_other_tax) {
167 $this->Cell(15, 6,
nbm($this->rap_other_tax), 0, 0,
'R');
169 $this->Cell(15,6,
nbm($this->rap_tvac),0,0,
'R');
178 $this->tp_other_tax=0;
179 foreach($this->a_Tva as $line_tva)
182 $tmp1=$line_tva[
'tva_id'];
183 $this->tp_tva[$tmp1]=0.0;
194 $flag_tva=(count($this->a_Tva) > 4)?
true:
false;
196 $this->Cell(143,6,
'Total page ',
'T',0,
'R');
198 $this->Cell(78,6,
'Total page ',
'T',0,
'R');
200 $this->Cell(15,6,
nbm($this->tp_htva),
'T',0,
'R');
201 if ( $this->jrn_type !=
'VEN')
203 $this->Cell(15,6,
nbm($this->tp_priv),
'T',0,
'R');
204 $this->Cell(15,6,
nbm($this->tp_nd),
'T',0,
'R');
206 $this->Cell(15,6,
nbm($this->tp_tva_np),
'T',0,
'R');
207 foreach($this->a_Tva as $line_tva)
209 $l=$line_tva[
'tva_id'];
210 $this->Cell(15,6,
nbm($this->tp_tva[
$l]),
'T',0,
'R');
212 if ($this->flag_other_tax) {
213 $this->Cell(15, 6,
nbm($this->tp_other_tax),
'T', 0,
'R');
215 $this->Cell(15,6,
nbm($this->tp_tvac),
'T',0,
'R');
217 $flag_tva=(count($this->a_Tva) > 4)?
true:
false;
220 $this->Cell(143,6,
'report',0,0,
'R');
222 $this->Cell(78,6,
'report',0,0,
'R');
224 $this->Cell(15,6,
nbm($this->rap_htva),0,0,
'R');
225 if ( $this->jrn_type !=
'VEN')
227 $this->Cell(15,6,
nbm($this->rap_priv),0,0,
'R');
228 $this->Cell(15,6,
nbm($this->rap_nd),0,0,
'R');
230 $this->Cell(15,6,
nbm($this->rap_tva_np),0,0,
'R');
232 foreach($this->a_Tva as $line_tva)
234 $l=$line_tva[
'tva_id'];
235 $this->Cell(15,6,
nbm($this->rap_tva[
$l]),0,0,
'R');
237 if ($this->flag_other_tax) {
238 $this->Cell(15, 6,
nbm($this->rap_other_tax), 0, 0,
'R');
240 $this->Cell(15,6,
nbm($this->rap_tvac),0,0,
'R');
244 $this->SetFont(
'Arial',
'I', 8);
246 $this->Cell(0,8,
'Date '.$this->date.
" - Page ".$this->PageNo().
'/{nb}',0,0,
'L');
248 $this->Cell(0,8,
'Created by NOALYSS, online on https://www.noalyss.eu',0,0,
'R',
false,
'https://www.noalyss.eu');
264 $this->get_filter_operation());
265 $ledger_history->get_row();
266 $a_jrn=$ledger_history->get_data();
268 if ( $a_jrn ==
null )
return;
271 $flag_tva=(count($this->a_Tva) > 4)?
true:
false;
275 $prepared_query->prepare_reconcile_date();
277 for (
$i=0;
$i<count($a_jrn);
$i++)
280 for (
$f=0;
$f<count($this->a_Tva);
$f++)
282 $l=$this->a_Tva[
$f][
'tva_id'];
287 $aAmountVat=
$ledger->vat_operation($a_jrn[
$i][
'jr_grpt_id']);
290 for (
$f=0;
$f<count($aAmountVat);
$f++)
292 $l=$aAmountVat[
$f][
'tva_id'];
293 $atva_amount[
$l]=bcadd($atva_amount[
$l],$aAmountVat[
$f][
'sum_vat']);
294 $this->tp_tva[
$l]=bcadd($this->tp_tva[
$l],$aAmountVat[
$f][
'sum_vat']);
295 $this->rap_tva[
$l]=bcadd($this->rap_tva[
$l],$aAmountVat[
$f][
'sum_vat']);
315 if ( $ledger_history->get_ledger_type() !=
'VEN')
323 foreach ($atva_amount as $row_atva_amount)
329 $l_tvac=bcadd($l_tvac,
$other[
'tva_nd']);
330 $l_tvac=bcadd($l_tvac,$a_jrn[
$i][
'other_tax_amount']);
331 if ($this->flag_other_tax) {
332 $this->
write_cell(15, 5,
nbm($a_jrn[
$i][
'other_tax_amount']), 0, 0,
'R');
344 $msg=(
$row[
'qcode_bank'] !=
"")?
"[".
$row[
'qcode_bank'].
"]".
$row[
'qcode_name']:
$row[
'jr_internal'];
345 $str_payment=
$row[
'jr_date'].$msg.$sep;
354 $this->tp_htva=bcadd($this->tp_htva,
$other[
'price']);
355 $this->tp_tvac=bcadd($this->tp_tvac,
$other[
'price']);
356 $this->tp_tvac=bcadd($this->tp_tvac,
$other[
'vat']);
357 $this->tp_tvac=bcadd($this->tp_tvac,
$other[
'tva_nd']);
358 $this->tp_tvac=bcsub($this->tp_tvac,
$other[
'tva_np']);
359 $this->tp_tva_np=bcadd($this->tp_tva_np,
$other[
'tva_np']);
360 $this->tp_priv=bcadd($this->tp_priv,
$other[
'priv']);
361 $this->tp_nd=bcadd($this->tp_nd,
$other[
'tva_nd']);
365 $this->rap_htva=bcadd($this->rap_htva,
$other[
'price']);
366 $this->rap_tvac=bcadd($this->rap_tvac,
$other[
'price']);
367 $this->rap_tvac=bcadd($this->rap_tvac,
$other[
'vat']);
368 $this->rap_tvac=bcsub($this->rap_tvac,
$other[
'tva_np']);
369 $this->rap_tvac=bcadd($this->rap_tvac,
$other[
'tva_nd']);
370 $this->rap_priv=bcadd($this->rap_priv,
$other[
'priv']);
371 $this->rap_nd=bcadd($this->rap_nd,
$other[
'tva_nd']);
372 $this->rap_tva_np=bcadd($this->rap_tva_np,
$other[
'tva_np']);
374 if ($this->flag_other_tax) {
375 $this->tp_other_tax = bcadd($this->tp_other_tax, $a_jrn[
$i][
'other_tax_amount']);
376 $this->rap_other_tax = bcadd($this->rap_other_tax, $a_jrn[
$i][
'other_tax_amount']);