Merge in from the pre_0.1 branch
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@744 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
@echo off
|
||||
%~dp0\scripts\sitelink2pmgr.pl %~dp0\db\schema.sql %~dp0db\vss.mdb %*
|
||||
mysql --user=pmgr --password=pmgruser < %~dp0\db\property_manager.sql
|
||||
echo Done!
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,53 +38,218 @@ class AppController extends Controller {
|
||||
var $helpers = array('Html', 'Form', 'Javascript', 'Format', 'Time', 'Grid');
|
||||
var $components = array('DebugKit.Toolbar');
|
||||
|
||||
var $sidemenu_areas = array('SITE' => false, 'CONTROLLER' => false, 'ACTION' => false);
|
||||
var $std_area = 10;
|
||||
var $new_area = 20;
|
||||
var $op_area = 30;
|
||||
var $admin_area = 40;
|
||||
var $dev_area = 50;
|
||||
|
||||
function __construct() {
|
||||
$this->params['dev'] = false;
|
||||
$this->params['admin'] = false;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function sideMenuLinks() {
|
||||
// Stupid Cake... our constructor sets admin/dev,
|
||||
// but cake stomps it somewhere along the way
|
||||
// after constructing the CakeError controller.
|
||||
if ($this->name === 'CakeError') {
|
||||
$this->params['dev'] = false;
|
||||
$this->params['admin'] = false;
|
||||
}
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: sideMenuAreaVerify
|
||||
* - Verifies the validity of the sidemenu area/subarea/priority,
|
||||
* and ensures the class member is set to appropriately handle it.
|
||||
*/
|
||||
|
||||
$menu = array();
|
||||
$menu[] = array('name' => 'Common', 'header' => true);
|
||||
$menu[] = array('name' => 'Site Map', 'url' => array('controller' => 'maps', 'action' => 'view', 1));
|
||||
$menu[] = array('name' => 'Units', 'url' => array('controller' => 'units', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Leases', 'url' => array('controller' => 'leases', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Customers', 'url' => array('controller' => 'customers', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Deposits', 'url' => array('controller' => 'transactions', 'action' => 'deposit'));
|
||||
function sideMenuAreaVerify(&$area, $subarea, $priority = null) {
|
||||
$area = strtoupper($area);
|
||||
if (!array_key_exists($area, $this->sidemenu_areas))
|
||||
$this->INTERNAL_ERROR("Sidemenu link '{$area}': Unknown");
|
||||
|
||||
if ($area == 'SITE')
|
||||
$name = 'Navigation';
|
||||
elseif ($area == 'CONTROLLER')
|
||||
$name = Inflector::humanize($this->params['controller']);
|
||||
elseif ($area == 'ACTION')
|
||||
$name = Inflector::humanize(Inflector::singularize($this->params['controller']));
|
||||
|
||||
if (empty($this->sidemenu_areas[$area]))
|
||||
$this->sidemenu_areas[$area]
|
||||
= array('enable' => true, 'name' => $name, 'subarea' => array());
|
||||
|
||||
if (empty($subarea))
|
||||
return;
|
||||
|
||||
$subname = $name;
|
||||
if ($subarea == $this->std_area)
|
||||
$subname .= '';
|
||||
elseif ($subarea == $this->op_area)
|
||||
//$subname .= '-Ops';
|
||||
$subname = 'Operations';
|
||||
elseif ($subarea == $this->new_area)
|
||||
//$subname .= '-New';
|
||||
$subname = 'Creation';
|
||||
elseif ($subarea == $this->admin_area)
|
||||
$subname .= '-Admin';
|
||||
elseif ($subarea == $this->dev_area)
|
||||
$subname .= '-Dev';
|
||||
else
|
||||
$subname .= '-' . $subarea;
|
||||
|
||||
if (empty($this->sidemenu_areas[$area]['subarea'][$subarea]))
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]
|
||||
= array('enable' => true, 'name' => $subname, 'priorities' => array());
|
||||
|
||||
if (empty($priority))
|
||||
return;
|
||||
|
||||
if (empty($this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority]))
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority]
|
||||
= array();
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: sideMenuAreaName
|
||||
* - Sets the name of the sidemenu area/subarea
|
||||
*/
|
||||
|
||||
function sideMenuAreaName($name, $area, $subarea = null) {
|
||||
$this->sideMenuAreaVerify($area, $subarea);
|
||||
if (empty($subarea))
|
||||
$this->sidemenu_areas[$area]['name'] = $name;
|
||||
else
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]['name'] = $name;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: sideMenuEnable
|
||||
* - Enables/Disables an area or subarea of the sidemenu
|
||||
*/
|
||||
|
||||
function sideMenuEnable($area, $subarea = null, $enable = true) {
|
||||
$this->sideMenuAreaVerify($area, $subarea);
|
||||
if (isset($subarea))
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]['enable'] = $enable;
|
||||
else
|
||||
$this->sidemenu_areas[$area]['enable'] = $enable;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: addSideMenuLink
|
||||
* - Adds another link to the sidemenu area/subarea/priority
|
||||
*/
|
||||
|
||||
function addSideMenuLink($name, $url, $extra, $area, $subarea = null, $priority = 10) {
|
||||
if (empty($subarea))
|
||||
$subarea = $this->std_area;
|
||||
$this->sideMenuAreaVerify($area, $subarea);
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority][]
|
||||
= array('name' => $name, 'url' => $url) + (empty($extra) ? array() : $extra);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: addDefaultSideMenuLinks
|
||||
* - Adds the standard links present on all generated pages
|
||||
*/
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
|
||||
$this->addSideMenuLink('Site Map',
|
||||
array('controller' => 'maps', 'action' => 'view', 1), null,
|
||||
'SITE');
|
||||
$this->addSideMenuLink('Units',
|
||||
array('controller' => 'units', 'action' => 'index'), null,
|
||||
'SITE');
|
||||
$this->addSideMenuLink('Leases',
|
||||
array('controller' => 'leases', 'action' => 'index'), null,
|
||||
'SITE');
|
||||
$this->addSideMenuLink('Customers',
|
||||
array('controller' => 'customers', 'action' => 'index'), null,
|
||||
'SITE');
|
||||
$this->addSideMenuLink('Deposits',
|
||||
array('controller' => 'transactions', 'action' => 'deposit'), null,
|
||||
'SITE');
|
||||
|
||||
/* $this->addSideMenuLink('Move-In', */
|
||||
/* array('controller' => 'customers', 'action' => 'move_in'), null, */
|
||||
/* 'SITE', $this->op_area); */
|
||||
|
||||
/* $this->addSideMenuLink('Move-Out', */
|
||||
/* array('controller' => 'customers', 'action' => 'move_out'), null, */
|
||||
/* 'SITE', $this->op_area); */
|
||||
|
||||
/* $this->addSideMenuLink('New Receipt', */
|
||||
/* array('controller' => 'customers', 'action' => 'receipt'), null, */
|
||||
/* 'SITE', $this->op_area); */
|
||||
|
||||
/* $this->addSideMenuLink('New Customer', */
|
||||
/* array('controller' => 'customers', 'action' => 'add'), null, */
|
||||
/* 'SITE', $this->op_area); */
|
||||
|
||||
/* $this->addSideMenuLink('New Deposit', */
|
||||
/* array('controller' => 'tenders', 'action' => 'deposit'), null, */
|
||||
/* 'SITE', $this->op_area); */
|
||||
|
||||
if ($this->params['admin']) {
|
||||
$menu[] = array('name' => 'Admin', 'header' => true);
|
||||
$menu[] = array('name' => 'Accounts', 'url' => array('controller' => 'accounts', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Contacts', 'url' => array('controller' => 'contacts', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Ledgers', 'url' => array('controller' => 'ledgers', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Tenders', 'url' => array('controller' => 'tenders', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Transactions', 'url' => array('controller' => 'transactions', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Ldgr Entries', 'url' => array('controller' => 'ledger_entries', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Stmt Entries', 'url' => array('controller' => 'statement_entries', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'New Ledgers', 'url' => array('controller' => 'accounts', 'action' => 'newledger'));
|
||||
$menu[] = array('name' => 'Assess Charges', 'url' => array('controller' => 'leases', 'action' => 'assess_all'));
|
||||
$this->addSideMenuLink('Accounts',
|
||||
array('controller' => 'accounts', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Contacts',
|
||||
array('controller' => 'contacts', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Ledgers',
|
||||
array('controller' => 'ledgers', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Tenders',
|
||||
array('controller' => 'tenders', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Transactions',
|
||||
array('controller' => 'transactions', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Ldgr Entries',
|
||||
array('controller' => 'ledger_entries', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Stmt Entries',
|
||||
array('controller' => 'statement_entries', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Assess Charges',
|
||||
array('controller' => 'leases', 'action' => 'assess_all'), null,
|
||||
'SITE', $this->admin_area);
|
||||
}
|
||||
|
||||
if ($this->params['dev']) {
|
||||
$menu[] = array('name' => 'Development', 'header' => true);
|
||||
$menu[] = array('name' => 'Un-Nuke', 'url' => '#', 'htmlAttributes' =>
|
||||
array('onclick' => '$(".pr-section").show(); return false;'));
|
||||
$menu[] = array('name' => 'New Ledgers', 'url' => array('controller' => 'accounts', 'action' => 'newledger'));
|
||||
//array('name' => 'RESET DATA', 'url' => array('controller' => 'accounts', 'action' => 'reset_data'));
|
||||
$this->addSideMenuLink('Un-Nuke',
|
||||
'#', array('htmlAttributes' =>
|
||||
array('onclick' => '$(".pr-section").show(); return false;')),
|
||||
'SITE', $this->dev_area);
|
||||
$this->addSideMenuLink('New Ledgers',
|
||||
array('controller' => 'accounts', 'action' => 'newledger'), null,
|
||||
'SITE', $this->dev_area);
|
||||
//array('name' => 'RESET DATA', array('controller' => 'accounts', 'action' => 'reset_data'));
|
||||
}
|
||||
|
||||
return $menu;
|
||||
|
||||
$this->sideMenuAreaName('Operations', 'SITE', $this->op_area);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* hook: beforeFilter
|
||||
* - Called just before the action function
|
||||
*/
|
||||
|
||||
function beforeFilter() {
|
||||
$this->params['dev'] =
|
||||
(!empty($this->params['dev_route']));
|
||||
@@ -93,12 +258,55 @@ class AppController extends Controller {
|
||||
|
||||
if (!$this->params['dev'])
|
||||
Configure::write('debug', '0');
|
||||
|
||||
$this->addDefaultSideMenuLinks();
|
||||
$this->sideMenuEnable('SITE', $this->op_area, false);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* hook: beforeRender
|
||||
* - Called just before rendering the page
|
||||
*/
|
||||
|
||||
function beforeRender() {
|
||||
$this->set('sidemenu', $this->sideMenuLinks());
|
||||
// Stupid Cake... our constructor sets admin/dev,
|
||||
// but cake stomps it somewhere along the way
|
||||
// after constructing the CakeError controller.
|
||||
if ($this->name === 'CakeError') {
|
||||
$this->params['dev'] = false;
|
||||
$this->params['admin'] = false;
|
||||
}
|
||||
|
||||
foreach ($this->sidemenu_areas AS &$area) {
|
||||
if (empty($area['enable']))
|
||||
$area = array();
|
||||
if (empty($area['subarea']))
|
||||
continue;
|
||||
ksort($area['subarea']);
|
||||
|
||||
foreach ($area['subarea'] AS &$subarea) {
|
||||
if (empty($subarea['enable']))
|
||||
$subarea = array();
|
||||
if (empty($subarea['priorities']))
|
||||
continue;
|
||||
ksort($subarea['priorities']);
|
||||
}
|
||||
}
|
||||
|
||||
//pr($this->sidemenu_areas);
|
||||
$this->set('sidemenu', $this->sidemenu_areas);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: redirect
|
||||
*/
|
||||
|
||||
function redirect($url, $status = null, $exit = true) {
|
||||
// OK, since the controller will not be able to
|
||||
// utilize our overriden url function in AppHelper,
|
||||
@@ -127,6 +335,14 @@ class AppController extends Controller {
|
||||
return parent::redirect($url, $status, $exit);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: reset_data
|
||||
* - Development function. TO BE DELETED
|
||||
*/
|
||||
|
||||
function reset_data() {
|
||||
$this->layout = null;
|
||||
$this->autoLayout = false;
|
||||
@@ -158,6 +374,7 @@ class AppController extends Controller {
|
||||
*/
|
||||
|
||||
function gridView($title, $action = null, $element = null) {
|
||||
$this->sideMenuEnable('SITE', $this->op_area);
|
||||
$this->set('title', $title);
|
||||
// The resulting page will contain a grid, which will
|
||||
// use ajax to obtain the actual data for this action
|
||||
|
||||
@@ -4,28 +4,19 @@ class AccountsController extends AppController {
|
||||
|
||||
var $uses = array('Account', 'LedgerEntry');
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Accounts', 'header' => true),
|
||||
array('name' => 'All', 'url' => array('controller' => 'accounts', 'action' => 'all')),
|
||||
array('name' => 'Asset', 'url' => array('controller' => 'accounts', 'action' => 'asset')),
|
||||
array('name' => 'Liability', 'url' => array('controller' => 'accounts', 'action' => 'liability')),
|
||||
array('name' => 'Equity', 'url' => array('controller' => 'accounts', 'action' => 'equity')),
|
||||
array('name' => 'Income', 'url' => array('controller' => 'accounts', 'action' => 'income')),
|
||||
array('name' => 'Expense', 'url' => array('controller' => 'accounts', 'action' => 'expense')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -41,6 +32,28 @@ class AccountsController extends AppController {
|
||||
function expense() { $this->gridView('Expense Accounts'); }
|
||||
function all() { $this->gridView('All Accounts', 'all'); }
|
||||
|
||||
function gridView($title, $action = null, $element = null) {
|
||||
$this->addSideMenuLink('Asset',
|
||||
array('controller' => 'accounts', 'action' => 'asset'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Liability',
|
||||
array('controller' => 'accounts', 'action' => 'liability'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Equity',
|
||||
array('controller' => 'accounts', 'action' => 'equity'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Income',
|
||||
array('controller' => 'accounts', 'action' => 'income'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Expense',
|
||||
array('controller' => 'accounts', 'action' => 'expense'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'accounts', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
parent::gridView($title, $action, $element);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -189,12 +202,12 @@ class AccountsController extends AppController {
|
||||
$stats = $this->Account->stats($id, true);
|
||||
$stats = $stats['Ledger'];
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Ledger', 'url' => array('action' => 'newledger', $id));
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Collected', 'url' => array('action' => 'collected', $id));
|
||||
$this->addSideMenuLink('New Ledger',
|
||||
array('action' => 'newledger', $id), null,
|
||||
'ACTION');
|
||||
$this->addSideMenuLink('Collected',
|
||||
array('action' => 'collected', $id), null,
|
||||
'ACTION');
|
||||
|
||||
// Prepare to render
|
||||
$title = 'Account: ' . $account['Account']['name'];
|
||||
|
||||
@@ -2,19 +2,7 @@
|
||||
|
||||
class ContactsController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -37,17 +25,19 @@ class ContactsController extends AppController {
|
||||
|
||||
function gridDataOrder(&$params, &$model, $index, $direction) {
|
||||
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
||||
if ($index === 'Contact.last_name') {
|
||||
$order[] = 'Contact.first_name ' . $direction;
|
||||
}
|
||||
if ($index === 'Contact.first_name') {
|
||||
$order[] = 'Contact.last_name ' . $direction;
|
||||
}
|
||||
|
||||
// After sorting by whatever the user wants, add these
|
||||
// defaults into the sort mechanism. If we're already
|
||||
// sorting by one of them, it will only be redundant,
|
||||
// and should cause no harm (possible a longer query?)
|
||||
$order[] = 'Contact.last_name ' . $direction;
|
||||
$order[] = 'Contact.first_name ' . $direction;
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
||||
$links['Contact'] = array('id');
|
||||
$links['Contact'] = array('last_name', 'first_name');
|
||||
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
||||
}
|
||||
|
||||
@@ -78,13 +68,9 @@ class ContactsController extends AppController {
|
||||
));
|
||||
|
||||
// Set up dynamic menu items
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Edit',
|
||||
'url' => array('action' => 'edit',
|
||||
$id));
|
||||
$this->addSideMenuLink('Edit',
|
||||
array('action' => 'edit', $id), null,
|
||||
'ACTION');
|
||||
|
||||
// Prepare to render.
|
||||
$title = 'Contact: ' . $contact['Contact']['display_name'];
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
<?php
|
||||
|
||||
class CustomersController extends AppController {
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Customers', 'header' => true),
|
||||
array('name' => 'Current', 'url' => array('controller' => 'customers', 'action' => 'current')),
|
||||
array('name' => 'Past', 'url' => array('controller' => 'customers', 'action' => 'past')),
|
||||
array('name' => 'All', 'url' => array('controller' => 'customers', 'action' => 'all')),
|
||||
array('name' => 'Add Customer', 'url' => array('controller' => 'customers', 'action' => 'add')),
|
||||
);
|
||||
|
||||
//var $components = array('RequestHandler');
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -35,6 +27,25 @@ class CustomersController extends AppController {
|
||||
function past() { $this->gridView('Past Tenants'); }
|
||||
function all() { $this->gridView('All Customers'); }
|
||||
|
||||
function gridView($title, $action = null, $element = null) {
|
||||
$this->addSideMenuLink('Current',
|
||||
array('controller' => 'customers', 'action' => 'current'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Past',
|
||||
array('controller' => 'customers', 'action' => 'past'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'customers', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
|
||||
$this->sideMenuAreaName('Creation', 'ACTION', $this->new_area);
|
||||
$this->addSideMenuLink('New Customer',
|
||||
array('controller' => 'customers', 'action' => 'add'), null,
|
||||
'ACTION', $this->new_area);
|
||||
|
||||
parent::gridView($title, $action, $element);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -229,42 +240,35 @@ class CustomersController extends AppController {
|
||||
}
|
||||
|
||||
// Set up dynamic menu items
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Edit',
|
||||
'url' => array('action' => 'edit',
|
||||
$id));
|
||||
$this->addSideMenuLink('Edit',
|
||||
array('action' => 'edit', $id), null,
|
||||
'ACTION');
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-In',
|
||||
'url' => array('action' => 'move_in',
|
||||
$id));
|
||||
$this->addSideMenuLink('Move-In',
|
||||
array('action' => 'move_in', $id), null,
|
||||
'ACTION');
|
||||
|
||||
/* if ($show_moveout) { */
|
||||
/* $this->sidemenu_links[] = */
|
||||
/* array('name' => 'Move-Out', */
|
||||
/* 'url' => array('action' => 'move_out', */
|
||||
/* $id)); */
|
||||
/* $this->addSideMenuLink('Move-Out', */
|
||||
/* array('action' => 'move_out', $id), null, */
|
||||
/* 'ACTION'); */
|
||||
/* } */
|
||||
|
||||
if ($show_payment || $outstanding_balance > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Receipt',
|
||||
'url' => array('action' => 'receipt',
|
||||
$id));
|
||||
$this->addSideMenuLink('New Receipt',
|
||||
array('action' => 'receipt', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if (!$show_moveout && $outstanding_balance > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Write-Off',
|
||||
'url' => array('action' => 'bad_debt',
|
||||
$id));
|
||||
$this->addSideMenuLink('Write-Off',
|
||||
array('action' => 'bad_debt', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($outstanding_balance < 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Issue Refund',
|
||||
'url' => array('action' => 'refund', $id));
|
||||
$this->addSideMenuLink('Issue Refund',
|
||||
array('action' => 'refund', $id), null,
|
||||
'ACTION');
|
||||
|
||||
// Prepare to render.
|
||||
$title = 'Customer: ' . $customer['Customer']['name'];
|
||||
|
||||
@@ -2,20 +2,7 @@
|
||||
|
||||
class DoubleEntriesController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
@@ -2,26 +2,19 @@
|
||||
|
||||
class LeasesController extends AppController {
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Leases', 'header' => true),
|
||||
array('name' => 'Active', 'url' => array('controller' => 'leases', 'action' => 'active')),
|
||||
array('name' => 'Closed', 'url' => array('controller' => 'leases', 'action' => 'closed')),
|
||||
array('name' => 'Delinquent', 'url' => array('controller' => 'leases', 'action' => 'delinquent')),
|
||||
array('name' => 'All', 'url' => array('controller' => 'leases', 'action' => 'all')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -35,6 +28,22 @@ class LeasesController extends AppController {
|
||||
function closed() { $this->gridView('Closed Leases'); }
|
||||
function all() { $this->gridView('All Leases', 'all'); }
|
||||
|
||||
function gridView($title, $action = null, $element = null) {
|
||||
$this->addSideMenuLink('Active',
|
||||
array('controller' => 'leases', 'action' => 'active'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Closed',
|
||||
array('controller' => 'leases', 'action' => 'closed'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Delinquent',
|
||||
array('controller' => 'leases', 'action' => 'delinquent'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'leases', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
parent::gridView($title, $action, $element);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -467,28 +476,21 @@ class LeasesController extends AppController {
|
||||
// yet still have an outstanding balance. This can happen if someone
|
||||
// were to reverse charges, or if a payment should come back NSF.
|
||||
if (!isset($lease['Lease']['close_date']) || $outstanding_balance > 0) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
if (!isset($lease['Lease']['moveout_date']))
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-Out', 'url' => array('action' => 'move_out',
|
||||
$id));
|
||||
$this->addSideMenuLink('Move-Out',
|
||||
array('action' => 'move_out', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if (!isset($lease['Lease']['close_date']))
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Invoice', 'url' => array('action' => 'invoice',
|
||||
$id));
|
||||
$this->addSideMenuLink('New Invoice',
|
||||
array('action' => 'invoice', $id), null,
|
||||
'ACTION');
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Receipt', 'url' => array('controller' => 'customers',
|
||||
'action' => 'receipt',
|
||||
$lease['Customer']['id']));
|
||||
|
||||
/* if ($outstanding_balance < 0) */
|
||||
/* $this->sidemenu_links[] = */
|
||||
/* array('name' => 'Transfer Credit to Customer', */
|
||||
/* 'url' => array('action' => 'promote_surplus', $id)); */
|
||||
$this->addSideMenuLink('New Receipt',
|
||||
array('controller' => 'customers',
|
||||
'action' => 'receipt',
|
||||
$lease['Customer']['id']), null,
|
||||
'ACTION');
|
||||
|
||||
// REVISIT <AP>:
|
||||
// Not allowing refund to be issued from the lease, as
|
||||
@@ -500,19 +502,19 @@ class LeasesController extends AppController {
|
||||
$this->INTERNAL_ERROR("Should not have a customer lease credit.");
|
||||
|
||||
/* if ($outstanding_balance < 0) */
|
||||
/* $this->sidemenu_links[] = */
|
||||
/* array('name' => 'Issue Refund', */
|
||||
/* 'url' => array('action' => 'refund', $id)); */
|
||||
/* $this->addSideMenuLink('Issue Refund', */
|
||||
/* array('action' => 'refund', $id), null, */
|
||||
/* 'ACTION'); */
|
||||
|
||||
if (isset($lease['Lease']['moveout_date']) && $outstanding_balance > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Write-Off', 'url' => array('action' => 'bad_debt',
|
||||
$id));
|
||||
$this->addSideMenuLink('Write-Off',
|
||||
array('action' => 'bad_debt', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($this->Lease->closeable($id))
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Close', 'url' => array('action' => 'close',
|
||||
$id));
|
||||
$this->addSideMenuLink('Close',
|
||||
array('action' => 'close', $id), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
// Prepare to render
|
||||
|
||||
@@ -2,19 +2,6 @@
|
||||
|
||||
class LedgerEntriesController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
@@ -2,25 +2,19 @@
|
||||
|
||||
class LedgersController extends AppController {
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Ledgers', 'header' => true),
|
||||
array('name' => 'Current', 'url' => array('controller' => 'ledgers', 'action' => 'current')),
|
||||
array('name' => 'Closed', 'url' => array('controller' => 'ledgers', 'action' => 'closed')),
|
||||
array('name' => 'All', 'url' => array('controller' => 'ledgers', 'action' => 'all')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -33,6 +27,19 @@ class LedgersController extends AppController {
|
||||
function closed() { $this->gridView('Closed Ledgers'); }
|
||||
function all() { $this->gridView('All Ledgers', 'all'); }
|
||||
|
||||
function gridView($title, $action = null, $element = null) {
|
||||
$this->addSideMenuLink('Current',
|
||||
array('controller' => 'ledgers', 'action' => 'current'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Closed',
|
||||
array('controller' => 'ledgers', 'action' => 'closed'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'ledgers', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
parent::gridView($title, $action, $element);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -90,23 +97,20 @@ class LedgersController extends AppController {
|
||||
}
|
||||
|
||||
function gridDataOrder(&$params, &$model, $index, $direction) {
|
||||
$id_sequence = false;
|
||||
if ($index === 'id_sequence') {
|
||||
$id_sequence = true;
|
||||
$index = 'Ledger.account_id';
|
||||
}
|
||||
|
||||
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
||||
|
||||
if ($id_sequence) {
|
||||
$order[] = 'Ledger.sequence ' . $direction;
|
||||
}
|
||||
// After sorting by whatever the user wants, add these
|
||||
// defaults into the sort mechanism. If we're already
|
||||
// sorting by one of them, it will only be redundant,
|
||||
// and should cause no harm (possible a longer query?)
|
||||
$order[] = 'Account.name ' . $direction;
|
||||
$order[] = 'Ledger.sequence ' . $direction;
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
||||
$links['Ledger'] = array('id_sequence');
|
||||
$links['Ledger'] = array('name');
|
||||
$links['Account'] = array('name');
|
||||
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
||||
}
|
||||
|
||||
@@ -2,20 +2,7 @@
|
||||
|
||||
class StatementEntriesController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -268,7 +255,7 @@ class StatementEntriesController extends AppController {
|
||||
('Transaction' => array('fields' => array('id', 'type', 'stamp')),
|
||||
'Account' => array('id', 'name', 'type'),
|
||||
'Customer' => array('fields' => array('id', 'name')),
|
||||
'Lease' => array('fields' => array('id')),
|
||||
'Lease' => array('fields' => array('id', 'number')),
|
||||
),
|
||||
|
||||
'conditions' => array(array('StatementEntry.id' => $id),
|
||||
@@ -293,24 +280,16 @@ class StatementEntriesController extends AppController {
|
||||
|
||||
if (strtoupper($entry['StatementEntry']['type']) === 'CHARGE') {
|
||||
|
||||
$reversable = $this->StatementEntry->reversable($id);
|
||||
|
||||
// Set up dynamic menu items
|
||||
if ($reversable || $stats['balance'] > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
if ($reversable)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Reverse',
|
||||
'url' => array('action' => 'reverse',
|
||||
$id));
|
||||
if ($this->StatementEntry->reversable($id))
|
||||
$this->addSideMenuLink('Reverse',
|
||||
array('action' => 'reverse', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($stats['balance'] > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Waive Balance',
|
||||
'url' => array('action' => 'waive',
|
||||
$id));
|
||||
$this->addSideMenuLink('Waive Balance',
|
||||
array('action' => 'waive', $id), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
// Prepare to render.
|
||||
|
||||
@@ -2,20 +2,7 @@
|
||||
|
||||
class TendersController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -163,16 +150,11 @@ class TendersController extends AppController {
|
||||
));
|
||||
|
||||
|
||||
// Set up dynamic menu items
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
// Watch out for the special "Closing" entries
|
||||
if (!empty($tender['TenderType']['id']))
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Edit',
|
||||
'url' => array('action' => 'edit',
|
||||
$id));
|
||||
$this->addSideMenuLink('Edit',
|
||||
array('action' => 'edit', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if (!empty($tender['Tender']['deposit_transaction_id'])
|
||||
&& empty($tender['Tender']['nsf_transaction_id'])
|
||||
@@ -181,10 +163,9 @@ class TendersController extends AppController {
|
||||
// (or if we're in development mode)
|
||||
&& (!empty($tender['TenderType']['data1_name']) || !empty($this->params['dev']))
|
||||
) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'NSF',
|
||||
'url' => array('action' => 'nsf',
|
||||
$id));
|
||||
$this->addSideMenuLink('NSF',
|
||||
array('action' => 'nsf', $id), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
// Prepare to render.
|
||||
|
||||
@@ -4,26 +4,19 @@ class TransactionsController extends AppController {
|
||||
|
||||
var $components = array('RequestHandler');
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Transactions', 'header' => true),
|
||||
array('name' => 'All', 'url' => array('controller' => 'transactions', 'action' => 'all')),
|
||||
array('name' => 'Invoices', 'url' => array('controller' => 'transactions', 'action' => 'invoice')),
|
||||
array('name' => 'Receipts', 'url' => array('controller' => 'transactions', 'action' => 'receipt')),
|
||||
array('name' => 'Deposits', 'url' => array('controller' => 'transactions', 'action' => 'deposit')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -36,13 +29,29 @@ class TransactionsController extends AppController {
|
||||
function invoice() { $this->gridView('Invoices'); }
|
||||
function receipt() { $this->gridView('Receipts'); }
|
||||
function deposit() {
|
||||
$this->sidemenu_links = array
|
||||
(array('name' => 'Operations', 'header' => true),
|
||||
array('name' => 'New Deposit', 'url' => array('controller' => 'tenders',
|
||||
'action' => 'deposit')));
|
||||
if (empty($this->params['admin']))
|
||||
$this->sideMenuEnable('CONTROLLER', $this->std_area, false);
|
||||
$this->addSideMenuLink('New Deposit',
|
||||
array('controller' => 'tenders', 'action' => 'deposit'), null,
|
||||
'ACTION');
|
||||
$this->gridView('Deposits');
|
||||
}
|
||||
|
||||
function gridView($title, $action = null, $element = null) {
|
||||
$this->addSideMenuLink('Invoices',
|
||||
array('controller' => 'transactions', 'action' => 'invoice'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Receipts',
|
||||
array('controller' => 'transactions', 'action' => 'receipt'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Deposits',
|
||||
array('controller' => 'transactions', 'action' => 'deposit'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'transactions', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
parent::gridView($title, $action, $element);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -389,7 +398,7 @@ class TransactionsController extends AppController {
|
||||
array('contain' =>
|
||||
array(// Models
|
||||
'Account(id,name)',
|
||||
'Ledger(id,name)',
|
||||
'Ledger(id,sequence)',
|
||||
'NsfTender(id,name)',
|
||||
),
|
||||
'conditions' => array(array('Transaction.id' => $id),
|
||||
@@ -410,20 +419,19 @@ class TransactionsController extends AppController {
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT' || $this->params['dev']) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT')
|
||||
$this->addSideMenuLink('View Slip',
|
||||
array('action' => 'deposit_slip', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT')
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'View Slip', 'url' => array('action' => 'deposit_slip', $id));
|
||||
if ($this->params['dev'])
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Destroy', 'url' => array('action' => 'destroy', $id),
|
||||
'confirmMessage' => ("This may leave the database in an unstable state." .
|
||||
" Do NOT do this unless you know what you're doing." .
|
||||
" Proceed anyway?"));
|
||||
}
|
||||
if ($this->params['dev'])
|
||||
$this->addSideMenuLink('Destroy',
|
||||
array('action' => 'destroy', $id),
|
||||
array('confirmMessage' =>
|
||||
"This may leave the database in an unstable state." .
|
||||
" Do NOT do this unless you know what you're doing." .
|
||||
" Proceed anyway?"),
|
||||
'ACTION', $this->dev_area);
|
||||
|
||||
// OK, prepare to render.
|
||||
$title = 'Transaction #' . $transaction['Transaction']['id'];
|
||||
@@ -482,10 +490,9 @@ class TransactionsController extends AppController {
|
||||
if ($deposit['Transaction']['amount'] != $deposit_total)
|
||||
$this->INTERNAL_ERROR("Deposit items do not add up to deposit slip total");
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'View Transaction', 'url' => array('action' => 'view', $id));
|
||||
$this->addSideMenuLink('View',
|
||||
array('action' => 'view', $id), null,
|
||||
'ACTION');
|
||||
|
||||
$title = 'Deposit Slip';
|
||||
$this->set(compact('title', 'deposit'));
|
||||
|
||||
@@ -2,23 +2,16 @@
|
||||
|
||||
class UnitsController extends AppController {
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Units', 'header' => true),
|
||||
array('name' => 'Occupied', 'url' => array('controller' => 'units', 'action' => 'occupied')),
|
||||
array('name' => 'Vacant', 'url' => array('controller' => 'units', 'action' => 'vacant')),
|
||||
array('name' => 'Unavailable', 'url' => array('controller' => 'units', 'action' => 'unavailable')),
|
||||
array('name' => 'All', 'url' => array('controller' => 'units', 'action' => 'all')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +28,21 @@ class UnitsController extends AppController {
|
||||
function occupied() { $this->gridView('Occupied Units'); }
|
||||
function all() { $this->gridView('All Units', 'all'); }
|
||||
|
||||
function gridView($title, $action = null, $element = null) {
|
||||
$this->addSideMenuLink('Occupied',
|
||||
array('controller' => 'units', 'action' => 'occupied'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Vacant',
|
||||
array('controller' => 'units', 'action' => 'vacant'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Unavailable',
|
||||
array('controller' => 'units', 'action' => 'unavailable'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'units', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
parent::gridView($title, $action, $element);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -233,36 +241,35 @@ class UnitsController extends AppController {
|
||||
}
|
||||
|
||||
// Set up dynamic menu items
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Edit', 'url' => array('action' => 'edit',
|
||||
$id));
|
||||
$this->addSideMenuLink('Edit',
|
||||
array('action' => 'edit', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if (isset($unit['CurrentLease']['id']) &&
|
||||
!isset($unit['CurrentLease']['moveout_date'])) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-Out', 'url' => array('action' => 'move_out',
|
||||
$id));
|
||||
$this->addSideMenuLink('Move-Out',
|
||||
array('action' => 'move_out', $id), null,
|
||||
'ACTION');
|
||||
} elseif ($this->Unit->available($unit['Unit']['status'])) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-In', 'url' => array('action' => 'move_in',
|
||||
$id));
|
||||
$this->addSideMenuLink('Move-In',
|
||||
array('action' => 'move_in', $id), null,
|
||||
'ACTION');
|
||||
} else {
|
||||
// Unit is unavailable (dirty, damaged, reserved, business-use, etc)
|
||||
}
|
||||
|
||||
if (isset($unit['CurrentLease']['id']) &&
|
||||
!isset($unit['CurrentLease']['close_date'])) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Invoice', 'url' => array('controller' => 'leases',
|
||||
'action' => 'invoice',
|
||||
$unit['CurrentLease']['id']));
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Receipt', 'url' => array('controller' => 'customers',
|
||||
'action' => 'receipt',
|
||||
$unit['CurrentLease']['customer_id']));
|
||||
$this->addSideMenuLink('New Invoice',
|
||||
array('controller' => 'leases',
|
||||
'action' => 'invoice',
|
||||
$unit['CurrentLease']['id']), null,
|
||||
'ACTION');
|
||||
$this->addSideMenuLink('New Receipt',
|
||||
array('controller' => 'customers',
|
||||
'action' => 'receipt',
|
||||
$unit['CurrentLease']['customer_id']), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
// Prepare to render.
|
||||
|
||||
@@ -16,7 +16,6 @@ if (isset($account['Account']))
|
||||
$account = $account['Account'];
|
||||
|
||||
$rows = array();
|
||||
$rows[] = array('ID', $account['id']);
|
||||
$rows[] = array('Name', $account['name']);
|
||||
$rows[] = array('Type', $account['type']);
|
||||
$rows[] = array('External Name', $account['external_name']);
|
||||
@@ -78,9 +77,8 @@ echo $this->element('ledger_entries', array
|
||||
(// Grid configuration
|
||||
'config' => array
|
||||
('grid_div_id' => 'ledger-ledger-entry-list',
|
||||
'caption' => ("Current Ledger: " .
|
||||
"(". $current_ledger['name'] .")"),
|
||||
'filter' => array('Ledger.id' => $current_ledger['id']),
|
||||
'caption' => "Current Ledger: #{$current_ledger['sequence']}",
|
||||
'filter' => array('Ledger.id' => $current_ledger['id']),
|
||||
'exclude' => array('Account', 'Amount', 'Cr/Dr', 'Balance',
|
||||
empty($account['receipts']) ? 'Tender' : null),
|
||||
'include' => array('Debit', 'Credit', 'Sub-Total'),
|
||||
|
||||
@@ -75,6 +75,8 @@ echo $this->element('leases', array
|
||||
('caption' => 'Lease History',
|
||||
'filter' => array('Customer.id' => $customer['Customer']['id']),
|
||||
'exclude' => array('Customer'),
|
||||
'sort_column' => 'Move-In',
|
||||
'sort_order' => 'DESC',
|
||||
)));
|
||||
|
||||
|
||||
@@ -89,8 +91,6 @@ echo $this->element('statement_entries', array
|
||||
'filter' => array('Customer.id' => $customer['Customer']['id'],
|
||||
'type !=' => 'VOID'),
|
||||
'exclude' => array('Customer'),
|
||||
'sort_column' => 'Effective',
|
||||
'sort_order' => 'DESC',
|
||||
)));
|
||||
|
||||
|
||||
@@ -107,9 +107,8 @@ echo $this->element('ledger_entries', array
|
||||
'Tender.id !=' => null,
|
||||
//'Account.id !=' => '-AR-'
|
||||
),
|
||||
'exclude' => array('Account', 'Cr/Dr'),
|
||||
'sort_column' => 'Date',
|
||||
'sort_order' => 'DESC',
|
||||
'include' => array('Transaction'),
|
||||
'exclude' => array('Entry', 'Account', 'Cr/Dr'),
|
||||
)));
|
||||
|
||||
|
||||
|
||||
@@ -1,50 +1,17 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
echo '<div class="ledger-entry view">' . "\n";
|
||||
echo '<div class="double-entry view">' . "\n";
|
||||
|
||||
// The two entry ids, debit and credit, are actually individual
|
||||
// The two entries, debit and credit, are actually individual
|
||||
// entries in separate accounts (each make up one of the two
|
||||
// entries required for "double entry"). This, when we provide
|
||||
// reconcile information, we're really providing reconcile info
|
||||
// for two independent accounts. The reconciling entries,
|
||||
// therefore, are those on the opposite side of the ledger in
|
||||
// each account. For example, assume this "double" entry is
|
||||
//
|
||||
// debit: A/R credit: Cash amount: 55
|
||||
//
|
||||
// Then, our accounts might look like:
|
||||
//
|
||||
// RENT TAX A/R CASH BANK
|
||||
// ------- ------- ------- ------- -------
|
||||
// |20 | 20| | | <-- Unrelated
|
||||
// | | |20 20| | <-- Unrelated
|
||||
// | | | | |
|
||||
// |50 | 50| | | <-- Rent paid by this entry
|
||||
// | |5 5| | | <-- Tax paid by this entry
|
||||
// | | |55 55| | <-- THIS ENTRY
|
||||
// | | | | |
|
||||
// | | | |75 75| <-- Deposit includes this entry
|
||||
// | | | | |
|
||||
//
|
||||
// In this case, we're looking to provide reconcile information
|
||||
// of A/R for (the credit side of) this entry, and also of Cash
|
||||
// (for the debit side). Taking the accounts as individual
|
||||
// entries, instead of the "double entry" representation in the
|
||||
// database, we're actually providing information on the two
|
||||
// A/R entries, 50 & 5, which are both debits, i.e. opposite
|
||||
// entries to the credit of A/R. The cash account entry
|
||||
// reconciles against the credit of 75. Again, this is the
|
||||
// opposite entry to the debit of Cash.
|
||||
//
|
||||
// Thus, for our debit_ledger_id, we're reconciling against
|
||||
// credits, and for our credit_ledger_id, against debits.
|
||||
// entries required for "double entry").
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
* LedgerEntry Detail Main Section
|
||||
* DoubleEntry Detail Main Section
|
||||
*/
|
||||
|
||||
$transaction = $entry['Transaction'];
|
||||
@@ -55,7 +22,6 @@ $entries = array('debit' => $entry['DebitEntry'],
|
||||
$entry = $entry['DoubleEntry'];
|
||||
|
||||
$rows = array();
|
||||
$rows[] = array('ID', $entry['id']);
|
||||
$rows[] = array('Transaction', $html->link('#'.$transaction['id'],
|
||||
array('controller' => 'transactions',
|
||||
'action' => 'view',
|
||||
@@ -64,41 +30,17 @@ $rows[] = array('Timestamp', FormatHelper::datetime($transaction['stamp']
|
||||
$rows[] = array('Comment', $entry['comment']);
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item ledger-entry detail',
|
||||
'caption' => 'Double Ledger Entry Detail',
|
||||
array('class' => 'item double-entry detail',
|
||||
'caption' => 'Double Ledger Entry',
|
||||
'rows' => $rows,
|
||||
'column_class' => array('field', 'value')));
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* LedgerEntry Info Box
|
||||
* Debit/Credit Entries
|
||||
*/
|
||||
|
||||
/* echo '<div class="infobox">' . "\n"; */
|
||||
/* foreach ($ledgers AS $type => $ledger) { */
|
||||
/* //pr($ledger); */
|
||||
/* if (!$ledger['Account']['trackable']) */
|
||||
/* continue; */
|
||||
|
||||
/* $applied_caption = "Transfers applied"; */
|
||||
/* $remaining_caption = "Unapplied amount"; */
|
||||
|
||||
/* $rows = array(); */
|
||||
/* $rows[] = array($applied_caption, */
|
||||
/* FormatHelper::currency($stats[$type]['amount_reconciled'])); */
|
||||
/* $rows[] = array($remaining_caption, */
|
||||
/* FormatHelper::currency($stats[$type]['amount_remaining'])); */
|
||||
/* echo $this->element('table', */
|
||||
/* array('class' => 'item summary', */
|
||||
/* 'caption' => "{$ledger['Account']['name']} Ledger Entry", */
|
||||
/* 'rows' => $rows, */
|
||||
/* 'column_class' => array('field', 'value'), */
|
||||
/* //'suppress_alternate_rows' => true, */
|
||||
/* )); */
|
||||
/* } */
|
||||
|
||||
/* echo '</div>' . "\n"; */
|
||||
|
||||
echo ('<DIV CLASS="ledger-double-entry">' . "\n");
|
||||
foreach ($ledgers AS $type => $ledger) {
|
||||
$rows = array();
|
||||
@@ -118,8 +60,7 @@ foreach ($ledgers AS $type => $ledger) {
|
||||
array('controller' => 'accounts',
|
||||
'action' => 'view',
|
||||
$ledger['Account']['id'])));
|
||||
$rows[] = array('Ledger', $html->link('#' . $ledger['Account']['id']
|
||||
. '-' . $ledger['sequence'],
|
||||
$rows[] = array('Ledger', $html->link('#' . $ledger['sequence'],
|
||||
array('controller' => 'ledgers',
|
||||
'action' => 'view',
|
||||
$ledger['id'])));
|
||||
@@ -128,7 +69,7 @@ foreach ($ledgers AS $type => $ledger) {
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => array('item', $type, 'detail'),
|
||||
'caption' => ucfirst($type) . ' Ledger Entry',
|
||||
'caption' => ucfirst($type) . ' Entry',
|
||||
'rows' => $rows,
|
||||
'column_class' => array('field', 'value')));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['ID'] = array('index' => 'Account.id', 'formatter' => 'id');
|
||||
$cols['Name'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
||||
$cols['Type'] = array('index' => 'Account.type', 'formatter' => 'enum');
|
||||
$cols['Entries'] = array('index' => 'entries', 'formatter' => 'number');
|
||||
@@ -15,7 +14,7 @@ $cols['Comment'] = array('index' => 'Account.comment', 'formatter' => 'comment
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Name')
|
||||
->defaultFields(array('ID', 'Name'))
|
||||
->defaultFields(array('Name'))
|
||||
->searchFields(array('Name'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Comment')));
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['ID'] = array('index' => 'Contact.id', 'formatter' => 'id');
|
||||
$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'name');
|
||||
$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'name');
|
||||
$cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname');
|
||||
@@ -14,7 +13,7 @@ $cols['Comment'] = array('index' => 'Contact.comment', 'formatter' =
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Last Name')
|
||||
->defaultFields(array('ID', 'Last Name', 'First Name'))
|
||||
->defaultFields(array('Last Name', 'First Name'))
|
||||
->searchFields(array('Last Name', 'First Name', 'Company'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Type', 'Active', 'Comment')));
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['ID'] = 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');
|
||||
@@ -20,7 +19,7 @@ if (!isset($config['filter']['Contact.id']))
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Name')
|
||||
->defaultFields(array('ID', 'Name'))
|
||||
->defaultFields(array('Name'))
|
||||
->searchFields(array('Name', 'Last Name', 'First Name'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Comment')));
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
<?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['Last Payment'] = array('index' => 'last_paid', 'formatter' => 'date');
|
||||
$cols['Applied'] = array('index' => "applied", 'formatter' => 'currency');
|
||||
$cols['Sub-Total'] = array('index' => 'subtotal-LedgerEntry.amount', 'formatter' => 'currency', 'sortable' => false);
|
||||
|
||||
|
||||
if (isset($transaction_id) || isset($reconcile_id))
|
||||
$grid->invalidFields('Transaction');
|
||||
|
||||
if (!isset($collected_account_id))
|
||||
$grid->invalidFields('Last Payment');
|
||||
|
||||
if (isset($account_ftype) || isset($ledger_id) || isset($account_id) || isset($ar_account) || isset($customer_id))
|
||||
$grid->invalidFields(array('Debit Account', 'Credit Account'));
|
||||
else
|
||||
$grid->invalidFields('Account');
|
||||
|
||||
if (isset($no_account) || $group_by_tx || isset($collected_account_id))
|
||||
$grid->invalidFields(array('Account', 'Debit Account', 'Credit Account'));
|
||||
|
||||
if (isset($ledger_id) || isset($account_id) || isset($ar_account) || isset($customer_id)) {
|
||||
$grid->invalidFields('Amount');
|
||||
$cols['Sub-Total']['index'] = 'subtotal-balance';
|
||||
} else {
|
||||
$grid->invalidFields(array('Debit', 'Credit'));
|
||||
$cols['Sub-Total']['index'] = 'subtotal-LedgerEntry.amount';
|
||||
}
|
||||
|
||||
// group_by_tx SHOULD wipe out Customer, but the reality
|
||||
// is that it works good at the present, so we'll leave it.
|
||||
if (isset($lease_id) || isset($customer_id))
|
||||
$grid->invalidFields(array('Customer'));
|
||||
|
||||
if (isset($lease_id) || $group_by_tx)
|
||||
$grid->invalidFields(array('Lease', 'Unit'));
|
||||
|
||||
if (!isset($reconcile_id) && !isset($collected_account_id))
|
||||
$grid->invalidFields('Applied');
|
||||
else
|
||||
$cols['Sub-Total']['index'] = 'subtotal-applied';
|
||||
|
||||
if (isset($account_ftype) || isset($collected_account_id))
|
||||
$grid->invalidFields('Sub-Total');
|
||||
|
||||
|
||||
// Now that columns are defined, establish basic grid parameters
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Date')
|
||||
->defaultFields(array('Entry', 'Date', 'Amount', 'Credit', 'Debit'));
|
||||
|
||||
|
||||
if (!isset($config['rows']) && !isset($collected_account_id)) {
|
||||
$config['action'] = 'ledger';
|
||||
$grid->limit(50);
|
||||
}
|
||||
|
||||
if (isset($reconcile_id)) {
|
||||
$config['action'] = 'reconcile';
|
||||
$grid->customData(compact('reconcile_id'))->limit(20);
|
||||
}
|
||||
|
||||
if (isset($collected_account_id)) {
|
||||
$config['action'] = 'collected';
|
||||
$account_id = $collected_account_id;
|
||||
$grid->limit(50);
|
||||
$grid->sortField('Last Payment');
|
||||
}
|
||||
|
||||
if (isset($entry_ids))
|
||||
$grid->id_list($entry_ids);
|
||||
|
||||
// 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', 'monetary_source_id',
|
||||
'customer_id', 'lease_id', 'transaction_id', 'group_by_tx'));
|
||||
|
||||
// Render the grid
|
||||
$grid
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array('Transaction', 'Entry', 'Date', 'Effective', 'Last Payment',
|
||||
'Account', 'Debit Account', 'Credit Account',
|
||||
'Customer', 'Unit',
|
||||
'Comment',
|
||||
'Amount', 'Debit', 'Credit',
|
||||
'Applied', 'Sub-Total')
|
||||
);
|
||||
@@ -22,9 +22,10 @@ $cols['Sub-Total'] = array('index' => 'subtotal-balance', 'formatter' =>
|
||||
$grid
|
||||
->limit(50)
|
||||
->columns($cols)
|
||||
->sortField('Date')
|
||||
->sortField('Date', 'DESC')
|
||||
->defaultFields(array('Entry', 'Date', 'Amount'))
|
||||
->searchFields(array('Customer', 'Unit'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Debit', 'Credit', 'Balance', 'Sub-Total', 'Comment')));
|
||||
array_diff(array_keys($cols), array('Transaction', 'Debit', 'Credit',
|
||||
'Balance', 'Sub-Total', 'Comment')));
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['ID'] = array('index' => 'id_sequence', 'formatter' => 'id');
|
||||
$cols['Name'] = array('index' => 'Ledger.name', 'formatter' => 'name');
|
||||
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
||||
$cols['Sequence'] = array('index' => 'Ledger.sequence', 'formatter' => 'id');
|
||||
$cols['Open Date'] = array('index' => 'PriorCloseTransaction.stamp', 'formatter' => 'date');
|
||||
$cols['Close Date'] = array('index' => 'CloseTransaction.stamp', 'formatter' => 'date');
|
||||
$cols['Comment'] = array('index' => 'Ledger.comment', 'formatter' => 'comment');
|
||||
@@ -16,8 +15,8 @@ $cols['Balance'] = array('index' => 'balance', 'formatter' => 'c
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('ID', 'ASC')
|
||||
->defaultFields(array('ID', 'Name', 'Account'))
|
||||
->sortField('Account')
|
||||
->defaultFields(array('Account', 'Sequence'))
|
||||
->searchFields(array('Account', 'Comment'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Open Date', 'Comment')));
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['ID'] = array('index' => 'Map.id', 'formatter' => 'id');
|
||||
$cols['Name'] = array('index' => 'Map.name', 'formatter' => 'longname');
|
||||
$cols['Site Area'] = array('index' => 'SiteArea.name', 'formatter' => 'longname');
|
||||
$cols['Width'] = array('index' => 'Map.width', 'formatter' => 'number');
|
||||
@@ -13,7 +12,7 @@ $cols['Comment'] = array('index' => 'Map.comment', 'formatter' => 'comment
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Name')
|
||||
->defaultFields(array('ID', 'Name'))
|
||||
->defaultFields(array('Name'))
|
||||
->searchFields(array('Name'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array()));
|
||||
|
||||
@@ -8,17 +8,29 @@
|
||||
* @package pmgr
|
||||
*/
|
||||
|
||||
foreach ($menu AS $item) {
|
||||
if (isset($item['header']))
|
||||
echo('<DIV CLASS="header">' . $item['name'] . '</DIV>' . "\n");
|
||||
elseif (isset($item['hr']))
|
||||
echo('<HR>' . "\n");
|
||||
elseif (isset($item['url']))
|
||||
echo('<DIV CLASS="item">'
|
||||
. $html->link($item['name'], $item['url'],
|
||||
isset($item['htmlAttributes']) ? $item['htmlAttributes'] : null,
|
||||
isset($item['confirmMessage']) ? $item['confirmMessage'] : null,
|
||||
isset($item['escapeTitle']) ? $item['escapeTitle'] : null)
|
||||
foreach ($menu AS $area) {
|
||||
if (empty($area['subarea']))
|
||||
continue;
|
||||
|
||||
. '</DIV>' . "\n");
|
||||
foreach ($area['subarea'] AS $subarea) {
|
||||
if (empty($subarea['priorities']))
|
||||
continue;
|
||||
|
||||
echo('<DIV CLASS="header">' . $subarea['name'] . '</DIV>' . "\n");
|
||||
foreach ($subarea['priorities'] AS $priority) {
|
||||
foreach ($priority AS $item) {
|
||||
if (isset($item['header']))
|
||||
echo('<DIV CLASS="header">' . $item['name'] . '</DIV>' . "\n");
|
||||
elseif (isset($item['hr']))
|
||||
echo('<HR>' . "\n");
|
||||
elseif (isset($item['url']))
|
||||
echo('<DIV CLASS="item">'
|
||||
. $html->link($item['name'], $item['url'],
|
||||
isset($item['htmlAttributes']) ? $item['htmlAttributes'] : null,
|
||||
isset($item['confirmMessage']) ? $item['confirmMessage'] : null,
|
||||
isset($item['escapeTitle']) ? $item['escapeTitle'] : null)
|
||||
. '</DIV>' . "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ $grid->customData(compact('statement_entry_id'));
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Date')
|
||||
->sortField('Date', 'DESC')
|
||||
->defaultFields(array('Entry', 'Date', 'Charge', 'Payment'))
|
||||
->searchFields(array('Customer', 'Unit'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Through', 'Lease',
|
||||
array_diff(array_keys($cols), array('Transaction', 'Through', 'Lease',
|
||||
'Amount', 'Applied', 'Balance', 'Sub-Total',
|
||||
'Comment')));
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
//$cols['ID'] = array('index' => 'Tender.id', 'formatter' => 'id');
|
||||
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
||||
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||
$cols['Item'] = array('index' => 'Tender.name', 'formatter' => 'longname');
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
$cols = array();
|
||||
$cols['Sort'] = array('index' => 'Unit.sort_order', 'hidden' => true);
|
||||
$cols['Walk'] = array('index' => 'Unit.walk_order', 'formatter' => 'number');
|
||||
$cols['ID'] = array('index' => 'Unit.id', 'formatter' => 'id');
|
||||
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname');
|
||||
$cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname');
|
||||
$cols['Rent'] = array('index' => 'Unit.rent', 'formatter' => 'currency');
|
||||
@@ -17,7 +16,7 @@ $cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Sort')
|
||||
->defaultFields(array('Sort', 'ID', 'Unit'))
|
||||
->defaultFields(array('Sort', 'Unit'))
|
||||
->searchFields(array('Unit', 'Size', 'Status'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Walk', 'Deposit', 'Comment')));
|
||||
|
||||
@@ -18,7 +18,6 @@ if (isset($lease['Lease']))
|
||||
|
||||
$rows = array();
|
||||
|
||||
$rows[] = array('ID', $lease['id']);
|
||||
$rows[] = array('Number', $lease['number']);
|
||||
$rows[] = array('Lease Type', $lease_type['name']);
|
||||
$rows[] = array('Unit', $html->link($unit['name'],
|
||||
@@ -90,8 +89,6 @@ echo $this->element('statement_entries', array
|
||||
'filter' => array('Lease.id' => $lease['id']),
|
||||
'include' => array('Through'),
|
||||
'exclude' => array('Customer', 'Lease', 'Unit'),
|
||||
'sort_column' => 'Effective',
|
||||
'sort_order' => 'DESC',
|
||||
)));
|
||||
|
||||
|
||||
@@ -108,9 +105,8 @@ echo $this->element('ledger_entries', array
|
||||
'Tender.id !=' => null,
|
||||
//'Account.id !=' => '-AR-'
|
||||
),
|
||||
'exclude' => array('Account', 'Cr/Dr'),
|
||||
'sort_column' => 'Date',
|
||||
'sort_order' => 'DESC',
|
||||
'include' => array('Transaction'),
|
||||
'exclude' => array('Entry', 'Account', 'Cr/Dr'),
|
||||
)));
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ $rows[] = array('Account', $html->link($account['name'],
|
||||
array('controller' => 'accounts',
|
||||
'action' => 'view',
|
||||
$account['id'])));
|
||||
$rows[] = array('Ledger', $html->link($ledger['name'],
|
||||
$rows[] = array('Ledger', $html->link('#' . $ledger['sequence'],
|
||||
array('controller' => 'ledgers',
|
||||
'action' => 'view',
|
||||
$ledger['id'])));
|
||||
|
||||
@@ -16,8 +16,6 @@ if (isset($ledger['Ledger']))
|
||||
$ledger = $ledger['Ledger'];
|
||||
|
||||
$rows = array();
|
||||
$rows[] = array('ID', $ledger['id']);
|
||||
$rows[] = array('Name', $ledger['name']);
|
||||
$rows[] = array('Account', $html->link($account['name'],
|
||||
array('controller' => 'accounts',
|
||||
'action' => 'view',
|
||||
|
||||
@@ -40,7 +40,7 @@ $rows[] = array('Customer', (isset($customer['name'])
|
||||
$customer['id']))
|
||||
: null));
|
||||
$rows[] = array('Lease', (isset($lease['id'])
|
||||
? $html->link('#'.$lease['id'],
|
||||
? $html->link('#'.$lease['number'],
|
||||
array('controller' => 'leases',
|
||||
'action' => 'view',
|
||||
$lease['id']))
|
||||
@@ -115,7 +115,6 @@ echo $this->element('statement_entries', array
|
||||
'config' => array
|
||||
('caption' => $applied_caption,
|
||||
//'filter' => array('id' => $entry['id']),
|
||||
'exclude' => array('Transaction'),
|
||||
)));
|
||||
|
||||
|
||||
|
||||
@@ -16,14 +16,13 @@ $transaction = $entry['Transaction'];
|
||||
$tender = $tender['Tender'];
|
||||
|
||||
$rows = array();
|
||||
$rows[] = array('ID', $tender['id']);
|
||||
$rows[] = array('Item', $tender['name']);
|
||||
$rows[] = array('Received', FormatHelper::date($transaction['stamp']));
|
||||
$rows[] = array('Customer', $html->link($customer['name'],
|
||||
array('controller' => 'customers',
|
||||
'action' => 'view',
|
||||
$customer['id'])));
|
||||
$rows[] = array('Amount', FormatHelper::currency($entry['amount']));
|
||||
$rows[] = array('Item', $tender['name']);
|
||||
$rows[] = array('Type', $ttype['name']);
|
||||
/* $rows[] = array('Type', $html->link($ttype['name'], */
|
||||
/* array('controller' => 'tender_types', */
|
||||
|
||||
@@ -25,7 +25,7 @@ $rows[] = array('Account', $html->link($account['name'],
|
||||
array('controller' => 'accounts',
|
||||
'action' => 'view',
|
||||
$account['id'])));
|
||||
$rows[] = array('Ledger', $html->link($ledger['name'],
|
||||
$rows[] = array('Ledger', $html->link('#' . $ledger['sequence'],
|
||||
array('controller' => 'ledgers',
|
||||
'action' => 'view',
|
||||
$ledger['id'])));
|
||||
|
||||
@@ -68,6 +68,8 @@ echo $this->element('leases', array
|
||||
('caption' => 'Lease History',
|
||||
'filter' => array('Unit.id' => $unit['id']),
|
||||
'exclude' => array('Unit'),
|
||||
'sort_column' => 'Move-In',
|
||||
'sort_order' => 'DESC',
|
||||
)));
|
||||
|
||||
|
||||
@@ -87,8 +89,6 @@ if (isset($current_lease['id'])) {
|
||||
'filter' => array('Lease.id' => $current_lease['id']),
|
||||
'include' => array('Through'),
|
||||
'exclude' => array('Customer', 'Lease', 'Unit'),
|
||||
'sort_column' => 'Effective',
|
||||
'sort_order' => 'DESC',
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user