! -> Note
$ -> Affected files
+17-Aug-2009 Joe Hunt
+# [0000160] Customer payments in different currencies (bank account exchange error). Fixed so diff bank_curr and cust/supp curr is readonly.
+$ /gl/includes/db/gl_db_bank_trans.inc
+ /purchasing/supplier_payment.php
+ /sales/customer_payments.php
+ /sales/includes/db/payments_db.inc
+
14-Aug-2009 Janusz Dobrowolski
# [0000161] Fixed reference edition on sales invoice/deliery/credit.
$ /sales/customer_credit_invoice.php
// $date_ is display date (non-sql)
function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_,
- $amount, $person_type_id, $person_id, $currency="", $err_msg="")
+ $amount, $person_type_id, $person_id, $currency="", $err_msg="", $rate=0)
{
$sqlDate = date2sql($date_);
if ($currency != "")
{
$bank_account_currency = get_bank_account_currency($bank_act);
- $to_bank_currency = get_exchange_rate_from_to($currency, $bank_account_currency, $date_);
+ if ($rate == 0)
+ $to_bank_currency = get_exchange_rate_from_to($currency, $bank_account_currency, $date_);
+ else
+ $to_bank_currency = 1 / $rate;
$amount_bank = ($amount / $to_bank_currency);
}
else
if (!is_date_in_fiscalyear($_POST['DatePaid']))
$_POST['DatePaid'] = end_fiscalyear();
}
- //start_table($table_style2, 5, 7);
- //echo "<tr><td valign=top>"; // outer table
start_outer_table($table_style2, 5);
- //echo "<table>";
table_section(1);
bank_accounts_list_row(_("From Bank Account:"), 'bank_account', null, true);
date_row(_("Date Paid") . ":", 'DatePaid', '', null, 0, 0, 0, null, true);
table_section(2);
- //echo "</table>";
- //echo "</td><td valign=top class='tableseparator'>"; // outer table
- //echo "<table>";
supplier_list_row(_("Payment To:"), 'supplier_id', null, false, true);
set_global_supplier($_POST['supplier_id']);
+ $comp_currency = get_company_currency();
$supplier_currency = get_supplier_currency($_POST['supplier_id']);
$bank_currency = get_bank_account_currency($_POST['bank_account']);
if ($bank_currency != $supplier_currency)
{
- exchange_rate_display($bank_currency, $supplier_currency, $_POST['DatePaid'], true);
+ exchange_rate_display($bank_currency, $supplier_currency, $_POST['DatePaid'], ($bank_currency == $comp_currency));
}
ref_row(_("Reference:"), 'ref', '', references::get_next(22));
text_row(_("Memo:"), 'memo_', null, 52,50);
- //echo "</table>";
-
- //echo "</td></tr>";
end_outer_table(1); // outer table
submit_center('ProcessSuppPayment',_("Enter Payment"), true, '', true);
bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true);
+ $comp_currency = get_company_currency();
$cust_currency = get_customer_currency($_POST['customer_id']);
$bank_currency = get_bank_account_currency($_POST['bank_account']);
if ($cust_currency != $bank_currency) {
- exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], true);
+ exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], ($bank_currency == $comp_currency));
}
text_row(_("Reference:"), 'ref', null, 20, 40);
/*now enter the bank_trans entry */
add_bank_trans(12, $payment_no, $bank_account, $ref,
$date_, $amount, payment_person_types::customer(), $customer_id,
- get_customer_currency($customer_id));
+ get_customer_currency($customer_id), "", $rate);
add_comments(12, $payment_no, $date_, $memo_);