Added ability to move an existing customer into a vacant unit. Changed out all of the 'amount' fields with 'rent', since it's much more self-explanatory. We still need the ability to add customers and contacts. I'll consider doing this by using the insert row ability of jqGrid.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@204 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-03 06:53:41 +00:00
parent a796e9e82d
commit d77dcfca75
16 changed files with 498 additions and 75 deletions

View File

@@ -12,11 +12,12 @@ $cols['Leases'] = array('index' => 'lease_count', 'width' =>
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency', 'sortable' => false);
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
$jqGrid_options = array('jqGridColumns' => $cols,
'controller' => 'customers');
// User requested options have priority
$jqGrid_options += compact('grid_div_id', 'grid_id', 'caption', 'grid_setup', 'limit');
$custom_post_data = compact('nothing');
$jqGrid_options = array('jqGridColumns' => $cols,
'controller' => 'customers');
$jqGrid_options += compact('action', 'caption',
'grid_div_id', 'grid_id', 'grid_setup',
'nolinks', 'limit');
if (isset($customers)) {
$jqGrid_options += array('custom_ids' =>

View File

@@ -93,6 +93,9 @@ if (isset($custom_post_data)) {
// correct subset of data
$postData['action'] = $action;
if (isset($nolinks)) {
$postData['nolinks'] = true;
}
// Perform column customizations.
// This will largely be based off of the 'formatter' parameter,

View File

@@ -2,15 +2,22 @@
// Define the table columns
$cols = array();
$cols['Sort'] = array('index' => 'Unit.sort_order', 'hidden' => true);
//$cols['Sort'] = array('index' => 'Unit.sort_order');
//$cols['Walk'] = array('index' => 'Unit.walk_order');
$cols['ID'] = array('index' => 'Unit.id', 'formatter' => 'id');
$cols['Unit'] = array('index' => 'Unit.name', 'width' => '50');
$cols['Size'] = array('index' => 'UnitSize.name', 'width' => '75');
$cols['Status'] = array('index' => 'Unit.status', 'width' => '75');
$cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');
$jqGrid_options = array('jqGridColumns' => $cols,
'controller' => 'units',
'caption' => isset($caption) ? $caption : null);
$custom_post_data = compact('nothing');
$jqGrid_options = array('jqGridColumns' => $cols,
'controller' => 'units');
$jqGrid_options += compact('action', 'caption',
'grid_div_id', 'grid_id', 'grid_setup',
'nolinks', 'limit');
if (isset($units)) {
$jqGrid_options += array('custom_ids' =>
@@ -19,9 +26,12 @@ if (isset($units)) {
$units),
'limit' => 5);
}
else {
if (isset($searchfields)) {
$jqGrid_options += array('search_fields' => array('Unit', 'Size', 'Status'));
}
$jqGrid_options += compact('custom_post_data');
$jqGrid_options['sort_column'] = 'Sort';
echo $this->element('jqGrid', $jqGrid_options);

View File

@@ -0,0 +1,159 @@
<?php /* -*- mode:PHP -*- */ ?>
<div class="move-in input">
<?php
; // Editor alignment
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
*
*/
$customer_grid_setup = array();
if (isset($customer['id']))
$customer_grid_setup['hiddengrid'] = true;
$customer_grid_setup['onSelectRow'] = array
('--special' =>
'function(ids) { if (ids != null) { onCustomerRowSelect("#"+$(this).attr("id"), ids); } }'
);
$unit_grid_setup = array();
if (isset($unit['id']))
$unit_grid_setup['hiddengrid'] = true;
$unit_grid_setup['onSelectRow'] = array
('--special' =>
'function(ids) { if (ids != null) { onUnitRowSelect("#"+$(this).attr("id"), ids); } }'
);
?>
<script type="text/javascript"><!--
function datepickerNow() {
now = new Date();
$("#datepicker").val($.datepicker.formatDate('mm/dd/yy', now)
+ ' '
+ (now.getHours() < 10 ? '0' : '')
+ now.getHours() + ':'
+ (now.getMinutes() < 10 ? '0' : '')
+ now.getMinutes());
}
function onCustomerRowSelect(grid_id, cust_id) {
// Set the customer id that will be returned with the form
$("#customer-id").val(cust_id);
// Get the customer name from the grid
$("#movein_customer").html($(grid_id).getCell(cust_id, "Customer-name"));
// Hide the "no customer" message and show the current customer
$("#no_customer").hide();
$("#current_customer").show();
$("#customers-list .HeaderButton").click();
}
function onUnitRowSelect(grid_id, unit_id) {
// Set the unit id that will be returned with the form
$("#unit-id").val(unit_id);
// Get the unit name from the grid
$("#movein_unit").html($(grid_id).getCell(unit_id, "Unit-name"));
// Hide the "no unit" message and show the current unit
$("#no_unit").hide();
$("#current_unit").show();
$("#units-list .HeaderButton").click();
}
--></script>
<?php
; // align
echo $this->element('customers',
array('grid_div_id' => 'customers-list',
'caption' => ('<A HREF="#" ONCLICK="$(\'#customers-list .HeaderButton\').click();'.
' return false;">Select Customer</A>'),
'grid_setup' => $customer_grid_setup,
'nolinks' => true,
'limit' => 10,
));
echo $this->element('units',
array('grid_div_id' => 'units-list',
'caption' => ('<A HREF="#" ONCLICK="$(\'#units-list .HeaderButton\').click();'.
' return false;">Select Unit</A>'),
'grid_setup' => $unit_grid_setup,
'action' => 'unoccupied',
'nolinks' => true,
'limit' => 10,
));
echo ('<H2>' .
'<SPAN id="current_customer" style="display:'.(isset($customer['id'])?"inline":"none").'">' .
'Customer: ' .
'<SPAN id="movein_customer">' . (isset($customer['name']) ? $customer['name'] : "") . '</SPAN>' .
'</SPAN>' .
'<SPAN id="no_customer" style="display:'.(isset($customer['id'])?"none":"inline").'">' .
'Please select customer' .
'</SPAN>' .
'</H2>' . "\n");
echo ('<H2>' .
'<SPAN id="current_unit" style="display:'.(isset($unit['id'])?"inline":"none").'">' .
'Unit: ' .
'<SPAN id="movein_unit">' . (isset($unit['name']) ? $unit['name'] : "") . '</SPAN>' .
'</SPAN>' .
'<SPAN id="no_unit" style="display:'.(isset($unit['id'])?"none":"inline").'">' .
'Please select unit' .
'</SPAN>' .
'</H2>' . "\n");
echo $form->create(null, array('id' => 'move-in-form',
'url' => array('controller' => 'leases',
'action' => 'move_in')));
echo $form->input("Lease.customer_id",
array('id' => 'customer-id',
'type' => 'hidden',
'value' => isset($customer['id']) ? $customer['id'] : 0));
echo $form->input("Lease.unit_id",
array('id' => 'unit-id',
'type' => 'hidden',
'value' => isset($unit['id']) ? $unit['id'] : 0));
echo 'Date: <input id="datepicker" name="data[Lease][movein_date]" type="text" /><BR>' . "\n";
echo 'Comment: <input id="comment" name="data[Lease][comment]" type="text" SIZE=80 /><BR>' . "\n";
echo $form->end('Move In Customer');
?>
<script type="text/javascript"><!--
$(document).ready(function(){
$("#datepicker").datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' })
.datepicker('setDate', '+0');
<?php if (isset($customer['id'])): ?>
$("#customer-id").val(<?php echo $customer['id']; ?>);
<?php endif; ?>
<?php if (isset($unit['id'])): ?>
$("#unit-id").val(<?php echo $unit['id']; ?>);
<?php endif; ?>
});
--></script>
</div>

View File

@@ -36,7 +36,7 @@ $rows = array(array('ID', $lease['id']),
array('Notice Received', FormatHelper::date($lease['notice_received_date'], true)),
array('Closed', FormatHelper::date($lease['close_date'], true)),
array('Deposit', FormatHelper::currency($lease['deposit'])),
array('Rent', FormatHelper::currency($lease['amount'])),
array('Rent', FormatHelper::currency($lease['rent'])),
array('Comment', $lease['comment']));

View File

@@ -9,15 +9,25 @@ echo '<div class="unit view">' . "\n";
* Unit Detail Main Section
*/
$rows = array(array('Name', $unit['Unit']['name']),
array('Status', $unit['Unit']['status']),
array('Comment', $unit['Unit']['comment']));
$leases = $unit['Lease'];
$current_lease = $unit['CurrentLease'];
$unit_size = $unit['UnitSize'];
if (isset($unit['Unit']))
$unit = $unit['Unit'];
$rows = array(array('Name', $unit['name']),
array('Status', $unit['status']),
array('Size', $unit_size['name']),
array('Deposit', FormatHelper::currency($unit['deposit'])),
array('Rent', FormatHelper::currency($unit['rent'])),
array('Comment', $unit['comment']));
echo $this->element('table',
array('class' => 'item unit detail',
'caption' => 'Unit Info',
'rows' => $rows,
'column_class' => array('field', 'value')));
'caption' => 'Unit Info',
'rows' => $rows,
'column_class' => array('field', 'value')));
/**********************************************************************
@@ -52,22 +62,22 @@ echo '<div CLASS="detail supporting">' . "\n";
*/
echo $this->element('leases',
array('caption' => 'Lease History',
'leases' => $unit['Lease']));
array('caption' => 'Lease History',
'leases' => $leases));
/**********************************************************************
* Current Tenant Lease Account History
*/
if (isset($unit['CurrentLease']['id'])) {
if (isset($current_lease['id'])) {
echo $this->element('ledger_entries',
array('caption' =>
('Current Lease Account ('
. $unit['CurrentLease']['Customer']['name']
. ')'),
'ar_account' => true,
'lease_id' => $unit['CurrentLease']['id'],
));
array('caption' =>
('Current Lease Account ('
. $current_lease['Customer']['name']
. ')'),
'ar_account' => true,
'lease_id' => $current_lease['id'],
));
}