Пример #1
0
 /**
  * 
  */
 public function fetchFinancialAnalysisAction()
 {
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->_helper->layout()->disableLayout();
     }
     $id = $this->_getParam('id');
     $businessPlan = $this->_mapper->fetchBusinessPlan($id);
     $this->_setParam('year', $businessPlan->year_activity);
     $totals = $this->_mapper->groupTotals($id);
     foreach ($totals as $total => $amount) {
         $this->_setParam($total, $amount);
     }
     $mapperBudgetCategory = new Fefop_Model_Mapper_Expense();
     if ($this->_mapper->hasBudgetCategory($id)) {
         $expenses = $this->_mapper->listExpenses($id, Fefop_Model_Mapper_Expense::CONFIG_PCE_ANNUAL);
         $annualSales = $this->_mapper->listExpenses($id, Fefop_Model_Mapper_Expense::CONFIG_PCE_REVENUE);
     } else {
         $expenses = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PCE_ANNUAL);
         $annualSales = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PCE_REVENUE);
     }
     $totalAnnualSales = 0;
     if ($annualSales->count() > 0) {
         $totalAnnualSales = $annualSales->current()->amount;
     }
     $this->_setParam('expenses', $expenses);
     $this->_setParam('annual', $totalAnnualSales);
     $this->_setParam('submitted', $businessPlan->submitted);
     $this->_forward('financial-analysis');
 }
Пример #2
0
 /**
  * 
  */
 public function informationAction()
 {
     $id = $this->_getParam('id');
     $row = $this->_mapper->fetchBusinessPlan($id);
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($row->fk_id_perdata);
     $clientsBusinessPlan = $this->_mapper->listClientBusinessPlan($id);
     $this->view->clientsBusinessPlan = $clientsBusinessPlan;
     // Fetch description fields
     $fieldsBusinessPlan = $this->_mapper->groupFieldsBusinessPlan($id);
     // Fetch totals
     $totalsFields = $this->_mapper->groupTotals($id);
     $mapperBudgetCategory = new Fefop_Model_Mapper_Expense();
     $itemConfig = $mapperBudgetCategory->getModuleToItem($row->fk_id_fefop_modules);
     $this->view->expenses = $this->_mapper->listExpenses($id, $itemConfig);
     $this->view->initial_expense = $this->_mapper->listExpenses($id, Fefop_Model_Mapper_Expense::CONFIG_PCE_INITIAL);
     $this->view->annual_expense = $this->_mapper->listExpenses($id, Fefop_Model_Mapper_Expense::CONFIG_PCE_ANNUAL);
     $this->view->revenue_expense = $this->_mapper->listExpenses($id, Fefop_Model_Mapper_Expense::CONFIG_PCE_REVENUE);
     // List the items expense detailed
     $itensExpense = $this->_mapper->listItemExpenses($id);
     $dataItensExpense = array();
     foreach ($itensExpense as $item) {
         if (!array_key_exists($item->fk_id_budget_category, $dataItensExpense)) {
             $dataItensExpense[$item->fk_id_budget_category] = array();
         }
         $dataItensExpense[$item->fk_id_budget_category][] = $item;
     }
     $this->view->itemsExpense = $dataItensExpense;
     $this->view->id = $id;
     $this->view->contract = $row;
     $this->view->totals_fields = $totalsFields;
     $this->view->values_description_fields = $fieldsBusinessPlan;
     $this->view->description_fields = $this->_mapper->getDescriptionFields();
     $this->view->client = $client;
     $this->view->no_edit = true;
 }