/** * */ public function expensesItemAction() { $this->_helper->layout()->disableLayout(); $this->view->rows = $this->_mapper->expensesInItem($this->_getParam('id')); $this->view->expense_amount = true; $this->_helper->viewRenderer->setRender('list-expense'); }
/** * */ public function informationAction() { // Form Information $formInformation = $this->_getForm($this->_helper->url('save')); $id = $this->_getParam('id'); if (!empty($id)) { $row = $this->_mapper->detail($id); $data = $row->toArray(); $data['date_start'] = $this->view->date($data['date_start']); $data['date_finish'] = $this->view->date($data['date_finish']); $data['date_formation'] = $this->view->date($data['date_formation']); $mapperSubDistrict = new Register_Model_Mapper_AddSubDistrict(); $rows = $mapperSubDistrict->listAll($data['fk_id_adddistrict']); $opts = array(array('' => '')); foreach ($rows as $row) { $opts[$row->id_addsubdistrict] = $row->sub_district; } $formInformation->getElement('fk_id_addsubdistrict')->addMultiOptions($opts); $formInformation->populate($data); $formInformation->getElement('fk_id_adddistrict')->setAttrib('readonly', true); // List the expenses related to the contract $this->view->expenses = $this->_mapper->listExpenses($id); if (!$this->view->fefopContract($data['id_fefop_contract'])->isEditable()) { $formInformation->removeDisplayGroup('toolbar'); } } else { // Fetch the Expenses related to the FE module $mapperBudgetCategory = new Fefop_Model_Mapper_Expense(); $this->view->expenses = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PISE_FE); } $this->view->form = $formInformation; }
/** * */ public function informationAction() { // Form Information $formInformation = $this->_getForm($this->_helper->url('save')); $id = $this->_getParam('id'); if (!empty($id)) { $row = $this->_mapper->detail($id); $data = $row->toArray(); $data['start_date'] = $this->view->date($data['date_start']); $data['finish_date'] = $this->view->date($data['date_finish']); $data['scholarity'] = (empty($row->external_code) ? '' : $row->external_code . ' - ') . $row->scholarity; $budget = $this->_mapper->getBudgetCategory($id); $data['id_budget_category'] = $budget->fk_id_budget_category; $formInformation->populate($data); $formInformation->getElement('fk_id_adddistrict')->setAttrib('readonly', true); if (!$this->view->fefopContract($data['id_fefop_contract'])->isEditable()) { $formInformation->removeDisplayGroup('toolbar'); } $this->view->id_planning_course = $row->fk_id_planning_course; } else { $mapperBudgetCategory = new Fefop_Model_Mapper_Expense(); $expenseModule = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PFPCI_FP); // Check if the module has Budget Category Defined if ($expenseModule->count() < 1) { foreach ($formInformation->getElements() as $element) { $element->setAttrib('disabled', true); } $this->view->fefopContract()->addMessage('Seidauk iha Rubrica ba Modulu FP.'); } else { $formInformation->getElement('id_budget_category')->setValue($expenseModule->current()->id_budget_category); } } $this->view->form = $formInformation; }
/** * */ public function businessExpenseAction() { $this->_helper->layout()->disableLayout(); $mapperBusinessExpense = new Fefop_Model_Mapper_Expense(); $this->view->rows = $mapperBusinessExpense->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PFPCI_DRH_PLAN); }
/** * */ public function informationAction() { // Form Information $formInformation = $this->_getForm($this->_helper->url('save')); $id = $this->_getParam('id'); if (!empty($id)) { $row = $this->_mapper->detail($id); $data = $row->toArray(); $data['date_start'] = $this->view->date($data['date_start']); $data['date_finish'] = $this->view->date($data['date_finish']); $mapperIsicTimor = new Register_Model_Mapper_IsicTimor(); $classTimor = $mapperIsicTimor->listClassByDisivion($data['fk_id_isicdivision']); $classes = array(); if (!empty($classTimor[$data['fk_id_isicdivision']]['classes'])) { $classes = $classTimor[$data['fk_id_isicdivision']]['classes']; } $opt = array('' => ''); foreach ($classes as $class) { $opt[$class->id_isicclasstimor] = $class->name_classtimor; } $formInformation->getElement('fk_id_isicclasstimor')->addMultiOptions($opt); $formInformation->populate($data); $formInformation->getElement('fk_id_adddistrict')->setAttrib('readonly', true); $formInformation->getElement('fk_id_fefop_modules')->setAttrib('readonly', true); // List the expenses related to the contract $this->view->expenses = $this->_mapper->listExpenses($id); // 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; if (!$this->view->fefopContract($data['id_fefop_contract'])->isEditable()) { $formInformation->removeDisplayGroup('toolbar'); } } else { $module = $this->_getParam('module'); if (!empty($module)) { $formInformation->getElement('fk_id_fefop_modules')->setValue($module); $constant = Fefop_Model_Mapper_Expense::CONFIG_PCE_CEC_FASE_I; if (Fefop_Model_Mapper_Module::CED == $module) { $constant = Fefop_Model_Mapper_Expense::CONFIG_PCE_CED_FASE_I; } // Fetch the Expenses related to the module $mapperBudgetCategory = new Fefop_Model_Mapper_Expense(); $this->view->expenses = $mapperBudgetCategory->expensesInItem($constant); } else { foreach ($formInformation->getElements() as $element) { $element->setAttrib('disabled', true); } $formInformation->getElement('fk_id_fefop_modules')->setAttrib('disabled', null); } } $this->view->form = $formInformation; }
/** * */ public function listContractsAction() { $this->_helper->layout()->disableLayout(); $id = $this->_getParam('id'); // Fetch the Expenses related to the DRH module $mapperBudgetCategory = new Fefop_Model_Mapper_Expense(); $this->view->expenses = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PFPCI_DRH); $mapperDRHTrainingPlan = new Fefop_Model_Mapper_DRHTrainingPlan(); $filters = array('no_contract' => true, 'training_plan' => $id); $this->view->beneficiaries = $mapperDRHTrainingPlan->listBeneficiariesByFilter($filters); $this->view->training_plan = $mapperDRHTrainingPlan->detail($id); }
/** * */ 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'); }