A working version of the collected report for accounts. There is still some error checking to do, since we don't want this report for just any account. Also, we may wish to do away with the form to prevent accidental submittal. Finally, it would be nice to do away with the button, and automatically update on date changes.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@324 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-13 02:24:31 +00:00
parent 3ffa3c81bb
commit 00cff7bb3a
6 changed files with 195 additions and 105 deletions

View File

@@ -146,77 +146,26 @@ class AccountsController extends AppController {
* - Displays the items actually collected for the period
* e.g. How much was collected in rent from 4/1/09 - 5/1/09
*/
function collected($id) {
//if ($this->data) {
//pr($this->data);
//}
function collected($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Item.', true));
$this->redirect(array('action'=>'index'));
}
/* $tillable_account = $this->Account->relatedAccounts('tillable'); */
/* $depositable_account = $this->Account->relatedAccounts('depositable'); */
$payment_accounts = $this->Account->paymentAccounts();
$default_accounts = array_diff_key($payment_accounts,
array($this->Account->concessionAccountID() => 1));
$this->set(compact('payment_accounts', 'default_accounts'));
$ledger_entries =
$this->Account->Ledger->LedgerEntry->find
('all',
array('link' => array
('Ledger' =>
array('fields' => array('sequence'),
$this->Account->recursive = -1;
$account = $this->Account->read(null, $id);
$account = $account['Account'];
'Account' =>
array('fields' => array('id', 'name')),
),
'MonetarySource' =>
array('fields' => array('name')),
'Customer' =>
array('fields' => array('name')),
'Transaction' =>
array('fields' => array('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).
'CreditReconciliationLedgerEntry' =>
array('alias' => 'RLedgerEntry',
'fields' => true,
'Transaction' =>
array('alias' => 'RTransaction',
'fields' => array('stamp')),
// Debit should be A/R; Credit is Account of interest
'CreditLedger' =>
array('alias' => 'RLedger',
'fields' => true,
'Account' =>
array('alias' => 'RAccount',
'fields' => true,
),
),
),
),
'fields' => array('LedgerEntry.*', 'Reconciliation.amount'),
'conditions' => array(array('RAccount.id' => $id),
//array('Account.tillable' => 1),
),
));
pr(compact('ledger_entries'));
$title = 'Collected Whatever';
$this->set(compact('title', 'ledger_entries'));
//$this->render('/empty');
$title = ($account['name'] . ': Collected Report');
$this->set(compact('account', 'title'));
}
/**************************************************************************
**************************************************************************
**************************************************************************
@@ -337,8 +286,7 @@ class AccountsController extends AppController {
$this->sidemenu_links[] =
array('name' => 'New Ledger', 'url' => array('action' => 'newledger', $id));
$this->sidemenu_links[] =
array('name' => 'Collected', 'url' => array('controller' => 'ledger_entries',
'action' => 'collected', $id));
array('name' => 'Collected', 'url' => array('action' => 'collected', $id));
// Prepare to render
$title = 'Account: ' . $account['Account']['name'];