Finally, a working NSF implementation. Ledger Entry tracking stops at the Bank account, since we switch from positive to negative ledger entries. However, we're not going to reconcile debits to credits in the bank account anyway, so I just disabled tracking on the account.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@334 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-15 03:06:59 +00:00
parent 2588fd6a91
commit c4942b922b
5 changed files with 79 additions and 42 deletions

View File

@@ -153,6 +153,8 @@ class AccountsController extends AppController {
}
$payment_accounts = $this->Account->paymentAccounts();
$payment_accounts[$this->Account->nsfAccountID()] =
$this->Account->name($this->Account->nsfAccountID());
$default_accounts = array_diff_key($payment_accounts,
array($this->Account->concessionAccountID() => 1));
$this->set(compact('payment_accounts', 'default_accounts'));

View File

@@ -184,6 +184,9 @@ class LedgerEntriesController extends AppController {
if (count(array_intersect($params['fields'], array('applied'))) == 1)
$fields[] = 'SUM(Reconciliation.amount) AS applied';
if ($params['action'] === 'collected')
$fields[] = 'MAX(ReceiptTransaction.stamp) AS last_paid';
return $fields;
}
@@ -205,12 +208,12 @@ class LedgerEntriesController extends AppController {
else
die("INTERNAL ERROR: COLLECTED ACCOUNT ID NOT SET");
if (isset($collected_from_date))
if (!empty($collected_from_date))
$conditions[]
= array('ReceiptTransaction.stamp >=' =>
$this->LedgerEntry->Transaction->dateFormatBeforeSave($collected_from_date));
if (isset($collected_through_date))
if (!empty($collected_through_date))
$conditions[]
= array('ReceiptTransaction.stamp <=' =>
$this->LedgerEntry->Transaction->dateFormatBeforeSave($collected_through_date . ' 23:59:59'));