Compare commits
10 Commits
8249ecc5cd
...
hosted_mig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3148cc17d | ||
|
|
c709f0bbf5 | ||
|
|
8faafe7f4e | ||
|
|
4319847665 | ||
|
|
d22a69b510 | ||
|
|
e9028b7558 | ||
|
|
26559f3c59 | ||
|
|
4d24428a19 | ||
|
|
15fc04e690 | ||
|
|
60254860b4 |
@@ -272,25 +272,25 @@ class AppController extends Controller {
|
||||
$this->addSideMenuLink('Unpaid Charges',
|
||||
array('controller' => 'statement_entries', 'action' => 'unpaid'), null,
|
||||
'REPORT');
|
||||
$this->addSideMenuLink('Unit Summary',
|
||||
array('controller' => 'units', 'action' => 'overview'), null,
|
||||
'REPORT');
|
||||
$this->addSideMenuLink('Lease Up',
|
||||
array('controller' => 'leases', 'action' => 'overview'), null,
|
||||
'REPORT');
|
||||
$this->addSideMenuLink('Unit Summary',
|
||||
array('controller' => 'units', 'action' => 'overview'), null,
|
||||
'REPORT');
|
||||
/* $this->addSideMenuLink('Monthly Income', */
|
||||
/* array('controller' => 'statement_entries', 'action' => 'incomebymonth'), null, */
|
||||
/* 'REPORT'); */
|
||||
/* $this->addSideMenuLink('Monthly Expenses', */
|
||||
/* array('controller' => 'statement_entries', 'action' => 'expensebymonth'), null, */
|
||||
/* 'REPORT'); */
|
||||
/* $this->addSideMenuLink('Quickbook Invoice', */
|
||||
/* array('controller' => 'statement_entries', 'action' => 'incomebymonth', 4, 1), null, */
|
||||
/* 'REPORT'); */
|
||||
/* $this->addSideMenuLink('Quickbook Credits', */
|
||||
/* array('controller' => 'statement_entries', 'action' => 'expensebymonth', 4, 0), null, */
|
||||
/* 'REPORT'); */
|
||||
$this->addSideMenuLink('Monthly Income',
|
||||
$this->addSideMenuLink('Quickbook Invoice',
|
||||
array('controller' => 'statement_entries', 'action' => 'incomebymonth', 4, 1), null,
|
||||
'REPORT');
|
||||
$this->addSideMenuLink('Quickbook Credits',
|
||||
array('controller' => 'statement_entries', 'action' => 'expensebymonth', 4, 0), null,
|
||||
'REPORT');
|
||||
$this->addSideMenuLink('Monthly Net',
|
||||
array('controller' => 'statement_entries', 'action' => 'netbymonth'), null,
|
||||
'REPORT');
|
||||
}
|
||||
@@ -539,9 +539,6 @@ class AppController extends Controller {
|
||||
// Retreive the appropriate subset of data
|
||||
$records = $this->gridDataRecords($params, $model, $pagination);
|
||||
|
||||
// If subtotaling, figure out the running total before pagination...
|
||||
$this->gridDataRecordsRunningSubtotal($params, $model, $pagination);
|
||||
|
||||
// Post process the records
|
||||
$this->gridDataPostProcess($params, $model, $records);
|
||||
|
||||
@@ -1038,53 +1035,6 @@ class AppController extends Controller {
|
||||
return $model->find($type, $query);
|
||||
}
|
||||
|
||||
function gridDataRecordsRunningSubtotal(&$params, $model, $pagination) {
|
||||
|
||||
// REVISIT <AP>: 20090722
|
||||
// Horrible solution to something that should be done
|
||||
// in SQL. Doesn't really work, but for a grid that contains
|
||||
// ALL records, and is sorted on the correct field, it does
|
||||
// actually work.
|
||||
//
|
||||
// If this function worked correctly, this mechanism would also
|
||||
// work for grids that did not contain ALL records.
|
||||
|
||||
$subtotals = array();
|
||||
foreach ($params['post']['fields'] AS $field) {
|
||||
if (preg_match('/subtotal-(.*)$/', $field, $matches))
|
||||
$subtotals[] = array('field' => $matches[1],
|
||||
'name' => $field,
|
||||
'amount' => 0);
|
||||
}
|
||||
|
||||
// This part, if functioning, should do a sub-total off all records
|
||||
// that are not part of the grid, instead of starting at zero, so that
|
||||
// the totals come out correctly for the each record entry.
|
||||
|
||||
/* $pagination['start'] = $pagination['start'] + $pagination['limit']; */
|
||||
/* $pagination['limit'] = 10000000; */
|
||||
|
||||
/* // Retreive the appropriate subset of data */
|
||||
/* $params_copy = $params; */
|
||||
/* $records = $this->gridDataRecords($params_copy, $model, $pagination); */
|
||||
|
||||
/* foreach ($records AS &$record) { */
|
||||
/* foreach ($subtotals AS &$subtotal) { */
|
||||
/* $field = $subtotal['field']; */
|
||||
/* if (preg_match("/\./", $field)) { */
|
||||
/* list($tbl, $col) = explode(".", $field); */
|
||||
/* $record['subtotal-'.$tbl][$col] = */
|
||||
/* ($subtotal['amount'] += $record[$tbl][$col]); */
|
||||
/* } */
|
||||
/* else { */
|
||||
/* $record[$model->alias]['subtotal-'.$field] = */
|
||||
/* ($subtotal['amount'] += $record[$model->alias][$field]); */
|
||||
/* } */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
$params['subtotals'] = $subtotals;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -1135,11 +1085,15 @@ class AppController extends Controller {
|
||||
|
||||
// REVISIT <AP>: 20090722
|
||||
// Horrible solution to something that should be done
|
||||
// in SQL. Doesn't really work, but for a grid that contains
|
||||
// ALL records, and is sorted on the correct field, it does
|
||||
// actually work.
|
||||
// in SQL. But, it works for now, so what the heck...
|
||||
|
||||
$subtotals = $params['subtotals'];
|
||||
$subtotals = array();
|
||||
foreach ($params['post']['fields'] AS $field) {
|
||||
if (preg_match('/subtotal-(.*)$/', $field, $matches))
|
||||
$subtotals[] = array('field' => $matches[1],
|
||||
'name' => $field,
|
||||
'amount' => 0);
|
||||
}
|
||||
|
||||
foreach ($records AS &$record) {
|
||||
foreach ($subtotals AS &$subtotal) {
|
||||
|
||||
@@ -334,6 +334,15 @@ class LeasesController extends AppController {
|
||||
* - Closes a lease to any further action
|
||||
*/
|
||||
|
||||
// REVISIT <AP>: 20090809
|
||||
// While cleaning up the sitelink data, then delete reldep()
|
||||
function reldep($id) {
|
||||
$this->Lease->id = $id;
|
||||
$stamp = $this->Lease->field('moveout_date');
|
||||
$this->Lease->releaseSecurityDeposits($id, $stamp);
|
||||
$this->redirect(array('action'=>'view', $id));
|
||||
}
|
||||
|
||||
function close($id) {
|
||||
// REVISIT <AP>: 20090708
|
||||
// We should probably seek confirmation first...
|
||||
@@ -346,21 +355,6 @@ class LeasesController extends AppController {
|
||||
$this->redirect(array('action'=>'view', $id));
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: open
|
||||
* - Re-opens a lease for further action
|
||||
*/
|
||||
|
||||
function open($id) {
|
||||
// REVISIT <AP>: 20131204
|
||||
// We should probably seek confirmation first, since this wipes out
|
||||
// the old close date, with no way to restore that date.
|
||||
$this->Lease->reopen($id);
|
||||
$this->redirect(array('action'=>'view', $id));
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -580,18 +574,13 @@ class LeasesController extends AppController {
|
||||
$this->addSideMenuLink('Write-Off',
|
||||
array('action' => 'bad_debt', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($this->Lease->closeable($id))
|
||||
$this->addSideMenuLink('Close',
|
||||
array('action' => 'close', $id), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
if ($this->Lease->closeable($id))
|
||||
$this->addSideMenuLink('Close',
|
||||
array('action' => 'close', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($this->Lease->isClosed($id))
|
||||
$this->addSideMenuLink('Re-Open',
|
||||
array('action' => 'open', $id), null,
|
||||
'ACTION');
|
||||
|
||||
// Prepare to render
|
||||
$title = 'Lease: #' . $lease['Lease']['id'];
|
||||
$this->set(compact('lease', 'title',
|
||||
|
||||
@@ -93,8 +93,7 @@ class TransactionsController extends AppController {
|
||||
$fields[] = ("IF(Transaction.type = 'DEPOSIT'," .
|
||||
" COUNT(DepositTender.id)," .
|
||||
" COUNT(StatementEntry.id)) AS entries");
|
||||
return array_merge($fields,
|
||||
$this->Transaction->LedgerEntry->debitCreditFields(false, true, 'Transaction'));
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function gridDataConditions(&$params, &$model) {
|
||||
|
||||
@@ -728,53 +728,6 @@ class Lease extends AppModel {
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: reopen
|
||||
* - Re-Opens the lease for further action
|
||||
*/
|
||||
|
||||
function reopen($id) {
|
||||
$this->prEnter(compact('id'));
|
||||
|
||||
if (!$this->isClosed($id))
|
||||
return $this->prReturn(false);
|
||||
|
||||
// Reset the data
|
||||
$this->create();
|
||||
$this->id = $id;
|
||||
|
||||
// Set the close date
|
||||
$this->data['Lease']['close_date'] = null;
|
||||
|
||||
// Save it!
|
||||
$this->save($this->data, false);
|
||||
|
||||
// Update the current lease count for the customer
|
||||
$this->Customer->updateLeaseCount($this->field('customer_id'));
|
||||
|
||||
return $this->prReturn(true);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: isClosed
|
||||
* - Checks to see if the lease is closed
|
||||
*/
|
||||
|
||||
function isClosed($id) {
|
||||
$this->prEnter(compact('id'));
|
||||
|
||||
$this->recursive = -1;
|
||||
$this->read(null, $id);
|
||||
|
||||
return $this->prReturn(!empty($this->data['Lease']['close_date']));
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
@@ -157,14 +157,13 @@ echo $this->element('contacts', array
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Customer Statement History
|
||||
* Customer Account History
|
||||
*/
|
||||
|
||||
echo $this->element('statement_entries', array
|
||||
(// Grid configuration
|
||||
'config' => array
|
||||
('caption' => 'Customer Statement',
|
||||
'grid_setup' => array('hiddengrid' => true),
|
||||
'filter' => array('Customer.id' => $customer['Customer']['id'],
|
||||
'type !=' => 'VOID'),
|
||||
//'include' => array('Sub-Total'),
|
||||
@@ -172,28 +171,6 @@ echo $this->element('statement_entries', array
|
||||
)));
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Customer Transaction History
|
||||
*/
|
||||
|
||||
echo $this->element('transactions', array
|
||||
(// Grid configuration
|
||||
'config' => array
|
||||
('caption' => 'Balance History',
|
||||
'limit' => 10000,
|
||||
'limitOptions' => array('10000'),
|
||||
'sort_column' => 'Timestamp',
|
||||
'sort_order' => 'ASC',
|
||||
'grid_setup' => array('hiddengrid' => true),
|
||||
'filter' => array('Customer.id' => $customer['Customer']['id']),
|
||||
'include' => array('Comment', 'PosNeg', 'Balance'),
|
||||
'exclude' => array('Amount', 'Entries'),
|
||||
'remap' => array(//'ID' => 'Invoice',
|
||||
'PosNeg' => 'Amount',
|
||||
//'Entries' => 'Charges',
|
||||
),
|
||||
)));
|
||||
|
||||
/* End "detail supporting" div */
|
||||
echo '</div>' . "\n";
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['Customer'] = array('index' => 'Customer.id', 'formatter' => 'id');
|
||||
$cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum');
|
||||
$cols['Name'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||
$cols['Last Name'] = array('index' => 'PrimaryContact.last_name', 'formatter' => 'name');
|
||||
|
||||
@@ -113,7 +113,7 @@ foreach ($fields AS $field => $config) {
|
||||
if (isset($config['with_value_after']))
|
||||
$value = $value . $config['with_value_after'];
|
||||
elseif (isset($with_value_after))
|
||||
$value = $value . $with_value_after;
|
||||
$value = $valeu . $with_value_after;
|
||||
$cells[] = $value;
|
||||
|
||||
if ($include_after) {
|
||||
|
||||
@@ -130,12 +130,12 @@ foreach ($jqGridColumns AS $header => &$col) {
|
||||
elseif ($col['formatter'] === 'currency') {
|
||||
// Use our custom formatting for currency
|
||||
$col['formatter'] = array('--special' => 'currencyFormatter');
|
||||
$default['width'] = 65;
|
||||
$default['width'] = 85;
|
||||
$default['align'] = 'right';
|
||||
}
|
||||
elseif ($col['formatter'] === 'date') {
|
||||
$default['formatoptions'] = array('newformat' => 'm/d/Y');
|
||||
$default['width'] = 90;
|
||||
$default['width'] = 95;
|
||||
$default['align'] = 'center';
|
||||
}
|
||||
elseif (preg_match("/^(long|short)?name$/",
|
||||
|
||||
@@ -5,7 +5,7 @@ $cols = array();
|
||||
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
||||
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||
$cols['Item'] = array('index' => 'Tender.name', 'formatter' => 'longname');
|
||||
$cols['Type'] = array('index' => 'TenderType.name', 'formatter' => 'shortname');
|
||||
$cols['Type'] = array('index' => 'TenderType.name', 'formatter' => 'name');
|
||||
$cols['Comment'] = array('index' => 'Tender.comment', 'formatter' => 'comment');
|
||||
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
|
||||
$cols['Sub-Total'] = array('index' => 'subtotal-LedgerEntry.amount', 'formatter' => 'currency');
|
||||
|
||||
@@ -11,11 +11,9 @@ $cols['ID'] = array('index' => 'Transaction.id', 'formatter' =
|
||||
$cols['Type'] = array('index' => 'Transaction.type', 'formatter' => 'enum');
|
||||
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||
$cols['Timestamp'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
||||
$cols['Comment'] = array('index' => 'Transaction.comment', 'formatter' => 'comment', 'sortable' => false);
|
||||
$cols['Entries'] = array('index' => 'entries', 'formatter' => 'number');
|
||||
$cols['Amount'] = array('index' => 'Transaction.amount', 'formatter' => 'currency');
|
||||
$cols['PosNeg'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||
$cols['Balance'] = array('index' => 'subtotal-balance', 'formatter' => 'currency', 'sortable' => false);
|
||||
$cols['Comment'] = array('index' => 'Transaction.comment', 'formatter' => 'comment');
|
||||
|
||||
// Render the grid
|
||||
$grid
|
||||
@@ -24,4 +22,4 @@ $grid
|
||||
->defaultFields(array('ID', 'Timestamp'))
|
||||
->searchFields(array('Type', 'Comment'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_merge($include, array_diff(array_keys($cols), array('Customer', 'PosNeg', 'Balance', 'Comment'))));
|
||||
array_merge($include, array_diff(array_keys($cols), array('Customer', 'Comment'))));
|
||||
|
||||
@@ -64,7 +64,6 @@ else {
|
||||
'config' => array
|
||||
(
|
||||
'caption' => 'Deposited Items',
|
||||
'sort_column' => 'Item',
|
||||
'filter' => array('deposit_transaction_id'
|
||||
=> $deposit['Transaction']['id'],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user