Example #1
0
 /**
  * 
  */
 public function indexAction()
 {
     $this->view->client = $this->_getParam('client');
     $this->view->case = $this->_getParam('case');
     // Search Client
     $mapperClient = new Client_Model_Mapper_Client();
     $this->view->clientRow = $mapperClient->detailClient($this->_getParam('client'));
 }
Example #2
0
 /**
  * 
  */
 public function evidenceAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->_getParam('id');
     $client = $this->_mapper->detailClient($id);
     if (!empty($client->id_action_plan)) {
         App_General_EvidenceCard::generate($client);
     }
     throw new Exception("Kliente ne'e seidauk iha Kazu Akonsellamentu");
 }
 /**
  * 
  */
 public function printAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->_getParam('id');
     $clients = $this->_getParam('clients');
     $clients = explode(',', $clients);
     $this->_mapper->savePrint($id, $clients);
     $mapperClient = new Client_Model_Mapper_Client();
     $dataClient = array();
     foreach ($clients as $client) {
         $dataClient[] = $mapperClient->detailClient($client);
     }
     App_General_EvidenceCard::generate($dataClient);
 }
 /**
  * 
  */
 public function fetchClientAction()
 {
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($this->_getParam('id'));
     $data = $client->toArray();
     $data['fk_id_perdata'] = $data['id_perdata'];
     $data['staff_name'] = Client_Model_Mapper_Client::buildName($client);
     $data['birth_date'] = $data['birth_date_format'];
     $data['gender'] = substr($data['gender'], 0, 1);
     $this->_helper->json($data);
 }
Example #5
0
 /**
  * 
  * @param Zend_Db_Table_Row $businessPlan
  * @return boolean|string
  */
 protected function _checkBeneficiaryGraduation($businessPlan)
 {
     //if ( Fefop_Model_Mapper_Module::CEG != $businessPlan->fk_id_fefop_modules )
     //    return true;
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($businessPlan->fk_id_perdata);
     $maxDili = array('SUPERIOR', 'POS-GRADUASAUN');
     if (strtolower($businessPlan->district) == 'dili' && (is_int($client->max_level_scholarity) && $client->max_level_scholarity < 2 || !in_array($client->max_level_scholarity, $maxDili)) || strtolower($businessPlan->district) != 'dili' && $client->max_level_scholarity < 1) {
         return sprintf('Kliente la iha Nivel Sertifikasaun Nasional level: %d', strtolower($businessPlan->district) == 'Dili' ? 2 : 1);
     } else {
         return true;
     }
 }
Example #6
0
 /**
  *
  * @param int $client
  * @param int $idJobTraining
  * @return string 
  */
 public function getFollowUpJob($client)
 {
     $view = Zend_Layout::getMvcInstance()->getView();
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($client);
     $link = '<a href="%s" target="_blank">%s</a>';
     $clientName = Client_Model_Mapper_Client::buildNumRow($client) . ' - ' . Client_Model_Mapper_Client::buildName($client);
     $aClient = sprintf($link, $view->baseUrl('/client/client/view/id/' . $client->id_perdata), $clientName);
     return sprintf(self::JOB_FOLLOW_UP, $aClient, $client->client_fone, $client->email);
 }
 /**
  * 
  */
 public function fetchClientAction()
 {
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($this->_getParam('id'));
     $data = array();
     $data['fk_id_perdata'] = $client['id_perdata'];
     $data['beneficiary'] = Client_Model_Mapper_Client::buildName($client);
     $this->_helper->json($data);
 }
