array('numeric'), 'number' => array('alphanumeric'), 'lease_type_id' => array('numeric'), 'unit_id' => array('numeric'), 'late_schedule_id' => array('numeric'), 'lease_date' => array('date'), 'movein_planed_date' => array('date'), 'movein_date' => array('date'), 'moveout_date' => array('date'), 'moveout_planed_date' => array('date'), 'notice_given_date' => array('date'), 'notice_received_date' => array('date'), 'close_date' => array('date'), 'deposit' => array('money'), 'amount' => array('money'), 'next_amount' => array('money'), 'next_amount_date' => array('date') ); var $belongsTo = array( 'LeaseType', 'Unit', 'Account', 'Customer', 'LateSchedule', ); /************************************************************************** ************************************************************************** ************************************************************************** * function: findAccountEntries * - Returns an array of ledger entries from the account of the given * lease. */ function findAccountEntries($id, $all = false, $cond = null, $link = null) { /* pr(array('function' => 'Lease::findAccountEntries', */ /* 'args' => compact('id', 'all', 'cond', 'link'), */ /* )); */ $lease = $this->find('first', array ('recursive' => -1, 'fields' => array('account_id'), 'conditions' => array(array('id' => $id)), )); $entries = $this->Account->findLedgerEntries($lease['Lease']['account_id'], $all, $cond, $link); /* pr(array('function' => 'Lease::findAccountEntries', */ /* 'args' => compact('id', 'all', 'cond', 'link'), */ /* 'vars' => compact('lease'), */ /* 'return' => compact('entries'), */ /* )); */ return $entries; } /************************************************************************** ************************************************************************** ************************************************************************** * function: findSecurityDeposits * - Returns an array of security deposit entries */ function findSecurityDeposits($id, $link = null) { /* pr(array('function' => 'Lease::findSecurityDeposits', */ /* 'args' => compact('id', 'link'), */ /* )); */ $lease = $this->find('first', array ('recursive' => -1, 'fields' => array('account_id'), 'conditions' => array(array('id' => $id)), )); $entries = $this->Account->findLedgerEntriesRelatedToAccount ($lease['Lease']['account_id'], $this->Account->securityDepositAccountID(), true, null, $link); /* pr(array('function' => 'Lease::findSecurityDeposits', */ /* 'args' => compact('id', 'link'), */ /* 'vars' => compact('lease'), */ /* 'return' => compact('entries'), */ /* )); */ return $entries; } /************************************************************************** ************************************************************************** ************************************************************************** * function: stats * - Returns summary data from the requested lease. */ function stats($id = null) { if (!$id) return null; // Find the associated account. $lease = $this->find('first', array('recursive' => -1, 'conditions' => array(array('Lease.id' => $id)))); // Pull the stats from the account. $stats['Account'] = $this->Account->stats($lease['Lease']['account_id']); return $stats; } } ?>