Fixed the last bug... I had just forgotten to use ReceiptTransaction for the dates in question. Also, I elminated the collected element, and just added a minor tweak to ledger_entries to make it work. I'll work on added user entered dates & accounts soon (perhaps next).

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@323 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-12 21:00:38 +00:00
parent 2cd73ed9e8
commit 03af4e731f
3 changed files with 33 additions and 74 deletions

View File

@@ -23,7 +23,13 @@ class LedgerEntriesController extends AppController {
* - Generate a listing of ledger_entries
*/
function collected() { $this->jqGridView('Collected Entries', null, 'collected'); }
function collected($account_id) {
$A = new Account();
$this->set('collected_account_id', $account_id);
$this->jqGridView('Collected ' .
$this->LedgerEntry->Ledger->Account->name($account_id) .
' Entries');
}
/**************************************************************************
@@ -191,9 +197,8 @@ class LedgerEntriesController extends AppController {
$fields = $model->ledgerContextFields2($ledger_id, $account_id, $account_type);
if ($params['action'] === 'collected') {
if (count(array_intersect($params['fields'], array('applied'))) == 1)
$fields[] = 'SUM(Reconciliation.amount) AS applied';
}
return $fields;
}
@@ -217,14 +222,14 @@ class LedgerEntriesController extends AppController {
$conditions[] = array('NOT' => array('MoneyAccount.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');
//$conditions[] = array('ReceiptTransaction.stamp >=' => '2009-06-11');
//$conditions[] = array('ReceiptTransaction.stamp <' => '2009-07-11');
//$conditions[] = array('ReceiptTransaction.stamp >=' => '2009-03-26');
//$conditions[] = array('ReceiptTransaction.stamp <' => '2009-04-11');
//$conditions[] = array('ReceiptTransaction.stamp >=' => '2009-04-11');
//$conditions[] = array('ReceiptTransaction.stamp <' => '2009-05-09');
//$conditions[] = array('ReceiptTransaction.stamp >=' => '2009-05-09');
//$conditions[] = array('ReceiptTransaction.stamp <' => '2009-06-11');
$conditions[] = array('ReceiptTransaction.stamp >=' => '2009-06-11');
$conditions[] = array('ReceiptTransaction.stamp <' => '2009-07-11');
}
if ($params['action'] === 'ledger') {

View File

@@ -1,58 +0,0 @@
<?php /* -*- mode:PHP -*- */
// Define the table columns
$cols = array();
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
$cols['Entry'] = array('index' => 'LedgerEntry.id', 'formatter' => 'id');
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
$cols['Effective'] = array('index' => 'LedgerEntry.effective_date', 'formatter' => 'date');
$cols['Through'] = array('index' => 'LedgerEntry.through_date', 'formatter' => 'date');
//$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
/* $cols['RTransaction'] = array('index' => 'ReceiptTransaction.id', 'formatter' => 'id'); */
/* $cols['REntry'] = array('index' => 'ReceiptLedgerEntry.id', 'formatter' => 'id'); */
/* $cols['RDate'] = array('index' => 'ReceiptTransaction.stamp', 'formatter' => 'date'); */
/* $cols['REffective'] = array('index' => 'ReceiptLedgerEntry.effective_date', 'formatter' => 'date'); */
/* $cols['RThrough'] = array('index' => 'ReceiptLedgerEntry.through_date', 'formatter' => 'date'); */
/* $cols['RAccount'] = array('index' => 'ReceiptAccount.name', 'formatter' => 'name'); */
/* $cols['RAmount'] = array('index' => 'ReceiptLedgerEntry.amount', 'formatter' => 'currency'); */
/* $cols['MTransaction'] = array('index' => 'MoneyTransaction.id', 'formatter' => 'id'); */
/* $cols['MEntry'] = array('index' => 'MoneyLedgerEntry.id', 'formatter' => 'id'); */
/* $cols['MDate'] = array('index' => 'MoneyTransaction.stamp', 'formatter' => 'date'); */
/* $cols['MEffective'] = array('index' => 'MoneyLedgerEntry.effective_date', 'formatter' => 'date'); */
/* $cols['MThrough'] = array('index' => 'MoneyLedgerEntry.through_date', 'formatter' => 'date'); */
/* $cols['MAccount'] = array('index' => 'MoneyAccount.name', 'formatter' => 'name'); */
/* $cols['MAmount'] = array('index' => 'MoneyLedgerEntry.amount', 'formatter' => 'currency'); */
$cols['Paid'] = array('index' => 'ReceiptTransaction.stamp', 'formatter' => 'date');
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
//$cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id');
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'name');
//$cols['Source'] = array('index' => 'MonetarySource.name', 'formatter' => 'name');
//$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150);
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
/* $cols['RAmount'] = array('index' => 'ReceiptLedgerEntry.amount', 'formatter' => 'currency'); */
/* $cols['MAmount'] = array('index' => 'MoneyLedgerEntry.amount', 'formatter' => 'currency'); */
$cols['Applied'] = array('index' => 'applied', 'formatter' => 'currency');
$cols['Sub-Total'] = array('index' => 'subtotal-applied', 'formatter' => 'currency', 'sortable' => false);
// This element is non-standard.
// Let grid know who the controller is
$grid->controller = 'ledger_entries';
$collected_account_id = $this->passedArgs[0];
$collected_not = (isset($this->passedArgs[1]) ? $this->passedArgs[1] : 0);
$grid->customData(compact('collected_account_id', 'collected_not'));
// Render the grid
$grid
->limit(500)
->columns($cols)
//->sortField('Date')
->render($this, isset($config) ? $config : null);

