[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 159/238: Currency : because of Misc Operation
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 159/238: Currency : because of Misc Operation, the tiers must also be saved into operation_currency. Fix also PRINTJRN for currency |
Date: |
Sat, 26 Oct 2019 04:40:56 -0400 (EDT) |
sparkyx pushed a commit to annotated tag rel7110
in repository noalyss.
commit 6a6322bd438cadfe059ef7d9898cf8b72bfbae69
Author: Dany De Bontridder <address@hidden>
Date: Wed Jan 9 09:26:14 2019 +0100
Currency : because of Misc Operation, the tiers must also be saved into
operation_currency.
Fix also PRINTJRN for currency
---
include/class/acc_ledger.class.php | 6 ++++--
include/class/acc_ledger_fin.class.php | 18 +++++++++++++-----
include/class/acc_ledger_sold.class.php | 12 ++++++++++--
include/class/print_ledger_fin.class.php | 20 ++++++++++----------
include/class/print_ledger_misc.class.php | 2 +-
include/database/jrn_def_sql.class.php | 1 +
include/template/ledger_detail_fin.php | 2 +-
7 files changed, 40 insertions(+), 21 deletions(-)
diff --git a/include/class/acc_ledger.class.php
b/include/class/acc_ledger.class.php
index 13f69dd..744911e 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -1927,8 +1927,10 @@ class Acc_Ledger extends jrn_def_sql
"jr_pj_number as pj,jr_grpt_id,".
" to_char(jr_date,'DDMMYY') as date_fmt, ".
" jr_comment as comment, jr_montant as montant ,".
- " jr_grpt_id,jr_def_id".
- " from jrn join jrn_def on (jr_def_id=jrn_def_id) where ".
+ "
jr_grpt_id,jr_def_id,jrn.currency_id,currency_rate,currency_rate_ref,cr_code_iso
".
+ " from jrn join jrn_def on (jr_def_id=jrn_def_id) ".
+ " left join currency on (currency.id=jrn.currency_id) ".
+ " where ".
" jr_date >= (select p_start from parm_periode where p_id = $1)
and jr_date <= (select p_end from
parm_periode where p_id = $2)".
' '.$jrn.' order by
jr_date,substring(jr_pj_number,\'[0-9]+$\')::numeric asc';
diff --git a/include/class/acc_ledger_fin.class.php
b/include/class/acc_ledger_fin.class.php
index a27e222..df743a4 100644
--- a/include/class/acc_ledger_fin.class.php
+++ b/include/class/acc_ledger_fin.class.php
@@ -852,7 +852,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
$operation_currency = new
Operation_currency_SQL($this->db);
$operation_currency->oc_amount=$amount_input;
$operation_currency->oc_vat_amount=0;
-
$operation_currency->oc_price_unit=$amount_input;
+ $operation_currency->oc_price_unit=0;
$operation_currency->j_id=$j_id_currency;
$operation_currency->insert();
@@ -883,18 +883,26 @@ class Acc_Ledger_Fin extends Acc_Ledger
$acc_operation->qcode = $e_bank_account;
$j_id=$acc_operation->insert_jrnx();
-
+ // -- Insert into Operation Currency
+ $operation_currency = new
Operation_currency_SQL($this->db);
+ $operation_currency->oc_amount=$amount_input;
+ $operation_currency->oc_vat_amount=0;
+ $operation_currency->oc_price_unit=0;
+ $operation_currency->j_id=$j_id;
+ $operation_currency->insert();
if (sql_string(${"e_other$i" . "_comment"}) ==
null)
{
// if comment is blank set a default one
- $comment = " compte : " .
$fBank->strAttribut(ATTR_DEF_NAME) . ' a ' .
-
$fPoste->strAttribut(ATTR_DEF_NAME);
+ $comment = sprintf(_(" compte : %s a
%s "),
+
$fBank->strAttribut(ATTR_DEF_NAME),
+
$fPoste->strAttribut(ATTR_DEF_NAME)
+ );
}
else
{
- $comment = ${'e_other' . $i .
'_comment'};
+ $comment =strip_tags(${'e_other' . $i .
'_comment'});
}
diff --git a/include/class/acc_ledger_sold.class.php
b/include/class/acc_ledger_sold.class.php
index ba65074..cf76ce9 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sold.class.php
@@ -478,8 +478,16 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$tot_debit=round($tot_debit, 2);
}
$let_tiers = $acc_operation->insert_jrnx();
-
-
+
+ // --- insert also the currency amount for the customer
+ $operation_currency=new Operation_currency_SQL($this->db);
+ $operation_currency->oc_amount=$tot_amount_cur;
+ $operation_currency->oc_vat_amount=0;
+ $operation_currency->oc_price_unit=0;
+ $operation_currency->j_id=$let_tiers ;
+ $operation_currency->insert();
+
+
/** save all vat
* $i contains the tva_id and value contains the vat amount
* if if ($g_parameter->MY_TVA_USE == 'Y' )
diff --git a/include/class/print_ledger_fin.class.php
b/include/class/print_ledger_fin.class.php
index 1f3b82b..931da51 100644
--- a/include/class/print_ledger_fin.class.php
+++ b/include/class/print_ledger_fin.class.php
@@ -100,12 +100,10 @@ class Print_Ledger_Financial extends PDF
if ( $a_jrn == null ) return;
bcscale(2);
$this->ledger->load();
- $currency=$this->ledger->get_currency()->get_code();
- $currency_id=$this->ledger->get_currency()->get_id();
+
$this->cn->prepare("amount_cur",
"select jrn2.jr_id ,
- sum(coalesce(oc_amount,0)) as sum_ocamount,
- sum(coalesce(oc_vat_amount,0)) as sum_ocvat_amount
+ sum(coalesce(oc_amount,0)) as sum_ocamount
from operation_currency
join jrnx using (j_id)
join jrn as jrn2 on (j_grpt=jrn2.jr_grpt_Id)
@@ -126,13 +124,15 @@ class Print_Ledger_Financial extends PDF
$this->LongLine(60,5,$row['comment'],0,'L');
$amount=$this->cn->get_value('select qf_amount from quant_fin
where jr_id=$1',array( $row['id']));
- if ( $currency_id != 0) {
-
$ret_amount_cur=$this->cn->execute("amount_cur",array($row['id']));
+ $ret_amount_cur=$this->cn->execute("amount_cur",array($row['id']));
+
+ if ( $this->cn->count($ret_amount_cur) == 1) {
- if ( $this->cn->count($ret_amount_cur) == 1) {
- $amount_cur=Database::fetch_result($ret_amount_cur, 0,1);
- $this->write_cell(20,5,sprintf('%s
%s',nbm($amount_cur),$currency),0,0,'R');
- }
+ $amount_cur=Database::fetch_result($ret_amount_cur, 0,1);
+ $this->write_cell(20,5,sprintf('%s
%s',nbm($amount_cur),$row['cr_code_iso']),0,0,'R');
+ } else {
+
+ $this->write_cell(20,5,"",0,0,'R');
}
$this->write_cell(20,5,sprintf('%s',nbm($amount)),0,0,'R');
$this->line_new(5);
diff --git a/include/class/print_ledger_misc.class.php
b/include/class/print_ledger_misc.class.php
index ece4cc6..6773b74 100644
--- a/include/class/print_ledger_misc.class.php
+++ b/include/class/print_ledger_misc.class.php
@@ -93,7 +93,7 @@ class Print_Ledger_Misc extends PDF
$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(20,5,nbm(bcadd($row['sum_ocvat_amount'],$row['sum_ocamount']),2).$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/database/jrn_def_sql.class.php
b/include/database/jrn_def_sql.class.php
index 818248f..3f77f53 100644
--- a/include/database/jrn_def_sql.class.php
+++ b/include/database/jrn_def_sql.class.php
@@ -55,6 +55,7 @@ class Jrn_Def_sql
, "jrn_def_bank" => "jrn_def_bank"
, "jrn_def_num_op" => "jrn_def_num_op"
, "jrn_def_description" => "jrn_def_description"
+ , "jrn_enable"=>"jrn_enable"
, "currency_id"=>"currency_id"
);
diff --git a/include/template/ledger_detail_fin.php
b/include/template/ledger_detail_fin.php
index 57f7d42..7025651 100644
--- a/include/template/ledger_detail_fin.php
+++ b/include/template/ledger_detail_fin.php
@@ -103,7 +103,7 @@ if ($obj->det->currency_id!=0)
[$obj->det->array[0]['j_id']]);
$currency_rate=$obj->db->get_value("select currency_rate from jrn where
jr_id=$1",[$obj->jr_id]);
$currency_code=$obj->db->get_value("select cr_code_iso from currency where
id=$1",[$obj->det->currency_id]);
- printf ("%s Taux utilisé %s Montant en devise
%s",$currency_code,$currency_rate,$currency_amount);
+ printf (_("%s Taux utilisé %s Montant en devise
%s"),$currency_code,$currency_rate,$currency_amount);
}
?>
<div class="myfieldset">
- [Noalyss-commit] [noalyss] 166/238: Typo, (continued)
- [Noalyss-commit] [noalyss] 166/238: Typo, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 154/238: by default jrn is an empty array, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 149/238: Currency : purchase, save all detail also in currency, fix problem with the advance payment, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 160/238: Protect parameters, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 157/238: Merge branch 'r700-currency' of gitlab.noalyss.eu:noalyss/noalyss into r700-currency, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 162/238: Currency - fix view, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 150/238: Currency : detail operation Sale , the amount in currency were wrong in the summary, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 165/238: Database upgrade, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 158/238: Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss into r700-currency, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 167/238: Currency : set default accounting for change difference when using currency, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 159/238: Currency : because of Misc Operation, the tiers must also be saved into operation_currency. Fix also PRINTJRN for currency,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 173/238: Mantis #0001682: CA - ajouter possibilité d'exporter le plan analytique, missing file, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 177/238: Mantis #1643: Déplacement du "bouton" «retour en-haut/calculatrice», Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 182/238: Bug : CARD misplace of "Search Card", Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 188/238: Fix broken merge, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 189/238: Fiche.clasS.php fix broken merge, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 191/238: Cosmetic adapt color, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 179/238: Mantis #1596: Dans le plan comptable, fiches non cliquables Les fiches sont cliquable dans Plan Comptable , PCMNCFG et dans la liste des postes, en plus on peut obtenir toutes les fiches d'un poste, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 175/238: mantis #1690: Bug : impossible d'utiliser < dans Inplace_Edit Use base64_decode to protect the string in serialize, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 196/238: Mantis #1693: CA - problème avec la balance croisée double, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 212/238: Merge branch 'accept7100' into entreprise, Dany De Bontridder, 2019/10/26