コード例 #1
0
ファイル: CaseController.php プロジェクト: fredcido/simuweb
 /**
  * 
  */
 public function certificateAction()
 {
     $id = $this->_getParam('id');
     $case = $this->_mapper->detailCase($id);
     $data = array('beneficiary' => Client_Model_Mapper_Client::buildNameById($case->fk_id_perdata), 'evidence' => Client_Model_Mapper_Client::buildNumById($case->fk_id_perdata));
     $file = APPLICATION_PATH . '/../public/forms/Kazu/Sertifikadu_Atendimentu.rtf';
     App_Util_Export::toRtf($file, $data);
 }
コード例 #2
0
ファイル: PceController.php プロジェクト: fredcido/simuweb
 /**
  * 
  */
 public function businessPlanAction()
 {
     $id = $this->_getParam('id');
     if (empty($id)) {
         $this->_helper->redirector->goToSimple('index', 'index', 'external');
     }
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->_helper->layout()->disableLayout();
     }
     $formBusinessPlan = new External_Form_BusinessPlan();
     $formBusinessPlan->setAction($this->_helper->url('save-business-plan'));
     $businessPlan = $this->_mapper->fetchBusinessPlan($id);
     // Prepare Subdistrict SELECT Option
     $mapperSubDistrict = new Register_Model_Mapper_AddSubDistrict();
     $rowsSubdistrict = $mapperSubDistrict->listAll($businessPlan->fk_id_adddistrict);
     $rows = array('' => '');
     foreach ($rowsSubdistrict as $subDistrict) {
         $rows[$subDistrict->id_addsubdistrict] = $subDistrict->sub_district;
     }
     $formBusinessPlan->getElement('fk_id_addsubdistrict')->addMultiOptions($rows);
     // Prepare Business Plan Owner Select
     $rowOwner = array($businessPlan->fk_id_perdata => Client_Model_Mapper_Client::buildNameById($businessPlan->fk_id_perdata));
     $clientsBusinessPlan = $this->_mapper->listClientBusinessPlan($id);
     foreach ($clientsBusinessPlan as $client) {
         $rowOwner[$client->id_perdata] = Client_Model_Mapper_Client::buildName($client);
     }
     $formBusinessPlan->getElement('bussines_plan_developer')->addMultiOptions($rowOwner);
     $data = $businessPlan->toArray();
     $formBusinessPlan->populate($data);
     $this->view->formBusiness = $formBusinessPlan;
     $this->view->businessPlan = $businessPlan;
     $mapperBudgetCategory = new Fefop_Model_Mapper_Expense();
     $expenses = $mapperBudgetCategory->expensesInModule($businessPlan->fk_id_fefop_modules);
     $initial_expense = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PCE_INITIAL);
     $annual_expense = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PCE_ANNUAL);
     $revenue_expense = $mapperBudgetCategory->expensesInItem(Fefop_Model_Mapper_Expense::CONFIG_PCE_REVENUE);
     $this->view->expenses = $this->_mapper->aggregateExpenses($expenses, $businessPlan, $mapperBudgetCategory->getModuleToItem($businessPlan->fk_id_fefop_modules));
     $this->view->initial_expense = $this->_mapper->aggregateExpenses($initial_expense, $businessPlan, Fefop_Model_Mapper_Expense::CONFIG_PCE_INITIAL);
     $this->view->annual_expense = $this->_mapper->aggregateExpenses($annual_expense, $businessPlan, Fefop_Model_Mapper_Expense::CONFIG_PCE_ANNUAL);
     $this->view->revenue_expense = $this->_mapper->aggregateExpenses($revenue_expense, $businessPlan, Fefop_Model_Mapper_Expense::CONFIG_PCE_REVENUE);
     // Populate form
     $this->_populateFormBusinessPlan($formBusinessPlan, $businessPlan);
     if (!empty($data['submitted']) || !empty($businessPlan->business_group)) {
         foreach ($formBusinessPlan->getElements() as $element) {
             $element->setAttrib('disabled', true);
         }
         $this->view->no_edit = true;
     }
     $can_create = $this->_mapper->canCreateBusinessPlan($data['fk_id_perdata'], $data['fk_id_fefop_modules']);
     if (!$can_create) {
         foreach ($formBusinessPlan->getElements() as $element) {
             $element->setAttrib('disabled', true);
         }
     }
     $this->view->can_create = $can_create;
 }