View File

@@ -24,7 +24,8 @@ $cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' =>
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
$cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' => 'currency');
$cols['Paid'] = array('index' => 'ReceiptTransaction.stamp', 'formatter' => 'date');
$cols['Applied'] = array('index' => "applied", 'formatter' => 'currency');
$cols['Sub-Total'] = array('index' => 'subtotal-LedgerEntry.amount', 'formatter' => 'currency', 'sortable' => false);
@@ -53,12 +54,15 @@ if ($group_by_tx)
if ($group_by_tx)
$grid->invalidFields(array('Effective', 'Through'));
if (!isset($collected_account_id))
$grid->invalidFields('Paid');
if (isset($account_ftype) || isset($ledger_id) || isset($account_id) || isset($ar_account))
$grid->invalidFields(array('Debit Account', 'Credit Account'));
else
$grid->invalidFields('Account');
if (isset($no_account) || $group_by_tx)
if (isset($no_account) || $group_by_tx || isset($collected_account_id))
$grid->invalidFields(array('Account', 'Debit Account', 'Credit Account'));
if (isset($ledger_id) || isset($account_id) || isset($ar_account))
@@ -74,14 +78,18 @@ if (isset($lease_id) || isset($customer_id))
if (isset($lease_id) || $group_by_tx)
$grid->invalidFields(array('Lease', 'Unit'));
if (!isset($reconcile_id))
if (!isset($reconcile_id) && !isset($collected_account_id))
$grid->invalidFields('Applied');
if (isset($collected_account_id))
$cols['Sub-Total']['index'] = 'subtotal-applied';
if (isset($account_ftype))
$grid->invalidFields('Sub-Total');
if (!isset($config['rows'])) {
if (!isset($config['rows']) && !isset($collected_account_id)) {
$config['action'] = 'ledger';
$grid->limit(50);
}
@@ -90,6 +98,10 @@ if (isset($reconcile_id)) {
$grid->customData(compact('reconcile_id'))->limit(20);
}
if (isset($collected_account_id)) {
$grid->customData(compact('collected_account_id'))->limit(500);
}
// Set up search fields if requested by caller
if (isset($searchfields))
$grid->searchFields(array('Customer', 'Unit'));
@@ -105,7 +117,7 @@ $grid
->sortField('Date')
->defaultFields(array('Entry', 'Date', 'Amount', 'Credit', 'Debit'))
->render($this, isset($config) ? $config : null,
array('Transaction', 'Entry', 'Date', 'Effective',
array('Transaction', 'Entry', 'Date', 'Effective', 'Paid',
'Account', 'Debit Account', 'Credit Account',
'Customer', 'Unit',
'Comment',