$trans_no = get_next_trans_no($trans_type);
+ $total = 0;
// do the source account postings
- add_gl_trans($trans_type, $trans_no, $date_, $from_account, 0, 0, "",
+ $total += add_gl_trans($trans_type, $trans_no, $date_, $from_account, 0, 0, "",
-$amount, $currency);
add_bank_trans($trans_type, $trans_no, $from_account, $ref,
// do the destination account postings
add_gl_trans($trans_type, $trans_no, $date_, $to_account, 0, 0, "",
- $amount, $currency);
+ -$total, null);
add_bank_trans($trans_type, $trans_no, $to_account, $ref,
$date_, $payment_type, $amount,
$trans_no = get_next_trans_no($trans_type);
}
- // do the source account postings
- add_gl_trans($trans_type, $trans_no, $date_, $from_account, 0, 0, "",
- -$total_amount, $currency, $person_type_id, $person_id);
-
add_bank_trans($trans_type, $trans_no, $from_account, $ref,
$date_, $type, -$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);
}
// 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);
}
}
+ // do the source account postings
+ add_gl_trans($trans_type, $trans_no, $date_, $from_account, 0, 0, "",
+ -$total, null, $person_type_id, $person_id);
+
add_comments($trans_type, $trans_no, $date_, $memo_);
references::save_last($ref, $trans_type);