Although I'm not too happy with the modifications, I do have a working version that minimizes the columns need to display ledger entries. The logic feels screwy to me, but I've beat my head on it long enough. I'll move on to something else and come back to it when my head clears.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@166 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -357,20 +357,15 @@ echo $this->element('customers',
|
||||
array('grid_div_id' => 'customers-list',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
|
||||
' return false;">Select Customer</A>'),
|
||||
'limit' => 7,
|
||||
'grid_setup' => $grid_setup,
|
||||
));
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('grid_div_id' => 'charge-entries',
|
||||
'caption' => 'Outstanding Charges',
|
||||
/* (isset($customer['name']) */
|
||||
/* ? " for {$customer['name']}: ".FormatHelper::currency($charges['balance']) */
|
||||
/* : '')), */
|
||||
'limit' => 8,
|
||||
'ledger_id' => 6,
|
||||
'account_type' => 'credit',
|
||||
'account_ftype' => 'credit',
|
||||
'ledger_entries' => $charges['entry'],
|
||||
'limit' => 8,
|
||||
));
|
||||
|
||||
echo ('<H2>' .
|
||||
|
||||
@@ -5,17 +5,27 @@ $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['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'longname');
|
||||
$cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'longname');
|
||||
if (isset($account_ftype) || isset($ledger_id)) {
|
||||
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
||||
}
|
||||
else {
|
||||
$cols['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'longname');
|
||||
$cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'longname');
|
||||
}
|
||||
$cols['Source'] = array('index' => 'MonetarySource.name', 'formatter' => 'name');
|
||||
$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150);
|
||||
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
|
||||
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
|
||||
if (isset($reconcile))
|
||||
if (isset($account_ftype)) {
|
||||
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
|
||||
}
|
||||
else {
|
||||
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
|
||||
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
|
||||
}
|
||||
if (isset($reconcile_id)) {
|
||||
$cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' => 'currency');
|
||||
}
|
||||
|
||||
$custom_post_data = array('ledger_id' => $ledger_id,
|
||||
'account_type' => $account_type);
|
||||
$custom_post_data = compact('ledger_id', 'account_type', 'account_ftype');
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'ledger_entries',
|
||||
@@ -23,6 +33,11 @@ $jqGrid_options = array('jqGridColumns' => $cols,
|
||||
|
||||
$jqGrid_options += compact('grid_div_id', 'grid_id', 'caption', 'grid_setup', 'limit');
|
||||
|
||||
if (isset($ledger_id)) {
|
||||
$jqGrid_options += array('action' => 'ledger',
|
||||
'limit' => 50);
|
||||
}
|
||||
|
||||
if (isset($ledger_entries)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
@@ -30,14 +45,10 @@ if (isset($ledger_entries)) {
|
||||
$ledger_entries),
|
||||
'limit' => 10);
|
||||
}
|
||||
elseif (isset($reconcile)) {
|
||||
$custom_post_data += compact('reconcile', 'reconcile_id');
|
||||
$jqGrid_options += array('action' => 'reconcile',
|
||||
'limit' => 5);
|
||||
}
|
||||
else {
|
||||
$jqGrid_options += array('action' => 'ledger',
|
||||
'limit' => 50);
|
||||
|
||||
if (isset($reconcile_id)) {
|
||||
$custom_post_data += compact('reconcile_id');
|
||||
$jqGrid_options += array('limit' => 5);
|
||||
}
|
||||
|
||||
$jqGrid_options += compact('custom_post_data');
|
||||
|
||||
@@ -99,20 +99,23 @@ echo '<div CLASS="detail supporting">' . "\n";
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => "Debit Applications",
|
||||
'grid_id' => 'debit_reconciliation_ledger_entries',
|
||||
'ledger_id' => $debit_ledger['id'],
|
||||
'account_type' => $debit_ledger['Account']['type'],
|
||||
'reconcile' => 'Credit', // Looking for credits to match this debit
|
||||
'grid_div_id' => 'debit_reconciliation_ledger_entries',
|
||||
//'ledger_id' => $debit_ledger['id'],
|
||||
//'account_type' => $debit_ledger['Account']['type'],
|
||||
'account_ftype' => 'debit',
|
||||
'reconcile_id' => $entry['id'],
|
||||
'ledger_entries' => $reconciled['debit']['entry'],
|
||||
));
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => "Credit Applications",
|
||||
'grid_id' => 'credit_reconciliation_ledger_entries',
|
||||
'ledger_id' => $credit_ledger['id'],
|
||||
'account_type' => $credit_ledger['Account']['type'],
|
||||
'reconcile' => 'Debit', // Looking for debits to match this credit
|
||||
'grid_div_id' => 'credit_reconciliation_ledger_entries',
|
||||
//'ledger_id' => $credit_ledger['id'],
|
||||
//'account_type' => $credit_ledger['Account']['type'],
|
||||
//'account_ftype' => 'debit', // Looking for debits to match this credit
|
||||
'account_ftype' => 'credit',
|
||||
'reconcile_id' => $entry['id'],
|
||||
'ledger_entries' => $reconciled['credit']['entry'],
|
||||
));
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user