From 5dda688b9dd1039d6396fcee3d024fba73bf7460 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 5 Dec 2018 08:51:10 +0100 Subject: [PATCH] Currency : All ledger's listing mode , html , csv and pdf --- .../class/acc_ledger_history_generic.class.php | 18 +++++++++++++----- include/class/print_ledger_misc.class.php | 14 +++++++++----- include/export/export_ledger_csv.php | 11 ++++++++--- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/include/class/acc_ledger_history_generic.class.php b/include/class/acc_ledger_history_generic.class.php index 95729ca00..5fd4e3c04 100644 --- a/include/class/acc_ledger_history_generic.class.php +++ b/include/class/acc_ledger_history_generic.class.php @@ -449,7 +449,6 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History join jrn as jrn2 on (j_grpt=jrn2.jr_grpt_Id) where j_id in (select j_id from jrnx where j_grpt=jrn2.jr_grpt_id) - and j_debit='t' group by jr_id ) as OC1 using (jr_id) WHERE $periode and $jrn order by jr_date,substring(jrn.jr_pj_number,'[0-9]+$')::numeric asc $cond_limite"; @@ -521,9 +520,11 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History jrn_def_type, jr_rapt as oc, j_tech_per as periode, j_id, - currency_id, - currency_rate, - currency_rate_ref + jrn.currency_id, + jrn.currency_rate, + jrn.currency_rate_ref, + operation_currency.oc_amount, + operation_currency.oc_vat_amount from jrnx join jrn on (jr_grpt_id=j_grpt ) left join operation_currency using (j_id) @@ -702,6 +703,7 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History th(_("internal")). th(_("Tiers")). th(_("Commentaire")). + th(_("Devise")). th(_("Total opération")). ""; // set a filter for the FIN @@ -719,6 +721,12 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History $tiers=$this->get_tiers($line['jrn_def_type'], $line['jr_id']); echo td($tiers); echo "".h($line['comment']).""; + if ( $line['currency_id'] != 0) { + echo td(bcadd($line['sum_ocamount'],$line['sum_ocvat_amount'])." ".$line['cr_code_iso'],'class="num"'); + } else { + echo td(""); + } + // echo "".$line['pj'].""; @@ -756,7 +764,7 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History } echo ''; echo ''._('Totaux').''; - echo td().td().td().td(); + echo td().td().td().td().td(); echo ''.nbm($tot_amount).''; echo ''; echo ""; diff --git a/include/class/print_ledger_misc.class.php b/include/class/print_ledger_misc.class.php index 72910b4e6..ece4cc653 100644 --- a/include/class/print_ledger_misc.class.php +++ b/include/class/print_ledger_misc.class.php @@ -44,8 +44,9 @@ class Print_Ledger_Misc extends PDF $this->Cell(30,6,_('Piece')); $this->Cell(20,6,_('Interne')); $this->Cell(25,6,_('Tiers')); - $this->Cell(80,6,_('Commentaire')); - $this->Cell(15,6,_('Montant')); + $this->Cell(60,6,_('Commentaire')); + $this->Cell(20,6,_('Devise'),0,0,'R'); + $this->Cell(15,6,_('Montant'),0,0,'R'); $this->Ln(6); } @@ -70,8 +71,10 @@ class Print_Ledger_Misc extends PDF */ function export() { - $a_jrn=$this->ledger->get_rowSimple($_GET['from_periode'], - $_GET['to_periode']); + $http=new HttpInput(); + + $a_jrn=$this->ledger->get_rowSimple($http->get('from_periode','number'), + $http->get('to_periode','number')); $this->SetFont('DejaVu', '', 6); if ( $a_jrn == null ) return; for ( $i=0;$iledger->get_tiers($type,$a_jrn[$i]['jr_id']),0,25); $this->LongLine(25,5,$other,0,'L'); $positive=$row['montant']; - $this->LongLine(80,5,$row['comment'],0,'L'); + $this->LongLine(60,5,$row['comment'],0,'L'); if ( $type == 'FIN' ) { $positive = $this->cn->get_value("select qf_amount from quant_fin ". " where jr_id=".$row['jr_id']); } + $this->write_cell(20,5,nbm(bcadd($row['sum_ocvat_amount'],$row['sum_ocamount']),4).$row['cr_code_iso'],0,0,'R'); $this->write_cell(15,5,nbm($positive),0,0,'R'); $this->line_new(5); diff --git a/include/export/export_ledger_csv.php b/include/export/export_ledger_csv.php index 16b9e2d34..4ab879947 100644 --- a/include/export/export_ledger_csv.php +++ b/include/export/export_ledger_csv.php @@ -178,9 +178,9 @@ if ($get_option=='A') $acc_ledger_history->export_csv(); exit; } -/** - * Mode list for ODS , FIN and GL - */ +//----------------------------------------------------------------------------- +// Mode list for ODS , FIN and GL +//----------------------------------------------------------------------------- if ($get_option=="L" && ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL') ) { if ( $get_jrn==0) { @@ -215,6 +215,8 @@ if ($get_option=="L" && ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL') ) $title[]=_("montant"); $title[]=_("montant devise"); $title[]=_("devise"); + $title[]=_("taux"); + $title[]=_("taux réf"); $export->write_header($title); foreach ($Row as $line) { @@ -249,6 +251,9 @@ if ($get_option=="L" && ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL') ) //-- add currency $export->add(bcadd($line['sum_ocamount'],$line['sum_ocvat_amount']),"number"); $export->add($line['cr_code_iso']); + $export->add($line['currency_rate']); + $export->add($line['currency_rate_ref']); + //------ Add reconcilied operation --------------- $ret_reconcile=$cn->execute('reconcile_date_csv', array($line['jr_id']));