Example #8
0
 /**
  * 
  */
 public function exportAction()
 {
     $id = $this->_getParam('id');
     $row = $this->_mapper->detail($id);
     $contractFiles = array('CEC' => 'Contrato_CEC_I_tet.xlsx', 'CED' => 'Contrato_CED_I_tet.xlsx');
     // Fetch Contract
     $mapperContract = new Fefop_Model_Mapper_Contract();
     $contract = $mapperContract->detail($row->fk_id_fefop_contract);
     $data = $row->toArray();
     $data += $contract->toArray();
     $data['contract'] = Fefop_Model_Mapper_Contract::buildNumById($row->fk_id_fefop_contract);
     $data['date_inserted'] = $this->view->date($data['date_inserted']);
     $data['date_start'] = $this->view->date($data['date_start'], 'yyyy-M-dd');
     $data['date_finish'] = $this->view->date($data['date_finish'], 'yyyy-M-dd');
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($row->fk_id_perdata);
     $data['evidence_card'] = Client_Model_Mapper_Client::buildNumRow($client);
     $data['client_name'] = Client_Model_Mapper_Client::buildName($client);
     $data['electoral'] = $client->electoral;
     $data['gender'] = $client->gender;
     $data['client_fone'] = $client->client_fone;
     $data['email'] = $client->email;
     $expensesRows = $mapperContract->listExpensesContract($row->fk_id_fefop_contract);
     $expenses = array();
     $total = 0;
     foreach ($expensesRows as $expense) {
         $expenses[] = array('name' => $expense->description, 'amount' => (double) $expense->amount);
         $total += (double) $expense->amount;
     }
     $excelPath = APPLICATION_PATH . '/../library/PHPExcel/';
     require_once $excelPath . 'PHPExcel/IOFactory.php';
     $objReader = PHPExcel_IOFactory::createReader('Excel2007');
     $objPHPExcel = $objReader->load(APPLICATION_PATH . '/../public/forms/FEFOP/' . $contractFiles[$data['num_module']]);
     $activeSheet = $objPHPExcel->getActiveSheet();
     $activeSheet->setCellValue('P12', $data['contract']);
     $activeSheet->setCellValue('T8', $data['date_inserted']);
     $activeSheet->setCellValue('F16', $data['evidence_card']);
     $activeSheet->setCellValue('F17', $data['electoral']);
     $activeSheet->setCellValue('E19', $data['client_name']);
     $activeSheet->setCellValue('D100', $data['client_name']);
     $activeSheet->setCellValue('Q19', $data['client_fone']);
     $activeSheet->setCellValue('O20', $data['email']);
     $activeSheet->setCellValue('F25', $data['name_disivion']);
     $activeSheet->setCellValue('L25', $data['name_classtimor']);
     $activeSheet->setCellValue('F27', $data['scholarity']);
     $activeSheet->setCellValue('Q27', $data['external_code']);
     $activeSheet->setCellValue('F29', $data['class_name']);
     //$activeSheet->setCellValue( 'Q23', (float)$data['amount_training'] );
     $activeSheet->setCellValue('F33', $data['date_start']);
     $activeSheet->setCellValue('F34', $data['date_finish']);
     //$activeSheet->setCellValue( 'J27', $data['duration'] . ' days' );
     $activeSheet->setCellValue('P33', $data['district_course']);
     $activeSheet->setCellValue('P34', $data['sub_district']);
     $startExpense = 40;
     $count = 'A';
     foreach ($expenses as $expense) {
         $activeSheet->setCellValue('B' . $startExpense, $count++);
         $activeSheet->setCellValue('C' . $startExpense, $expense['name']);
         $activeSheet->setCellValue('S' . $startExpense, $expense['amount']);
         $startExpense++;
     }
     //$activeSheet->setCellValue( 'S' . $startExpense, $total );
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     $file = sprintf('Contract_%s.xlsx', $data['contract']);
     header(sprintf('Content-Disposition: attachment;filename="%s"', $file));
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
     exit;
 }
