Modified the statement entries grid, as well as the underlying controller, to support a couple new fields, 'applied' and 'balance'.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@532 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -379,20 +379,9 @@ class CustomersController extends AppController {
|
|||||||
$this->Customer->recursive = -1;
|
$this->Customer->recursive = -1;
|
||||||
$customer = $this->Customer->read(null, $id);
|
$customer = $this->Customer->read(null, $id);
|
||||||
$customer = $customer['Customer'];
|
$customer = $customer['Customer'];
|
||||||
$unreconciled = $this->Customer->unreconciledCharges($id);
|
|
||||||
//pr($unreconciled);
|
|
||||||
$charges = $unreconciled['entries'];
|
|
||||||
$stats = $unreconciled['summary']['Charge'];
|
|
||||||
// Kludge until we update receipt to have the unpaid
|
|
||||||
// charges grid generated from a dynamic query instead
|
|
||||||
// of simply pre-providing the list of charge IDs
|
|
||||||
foreach ($charges AS &$charge)
|
|
||||||
$charge['id'] = $charge['StatementEntry']['id'];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$customer = null;
|
$customer = null;
|
||||||
$charges = array();
|
|
||||||
$stats = array('balance' => 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$TT = new TenderType();
|
$TT = new TenderType();
|
||||||
@@ -401,7 +390,7 @@ class CustomersController extends AppController {
|
|||||||
$this->set(compact('payment_types', 'default_type'));
|
$this->set(compact('payment_types', 'default_type'));
|
||||||
|
|
||||||
$title = ($customer['name'] . ': Receipt Entry');
|
$title = ($customer['name'] . ': Receipt Entry');
|
||||||
$this->set(compact('customer', 'charges', 'stats', 'title'));
|
$this->set(compact('customer', 'title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class StatementEntriesController extends AppController {
|
|||||||
* to jqGrid.
|
* to jqGrid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function gridDataTables(&$params, &$model) {
|
function gridDataCountTables(&$params, &$model) {
|
||||||
$link =
|
$link =
|
||||||
array(// Models
|
array(// Models
|
||||||
'Transaction' =>
|
'Transaction' =>
|
||||||
@@ -58,25 +58,18 @@ class StatementEntriesController extends AppController {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($params['post']['custom']['statement_entry_id'])) {
|
return array('link' => $link);
|
||||||
$link['DisbursementEntry'] = array();
|
}
|
||||||
$link['ChargeEntry'] = array();
|
|
||||||
|
function gridDataTables(&$params, &$model) {
|
||||||
|
$tables = $this->gridDataCountTables($params, $model);
|
||||||
|
|
||||||
|
if (in_array('applied', $params['post']['fields'])) {
|
||||||
|
$tables['link']['DisbursementEntry'] = array();
|
||||||
|
$tables['link']['ChargeEntry'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if ($params['action'] === 'collected') { */
|
return $tables;
|
||||||
/* $link['DisbursementEntry'] = array('Receipt' => array('class' => 'Transaction')); */
|
|
||||||
/* $link['ChargeEntry'] = array('Invoice' => array('class' => 'Transaction')); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* if (count(array_intersect($params['fields'], array('applied'))) == 1) { */
|
|
||||||
/* $link['DisbursementEntry'] = array(); */
|
|
||||||
/* $link['ChargeEntry'] = array(); */
|
|
||||||
/* } */
|
|
||||||
/* elseif (isset($params['post']['custom']['customer_id']) || isset($params['post']['custom']['lease_id'])) { */
|
|
||||||
/* $link['DisbursementEntry'] = array(); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
return array('link' => $link);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function gridDataFields(&$params, &$model) {
|
function gridDataFields(&$params, &$model) {
|
||||||
|
|||||||
@@ -303,17 +303,17 @@ echo ('<DIV CLASS="receipt grid-selection-text">' .
|
|||||||
|
|
||||||
|
|
||||||
echo $this->element('statement_entries', array
|
echo $this->element('statement_entries', array
|
||||||
(// Element configuration
|
(// Grid configuration
|
||||||
'account_ftype' => 'credit',
|
|
||||||
'limit' => 8,
|
|
||||||
|
|
||||||
// Grid configuration
|
|
||||||
'config' => array
|
'config' => array
|
||||||
(
|
(
|
||||||
'grid_div_id' => 'charge-entries',
|
'grid_div_id' => 'charge-entries',
|
||||||
'grid_div_class' => 'text-below',
|
'grid_div_class' => 'text-below',
|
||||||
'caption' => '<SPAN id="receipt-charges-caption"></SPAN>',
|
'caption' => '<SPAN id="receipt-charges-caption"></SPAN>',
|
||||||
'rows' => $charges,
|
'action' => 'idlist',
|
||||||
|
'exclude' => array('Customer', 'Unit', 'Type', 'Debit', 'Credit'),
|
||||||
|
'include' => array('Amount', 'Applied', 'Balance'),
|
||||||
|
'remap' => array('Applied' => 'Paid'),
|
||||||
|
'limit' => 8,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -393,15 +393,11 @@ Configure::write('debug', '0');
|
|||||||
showCurrentAtPos: 0,
|
showCurrentAtPos: 0,
|
||||||
dateFormat: 'mm/dd/yy' });
|
dateFormat: 'mm/dd/yy' });
|
||||||
|
|
||||||
datepickerNow('TransactionStamp');
|
|
||||||
|
|
||||||
$("#receipt-customer-id").html("INTERNAL ERROR");
|
$("#receipt-customer-id").html("INTERNAL ERROR");
|
||||||
$("#receipt-customer-name").html("INTERNAL ERROR");
|
$("#receipt-customer-name").html("INTERNAL ERROR");
|
||||||
$("#receipt-balance").html("INTERNAL ERROR");
|
$("#receipt-balance").html("INTERNAL ERROR");
|
||||||
$("#receipt-charges-caption").html("Outstanding Charges");
|
$("#receipt-charges-caption").html("Outstanding Charges");
|
||||||
|
|
||||||
resetForm();
|
|
||||||
|
|
||||||
<?php if (isset($customer['id'])): ?>
|
<?php if (isset($customer['id'])): ?>
|
||||||
$("#customer-id").val(<?php echo $customer['id']; ?>);
|
$("#customer-id").val(<?php echo $customer['id']; ?>);
|
||||||
//$("#receipt-customer-id").html("<?php echo '#'.$customer['id']; ?>");
|
//$("#receipt-customer-id").html("<?php echo '#'.$customer['id']; ?>");
|
||||||
@@ -417,6 +413,9 @@ Configure::write('debug', '0');
|
|||||||
onGridState(null, 'visible');
|
onGridState(null, 'visible');
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
resetForm();
|
||||||
|
datepickerNow('TransactionStamp');
|
||||||
|
|
||||||
});
|
});
|
||||||
--></script>
|
--></script>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ $cols['Type'] = array('index' => 'StatementEntry.type', 'formatter' =>
|
|||||||
$cols['Debit'] = array('index' => 'charge', 'formatter' => 'currency');
|
$cols['Debit'] = array('index' => 'charge', 'formatter' => 'currency');
|
||||||
$cols['Credit'] = array('index' => 'disbursement', 'formatter' => 'currency');
|
$cols['Credit'] = array('index' => 'disbursement', 'formatter' => 'currency');
|
||||||
|
|
||||||
|
$cols['Amount'] = array('index' => "StatementEntry.amount", 'formatter' => 'currency');
|
||||||
$cols['Applied'] = array('index' => "applied", 'formatter' => 'currency');
|
$cols['Applied'] = array('index' => "applied", 'formatter' => 'currency');
|
||||||
|
$cols['Balance'] = array('index' => "balance", 'formatter' => 'currency');
|
||||||
$cols['Sub-Total'] = array('index' => 'subtotal-balance', 'formatter' => 'currency', 'sortable' => false);
|
$cols['Sub-Total'] = array('index' => 'subtotal-balance', 'formatter' => 'currency', 'sortable' => false);
|
||||||
|
|
||||||
|
|
||||||
@@ -40,6 +42,6 @@ $grid
|
|||||||
->searchFields(array('Customer', 'Unit'))
|
->searchFields(array('Customer', 'Unit'))
|
||||||
->render($this, isset($config) ? $config : null,
|
->render($this, isset($config) ? $config : null,
|
||||||
array_diff(array_keys($cols), array('Through', 'Lease',
|
array_diff(array_keys($cols), array('Through', 'Lease',
|
||||||
'Applied', 'Sub-Total',
|
'Amount', 'Applied', 'Balance', 'Sub-Total',
|
||||||
'Comment')));
|
'Comment')));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user