Moved all grid elements onto the grid helper. Basic testing done, but more testing needs to be done.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@262 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -48,14 +48,20 @@ foreach ($tillableAccount AS $acct) {
|
||||
echo "\n";
|
||||
|
||||
$grid_div_id = 'ledger_entries'.$acct['CurrentLedger']['id'].'-list';
|
||||
echo $this->element('ledger_entries',
|
||||
array('grid_div_id' => $grid_div_id,
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#'.$grid_div_id.' .HeaderButton\').click();'.
|
||||
' return false;">Items in '.$acct['Account']['name'].' Ledger</A>'),
|
||||
'ledger_id' => $acct['CurrentLedger']['id'],
|
||||
'no_account' => true,
|
||||
'grid_setup' => $grid_setup,
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'ledger_id' => $acct['CurrentLedger']['id'],
|
||||
'no_account' => true,
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
(
|
||||
'grid_div_id' => $grid_div_id,
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#'.$grid_div_id.' .HeaderButton\').click();'.
|
||||
' return false;">Items in '.$acct['Account']['name'].' Ledger</A>'),
|
||||
'grid_setup' => $grid_setup,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
$options = array();
|
||||
|
||||
@@ -55,20 +55,32 @@ echo '<div CLASS="detail supporting">' . "\n";
|
||||
* Ledgers
|
||||
*/
|
||||
|
||||
echo $this->element('ledgers',
|
||||
array('caption' => $account['Account']['name'] . " Ledgers",
|
||||
'ledgers' => $account['Ledger']));
|
||||
echo $this->element('ledgers', array
|
||||
('config' => array
|
||||
('caption' => $account['Account']['name'] . " Ledgers",
|
||||
'rows' => $account['Ledger'],
|
||||
)));
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Current Ledger
|
||||
*/
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => "Current Ledger: (#{$account['Account']['id']}-{$account['CurrentLedger']['sequence']})",
|
||||
'ledger_id' => $account['CurrentLedger']['id'],
|
||||
'account_type' => $account['Account']['type'],
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'ledger_id' => $account['CurrentLedger']['id'],
|
||||
'account_type' => $account['Account']['type'],
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
('caption' =>
|
||||
"Current Ledger: (" .
|
||||
"#{$account['Account']['id']}" .
|
||||
"-" .
|
||||
"{$account['CurrentLedger']['sequence']}" .
|
||||
")",
|
||||
),
|
||||
));
|
||||
|
||||
/* End "detail supporting" div */
|
||||
echo '</div>' . "\n";
|
||||
|
||||
@@ -121,9 +121,12 @@ echo $this->element('table',
|
||||
/**********************************************************************
|
||||
* Customers
|
||||
*/
|
||||
echo $this->element('customers', array('heading' => '',
|
||||
'caption' => 'Related Customers',
|
||||
'customers' => $contact['Customer']));
|
||||
|
||||
echo $this->element('customers', array
|
||||
('config' => array
|
||||
('caption' => 'Related Customers',
|
||||
'rows' => $contact['Customer'],
|
||||
)));
|
||||
|
||||
|
||||
/* End "detail supporting" div */
|
||||
|
||||
@@ -323,15 +323,16 @@ function updateCharges(id) {
|
||||
; // align
|
||||
//echo '<DIV ID="dialog">' . "\n";
|
||||
|
||||
echo $this->element('customers',
|
||||
array('grid_div_id' => 'customers-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
|
||||
' return false;">Select Customer</A>'),
|
||||
'grid_setup' => $grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
));
|
||||
echo $this->element('customers', array
|
||||
('config' => array
|
||||
('grid_div_id' => 'customers-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
|
||||
' return false;">Select Customer</A>'),
|
||||
'grid_setup' => $grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
)));
|
||||
|
||||
echo ('<H2>' .
|
||||
'<SPAN id="current-customer" style="display:none">' .
|
||||
@@ -343,13 +344,19 @@ echo ('<H2>' .
|
||||
'</SPAN>' .
|
||||
'</H2>' . "\n");
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('grid_div_id' => 'charge-entries',
|
||||
'caption' => 'Outstanding Charges',
|
||||
'account_ftype' => 'credit',
|
||||
'ledger_entries' => $charges['entry'],
|
||||
'limit' => 8,
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'account_ftype' => 'credit',
|
||||
'limit' => 8,
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
(
|
||||
'grid_div_id' => 'charge-entries',
|
||||
'caption' => 'Outstanding Charges',
|
||||
'rows' => $charges['entry'],
|
||||
),
|
||||
));
|
||||
|
||||
echo $form->create(null, array('id' => 'receipt-form',
|
||||
'url' => array('controller' => 'transactions',
|
||||
|
||||
@@ -49,19 +49,22 @@ echo '<div CLASS="detail supporting">' . "\n";
|
||||
/**********************************************************************
|
||||
* Contacts
|
||||
*/
|
||||
echo $this->element('contacts',
|
||||
array('caption' => 'Customer Contacts',
|
||||
'contacts' => $customer['Contact']));
|
||||
|
||||
echo $this->element('contacts', array
|
||||
('config' => array
|
||||
('caption' => 'Customer Contacts',
|
||||
'rows' => $customer['Contact'],
|
||||
)));
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Lease History
|
||||
*/
|
||||
|
||||
echo $this->element('leases', array
|
||||
('config' => array
|
||||
('caption' => 'Lease History',
|
||||
'rows' => $customer['Lease'],
|
||||
'limit' => 5,
|
||||
)));
|
||||
|
||||
|
||||
@@ -69,11 +72,16 @@ echo $this->element('leases', array
|
||||
* Customer Account History
|
||||
*/
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => 'Account',
|
||||
'customer_id' => $customer['Customer']['id'],
|
||||
'ar_account' => true,
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'customer_id' => $customer['Customer']['id'],
|
||||
'ar_account' => true,
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
('caption' => 'Account',
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
/* End "detail supporting" div */
|
||||
|
||||
@@ -11,26 +11,13 @@ $cols['Credits'] = array('index' => 'credits', 'formatter' => 'currenc
|
||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||
$cols['Comment'] = array('index' => 'Account.comment', 'formatter' => 'comment');
|
||||
|
||||
$custom_post_data = compact('nothing');
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Name'));
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'accounts',
|
||||
);
|
||||
|
||||
$jqGrid_options += compact('grid_div_id', 'grid_id', 'caption', 'grid_setup', 'limit');
|
||||
|
||||
|
||||
if (isset($accounts)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
'return $data["id"];'),
|
||||
$accounts),
|
||||
'limit' => 5);
|
||||
}
|
||||
else {
|
||||
$jqGrid_options += array('search_fields' => array('Name'));
|
||||
}
|
||||
|
||||
$jqGrid_options += compact('custom_post_data');
|
||||
$jqGrid_options['sort_column'] = 'Name';
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Name')
|
||||
->defaultFields(array('ID', 'Name'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -12,19 +12,13 @@ if (0) { // REVISIT<AP>: Need to figure out how to put this in play
|
||||
}
|
||||
$cols['Comment'] = array('index' => 'Contact.comment', 'formatter' => 'comment');
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'contacts',
|
||||
'caption' => isset($caption) ? $caption : null);
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Last Name', 'First Name'));
|
||||
|
||||
if (isset($contacts)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
'return $data["id"];'),
|
||||
$contacts),
|
||||
'limit' => 5);
|
||||
}
|
||||
else {
|
||||
$jqGrid_options += array('search_fields' => array('Last Name', 'First Name'));
|
||||
}
|
||||
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Last Name')
|
||||
->defaultFields(array('ID', 'Last Name', 'First Name'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -12,24 +12,13 @@ $cols['Leases'] = array('index' => 'lease_count', 'width' =>
|
||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
|
||||
|
||||
$custom_post_data = compact('nothing');
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'customers');
|
||||
$jqGrid_options += compact('action', 'caption',
|
||||
'grid_div_id', 'grid_div_class', 'grid_id', 'grid_setup',
|
||||
'nolinks', 'limit');
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Last Name', 'First Name'));
|
||||
|
||||
if (isset($customers)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
'return $data["id"];'),
|
||||
$customers),
|
||||
'limit' => 5);
|
||||
}
|
||||
|
||||
// Not the long term solution here... just for testing
|
||||
if (isset($searchfields)) {
|
||||
$jqGrid_options += array('search_fields' => array('Last Name', 'First Name'));
|
||||
}
|
||||
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Name')
|
||||
->defaultFields(array('ID', 'Name'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
<?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['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'name');
|
||||
$cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'name');
|
||||
|
||||
$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['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
|
||||
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
|
||||
|
||||
$cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' => 'currency');
|
||||
$cols['Sub-Total'] = array('index' => 'subtotal', 'formatter' => 'currency', 'sortable' => false);
|
||||
|
||||
|
||||
if (isset($account_ftype) || isset($ledger_id) || isset($account_id) || isset($ar_account)) {
|
||||
$single_account = true;
|
||||
$double_account = false;
|
||||
@@ -36,85 +64,48 @@ if (isset($account_ftype)) {
|
||||
}
|
||||
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
if (0) {
|
||||
if (isset($notxgroup))
|
||||
$cols['Entry'] = array('index' => 'LedgerEntry.id', 'formatter' => 'id');
|
||||
if (!$single_account)
|
||||
$grid->invalidFields('Account');
|
||||
|
||||
if (!$double_account)
|
||||
$grid->invalidFields(array('Debit Account', 'Credit Account'));
|
||||
|
||||
if (!$references)
|
||||
$grid->invalidFields(array('Customer', 'Lease', 'Unit'));
|
||||
|
||||
if ($single_amount)
|
||||
$grid->invalidFields(array('Debit', 'Credit'));
|
||||
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');
|
||||
}
|
||||
$grid->invalidFields('Amount');
|
||||
|
||||
$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');
|
||||
if (!$applied_amount)
|
||||
$grid->invalidFields('Applied');
|
||||
|
||||
if ($single_account) {
|
||||
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
|
||||
}
|
||||
if (!$subtotal_amount)
|
||||
$grid->invalidFields('Sub-Total');
|
||||
|
||||
if ($double_account) {
|
||||
$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($config['rows'])) {
|
||||
$config['action'] = 'ledger';
|
||||
$grid->limit(50);
|
||||
}
|
||||
|
||||
if (isset($reconcile_id)) {
|
||||
$custom_post_data += compact('reconcile_id');
|
||||
$jqGrid_options += array('limit' => 5);
|
||||
$grid->customData(compact('reconcile_id'))->limit(5);
|
||||
}
|
||||
|
||||
$jqGrid_options += compact('custom_post_data');
|
||||
$jqGrid_options['sort_column'] = 'Date';
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Customer', 'Unit'));
|
||||
|
||||
// Include custom data
|
||||
$grid->customData(compact('ledger_id', 'account_id', 'ar_account',
|
||||
'account_type', 'account_ftype',
|
||||
'customer_id', 'lease_id', 'transaction_id', 'notxgroup'));
|
||||
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Date')
|
||||
->defaultFields(array('Entry', 'Amount', 'Credit', 'Debit'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -12,25 +12,13 @@ $cols['Debits'] = array('index' => 'debits', 'formatter' => 'c
|
||||
$cols['Credits'] = array('index' => 'credits', 'formatter' => 'currency');
|
||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||
|
||||
$custom_post_data = compact('nothing');
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'ledgers',
|
||||
);
|
||||
$jqGrid_options += compact('grid_div_id', 'grid_id', 'caption', 'grid_setup', 'limit');
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Account', 'Comment'));
|
||||
|
||||
|
||||
if (isset($ledgers)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
'return $data["id"];'),
|
||||
$ledgers),
|
||||
'limit' => 5);
|
||||
}
|
||||
else {
|
||||
$jqGrid_options += array('search_fields' => array('Account'));
|
||||
}
|
||||
|
||||
$jqGrid_options += compact('custom_post_data');
|
||||
$jqGrid_options['sort_column'] = 'ID';
|
||||
$jqGrid_options['sort_order'] = 'DESC';
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('ID', 'DESC')
|
||||
->defaultFields(array('ID', 'Account'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -9,16 +9,13 @@ $cols['Width'] = array('index' => 'Map.width', 'width' => '50', 'align
|
||||
$cols['Depth'] = array('index' => 'Map.depth', 'width' => '50', 'align' => 'right');
|
||||
$cols['Comment'] = array('index' => 'Map.comment', 'formatter' => 'comment');
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'maps',
|
||||
'caption' => isset($caption) ? $caption : null);
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Name'));
|
||||
|
||||
if (isset($maps)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
'return $data["id"];'),
|
||||
$maps),
|
||||
'limit' => 5);
|
||||
}
|
||||
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Name')
|
||||
->defaultFields(array('ID', 'Name'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -7,16 +7,13 @@ $cols['Name'] = array('index' => 'MonetarySource.name', 'formatter'
|
||||
$cols['Type'] = array('index' => 'MonetaryType.name', 'formatter' => 'name');
|
||||
$cols['Comment'] = array('index' => 'MonetarySource.comment', 'formatter' => 'comment');
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'monetary_sources',
|
||||
'caption' => isset($caption) ? $caption : null);
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('ID', 'Name'));
|
||||
|
||||
if (isset($monetary_sources)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
'return $data["id"];'),
|
||||
$monetary_sources),
|
||||
'limit' => 5);
|
||||
}
|
||||
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('ID')
|
||||
->defaultFields(array('ID', 'Name'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -8,19 +8,13 @@ $cols['Timestamp'] = array('index' => 'Transaction.stamp', 'formatter' =
|
||||
$cols['Due'] = array('index' => 'Transaction.due_date', 'formatter' => 'date');
|
||||
$cols['Comment'] = array('index' => 'Transaction.comment', 'formatter' => 'comment');
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'transactions',
|
||||
'caption' => isset($caption) ? $caption : null);
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Due', 'Comment'));
|
||||
|
||||
if (isset($transactions)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
'return $data["id"];'),
|
||||
$transactions),
|
||||
'limit' => 5);
|
||||
}
|
||||
else {
|
||||
$jqGrid_options += array('search_fields' => array('Due', 'Comment'));
|
||||
}
|
||||
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('ID')
|
||||
->defaultFields(array('ID', 'Timestamp'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -12,27 +12,13 @@ $cols['Status'] = array('index' => 'Unit.status', 'width' => '75');
|
||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||
$cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');
|
||||
|
||||
// Set up search fields if requested by caller
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Unit', 'Size', 'Status'));
|
||||
|
||||
$custom_post_data = compact('nothing');
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'units');
|
||||
$jqGrid_options += compact('action', 'caption',
|
||||
'grid_div_id', 'grid_div_class', 'grid_id', 'grid_setup',
|
||||
'nolinks', 'limit');
|
||||
|
||||
if (isset($units)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
array_map(create_function('$data',
|
||||
'return $data["id"];'),
|
||||
$units),
|
||||
'limit' => 5);
|
||||
}
|
||||
|
||||
if (isset($searchfields)) {
|
||||
$jqGrid_options += array('search_fields' => array('Unit', 'Size', 'Status'));
|
||||
}
|
||||
|
||||
$jqGrid_options += compact('custom_post_data');
|
||||
$jqGrid_options['sort_column'] = 'Sort';
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Sort')
|
||||
->defaultFields(array('Sort', 'ID', 'Unit'))
|
||||
->render($this, isset($config) ? $config : null);
|
||||
|
||||
@@ -13,7 +13,10 @@ class GridHelper extends AppHelper {
|
||||
|
||||
function reset() {
|
||||
$this->jqGrid_options
|
||||
= array('limit' => 20);
|
||||
= array('limit' => 20,
|
||||
'search_fields' => array(),
|
||||
'custom_post_data' => array(),
|
||||
);
|
||||
|
||||
$this->columns = array();
|
||||
$this->included = array();
|
||||
@@ -71,8 +74,10 @@ class GridHelper extends AppHelper {
|
||||
return $this;
|
||||
}
|
||||
|
||||
function sortField($field) {
|
||||
function sortField($field, $order = null) {
|
||||
$this->jqGrid_options['sort_column'] = $field;
|
||||
if ($order)
|
||||
$this->jqGrid_options['sort_order'] = $order;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -149,6 +154,12 @@ class GridHelper extends AppHelper {
|
||||
elseif (is_bool($excluded) && !$excluded)
|
||||
$excluded = array();
|
||||
|
||||
// Tack on any config include/exclude requests
|
||||
if (isset($config['include']))
|
||||
$included = array_merge($included, $config['include']);
|
||||
if (isset($config['exclude']))
|
||||
$excluded = array_merge($excluded, $config['exclude']);
|
||||
|
||||
// Calculate the actual inclusion set
|
||||
$included = array_diff(array_merge($this->included, $included),
|
||||
array_merge($this->invalid, $excluded));
|
||||
|
||||
@@ -205,15 +205,16 @@ function addChargeSource(flash) {
|
||||
<?php
|
||||
; // align
|
||||
|
||||
echo $this->element('leases',
|
||||
array('grid_div_id' => 'leases-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#leases-list .HeaderButton\').click();'.
|
||||
' return false;">Select Lease</A>'),
|
||||
'grid_setup' => $lease_grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
));
|
||||
echo $this->element('leases', array
|
||||
('config' => array
|
||||
('grid_div_id' => 'leases-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#leases-list .HeaderButton\').click();'.
|
||||
' return false;">Select Lease</A>'),
|
||||
'grid_setup' => $lease_grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
)));
|
||||
|
||||
echo ('<SPAN id="current-lease" style="display:none">' .
|
||||
'<DIV>' .
|
||||
|
||||
@@ -94,31 +94,33 @@ function onGridState(grid_id, item_type, state) {
|
||||
<?php
|
||||
; // align
|
||||
|
||||
echo $this->element('customers',
|
||||
array('grid_div_id' => 'customers-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
|
||||
' return false;">Select Customer</A>'),
|
||||
'grid_setup' => $customer_grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
));
|
||||
echo $this->element('customers', array
|
||||
('config' => array
|
||||
('grid_div_id' => 'customers-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
|
||||
' return false;">Select Customer</A>'),
|
||||
'grid_setup' => $customer_grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
)));
|
||||
|
||||
echo ('<H2>' .
|
||||
'<SPAN id="current-customer">Customer: <SPAN id="movein-customer"></SPAN></SPAN>' .
|
||||
'<SPAN id="no-customer">Please select customer</SPAN>' .
|
||||
'</H2>' . "\n");
|
||||
|
||||
echo $this->element('units',
|
||||
array('grid_div_id' => 'units-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#units-list .HeaderButton\').click();'.
|
||||
' return false;">Select Unit</A>'),
|
||||
'grid_setup' => $unit_grid_setup,
|
||||
'action' => 'unoccupied',
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
));
|
||||
echo $this->element('units', array
|
||||
('config' => array
|
||||
('grid_div_id' => 'units-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#units-list .HeaderButton\').click();'.
|
||||
' return false;">Select Unit</A>'),
|
||||
'grid_setup' => $unit_grid_setup,
|
||||
'action' => 'unoccupied',
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
)));
|
||||
|
||||
echo ('<H2>' .
|
||||
'<SPAN id="current-unit">Unit: <SPAN id="movein-unit"></SPAN></SPAN>' .
|
||||
|
||||
@@ -78,11 +78,16 @@ echo '<div CLASS="detail supporting">' . "\n";
|
||||
* Lease Account History
|
||||
*/
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => 'Account',
|
||||
'lease_id' => $lease['id'],
|
||||
'ar_account' => true,
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'lease_id' => $lease['id'],
|
||||
'ar_account' => true,
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
('caption' => 'Account',
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
/* End "detail supporting" div */
|
||||
|
||||
@@ -118,21 +118,31 @@ echo '<div CLASS="detail supporting">' . "\n";
|
||||
*/
|
||||
|
||||
if ($debit_ledger['Account']['trackable']) {
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => "Applied to " . $debit_ledger['Account']['name'],
|
||||
'grid_div_id' => 'debit_reconciliation_ledger_entries',
|
||||
'account_ftype' => 'debit',
|
||||
'reconcile_id' => $entry['id'],
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'account_ftype' => 'debit',
|
||||
'reconcile_id' => $entry['id'],
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
('caption' => "Applied to " . $debit_ledger['Account']['name'],
|
||||
'grid_div_id' => 'debit_reconciliation_ledger_entries',
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
if ($credit_ledger['Account']['trackable']) {
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => "Applied to " . $credit_ledger['Account']['name'],
|
||||
'grid_div_id' => 'credit_reconciliation_ledger_entries',
|
||||
'account_ftype' => 'credit',
|
||||
'reconcile_id' => $entry['id'],
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'account_ftype' => 'credit',
|
||||
'reconcile_id' => $entry['id'],
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
('caption' => "Applied to " . $credit_ledger['Account']['name'],
|
||||
'grid_div_id' => 'credit_reconciliation_ledger_entries',
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -63,11 +63,17 @@ echo '<div CLASS="detail supporting">' . "\n";
|
||||
* Ledger Entries
|
||||
*/
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => "Ledger Entries",
|
||||
'ledger_id' => $ledger['id'],
|
||||
'account_type' => $account['type'],
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'ledger_id' => $ledger['id'],
|
||||
'account_type' => $account['type'],
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
('caption' => "Ledger Entries",
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
/* End "detail supporting" div */
|
||||
echo '</div>' . "\n";
|
||||
|
||||
@@ -51,12 +51,17 @@ echo '<div CLASS="detail supporting">' . "\n";
|
||||
* Entries
|
||||
*/
|
||||
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' => 'Entries in Transaction',
|
||||
//'ledger_entries' => $transaction['LedgerEntry'],
|
||||
'transaction_id' => $transaction['Transaction']['id'],
|
||||
'notxgroup' => true,
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'transaction_id' => $transaction['Transaction']['id'],
|
||||
'notxgroup' => true,
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
(
|
||||
'caption' => 'Entries in Transaction',
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
/* End "detail supporting" div */
|
||||
|
||||
@@ -71,15 +71,22 @@ echo $this->element('leases', array
|
||||
/**********************************************************************
|
||||
* Current Customer Lease Account History
|
||||
*/
|
||||
|
||||
if (isset($current_lease['id'])) {
|
||||
echo $this->element('ledger_entries',
|
||||
array('caption' =>
|
||||
('Current Lease Account ('
|
||||
. $current_lease['Customer']['name']
|
||||
. ')'),
|
||||
'ar_account' => true,
|
||||
'lease_id' => $current_lease['id'],
|
||||
));
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'ar_account' => true,
|
||||
'lease_id' => $current_lease['id'],
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
(
|
||||
'caption' =>
|
||||
('Current Lease Account ('
|
||||
. $current_lease['Customer']['name']
|
||||
. ')'),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user