Fixed the problem of client side lease selection breaking the automated rent invoicing tools.
git-svn-id: file:///svn-source/pmgr/branches/v0.2.0_work@872 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -11,6 +11,7 @@ $cols['Signed'] = array('index' => 'Lease.lease_date', 'formatter' => 'dat
|
||||
$cols['Move-In'] = array('index' => 'Lease.movein_date', 'formatter' => 'date');
|
||||
$cols['Move-Out'] = array('index' => 'Lease.moveout_date', 'formatter' => 'date');
|
||||
$cols['Closed'] = array('index' => 'Lease.close_date', 'formatter' => 'date');
|
||||
$cols['Charge-Thru'] = array('index' => 'Lease.charge_through_date', 'formatter' => 'date');
|
||||
$cols['Paid-Thru'] = array('index' => 'Lease.paid_through_date', 'formatter' => 'date');
|
||||
$cols['Status'] = array('index' => 'status', 'formatter' => 'longenum');
|
||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||
@@ -18,7 +19,7 @@ $cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'com
|
||||
|
||||
if (!empty($this->params['action'])) {
|
||||
if ($this->params['action'] === 'closed')
|
||||
$grid->invalidFields(array('Paid-Thru', 'Status'));
|
||||
$grid->invalidFields(array('Charge-Thru', 'Paid-Thru', 'Status'));
|
||||
elseif ($this->params['action'] === 'active')
|
||||
$grid->invalidFields(array('Closed'));
|
||||
elseif ($this->params['action'] === 'delinquent')
|
||||
@@ -32,4 +33,4 @@ $grid
|
||||
->defaultFields(array('Lease'))
|
||||
->searchFields(array('Customer', 'Unit'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Signed', 'Status', 'Comment')));
|
||||
array_diff(array_keys($cols), array('Signed', 'Charge-Thru', 'Status', 'Comment')));
|
||||
|
||||
@@ -26,6 +26,8 @@ Configure::write('debug', '0');
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
var lease_charge_through;
|
||||
|
||||
// prepare the form when the DOM is ready
|
||||
$(document).ready(function() {
|
||||
var options = {
|
||||
@@ -151,6 +153,7 @@ function onRowSelect(grid_id, lease_id) {
|
||||
$("#invoice-deposit").html($(grid_id).getCell(lease_id, 'Lease-deposit')
|
||||
? $(grid_id).getCell(lease_id, 'Lease-deposit')
|
||||
: '-');
|
||||
lease_charge_through = $(grid_id).getCell(lease_id, 'Lease-charge_through_date')
|
||||
|
||||
// Hide the "no lease" message and show the current lease
|
||||
$(".lease-selection-invalid").hide();
|
||||
@@ -191,16 +194,8 @@ function setNextRent(id) {
|
||||
}
|
||||
});
|
||||
|
||||
if (!chg_thru) {
|
||||
chg_thru = <?php
|
||||
if ($lease['charge_through_date'])
|
||||
echo 'new Date("'.date('m/d/Y', strtotime($lease['charge_through_date'])).'")';
|
||||
elseif ($lease['paid_through_date'])
|
||||
echo 'new Date("'.date('m/d/Y', strtotime($lease['paid_through_date'])).'")';
|
||||
else
|
||||
echo 'dateYesterday("'.date('m/d/Y', strtotime($lease['movein_date'])).'")';
|
||||
?>;
|
||||
}
|
||||
if (!chg_thru)
|
||||
chg_thru = new Date(lease_charge_through);
|
||||
|
||||
if (chg_thru < dateEOM(chg_thru)) {
|
||||
// Add a charge to finish out the month
|
||||
@@ -328,7 +323,8 @@ if (empty($movein))
|
||||
array('gridstate' =>
|
||||
'onGridState("#"+$(this).attr("id"), gridstate)'),
|
||||
),
|
||||
'exclude' => array('Closed'),
|
||||
'include' => array('Charge-Thru'),
|
||||
'exclude' => array('Closed', 'Paid-Thru'),
|
||||
'action' => 'active',
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
@@ -443,6 +439,15 @@ Configure::write('debug', '0');
|
||||
$("#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']); ?>");
|
||||
lease_charge_through = <?php
|
||||
if ($lease['charge_through_date'])
|
||||
echo 'new Date("'.date('m/d/Y', strtotime($lease['charge_through_date'])).'")';
|
||||
elseif ($lease['paid_through_date'])
|
||||
echo 'new Date("'.date('m/d/Y', strtotime($lease['paid_through_date'])).'")';
|
||||
else
|
||||
echo 'dateYesterday("'.date('m/d/Y', strtotime($lease['movein_date'])).'")';
|
||||
?>;
|
||||
|
||||
<?php else: ?>
|
||||
$("#lease-id").val(0);
|
||||
$("#invoice-lease").html("INTERNAL ERROR");
|
||||
|
||||
Reference in New Issue
Block a user