From ffb2aa2f6cba762c6f54cc49005afd7aec1986b9 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 14 May 2010 02:02:58 +0000 Subject: [PATCH] Fix small bugs include/class_print_ledger_simple.php --- html/admin/sql/patch/upgrade76.sql | 31 +++++++++++++++++++++++++++ html/jrn_pdf.php | 2 +- include/class_print_ledger_simple.php | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/html/admin/sql/patch/upgrade76.sql b/html/admin/sql/patch/upgrade76.sql index 892461d44..99259493b 100644 --- a/html/admin/sql/patch/upgrade76.sql +++ b/html/admin/sql/patch/upgrade76.sql @@ -65,6 +65,37 @@ begin insert into quant_fin (jr_id,qf_bank,qf_other,qf_amount) values (rec.jr_id,nBank,nOther,nAmount); end if; end loop; +-- only cash + for rec in select jr_id,jr_grpt_id from jrn + where jr_def_id in (select jrn_def_id from jrn_def where jrn_def_type='FIN') and jr_id not in (select jr_id from quant_fin) + loop + -- there are only 2 lines for bank operations + -- first debit + select count(j_id) into nCount from jrnx where j_grpt=rec.jr_grpt_id; + if nCount > 2 then + raise notice 'Trop de valeur pour jr_grpt_id % count %',rec.jr_grpt_id,nCount; + return; + end if; + nBank := 0; nOther:=0; + for recBank in select j_id, j_montant,j_debit,j_qcode,j_poste from jrnx where j_grpt=rec.jr_grpt_id + loop + if recBank.j_poste like sCassa||'%' then + -- retrieve f_id for bank + select f_id into nBank from vw_poste_qcode where j_qcode=recBank.j_qcode; + if recBank.j_debit = false then + nAmount=recBank.j_montant*(-1); + else + nAmount=recBank.j_montant; + end if; + else + select f_id into nOther from vw_poste_qcode where j_qcode=recBank.j_qcode; + end if; + end loop; + if nBank != 0 and nOther != 0 then + insert into quant_fin (jr_id,qf_bank,qf_other,qf_amount) values (rec.jr_id,nBank,nOther,nAmount); + end if; + end loop; + return; end; $_$ diff --git a/html/jrn_pdf.php b/html/jrn_pdf.php index d20ca87b3..c8083ba5f 100644 --- a/html/jrn_pdf.php +++ b/html/jrn_pdf.php @@ -129,7 +129,7 @@ if ( $_REQUEST['p_simple']== 1 ) $pdf->Output('journal-'.$fDate.'.pdf','I'); exit(0); } - if ( $jrn_type=='ODS') { + if ( $jrn_type=='ODS' || $Jrn->id==0) { $pdf= new Print_Ledger_Misc($cn,$Jrn); $pdf->setDossierInfo($Jrn->name); $pdf->AliasNbPages(); diff --git a/include/class_print_ledger_simple.php b/include/class_print_ledger_simple.php index 79373fb49..5cc83a9d0 100644 --- a/include/class_print_ledger_simple.php +++ b/include/class_print_ledger_simple.php @@ -87,7 +87,7 @@ class Print_Ledger_Simple extends PDF { //initialize Amount TVA $tmp1=$line_tva['tva_id']; - $rap_tva[$tmp1]=0; + $this->rap_tva[$tmp1]=0; } $this->Cell(15,6,'Pièce'); $this->Cell(10,6,'Date');