projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merged changes in main trunk up to 2.0.6 (see CHANGELOG)
[fa-stable.git]
/
gl
/
includes
/
db
/
gl_db_banking.inc
diff --git
a/gl/includes/db/gl_db_banking.inc
b/gl/includes/db/gl_db_banking.inc
index 518e73c1f9c3fa9b16f49273c48fe71866053d4c..ca3d5867442caf51d1443bf37e4d1425878e73a1 100644
(file)
--- a/
gl/includes/db/gl_db_banking.inc
+++ b/
gl/includes/db/gl_db_banking.inc
@@
-20,8
+20,9
@@
function add_bank_transfer($from_account, $to_account, $date_,
$from_gl_account = get_bank_gl_account($from_account);
$to_gl_account = get_bank_gl_account($to_account);
$from_gl_account = get_bank_gl_account($from_account);
$to_gl_account = get_bank_gl_account($to_account);
+ $total = 0;
// do the source account postings
// do the source account postings
- add_gl_trans($trans_type, $trans_no, $date_, $from_gl_account, 0, 0, "",
+
$total +=
add_gl_trans($trans_type, $trans_no, $date_, $from_gl_account, 0, 0, "",
-$amount, $currency);
add_bank_trans($trans_type, $trans_no, $from_account, $ref,
-$amount, $currency);
add_bank_trans($trans_type, $trans_no, $from_account, $ref,
@@
-30,9
+31,11
@@
function add_bank_transfer($from_account, $to_account, $date_,
"Cannot insert a source bank transaction");
// do the destination account postings
"Cannot insert a source bank transaction");
// do the destination account postings
- add_gl_trans($trans_type, $trans_no, $date_, $to_gl_account, 0, 0, "",
+
$total +=
add_gl_trans($trans_type, $trans_no, $date_, $to_gl_account, 0, 0, "",
$amount, $currency);
$amount, $currency);
-
+ /*Post a balance post if $total != 0 */
+ add_gl_balance($trans_type, $trans_no, $date_, -$total);
+
add_bank_trans($trans_type, $trans_no, $to_account, $ref,
$date_, $amount, payment_person_types::misc(), "",
$currency, "Cannot insert a destination bank transaction");
add_bank_trans($trans_type, $trans_no, $to_account, $ref,
$date_, $amount, payment_person_types::misc(), "",
$currency, "Cannot insert a destination bank transaction");
@@
-108,9
+111,11
@@
function add_bank_transaction($trans_type, $from_account, $items, $date_,
-$total_amount, $currency, $person_type_id, $person_id);
add_bank_trans($trans_type, $trans_no, $from_account, $ref,
-$total_amount, $currency, $person_type_id, $person_id);
add_bank_trans($trans_type, $trans_no, $from_account, $ref,
- $date_, -$total_amount, $person_type_id, $person_id,
- $currency, "Cannot insert a source bank transaction");
-
+ $date_, -$total_amount,
+ $person_type_id, $person_id,
+ $currency,
+ "Cannot insert a source bank transaction");
+ $total = 0;
foreach ($items->gl_items as $gl_item)
{
$is_bank_to = is_bank_account($gl_item->code_id);
foreach ($items->gl_items as $gl_item)
{
$is_bank_to = is_bank_account($gl_item->code_id);
@@
-122,7
+127,7
@@
function add_bank_transaction($trans_type, $from_account, $items, $date_,
}
// do the destination account postings
}
// do the destination account postings
- add_gl_trans($trans_type, $trans_no, $date_, $gl_item->code_id,
+
$total +=
add_gl_trans($trans_type, $trans_no, $date_, $gl_item->code_id,
$gl_item->dimension_id, $gl_item->dimension2_id, $gl_item->reference,
$gl_item->amount, $currency, $person_type_id, $person_id);
$gl_item->dimension_id, $gl_item->dimension2_id, $gl_item->reference,
$gl_item->amount, $currency, $person_type_id, $person_id);
@@
-134,6
+139,10
@@
function add_bank_transaction($trans_type, $from_account, $items, $date_,
}
}
}
}
+ // do the source account postings
+ add_gl_trans($trans_type, $trans_no, $date_, $bank_gl_account, 0, 0, "",
+ -$total, null, $person_type_id, $person_id);
+
add_comments($trans_type, $trans_no, $date_, $memo_);
references::save_last($ref, $trans_type);
add_comments($trans_type, $trans_no, $date_, $memo_);
references::save_last($ref, $trans_type);