Example #9
0
 /**
  * 
  * @return int
  * @throws Exception
  */
 protected function _getAge()
 {
     switch (true) {
         case !empty($this->_dataModel['age']):
             return $this->_dataModel['age'];
         case !empty($this->_dataModel['client']) && is_object($this->_dataModel['client']):
             return $this->_dataModel['client']->age;
         case !empty($this->_dataModel['client']) && is_array($this->_dataModel['client']):
             $mapperClient = new Client_Model_Mapper_Client();
             $select = $mapperClient->selectClient();
             $select->where('c.id_perdata IN(?)', (array) $this->_dataModel['client']);
             $this->_dataModel['client'] = $this->_dbTable->fetchAll($select);
             $ages = array();
             foreach ($this->_dataModel['client'] as $client) {
                 $ages[] = $client->age;
             }
             return $ages;
         case !empty($this->_dataModel['fk_id_perdata']):
             $mapperClient = new Client_Model_Mapper_Client();
             $this->_dataModel['client'] = $mapperClient->detailClient($this->_dataModel['fk_id_perdata']);
             return $this->_dataModel['client']->age;
         default:
             $message = 'La hetan kliente tinan ba halo validasaun';
             $this->_messageModel->addMessage($message, App_Message::ERROR);
             throw new Exception($message);
     }
 }
 /**
  * 
  */
 public function editTraineeAction()
 {
     $this->_helper->layout()->disableLayout();
     // Form Edit Trainee
     $formEditTrainee = $this->_initForm('editTrainee');
     $idTrainee = $this->_getParam('trainee');
     $trainee = $this->_mapper->fetchTrainee($idTrainee);
     $data = $trainee->toArray();
     $date = new Zend_Date();
     if (!empty($data['date_start'])) {
         $data['date_start'] = $date->set($data['date_start'])->toString('dd/MM/yyyy');
     }
     if (!empty($data['date_finish'])) {
         $data['date_finish'] = $date->set($data['date_finish'])->toString('dd/MM/yyyy');
     }
     $formEditTrainee->populate($data);
     // Fetch the client
     $mapperClient = new Client_Model_Mapper_Client();
     $this->view->client = $mapperClient->detailClient($trainee->fk_id_perdata);
     if (!$this->view->jobTrainingActive()->hasAccessEdit()) {
         $formEditTrainee->getElement('save')->setAttrib('disabled', true);
     }
     $mapperFeContract = new Fefop_Model_Mapper_FEContract();
     $contract = $mapperFeContract->getContractByTrainee($idTrainee);
     if (!empty($contract)) {
         $formEditTrainee->getElement('date_start')->setAttrib('readonly', true)->setAttrib('class', 'm-wrap span12');
         $formEditTrainee->getElement('date_finish')->setAttrib('readonly', true)->setAttrib('class', 'm-wrap span12 ');
         $this->view->contract = $contract->fk_id_fefop_contract;
     }
     $this->view->form = $formEditTrainee;
     $this->view->trainee = $trainee;
 }
Example #11
0
 /**
  * 
  */
 public function fetchTraineeAction()
 {
     $id = $this->_getParam('id');
     $mapperJobTraining = new StudentClass_Model_Mapper_JobTraining();
     $trainee = $mapperJobTraining->fetchTrainee($id);
     $data = array();
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($trainee->fk_id_perdata);
     $contract = $this->_mapper->getContractByTrainee($id);
     if (!empty($contract)) {
         $data['valid'] = false;
     } else {
         $data['valid'] = true;
         $data['fk_id_trainee'] = $trainee->id_trainee;
         $data['fk_id_fefpenterprise'] = $trainee->fk_id_fefpenterprise;
         $data['fk_id_fefpeduinstitution'] = $trainee->fk_id_fefpeduinstitution;
         $data['entity'] = $trainee->entity;
         $data['fk_id_scholarity_area'] = $trainee->fk_id_scholarity_area;
         $data['beneficiary'] = Client_Model_Mapper_Client::buildName($client);
         $data['fk_id_perdata'] = $trainee->fk_id_perdata;
         $data['date_start'] = $trainee->date_start_formated;
         $data['date_finish'] = $trainee->date_finish_formated;
         $data['duration_month'] = $trainee->duration;
     }
     $this->_helper->json($data);
 }
