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:
72
site/views/leases/move_out.ctp
Normal file
72
site/views/leases/move_out.ctp
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
$multiple = false;
|
||||
$class = 'move-out';
|
||||
|
||||
if (isset($lease)) {
|
||||
$class .= ' lease';
|
||||
$data = $lease;
|
||||
}
|
||||
elseif (isset($customer) && count($customer['Lease']) == 1) {
|
||||
$class .= ' customer';
|
||||
$data = array_diff_key($customer, array('Lease'=>1));
|
||||
$data['Lease'] = array_diff_key($customer['Lease'][0], array('Unit'=>1));
|
||||
$data['Unit'] = $customer['Lease'][0]['Unit'];
|
||||
}
|
||||
elseif (isset($customer)) {
|
||||
$class .= ' customer';
|
||||
$data = $customer;
|
||||
$multiple = true;
|
||||
}
|
||||
elseif (isset($unit)) {
|
||||
$class .= ' unit';
|
||||
$data = array_diff_key($unit, array('CurrentLease'=>1));
|
||||
$data['Lease'] = array_diff_key($unit['CurrentLease'], array('Customer'=>1));
|
||||
$data['Customer'] = $unit['CurrentLease']['Customer'];
|
||||
}
|
||||
else {
|
||||
die("INTERNAL ERROR");
|
||||
}
|
||||
|
||||
//pr(compact('customer', 'lease', 'unit', 'class', 'multiple', 'data', 'redirect'));
|
||||
|
||||
echo '<div class="'.$class.'">' . "\n";
|
||||
echo('<H2>Move Out: '. $data['Customer']['name'] .
|
||||
(!$multiple ? ': Unit ' . $data['Unit']['name'] : '') .
|
||||
'</H2>' . "\n");
|
||||
echo('<P>Be sure that you really want to move this customer out, ' .
|
||||
($multiple ? 'select the correct unit to move out of, ' : '') .
|
||||
'and press the "Perform Move Out" button.' . "\n");
|
||||
echo '<P><BR>' . "\n";
|
||||
|
||||
echo $form->create(null, array('id' => 'move-out-form',
|
||||
'url' => array('controller' => 'leases',
|
||||
'action' => 'move_out')));
|
||||
|
||||
if ($multiple) {
|
||||
$options = array();
|
||||
foreach ($data['Lease'] AS $lease)
|
||||
$options[$lease['id']] = $lease['Unit']['name'];
|
||||
echo $form->input('Lease.id', array('label' => 'Move Out of Unit: ',
|
||||
'options' => $options));
|
||||
}
|
||||
else {
|
||||
echo $form->input('Lease.id',
|
||||
array('type' => 'hidden',
|
||||
'value' => $data['Lease']['id'],
|
||||
));
|
||||
}
|
||||
|
||||
// Set up a redirect page. I use lower case 'redirect' here
|
||||
// to avoid the model convention, which starts with upper-case.
|
||||
foreach ($redirect AS $name => $value) {
|
||||
echo $form->input("redirect.$name",
|
||||
array('type' => 'hidden',
|
||||
'value' => $value,
|
||||
));
|
||||
}
|
||||
|
||||
echo $form->end('Perform Move Out');
|
||||
|
||||
// End page div
|
||||
echo '</div>' . "\n";
|
||||
Reference in New Issue
Block a user