/**
  * Budget Action
  */
 public function budgetAction()
 {
     if ($this->_request->getParam('id', null) === null) {
         $this->_redirect('/admin/clients/');
     }
     $this->view->clientId = array('client_id' => $this->_request->id);
     // retrieve client employment income
     $clientEmploymentGateway = new Clients_Model_ClientEmploymentGateway();
     $clientEmplomentIncome = $clientEmploymentGateway->fetchClientAndSpouseMthlySalary($this->_request->id);
     if (is_object($clientEmplomentIncome)) {
         $clientEmplomentIncome = $clientEmplomentIncome->toArray();
     }
     $this->view->clientEmplomentIncome = $clientEmplomentIncome;
     // retrieve client income list
     $clientIncomeGateway = new Clients_Model_ClientIncomeGateway();
     $clientIncomeList = $clientIncomeGateway->fetchClientIncomeByClientId($this->_request->id);
     if (is_object($clientIncomeList)) {
         $clientIncomeList = $clientIncomeList->toArray();
     }
     //format dates for viewing
     foreach ($clientIncomeList as &$incomeList) {
         $incomeList['client_income_startdate'] = $this->_dateFormatter->viewDateFormat($incomeList['client_income_startdate']);
         $incomeList['client_income_enddate'] = $this->_dateFormatter->viewDateFormat($incomeList['client_income_enddate']);
         $incomeList['client_income_monthlyamt'] = number_format($incomeList['client_income_monthlyamt'], 2);
     }
     $this->view->clientIncomeList = Zend_Paginator::factory($clientIncomeList);
     //retrieve client insurance expenses for display
     $clientInsuranceGateway = new Clients_Model_ClientInsuranceGateway();
     $clientInsList = $clientInsuranceGateway->fetchClientInsuranceByClientId($this->_request->id);
     if (is_object($clientInsList)) {
         $clientInsList = $clientInsList->toArray();
     }
     $this->view->clientInsList = $clientInsList;
     // retrieve client expense list
     $clientExpenseGateway = new Clients_Model_ClientExpenseGateway();
     $clientExpenseList = $clientExpenseGateway->fetchClientExpenseByClientId($this->_request->id);
     if (is_object($clientExpenseList)) {
         $clientExpenseList = $clientExpenseList->toArray();
     }
     foreach ($clientExpenseList as &$expenseList) {
         $expenseList['client_expense_payoffdate'] = $this->_dateFormatter->viewDateFormat($expenseList['client_expense_payoffdate']);
     }
     $this->view->clientExpenseList = Zend_Paginator::factory($clientExpenseList);
     //Calculate Monthly Totals
     //Income
     $monthlyIncome = 0;
     foreach ($clientEmplomentIncome as $key => $value) {
         $monthlyIncome += str_replace(',', '', $clientEmplomentIncome[$key]['client_employment_netpay']);
     }
     foreach ($clientIncomeList as $key => $value) {
         $monthlyIncome += str_replace(',', '', $clientIncomeList[$key]['client_income_monthlyamt']);
     }
     $this->view->monthlyIncome = number_format($monthlyIncome, 2);
     //Expenses
     $monthlyExpenses = 0;
     foreach ($clientExpenseList as $key => $value) {
         $monthlyExpenses += str_replace(',', '', $clientExpenseList[$key]['client_expense_avgpmt']);
     }
     foreach ($clientInsList as $key => $value) {
         $monthlyExpenses += str_replace(',', '', $clientInsList[$key]['client_insurance_mthlypremium']);
     }
     $this->view->monthlyExpenses = number_format($monthlyExpenses, 2);
     //Get Front controller/Request Module/Controller Name
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $this->view->module = $request->getModuleName();
     $this->view->controller = $request->getControllerName();
     //setup pagination
     $this->view->clientIncomeList->setCurrentPageNumber($this->_getParam('page'));
     $this->view->clientExpenseList->setCurrentPageNumber($this->_getParam('page'));
 }