Example #12
0
 /**
  * 
  */
 public function printAppointmentAction()
 {
     $this->_helper->layout()->setLayout('print');
     $id = $this->_getParam('id');
     $mapperAppointment = new Client_Model_Mapper_Appointment();
     $this->view->appointment = $mapperAppointment->detailAppointment($id);
     $this->view->objectives = $mapperAppointment->listObjectives($id);
     $mapperClient = new Client_Model_Mapper_Client();
     $this->view->client = $mapperClient->detailClient($this->view->appointment->fk_id_perdata);
 }
 /**
  * 
  */
 public function exportAction()
 {
     $id = $this->_getParam('id');
     $row = $this->_mapper->fetchBusinessPlan($id);
     $contractFiles = array('CEG' => 'Contrato_CEG_tet.xlsx', 'CEC' => 'Contrato_CEC_II_tet.xlsx', 'CED' => 'Contrato_CED_II_tet.xlsx');
     // Fetch Contract
     $mapperContract = new Fefop_Model_Mapper_Contract();
     $contract = $mapperContract->detail($row->fk_id_fefop_contract);
     $data = $row->toArray();
     $data += $contract->toArray();
     $reserve_fund = $this->_mapper->getTotal($id, 'reserve_fund');
     $reserve_fund = $reserve_fund < 1 ? 600 : $reserve_fund;
     $data['contract'] = Fefop_Model_Mapper_Contract::buildNumById($row->fk_id_fefop_contract);
     $data['business_plan'] = External_Model_Mapper_Pce::buildNumRow($row);
     $data['date_inserted'] = $this->view->date($data['date_inserted']);
     $dateInsert = new Zend_Date($data['date_inserted']);
     $data['date_finish'] = $dateInsert->addYear(2)->toString('dd/MM/yyyy');
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($row->fk_id_perdata);
     $data['evidence_card'] = Client_Model_Mapper_Client::buildNumRow($client);
     $data['client_name'] = Client_Model_Mapper_Client::buildName($client);
     $data['is_handicapped'] = Client_Model_Mapper_Client::isHandicapped($row->fk_id_perdata);
     $data['electoral'] = $client->electoral;
     $data['gender'] = $client->gender;
     $data['client_fone'] = $client->client_fone;
     $group = array();
     $rowsGroup = $this->_mapper->listClientBusinessPlan($id);
     foreach ($rowsGroup as $rowGroup) {
         $group[] = array('name' => Client_Model_Mapper_Client::buildName($rowGroup), 'evidence_card' => Client_Model_Mapper_Client::buildNumRow($rowGroup), 'electoral' => $client->electoral, 'gender' => $client->gender, 'is_handicapped' => Client_Model_Mapper_Client::isHandicapped($client->id_perdata));
     }
     $expensesRows = $mapperContract->listExpensesContract($row->fk_id_fefop_contract);
     $expenses = array();
     $total = 0;
     foreach ($expensesRows as $expense) {
         $expenses[] = array('name' => $expense->description, 'amount' => (double) $expense->amount);
         $total += (double) $expense->amount;
     }
     $excelPath = APPLICATION_PATH . '/../library/PHPExcel/';
     require_once $excelPath . 'PHPExcel/IOFactory.php';
     $objReader = PHPExcel_IOFactory::createReader('Excel2007');
     $objPHPExcel = $objReader->load(APPLICATION_PATH . '/../public/forms/FEFOP/' . $contractFiles[$data['num_module']]);
     $activeSheet = $objPHPExcel->getActiveSheet();
     $activeSheet->setCellValue('P12', $data['contract']);
     $activeSheet->setCellValue('Q40', $data['business_plan']);
     $activeSheet->setCellValue('T8', $data['date_inserted']);
     $activeSheet->setCellValue('F45', $data['date_inserted']);
     $activeSheet->setCellValue('F46', $data['date_finish']);
     $activeSheet->setCellValue('F16', $data['evidence_card']);
     $activeSheet->setCellValue('F17', $data['electoral']);
     $activeSheet->setCellValue('E19', $data['client_name']);
     $activeSheet->setCellValue('D117', $data['client_name']);
     $activeSheet->setCellValue('Q19', $data['client_fone']);
     $activeSheet->setCellValue('O20', $data['email']);
     $activeSheet->setCellValue('H25', $data['total_partisipants']);
     // Responsible
     $activeSheet->setCellValue('E28', $data['client_name']);
     $activeSheet->setCellValue('M28', $data['evidence_card']);
     $activeSheet->setCellValue('O28', $data['electoral']);
     $activeSheet->setCellValue('Q28', $data['gender']);
     $activeSheet->setCellValue('R28', $data['is_handicapped'] ? 'Sin' : 'Lae');
     $startPerson = 29;
     foreach ($group as $person) {
         $activeSheet->setCellValue('E' . $startPerson, $person['name']);
         $activeSheet->setCellValue('M' . $startPerson, $person['evidence_card']);
         $activeSheet->setCellValue('O' . $startPerson, $person['electoral']);
         $activeSheet->setCellValue('Q' . $startPerson, $person['gender']);
         $activeSheet->setCellValue('R' . $startPerson, $person['is_handicapped'] ? 'Sin' : 'Lae');
         $startPerson++;
     }
     $activeSheet->setCellValue('F38', $data['name_disivion']);
     $activeSheet->setCellValue('L38', $data['name_classtimor']);
     $activeSheet->setCellValue('F40', $data['project_name']);
     $activeSheet->setCellValue('P45', $data['district']);
     $activeSheet->setCellValue('P46', $data['sub_district']);
     $activeSheet->setCellValue('P47', $data['sucu']);
     $startExpense = 52;
     $count = 'A';
     foreach ($expenses as $expense) {
         $activeSheet->setCellValue('B' . $startExpense, $count++);
         $activeSheet->setCellValue('C' . $startExpense, $expense['name']);
         $activeSheet->setCellValue('S' . $startExpense, $expense['amount']);
         $startExpense++;
     }
     $activeSheet->setCellValue('B' . $startExpense, $count++);
     $activeSheet->setCellValue('C' . $startExpense, 'Fundu Maneiu (600 USD + 10% rubrika sira iha leten)');
     $activeSheet->setCellValue('S' . $startExpense, $reserve_fund);
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     $file = sprintf('Contract_%s.xlsx', $data['contract']);
     header(sprintf('Content-Disposition: attachment;filename="%s"', $file));
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
     exit;
 }
