Some of the finer detail work, mostly around pre-populating the move-in invoice with useful and correct data, and allowing the lease rent and deposit to be set at movein.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@503 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -123,7 +123,7 @@ foreach ($fields AS $field => $config) {
|
||||
}
|
||||
|
||||
echo $this->element('table',
|
||||
compact('class', 'caption', 'headers',
|
||||
compact('id', 'class', 'caption', 'headers',
|
||||
'rows', 'row_class', 'suppress_alternate_rows',
|
||||
'column_class')
|
||||
);
|
||||
|
||||
@@ -64,7 +64,10 @@ if (isset($rows) && is_array($rows) && count($rows)) {
|
||||
$class = implode(' ', $class);
|
||||
|
||||
// OK, output the table HTML
|
||||
echo('<TABLE' . (isset($class) ? ' CLASS="'.$class.'"' : '') . '>' . "\n");
|
||||
echo('<TABLE' .
|
||||
(isset($id) ? ' ID="'.$id.'"' : '') .
|
||||
(isset($class) ? ' CLASS="'.$class.'"' : '') .
|
||||
'>' . "\n");
|
||||
|
||||
if (isset($caption))
|
||||
echo(' <CAPTION>' . $caption . '</CAPTION>' . "\n");
|
||||
|
||||
@@ -8,6 +8,7 @@ $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');
|
||||
$cols['Deposit'] = array('index' => 'Unit.deposit', 'formatter' => 'currency');
|
||||
$cols['Status'] = array('index' => 'Unit.status', 'formatter' => 'name'); // We have enough real estate
|
||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||
$cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');
|
||||
@@ -19,4 +20,4 @@ $grid
|
||||
->defaultFields(array('Sort', 'ID', 'Unit'))
|
||||
->searchFields(array('Unit', 'Size', 'Status'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Walk', 'Comment')));
|
||||
array_diff(array_keys($cols), array('Walk', 'Deposit', 'Comment')));
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
<?php
|
||||
; // Editor alignment
|
||||
|
||||
$unit = $lease['Unit'];
|
||||
$customer = $lease['Customer'];
|
||||
|
||||
if (isset($lease['Lease']))
|
||||
$lease = $lease['Lease'];
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
@@ -11,6 +18,9 @@
|
||||
* Javascript
|
||||
*/
|
||||
|
||||
// Warnings _really_ screw up javascript
|
||||
$saved_debug_state = Configure::read('debug');
|
||||
Configure::write('debug', '0');
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
@@ -90,8 +100,74 @@ function resetForm() {
|
||||
$("#invoice-late").html("INTERNAL ERROR");
|
||||
$("#invoice-deposit").html("INTERNAL ERROR");
|
||||
|
||||
|
||||
<?php if (empty($movein)): ?>
|
||||
|
||||
addChargeSource(false);
|
||||
datepickerNow('TransactionStamp');
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
var id;
|
||||
|
||||
$("#TransactionStamp").datepicker('disable');
|
||||
$("#TransactionStamp").val("<?php echo date('m/d/Y', $movein['time']); ?>");
|
||||
$('#TransactionStamp').after
|
||||
('<input type="hidden"' +
|
||||
' name="data[Transaction][stamp]"' +
|
||||
' value="<?php echo date('m/d/Y', $movein['time']); ?>">');
|
||||
$("#TransactionComment").val('Move-In Charges');
|
||||
|
||||
id = addChargeSource(false);
|
||||
$('#Entry'+id+'Form').removeCol(2);
|
||||
$('#Entry'+id+'Form input, #Entry'+id+'Form select').attr('disabled', true);
|
||||
$('#Entry'+id+'EffectiveDate').val("<?php echo date('m/d/Y', $movein['effective_time']); ?>");
|
||||
$('#Entry'+id+'EffectiveDate').after
|
||||
('<input type="hidden"' +
|
||||
' name="data[Entry]['+id+'][effective_date]"' +
|
||||
' value="<?php echo date('m/d/Y', $movein['effective_time']); ?>">');
|
||||
$('#Entry'+id+'AccountId').val(<?php echo $securityDepositAccount; ?>);
|
||||
$('#Entry'+id+'AccountId').after
|
||||
('<input type="hidden"' +
|
||||
' name="data[Entry]['+id+'][account_id]"' +
|
||||
' value="<?php echo $securityDepositAccount; ?>">');
|
||||
$('#Entry'+id+'Amount').val("<?php echo FormatHelper::currency($movein['deposit']); ?>");
|
||||
$('#Entry'+id+'Amount').after
|
||||
('<input type="hidden"' +
|
||||
' name="data[Entry]['+id+'][amount]"' +
|
||||
' value="<?php echo FormatHelper::currency($movein['deposit']); ?>">');
|
||||
//$('#Entry'+id+'Comment').val('Move-In Security Deposit');
|
||||
$('#Entry'+id+'Comment').removeAttr('disabled');
|
||||
|
||||
|
||||
id = addChargeSource(false);
|
||||
$('#Entry'+id+'Form').removeCol(2);
|
||||
$('#Entry'+id+'Form input, #Entry'+id+'Form select').attr('disabled', true);
|
||||
$('#Entry'+id+'EffectiveDate').val("<?php echo date('m/d/Y', $movein['effective_time']); ?>");
|
||||
$('#Entry'+id+'EffectiveDate').after
|
||||
('<input type="hidden"' +
|
||||
' name="data[Entry]['+id+'][effective_date]"' +
|
||||
' value="<?php echo date('m/d/Y', $movein['effective_time']); ?>">');
|
||||
$('#Entry'+id+'ThroughDate').val("<?php echo date('m/d/Y', $movein['through_time']); ?>");
|
||||
$('#Entry'+id+'ThroughDate').after
|
||||
('<input type="hidden"' +
|
||||
' name="data[Entry]['+id+'][through_date]"' +
|
||||
' value="<?php echo date('m/d/Y', $movein['through_time']); ?>">');
|
||||
$('#Entry'+id+'AccountId').val(<?php echo $rentAccount; ?>);
|
||||
$('#Entry'+id+'AccountId').after
|
||||
('<input type="hidden"' +
|
||||
' name="data[Entry]['+id+'][account_id]"' +
|
||||
' value="<?php echo $rentAccount; ?>">');
|
||||
$('#Entry'+id+'Amount').val("<?php echo FormatHelper::currency($movein['prorated_rent']); ?>");
|
||||
$('#Entry'+id+'Amount').after
|
||||
('<input type="hidden"' +
|
||||
' name="data[Entry]['+id+'][amount]"' +
|
||||
' value="<?php echo FormatHelper::currency($movein['prorated_rent']); ?>">');
|
||||
$('#Entry'+id+'Comment').val('Move-In Rent'
|
||||
<?php if ($movein['prorated']) echo "+ ' (Prorated)'" ?>);
|
||||
$('#Entry'+id+'Comment').removeAttr('disabled');
|
||||
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +228,8 @@ function addChargeSource(flash) {
|
||||
<?php
|
||||
echo FormatHelper::phpVarToJavascript
|
||||
($this->element('form_table',
|
||||
array('class' => "item invoice ledger-entry entry",
|
||||
array('id' => 'Entry%{id}Form',
|
||||
'class' => "item invoice ledger-entry entry",
|
||||
//'with_name_after' => ':',
|
||||
'field_prefix' => 'Entry.%{id}',
|
||||
'fields' => array
|
||||
@@ -192,12 +269,16 @@ function addChargeSource(flash) {
|
||||
numberOfMonths: [1, 1],
|
||||
showCurrentAtPos: 0,
|
||||
dateFormat: 'mm/dd/yy' });
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
--></script>
|
||||
|
||||
<?php
|
||||
; // align
|
||||
// Re-Enable warnings
|
||||
Configure::write('debug', $saved_debug_state);
|
||||
|
||||
echo $this->element('leases', array
|
||||
('config' => array
|
||||
@@ -205,7 +286,7 @@ echo $this->element('leases', array
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#leases-list .HeaderButton\').click();'.
|
||||
' return false;">Select Lease</A>'),
|
||||
'grid_setup' => array('hiddengrid' => isset($lease['Lease']['id'])),
|
||||
'grid_setup' => array('hiddengrid' => isset($lease['id'])),
|
||||
'grid_events' => array('onSelectRow' =>
|
||||
array('ids' =>
|
||||
'if (ids != null){onRowSelect("#"+$(this).attr("id"), ids);}'),
|
||||
@@ -285,7 +366,17 @@ echo $form->submit('Generate Invoice') . "\n";
|
||||
<div><H4>Response</H4><div id="response-debug"></div></div>
|
||||
<div><H4>Output</H4><div id="output-debug"></div></div>
|
||||
|
||||
<?php
|
||||
// Warnings _really_ screw up javascript
|
||||
Configure::write('debug', '0');
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
$.fn.removeCol = function(col){
|
||||
if(!col){ col = 1; }
|
||||
$('tr td:nth-child('+col+'), tr th:nth-child('+col+')', this).remove();
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#TransactionStamp")
|
||||
.attr('autocomplete', 'off')
|
||||
@@ -296,19 +387,19 @@ echo $form->submit('Generate Invoice') . "\n";
|
||||
|
||||
resetForm();
|
||||
|
||||
<?php if (isset($lease['Lease']['id'])): ?>
|
||||
$("#lease-id").val(<?php echo $lease['Lease']['id']; ?>);
|
||||
//$("#invoice-lease").html("<?php echo '#'.$lease['Lease']['number']; ?>");
|
||||
<?php if (isset($lease['id'])): ?>
|
||||
$("#lease-id").val(<?php echo $lease['id']; ?>);
|
||||
//$("#invoice-lease").html("<?php echo '#'.$lease['number']; ?>");
|
||||
$("#invoice-lease").html('<A HREF="/pmgr/site/leases/view/' +
|
||||
"<?php echo $lease['Lease']['id']; ?>" +
|
||||
"<?php echo $lease['id']; ?>" +
|
||||
'">#' +
|
||||
"<?php echo $lease['Lease']['number']; ?>" +
|
||||
"<?php echo $lease['number']; ?>" +
|
||||
'</A>');
|
||||
$("#invoice-unit").html("<?php echo $lease['Unit']['name']; ?>");
|
||||
$("#invoice-customer").html("<?php echo $lease['Customer']['name']; ?>");
|
||||
$("#invoice-rent").html("<?php echo FormatHelper::currency($lease['Lease']['rent']); ?>");
|
||||
$("#invoice-late").html('$10.00');
|
||||
$("#invoice-deposit").html("<?php echo FormatHelper::currency($lease['Lease']['deposit']); ?>");
|
||||
$("#invoice-unit").html("<?php echo $unit['name']; ?>");
|
||||
$("#invoice-customer").html("<?php echo $customer['name']; ?>");
|
||||
$("#invoice-rent").html("<?php echo FormatHelper::currency($lease['rent']); ?>");
|
||||
$("#invoice-late").html("<?php echo FormatHelper::currency($defaultLate); ?>");
|
||||
$("#invoice-deposit").html("<?php echo FormatHelper::currency($lease['deposit']); ?>");
|
||||
onGridState(null, 'hidden');
|
||||
<?php else: ?>
|
||||
onGridState(null, 'visible');
|
||||
|
||||
@@ -41,6 +41,12 @@ function onRowSelect(grid_id, item_type, item_id) {
|
||||
// Get the item name from the grid
|
||||
$("#move-"+item_type).html($(grid_id).getCell(item_id, cell_name));
|
||||
|
||||
// If a unit was selected, update the rent and deposit
|
||||
if (item_type == 'unit') {
|
||||
$("#LeaseRent").val($(grid_id).getCell(item_id, 'Unit-rent'));
|
||||
$("#LeaseDeposit").val($(grid_id).getCell(item_id, 'Unit-deposit'));
|
||||
}
|
||||
|
||||
// Hide the "no customer" message and show the current customer
|
||||
$("."+item_type+"-selection-invalid").hide();
|
||||
$("."+item_type+"-selection-valid").show();
|
||||
@@ -120,6 +126,8 @@ if ($move_type !== 'out') {
|
||||
array('gridstate' =>
|
||||
'onGridState("#"+$(this).attr("id"), "unit", gridstate)'),
|
||||
),
|
||||
'include' => array('Deposit'),
|
||||
'exclude' => array('Balance'),
|
||||
'action' => 'unoccupied',
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
@@ -169,7 +177,20 @@ echo $this->element('form_table',
|
||||
'id' => "LeaseMoveDate"),
|
||||
'between' => '<A HREF="#" ONCLICK="datepickerNow(\'LeaseMoveDate\', false); return false;">Now</A>',
|
||||
),
|
||||
"comment" =>
|
||||
) +
|
||||
($move_type === 'in' ? array
|
||||
("deposit" =>
|
||||
array('opts' => array
|
||||
('value' => (!empty($unit)
|
||||
? FormatHelper::currency($unit['deposit'])
|
||||
: null))),
|
||||
"rent" =>
|
||||
array('opts' => array
|
||||
('value' => (!empty($unit)
|
||||
? FormatHelper::currency($unit['rent'])
|
||||
: null))),
|
||||
) : array()) + array
|
||||
("comment" =>
|
||||
($move_type !== 'out'
|
||||
? array('opts' => array('size' => 50))
|
||||
: null),
|
||||
|
||||
Reference in New Issue
Block a user