41 $this->
jr_id = $pjr_id;
51 $ledger =
new Jrn_Def_sql($this->
cn, $this->acc_detail->det->jr_def_id);
60 'BON_COMMANDE'=>_(
"Bon de commande")
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]);
66 $this->pdf->write_cell(50, 6,
$label);
67 $this->pdf->write_cell(100, 6, $other_info);
68 $this->pdf->line_new(4);
76 $this->pdf->SetFont(
'DejaVu',
'', 6);
77 $this->pdf->write_cell(50, 6, _(
'Journal'));
79 $this->pdf->line_new(4);
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)
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));
117 $this->pdf->line_new(4);
119 $this->pdf->line_new(8);
127 if ( $this->acc_detail->signature==
'FIN' ||
128 $this->acc_detail->signature==
"ODS") {
131 if ($this->acc_detail->signature==
"ACH") {
133 $tiers_id=$this->acc_detail->det->array[0][
'qp_supplier'];
136 $tiers_id=$this->acc_detail->det->array[0][
'qs_client'];
138 $this->pdf->SetFont(
'DejaVu',
'B', 10);
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") {
165 if ( $tva->tva_both_side==1) {
168 $ret=sprintf(
"%d %s %s",$p_tva_id,$tva->tva_label,$auto);
174 $nb=count($this->acc_detail->det->array);
175 $width=array(10,30,50,25,25,25,25);
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);
190 $row=$this->acc_detail->det->array[
$i];
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");
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);
203 $sum_amount=bcadd($sum_amount,
$row[
"qs_price"]);
204 $sum_vat=bcadd($sum_vat,
$row[
"qs_vat"]);
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");
216 $this->pdf->write_cell(
$width[5],6,
nbm($sum_vat,2),
"",0,
"R");
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);
225 $nb=count($this->acc_detail->det->array);
226 $width=array(10,30,50,25,25,25,25);
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);
241 $row=$this->acc_detail->det->array[
$i];
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");
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);
254 $sum_amount=bcadd($sum_amount,
$row[
"qp_price"]);
255 $sum_vat=bcadd($sum_vat,
$row[
"qp_vat"]);
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");
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);
275 $this->pdf->SetFont(
'DejaVu',
'B', 10);
276 $this->pdf->write_cell(60,8,$p_section,
"1");
277 $this->pdf->line_new(8);
281 $width=array(10,80,25,25,25,25);
284 foreach ($aOther_tax as $other_tax)
286 $amount=$other_tax->getTaxAmount();
288 $this->pdf->write_cell(
$width[0],6,
"");
289 $this->pdf->write_cell(
$width[1],6,$other_tax->getAcLabel().
" ".$other_tax->getAcRate().
"%");
291 $this->pdf->write_cell(
$width[3],6,
"");
293 $this->pdf->write_cell(
$width[4],6,
"");
295 $this->pdf->line_new(6);
301 $obj1->set_id($this->
jr_id);
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);
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"]);
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"]));
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"]));
333 $this->pdf->write_cell(
$width[4],6,
nbm(
$row[
"j_montant"],2),
"",0,
"R");
334 $deb=(
$row[
"j_debit"]==
"t")?
"D":
"C";
336 $this->pdf->line_new(6);
345 $a_reconcilied_operation=$this->
cn->get_array(
"select jr_id,jra_concerned from jrn_rapt where jra_concerned=$1 or jr_id=$1",
347 if ( empty ($a_reconcilied_operation)) {
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'];
362 $this->pdf->SetFont(
'DejaVu',
'B', 8);
364 $this->pdf->SetFillColor(220,221,255);
366 $this->pdf->write_cell(
$width,8,$pa_plan[
$i][
'pa_name'],1,
"C",1);
368 $this->pdf->write_cell(
$width,8,_(
'Montant'),1,
"C",1);
369 $this->pdf->SetFillColor(0,0,0);
370 $this->pdf->line_new(8);
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));
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);
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)
396 order by oa_row,pa_id
398 $this->pdf->SetFont(
'DejaVu',
'', 6);
404 $cnt_plan = count($pa_plan);
408 $current_row = $a_operation_analytique[
$i];
410 $old_row = $current_row;
411 if ($old_row[
'oa_row']!=$current_row[
'oa_row']) {
413 for (
$e = $idx_plan;
$e<$cnt_plan;
$e++)
414 $this->pdf->write_cell(
$width, 8,
"", 1,
"C", 0);
417 $this->pdf->write_cell(
$width, 8,
nbm($old_row[
"signed_amount"],2), 1,
"R", 0);
419 $tot_anc= bcadd($tot_anc, $old_row[
"signed_amount"]);
421 $this->pdf->line_new(8);
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);
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);
436 $this->pdf->write_cell(
$width, 8,
"", 1,
"C", 0);
441 if ($idx_plan == $cnt_plan ) $idx_plan=0;
442 $old_row = $current_row;
447 $this->pdf->write_cell(
$width, 8,
"", 1,
"C", 0);
449 $this->pdf->write_cell(
$width, 8,
nbm($old_row[
"signed_amount"],2), 1,
"R", 0);
450 $this->pdf->line_new(8);
453 $tot_anc= bcadd($tot_anc, $old_row[
"signed_amount"]);
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();
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();
470 $a_plan=$this->
cn->get_array(
"select pa_id,pa_name
471 from public.plan_analytique order by pa_id");
476 $a_jrnxId=$this->
cn->get_array(
477 "select j_id from jrnx join jrn on (jr_grpt_id=j_grpt)
479 jr_id=$1",array($this->
jr_id));
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
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;
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();
521 if ($this->acc_detail->signature==
"ODS" ||
522 $this->acc_detail->signature==
"FIN" ||
523 array_search(
"acc", $p_option) !==
false
528 if (array_search(
"anc", $p_option) !==
false )
544 $file_name=$_ENV[
'TMP'].
"/".
"acc_op".$this->acc_detail->det->jr_internal.
".pdf";
545 $this->pdf->Output($file_name,
"F");
549 $this->pdf->Output(
"acc_op".$this->acc_detail->det->jr_internal.
".pdf",
"D");
nb($p_number)
format the number for the CSV export
nbm($p_number, $p_dec=2)
format the number with a sep.
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...
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.
if( $t !=-1 &&isNumber($t)==1) $total
for($i=0;$i< $nb_jrn;$i++) $deb