diff --git a/site/models/customer.php b/site/models/customer.php index 269f2fb..1f1c9f3 100644 --- a/site/models/customer.php +++ b/site/models/customer.php @@ -77,6 +77,7 @@ class Customer extends AppModel { * - Returns an array of security deposit entries */ function securityDeposits($id, $query = null) { + $this->prEnter(compact('id', 'query')); $this->queryInit($query); $A = new Account(); @@ -90,8 +91,7 @@ class Customer extends AppModel { $query['conditions'][] = array('StatementEntry.account_id' => $A->securityDepositAccountID()); $set = $this->StatementEntry->reconciledSet('CHARGE', $query); - //pr(compact('set')); - return $set; + return $this->prReturn($set); } @@ -103,6 +103,7 @@ class Customer extends AppModel { */ function unreconciledCharges($id, $query = null) { + $this->prEnter(compact('id', 'query')); $this->queryInit($query); if (!isset($query['link']['Customer'])) @@ -119,8 +120,7 @@ class Customer extends AppModel { $query['conditions'][] = array('Customer.id' => $id); $set = $this->StatementEntry->reconciledSet('CHARGE', $query, true); - //pr(compact('set')); - return $set; + return $this->prReturn($set); } @@ -132,6 +132,7 @@ class Customer extends AppModel { */ function excessPayments($id, $query = null) { + $this->prEnter(compact('id', 'query')); $this->queryInit($query); if (!isset($query['link']['StatementEntry'])) @@ -144,8 +145,7 @@ class Customer extends AppModel { $query['conditions'][] = array('Customer.id' => $id); $set = $this->StatementEntry->reconciledSet('PAYMENT', $query, true); - //pr(compact('set')); - return $set; + return $this->prReturn($set); } @@ -157,6 +157,8 @@ class Customer extends AppModel { */ function details($id = null) { + $this->prEnter(compact('id')); + // Query the DB for need information. $customer = $this->find ('first', array @@ -186,7 +188,7 @@ class Customer extends AppModel { // Figure out the total security deposit for the current lease. $customer['deposits'] = $this->securityDeposits($id); - return $customer; + return $this->prReturn($customer); } @@ -274,8 +276,10 @@ class Customer extends AppModel { */ function stats($id = null, $query = null) { + //$this->prFunctionLevel(20); + $this->prEnter(compact('id', 'query')); if (!$id) - return null; + return $this->prExit(null); $this->queryInit($query); @@ -301,20 +305,20 @@ class Customer extends AppModel { 'conditions' => array('StatementEntry.customer_id' => $id), )); $find_stats = $find_stats[0]; -/* pr(compact('find_stats')); */ + $this->pr(17, compact('find_stats')); $tquery = $query; $tquery['conditions'][] = array('StatementEntry.customer_id' => $id); $statement_stats = $this->StatementEntry->stats(null, $tquery); $statement_stats['balance'] = $statement_stats['Charge']['balance']; -/* pr(compact('statement_stats')); */ + $this->pr(17, compact('statement_stats')); $tquery = $query; //$tquery['conditions'][] = array('StatementEntry.customer_id' => $id); $tquery['conditions'][] = array('Transaction.customer_id' => $id); $transaction_stats = $this->Transaction->stats(null, $tquery); $transaction_stats += $transaction_stats['StatementEntry']; -/* pr(compact('transaction_stats')); */ + $this->pr(17, compact('transaction_stats')); $tquery = $query; //$tquery['conditions'][] = array('StatementEntry.customer_id' => $id); @@ -322,11 +326,11 @@ class Customer extends AppModel { $ar_transaction_stats = $this->Transaction->stats(null, $tquery, $this->Transaction->Account->accountReceivableAccountID()); $ar_transaction_stats += $ar_transaction_stats['LedgerEntry']; -/* pr(compact('ar_transaction_stats')); */ + $this->pr(17, compact('ar_transaction_stats')); //$stats = $ar_transaction_stats; $stats = $find_stats; - return $stats; + return $this->prReturn($stats); } }