Changed the StatementEntry type enum from CREDIT to SURPLUS. I never liked using the term CREDIT, since its use is confusing along side DEBIT/CREDIT. I couldn't think of another name earlier, which is why I used CREDIT, but I decided anything other than CREDIT is good, so I chose SURPLUS.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@435 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-30 21:40:38 +00:00
parent 0cb961925d
commit 0b8d8fe1ac

View File

@@ -39,7 +39,7 @@ class StatementEntry extends AppModel {
($sum ? ')' : '') . ' AS charge' . ($sum ? 's' : ''),
($sum ? 'SUM(' : '') .
"IF({$entry_name}.type = 'PAYMENT' OR {$entry_name}.type = 'CREDIT'," .
"IF({$entry_name}.type = 'PAYMENT' OR {$entry_name}.type = 'SURPLUS'," .
" {$entry_name}.amount, NULL)" .
($sum ? ')' : '') . ' AS payment' . ($sum ? 's' : ''),
@@ -346,7 +346,7 @@ OPTION 2
// First, find all known credits
$lquery = $query;
$lquery['conditions'][] = array('StatementEntry.type' => 'CREDIT');
$lquery['conditions'][] = array('StatementEntry.type' => 'SURPLUS');
$lquery['order'][] = 'StatementEntry.effective_date ASC';
$credits = $this->find('all', $lquery);
/* pr(array('StatementEntry::assignCredits' => */
@@ -435,7 +435,7 @@ OPTION 2
$payment_account_id = $credit['LedgerEntry']['account_id'];
}
else {
die("HOW DID WE GET HERE WITH NO CREDITS?");
die("HOW DID WE GET HERE WITH NO SURPLUS?");
}
// Set the payment amount to the maximum amount
@@ -454,7 +454,7 @@ OPTION 2
/* + compact('credit'))); */
if ($credit['balance'] < 0)
die("HOW DID WE END UP WITH NEGATIVE CREDIT BALANCE?");
die("HOW DID WE END UP WITH NEGATIVE SURPLUS BALANCE?");
// If we've exhaused the credit, get it out of the
// available credit pool (but keep track of it for later).
@@ -534,7 +534,7 @@ OPTION 2
/* + compact('credit'))); */
$result = $this->addStatementEntry
(array('type' => 'CREDIT',
(array('type' => 'SURPLUS',
'account_id' => $credit['LedgerEntry']['account_id'],
'amount' => $credit['balance'],
'effective_date' => $credit['Transaction']['stamp'],