/** * Asset Action */ public function assetAction() { $totalInvestments = 0; $totalAssets = 0; if ($this->_request->getParam('id', null) === null) { $this->_redirect('/admin/clients/'); } $this->view->clientId = array('client_id' => $this->_request->id); $clientAssetGateway = new Clients_Model_ClientAssetGateway(); // retrieve client asset list $clientAssetList = $clientAssetGateway->fetchClientAssetByClientId($this->_request->id); if (is_object($clientAssetList)) { $clientAssetList = $clientAssetList->toArray(); } //Format Data and Calculate Total Asset Equity foreach ($clientAssetList as &$assetList) { $assetList['client_asset_payoffdate'] = $this->_dateFormatter->viewDateFormat($assetList['client_asset_payoffdate']); $totalAssets += str_replace(',', '', $assetList['client_asset_value']) - str_replace(',', '', $assetList['client_asset_owed']); $assetList['client_asset_value'] = number_format($assetList['client_asset_value'], 2); $assetList['client_asset_owed'] = number_format($assetList['client_asset_owed'], 2); $assetList['client_asset_pmtamount'] = number_format($assetList['client_asset_pmtamount'], 2); $assetList['client_asset_mthlyincome'] = number_format($assetList['client_asset_mthlyincome'], 2); } $this->view->clientAssetList = Zend_Paginator::factory($clientAssetList); // retrieve client investment list $clientEmploymentGateway = new Clients_Model_ClientEmploymentGateway(); $clientRetirementPlans = $clientEmploymentGateway->fetchClientAndSpouseRetirementPlan($this->_request->id); if (is_object($clientRetirementPlans)) { $clientRetirementPlans = $clientRetirementPlans->toArray(); } // retrieve client investment list $clientInvestmentGateway = new Clients_Model_ClientInvestmentGateway(); $clientInvestmentList = $clientInvestmentGateway->fetchClientInvestmentByClientId($this->_request->id); if (is_object($clientInvestmentList)) { $clientInvestmentList = $clientInvestmentList->toArray(); } //Format Data and Calculate Total Investments foreach ($clientInvestmentList as &$clientInvestment) { $totalInvestments += str_replace(',', '', $clientInvestment['client_investment_amount']); $clientInvestment['client_investment_amount'] = number_format($clientInvestment['client_investment_amount'], 2); $clientInvestment['client_investment_monthlycontribute'] = number_format($clientInvestment['client_investment_monthlycontribute'], 2); $clientInvestment['client_investment_monthlywithdraw'] = number_format($clientInvestment['client_investment_monthlywithdraw'], 2); } //Employment Retirement Plans if ($clientRetirementPlans) { foreach ($clientRetirementPlans as &$clientRetirementPlan) { $totalInvestments += str_replace(',', '', $clientRetirementPlan['client_employment_amount']); $clientRetirementPlan['client_employment_amount'] = number_format($clientRetirementPlan['client_employment_amount'], 2); $clientRetirementPlan['client_employment_yourcontribution'] = number_format($clientRetirementPlan['client_employment_yourcontribution'], 2); $clientRetirementPlan['client_employment_matchingmax'] = number_format($clientRetirementPlan['client_employment_matchingmax'], 2); } } $this->view->clientInvestmentList = Zend_Paginator::factory($clientInvestmentList); $request = Zend_Controller_Front::getInstance()->getRequest(); $this->view->module = $request->getModuleName(); $this->view->controller = $request->getControllerName(); $this->view->totalAssets = number_format($totalAssets, 2); $this->view->totalInvestments = number_format($totalInvestments, 2); $this->view->clientRetirementPlans = $clientRetirementPlans; //setup pagination $this->view->clientAssetList->setCurrentPageNumber($this->_getParam('page')); $this->view->clientInvestmentList->setCurrentPageNumber($this->_getParam('page')); }