Implemented a list that checks for collected rents. There is AccountsController::collected, which I'm keeping at the moment, but I decided to move the logic into ledger_entries, since ultimately that's what we want a list of and it doesn't make sense to add a bunch of LedgerEntry logic into the jqGrid query of AccountsController. Of course, right now there is hardcoded calendar functions, and hardcoded exclusion of the Concession Account. I will probably offer up two calendars to provide a range, and a list of checkboxes of each payable account.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@318 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -16,6 +16,16 @@ class LedgerEntriesController extends AppController {
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: index / etc
|
||||
* - Generate a listing of ledger_entries
|
||||
*/
|
||||
|
||||
function collected() { $this->jqGridView('Collected Entries', null, 'collected'); }
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -56,6 +66,40 @@ class LedgerEntriesController extends AppController {
|
||||
),
|
||||
);
|
||||
|
||||
if ($params['action'] === 'collected') {
|
||||
$link['DebitLedger']['fields'][] = 'sequence';
|
||||
$link['DebitLedger']['Account']['fields'][] = 'id';
|
||||
$link['DebitLedger']['Account']['fields'][] = 'name';
|
||||
|
||||
$link['MonetarySource']['fields'][] = 'name';
|
||||
$link['Customer']['fields'][] = 'name';
|
||||
$link['Transaction']['fields'][] = 'id';
|
||||
$link['Transaction']['fields'][] = 'stamp';
|
||||
|
||||
// Income / Receipt flow
|
||||
// debit: Receipt credit: A/R <-- this entry
|
||||
// debit: A/R credit: Income <-- CRLE, below
|
||||
//
|
||||
// We're searching for the Receipt<->A/R entries,
|
||||
// which are credits on the A/R account. Find the
|
||||
// reconciling A/R entries (except for unassigned
|
||||
// pre-payments, all A/R credits should have one).
|
||||
$link['CreditReconciliationLedgerEntry']['alias'] = 'RLedgerEntry';
|
||||
$link['CreditReconciliationLedgerEntry']['Transaction']['alias'] = 'RTransaction';
|
||||
|
||||
// Debit should be A/R; Credit is Account of interest
|
||||
$link['CreditReconciliationLedgerEntry']['CreditLedger']['alias'] = 'RLedger';
|
||||
$link['CreditReconciliationLedgerEntry']['CreditLedger']['Account']['alias'] = 'RAccount';
|
||||
|
||||
$link['DebitReconciliationLedgerEntry']['alias'] = 'DRLE';
|
||||
$link['DebitReconciliationLedgerEntry']['linkalias'] = 'DRLE_R';
|
||||
$link['DebitReconciliationLedgerEntry']['DebitLedger']['alias'] = 'DL';
|
||||
$link['DebitReconciliationLedgerEntry']['DebitLedger']['Account']['alias'] = 'DA';
|
||||
|
||||
//$link['DebitReconciliationLedgerEntry']['conditions'] =
|
||||
|
||||
}
|
||||
|
||||
if (isset($params['custom']['account_ftype'])) {
|
||||
$ftype = $params['custom']['account_ftype'];
|
||||
$ftype = ucfirst($ftype);
|
||||
@@ -130,7 +174,13 @@ class LedgerEntriesController extends AppController {
|
||||
? $params['custom']['account_type']
|
||||
: null);
|
||||
|
||||
return $model->ledgerContextFields2($ledger_id, $account_id, $account_type);
|
||||
$fields = $model->ledgerContextFields2($ledger_id, $account_id, $account_type);
|
||||
|
||||
if ($params['action'] === 'collected') {
|
||||
$fields[] = 'Reconciliation.amount';
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function jqGridDataConditions(&$params, &$model) {
|
||||
@@ -143,6 +193,23 @@ class LedgerEntriesController extends AppController {
|
||||
|
||||
$conditions = parent::jqGridDataConditions($params, $model);
|
||||
|
||||
if ($params['action'] === 'collected') {
|
||||
$conditions[] = array('RAccount.id' => $params['custom']['collected_account_id']);
|
||||
//$conditions[] = array('DebitAccount.tillable' => 1);
|
||||
//$conditions[] = array('RLedgerEntry.amount != LedgerEntry.amount');
|
||||
//$conditions[] = array('Reconciliation.amount < RLedgerEntry.amount');
|
||||
$conditions[] = array('DA.payable' => 1);
|
||||
$conditions[] = array('NOT' => array('DA.name' => 'Concession'));
|
||||
//$conditions[] = array('DA.name' => 'Check');
|
||||
//$conditions[] = array('DA.name' => 'Cash');
|
||||
//$conditions[] = array('Transaction.stamp >=' => '2009-03-26');
|
||||
//$conditions[] = array('Transaction.stamp <' => '2009-04-11');
|
||||
//$conditions[] = array('Transaction.stamp >=' => '2009-04-11');
|
||||
//$conditions[] = array('Transaction.stamp <' => '2009-05-09');
|
||||
$conditions[] = array('Transaction.stamp >=' => '2009-05-09');
|
||||
$conditions[] = array('Transaction.stamp <' => '2009-06-11');
|
||||
}
|
||||
|
||||
if ($params['action'] === 'ledger') {
|
||||
$conditions[] = $model->ledgerContextConditions($ledger_id, $account_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user