From 28cd4e35b32306e34d2c04f5e8a3c0b9c0e30995 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sat, 26 Oct 2013 19:15:15 +0200 Subject: [PATCH] Bank Transfer: roundings for transfers between two currencies are posted to exchange variance account. --- gl/includes/db/gl_db_banking.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gl/includes/db/gl_db_banking.inc b/gl/includes/db/gl_db_banking.inc index 1e4f4305..e6d65d92 100644 --- a/gl/includes/db/gl_db_banking.inc +++ b/gl/includes/db/gl_db_banking.inc @@ -196,7 +196,7 @@ function add_bank_transfer($from_account, $to_account, $date_, global $Refs, $SysPrefs; begin_transaction(); - $args = func_get_args(); if (count($args) < 7) $args[] = 0; + $args = func_get_args(); if (count($args) < 8) $args[] = 0; $args = (object)array_combine(array('from_account', 'to_account', 'date_', 'amount', 'ref', 'memo_', 'charge', 'target_amount'), $args); $args->trans_no = 0; @@ -249,7 +249,11 @@ function add_bank_transfer($from_account, $to_account, $date_, $to_amount, $to_currency); /*Post a balance post if $total != 0 */ - add_gl_balance($trans_type, $trans_no, $date_, -$total); + if ($currency == $to_currency) + add_gl_balance($trans_type, $trans_no, $date_, -$total); + else // in this case those are exchange variances between bank and home rates + add_gl_trans($trans_type, $trans_no, $date_, get_company_pref('exchange_diff_act'), + 0, 0, _("Exchange Variance"), -$total); add_bank_trans($trans_type, $trans_no, $to_account, $ref, $date_, $to_amount, PT_MISC, $person_id, -- 2.30.2