- $currency = get_bank_account_currency($from_account);
- $bank_gl_account = get_bank_gl_account($from_account);
-
- // the gl items are already inversed/negated for type 2 (deposit)
- $total_amount = $items->gl_items_total();
-
- if ($person_type_id == PT_CUSTOMER)
- {
- // we need to add a customer transaction record
-
- // convert to customer currency
- $cust_amount = exchange_from_to($total_amount, $currency, get_customer_currency($person_id), $date_);
- // we need to negate it too
- $cust_amount = -$cust_amount;
-
- $trans_no = reinsert_customer_trans($trans_type, $trans_no, $person_id, $person_detail_id, $date_,
- $ref, $cust_amount);
-
- }
- elseif ($person_type_id == PT_SUPPLIER)
- {
- // we need to add a supplier transaction record
- // convert to supp currency
- $supp_amount = exchange_from_to($total_amount, $currency, get_supplier_currency($person_id), $date_);
-
- // we need to negate it too
- $supp_amount = -$supp_amount;
-
- $trans_no = reinsert_supp_trans($trans_type, $trans_no, $person_id, $date_, '',
- $ref, "", $supp_amount, 0, 0);
-
- }
- else
- {
- $do_exchange_variance = $SysPrefs->auto_currency_revaluation();
- if ($do_exchange_variance)
- $trans_no1 = get_next_trans_no(ST_JOURNAL);
- }
-
- // do the source account postings