Exemplo n.º 1
0
 /**
  * 
  * @return boolean
  */
 protected function _validFundContract()
 {
     $mapperFinancial = new Fefop_Model_Mapper_Financial();
     $fundContract = $mapperFinancial->listFundsContract($this->_contract->id_fefop_contract);
     // If there is fund contract statement
     if (!empty($fundContract['funds'])) {
         $this->addMessage('Ita la bele edita kontratu nee tamba iha lansamentu finanseiru tiha ona ba fundu.');
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * 
  */
 public function fundContractAction()
 {
     $this->_helper->layout()->disableLayout();
     $id = $this->_getParam('id');
     $formFundContract = new Fefop_Form_ContractFund();
     $formFundContract->setAction($this->_helper->url('save-fund-contract'));
     $formFundContract->getElement('fk_id_fefop_contract')->setValue($id);
     // List all Funds
     $mapperFunds = new Fefop_Model_Mapper_Fund();
     $funds = $mapperFunds->fetchAll(array(), array('type'));
     // Fetch the totals by fund
     $reportFefop = new Report_Model_Mapper_Fefop();
     $filterReport = array('year' => date('Y'));
     $fundsTotals = $reportFefop->donorContractCostReport();
     $donorsTotals = $fundsTotals['item']['donor'];
     $donorTotalsViews = array();
     foreach ($donorsTotals as $typeDonor) {
         foreach ($typeDonor as $idDonor => $donor) {
             $donorTotalsViews[$idDonor] = $donor['balance'];
         }
     }
     $this->view->donor_totals = $donorTotalsViews;
     // List the funds already registered to the contract
     $fundsContract = $this->_mapper->listFundsContract($id);
     // List all the components related to the contract
     $mapperContract = new Fefop_Model_Mapper_Contract();
     $components = $mapperContract->listComponentsContract($id);
     // Reimbursement by Component
     $reimbursement = $this->_mapper->listExpenseTypeTotalsByContract($id, Fefop_Model_Mapper_Financial::TYPE_REIMBURSEMENT);
     $dataReimbursement = array();
     foreach ($reimbursement as $row) {
         $dataReimbursement[$row->fk_id_budget_category_type] = $row->total;
     }
     $this->view->reimbursement = $dataReimbursement;
     $this->view->components = $components;
     $this->view->funds = $funds;
     $this->view->funds_contract = $fundsContract;
     $this->view->form = $formFundContract;
 }