Example #14
0
 /**
  * 
  */
 public function addClientAction()
 {
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->_helper->layout()->disableLayout();
     }
     $id = $this->_getParam('id');
     $row = $this->_getParam('row');
     $no_edit = $this->_getParam('no_edit');
     if (empty($row)) {
         $mapperClient = new Client_Model_Mapper_Client();
         $row = $mapperClient->detailClient($id);
     }
     $this->view->no_edit = $no_edit;
     $this->view->client = $row;
 }
Example #15
0
 /**
  * 
  * @return int|bool
  */
 public function saveStaff()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $dbStaff = App_Model_DbTable_Factory::get('Staff');
         $dataForm = $this->_data;
         $mapperClient = new Client_Model_Mapper_Client();
         $client = $mapperClient->detailClient($dataForm['fk_id_perdata']);
         $this->_data['birth_date'] = $client->birth_date;
         $this->_data['gender'] = substr($client->gender, 0, 1);
         //$dateBirth = new Zend_Date( $this->_data['birth_date'] );
         //$this->_data['birth_date'] = $dateBirth->toString( 'yyyy-MM-dd' );
         if (empty($dataForm['id_staff'])) {
             $history = 'INSERE STAFF OF INSTITUISAUN ENSINU: %s - %s - %s DADUS PRINCIPAL - INSERE NOVO STAFF OF INSTITUISAUN ENSINU';
         } else {
             $history = 'ALTERA STAFF OF INSTITUISAUN ENSINU: %s - %s - %s DADUS PRINCIPAL - ALTERA STAFF OF INSTITUISAUN ENSINU';
         }
         $id = parent::_simpleSave($dbStaff, false);
         $history = sprintf($history, $dataForm['staff_name'], $id, $dataForm['fk_id_fefpeduinstitution']);
         $this->_sysAudit($history, Register_Form_EducationInstitutionStaff::ID);
         $dbAdapter->commit();
         return $id;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         return false;
     }
 }