diff --git a/controllers/leases_controller.php b/controllers/leases_controller.php index 241b43b..2eef49a 100644 --- a/controllers/leases_controller.php +++ b/controllers/leases_controller.php @@ -453,13 +453,16 @@ class LeasesController extends AppController { ('first', array('contain' => array(// Models - 'LeaseType', - 'Unit', - 'Customer', + 'LeaseType(id,name)', + 'Unit(id,name)', + 'Customer(id,name)', ), + 'fields' => array('Lease.*', $this->Lease->delinquentField()), 'conditions' => array(array('Lease.id' => $id)), ) ); + $lease['Lease'] += $lease[0]; + unset($lease[0]); // Figure out the outstanding balances for this lease $outstanding_balance = $this->Lease->balance($id); diff --git a/views/leases/view.ctp b/views/leases/view.ctp index f13cea9..b68767c 100644 --- a/views/leases/view.ctp +++ b/views/leases/view.ctp @@ -39,7 +39,6 @@ $rows[] = array('Notice Received', FormatHelper::date($lease['notice_received_d $rows[] = array('Closed', FormatHelper::date($lease['close_date'], true)); $rows[] = array('Deposit', FormatHelper::currency($lease['deposit'])); $rows[] = array('Rent', FormatHelper::currency($lease['rent'])); -$rows[] = array('Paid Through', FormatHelper::date($lease['paid_through'], true)); $rows[] = array('Comment', $lease['comment']); @@ -58,6 +57,9 @@ echo '
' . "\n"; $rows = array(); $rows[] = array('Security Deposit:', FormatHelper::currency($outstandingDeposit)); $rows[] = array('Balance Owed:', FormatHelper::currency($outstandingBalance)); +$rows[] = array('Paid Through:', FormatHelper::date($lease['paid_through_date'], false)); +if ($lease['delinquent']) + $rows[] = array('Delinquent:', FormatHelper::age($lease['paid_through_date'], 'delinquent')); echo $this->element('table', array('class' => 'summary', 'rows' => $rows, diff --git a/webroot/css/layout.css b/webroot/css/layout.css index 75235f8..fc650b7 100644 --- a/webroot/css/layout.css +++ b/webroot/css/layout.css @@ -32,6 +32,13 @@ div.item.list { margin-bottom: 1.5em; } table.item.list { margin-bottom: 1.5em; } +/************************************************************ + ************************************************************ + * Date formats + */ +span.fmt-age.delinquent { color: #f00; } + + /************************************************************ ************************************************************ * Cell configuration