Files
pmgr/site/views/elements/ledger_entries.ctp
abijah c9ade62536 Very, very messy and broken. It does work somewhat, but I can see just what a mess it's going to be to carry it out, so I'm abandoning.
git-svn-id: file:///svn-source/pmgr/branches/reconcile_entry_to_receipt_20090629@187 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-06-30 00:59:09 +00:00

114 lines
3.5 KiB
PHP

<?php /* -*- mode:PHP -*- */
if (isset($account_ftype) || isset($ledger_id) || isset($lease_id) || isset($account_id) || isset($ar_account)) {
$single_account = true;
} else {
$single_account = false;
}
if (isset($ledger_id) || isset($lease_id) || isset($account_id) || isset($ar_account)) {
$single_amount = false;
} else {
$single_amount = true;
}
if (isset($lease_id) || isset($customer_id)) {
$references = false;
}
else {
$references = true;
}
if (isset($reconcile_id)) {
$applied_amount = true;
} else {
$applied_amount = false;
}
if (isset($account_ftype)) {
$subtotal_amount = false;
} else {
$subtotal_amount = true;
}
// Define the table columns
$cols = array();
if (0) {
if (isset($notxgroup))
$cols['Entry'] = array('index' => 'LedgerEntry.id', 'formatter' => 'id');
else
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
} else {
$notxgroup = false;
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
$cols['Entry'] = array('index' => 'LedgerEntry.id', 'formatter' => 'id');
}
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
if ($single_account) {
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
}
else {
$cols['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'name');
$cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'name');
}
if ($references) {
$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);
if ($single_amount) {
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
}
else {
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
}
if ($applied_amount) {
$cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' => 'currency');
}
if ($subtotal_amount) {
$cols['Sub-Total'] = array('index' => 'subtotal', 'formatter' => 'currency', 'sortable' => false);
}
$custom_post_data = compact('ledger_id', 'account_id', 'ar_account',
'account_type', 'account_ftype',
'customer_id', 'lease_id', 'transaction_id', 'notxgroup');
$jqGrid_options = array('jqGridColumns' => $cols,
'controller' => 'ledger_entries',
);
$jqGrid_options += compact('grid_div_id', 'grid_id', 'caption', 'grid_setup', 'limit');
if (isset($ledger_entries)) {
$jqGrid_options += array('custom_ids' =>
array_map(create_function('$data',
'return $data["id"];'),
$ledger_entries),
'limit' => 10);
}
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');
$jqGrid_options['sort_column'] = 'Date';
echo $this->element('jqGrid', $jqGrid_options);