Finished basic functionality for Move-Out. This still needs some work to handle the security deposit.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@202 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -140,6 +140,42 @@ class CustomersController extends AppController {
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: move_out
|
||||
* - prepare to move a customer out of one of their units
|
||||
*/
|
||||
|
||||
function move_out($id) {
|
||||
|
||||
$customer = $this->Customer->find
|
||||
('first', array
|
||||
('contain' => array
|
||||
(// Models
|
||||
'Lease' =>
|
||||
array('conditions' => array('Lease.moveout_date' => null),
|
||||
// Models
|
||||
'Unit' =>
|
||||
array('order' => array('sort_order'),
|
||||
'fields' => array('id', 'name'),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
'conditions' => array('Customer.id' => $id),
|
||||
));
|
||||
|
||||
$redirect = array('controller' => 'customers',
|
||||
'action' => 'view',
|
||||
$id);
|
||||
|
||||
$title = $customer['Customer']['name'] . ': Prepare Move-Out';
|
||||
$this->set(compact('title', 'customer', 'redirect'));
|
||||
$this->render('/leases/move_out');
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -158,12 +194,31 @@ class CustomersController extends AppController {
|
||||
$outstanding_balance = $customer['stats']['balance'];
|
||||
$outstanding_deposit = $customer['deposits']['summary']['balance'];
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Payment', 'url' => array('action' => 'payment', $id));
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-Out', 'url' => array('controller' => 'units', 'action' => 'move-out'));
|
||||
// Figure out if this customer has any non-closed leases
|
||||
$show_moveout = false;
|
||||
$show_payment = false;
|
||||
foreach ($customer['Lease'] AS $lease) {
|
||||
if (!isset($lease['close_date']))
|
||||
$show_payment = true;
|
||||
if (!isset($lease['moveout_date']))
|
||||
$show_moveout = true;
|
||||
}
|
||||
|
||||
// Set up dynamic menu items
|
||||
if ($show_moveout || $show_payment) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
if ($show_moveout) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-Out', 'url' => array('action' => 'move_out',
|
||||
$id));
|
||||
}
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Payment', 'url' => array('action' => 'payment',
|
||||
$id));
|
||||
}
|
||||
|
||||
// Prepare to render.
|
||||
$title = $customer['Customer']['name'];
|
||||
|
||||
Reference in New Issue
Block a user