Modified NSF to use positive amounts for the ledger entries (swapping credit/debit, of course). The statement entries remain using negative amounts, as they are negative disbursements.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@511 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -225,7 +225,7 @@ class Transaction extends AppModel {
|
||||
if (!isset($group[$entry['account_id']]))
|
||||
$group[$entry['account_id']] =
|
||||
array('account_id' => $entry['account_id'],
|
||||
'crdr' => 'CREDIT',
|
||||
'crdr' => strtoupper($this->Account->fundamentalOpposite($deposit['crdr'])),
|
||||
'amount' => 0);
|
||||
$group[$entry['account_id']]['amount'] += $entry['amount'];
|
||||
}
|
||||
@@ -556,6 +556,8 @@ class Transaction extends AppModel {
|
||||
array_intersect_key($transaction,
|
||||
array_flip(array('customer_id', 'lease_id')));
|
||||
$se['comment'] = $entry['statement_entry_comment'];
|
||||
if (!empty($entry['se_negative']))
|
||||
$se['amount'] *= -1;
|
||||
|
||||
// (DISBURSEMENTS will have statement entries created below, when
|
||||
// assigning credits, and DEPOSITS don't have statement entries)
|
||||
@@ -581,11 +583,11 @@ class Transaction extends AppModel {
|
||||
// that were created above before we nulled them out
|
||||
array_unshift($entries,
|
||||
array('le1' => array('account_id' => $transaction['account_id'],
|
||||
'crdr' => 'DEBIT',
|
||||
'amount' => $transaction['amount']),
|
||||
'le2' => array('account_id' => $this->Account->accountReceivableAccountID(),
|
||||
'crdr' => 'CREDIT',
|
||||
'amount' => $transaction['amount'])
|
||||
'amount' => -1 * $transaction['amount']),
|
||||
'le2' => array('account_id' => $this->Account->accountReceivableAccountID(),
|
||||
'crdr' => 'DEBIT',
|
||||
'amount' => -1 * $transaction['amount'])
|
||||
));
|
||||
}
|
||||
|
||||
@@ -681,10 +683,12 @@ class Transaction extends AppModel {
|
||||
// and recording it in the NSF account. It has nothing to do
|
||||
// with the customer statement (charges, disbursements, credits, etc).
|
||||
$bounce_result = $this->addDeposit
|
||||
(array('Transaction' => array(),
|
||||
(array('Transaction' => array('crdr' => 'CREDIT'),
|
||||
'Entry' => array(array('tender_id' => null,
|
||||
'account_id' => $this->Account->nsfAccountID(),
|
||||
'amount' => -1 * $tender['LedgerEntry']['amount'],
|
||||
'crdr' => 'DEBIT',
|
||||
'amount' => $tender['LedgerEntry']['amount'],
|
||||
'se_negative' => true,
|
||||
))),
|
||||
$tender['Transaction']['account_id']);
|
||||
|
||||
@@ -724,10 +728,9 @@ class Transaction extends AppModel {
|
||||
|
||||
$rollback['Transaction']['stamp'] = $stamp;
|
||||
$rollback['Transaction']['type'] = 'RECEIPT';
|
||||
$rollback['Transaction']['crdr'] = 'DEBIT'; // Unused... keeps verifyTx happy
|
||||
$rollback['Transaction']['crdr'] = 'CREDIT'; // Unused... keeps verifyTx happy
|
||||
$rollback['Transaction']['account_id'] = $this->Account->nsfAccountID();
|
||||
$rollback['Transaction']['customer_id'] = $tender['Tender']['customer_id'];
|
||||
$rollback['Transaction']['amount'] = -1 * $tender['LedgerEntry']['amount'];
|
||||
|
||||
foreach ($nsf_ledger_entry['Transaction']['StatementEntry'] AS $disbursement) {
|
||||
if ($disbursement['type'] === 'SURPLUS') {
|
||||
|
||||
Reference in New Issue
Block a user