Modified how NSF customer surplus items are handled. Instead of creating a negative surplus (which was dumb, but a decent first pass), we just void out the surplus. This drops the surplus off the radar, and in fact may cause confusion since the transaction no longer has enough statement entries to total up correctly. However, it doesn't appear too confusing, especially as tender item names are now decorated with strikethrough when they're NSF (the previous checkin).

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@444 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-31 01:40:16 +00:00
parent fe17f87f7d
commit a1a9c7800b
5 changed files with 27 additions and 14 deletions

View File

@@ -1062,7 +1062,11 @@ CREATE TABLE `pmgr_statement_entries` (
`type` ENUM('CHARGE', `type` ENUM('CHARGE',
'PAYMENT', 'PAYMENT',
'SURPLUS') 'SURPLUS',
-- REVISIT <AP>: 20090730
-- VOID is just to test out a theory
-- for handling NSF and charge reversals
'VOID')
NOT NULL, NOT NULL,
`transaction_id` INT(10) UNSIGNED NOT NULL, `transaction_id` INT(10) UNSIGNED NOT NULL,

View File

@@ -171,15 +171,22 @@ class Tender extends AppModel {
$bounce['Transaction']['amount'] = -1 * $tender['LedgerEntry']['amount']; $bounce['Transaction']['amount'] = -1 * $tender['LedgerEntry']['amount'];
foreach ($nsf_ledger_entry['Transaction']['StatementEntry'] AS $payment) { foreach ($nsf_ledger_entry['Transaction']['StatementEntry'] AS $payment) {
$bounce['Entry'][] = if ($payment['type'] === 'SURPLUS') {
array('type' => $payment['type'], $payment['type'] = 'VOID';
'amount' => -1 * $payment['amount'], $this->NsfTransaction->StatementEntry->id = $payment['id'];
'account_id' => $this->LedgerEntry->Account->nsfAccountID(), $this->NsfTransaction->StatementEntry->saveField('type', $payment['type']);
'customer_id' => $payment['customer_id'], }
'lease_id' => $payment['lease_id'], else {
'charge_entry_id' => $payment['charge_entry_id'], $bounce['Entry'][] =
'effective_date' => $nsf_deposit['stamp'], array('type' => $payment['type'],
); 'amount' => -1 * $payment['amount'],
'account_id' => $this->LedgerEntry->Account->nsfAccountID(),
'customer_id' => $payment['customer_id'],
'lease_id' => $payment['lease_id'],
'charge_entry_id' => $payment['charge_entry_id'],
'effective_date' => $nsf_deposit['stamp'],
);
}
} }
pr(compact('bounce')); pr(compact('bounce'));

View File

@@ -81,7 +81,8 @@ echo $this->element('statement_entries', array
(// Grid configuration (// Grid configuration
'config' => array 'config' => array
('caption' => 'Account', ('caption' => 'Account',
'filter' => array('Customer.id' => $customer['Customer']['id']), 'filter' => array('Customer.id' => $customer['Customer']['id'],
'type !=' => 'VOID'),
'exclude' => array('Customer'), 'exclude' => array('Customer'),
))); )));

View File

@@ -8,7 +8,7 @@ $cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' =>
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name'); $cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
$cols['Cr/Dr'] = array('index' => 'LedgerEntry.crdr', 'formatter' => 'enum'); $cols['Cr/Dr'] = array('index' => 'LedgerEntry.crdr', 'formatter' => 'enum');
$cols['Tender'] = array('index' => 'Tender.name', 'formatter' => 'name'); $cols['Tender'] = array('index' => 'Tender.name', 'formatter' => 'longname');
$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150); $cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150);
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency'); $cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');

View File

@@ -73,8 +73,9 @@ if ($transaction['type'] === 'INVOICE' || $transaction['type'] === 'RECEIPT') {
'config' => array 'config' => array
( (
'caption' => 'Statement Entries', 'caption' => 'Statement Entries',
'filter' => array('Transaction.id' => $transaction['id']), 'filter' => array('Transaction.id' => $transaction['id'],
'exclude' => array('Transaction'), 'type !=' => 'VOID'),
'exclude' => array('Transaction', 'Account'),
))); )));
} }