From f7bcfef6652596ab3748bef86d8a41fc6e0a5514 Mon Sep 17 00:00:00 2001 From: abijah Date: Thu, 18 Jun 2009 04:19:17 +0000 Subject: [PATCH] Added a ledger listing to the Lease view page, which was otherwise quite empty. git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@168 97e9348a-65ac-dc4b-aefc-98561f571b83 --- controllers/leases_controller.php | 6 +++++- views/leases/view.ctp | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/controllers/leases_controller.php b/controllers/leases_controller.php index c98e28b..15c0feb 100644 --- a/controllers/leases_controller.php +++ b/controllers/leases_controller.php @@ -107,7 +107,7 @@ class LeasesController extends AppController { array(// Models 'LeaseType', 'Unit', - 'Account' => array('Ledger'), + 'Account' => array('CurrentLedger'), 'Customer', ), 'conditions' => array(array('Lease.id' => $id)), @@ -128,6 +128,10 @@ class LeasesController extends AppController { $deposits = $this->Lease->findSecurityDeposits($lease['Lease']['id']); $outstanding_deposit = $deposits['summary']['balance']; + // Move the Leder stats into our alias 'CurrentLedger' + $lease['Account']['CurrentLedger'] += $lease['Account']['Ledger']; + unset($lease['Account']['Ledger']); + // Prepare to render $title = 'Lease: #' . $lease['Lease']['id']; $this->set(compact('lease', 'title', diff --git a/views/leases/view.ctp b/views/leases/view.ctp index e195f43..8ee77e9 100644 --- a/views/leases/view.ctp +++ b/views/leases/view.ctp @@ -79,6 +79,16 @@ echo '' . "\n"; echo '
' . "\n"; +/********************************************************************** + * Current Ledger + */ + +echo $this->element('ledger_entries', + array('caption' => "Current Ledger: (#{$account['id']}-{$account['CurrentLedger']['sequence']})", + 'ledger_id' => $account['CurrentLedger']['id'], + 'account_type' => $account['type'], + )); + /* End "detail supporting" div */ echo '
' . "\n";