/** * * @return array */ public function getDataClassIndmo() { $dbStudentClassSent = App_Model_DbTable_Factory::get('StudentClass_Sent'); $rows = $dbStudentClassSent->fetchAll(array('sent = ?' => 0)); $mapperStudentClass = new StudentClass_Model_Mapper_StudentClass(); $mapperScholarity = new Register_Model_Mapper_PerScholarity(); $classes = array(); foreach ($rows as $row) { $class = $mapperStudentClass->detailStudentClass($row->fk_id_fefpstudentclass); $course = $mapperScholarity->fetchRow($class->fk_id_perscholarity); $dataClass = array('id' => $class->id_fefpstudentclass, 'title' => $class->class_name, 'start_date' => $class->start_date, 'finish_date' => $class->schedule_finish_date, 'qualification' => $course->remote_id, 'training_provider' => $class->num_register, 'id_training_provider' => $class->fk_id_fefpeduinstitution); $students = $mapperStudentClass->listClientClass($row->fk_id_fefpstudentclass); $studentsClass = array(); foreach ($students as $student) { $dataStudent = array('id' => $student->id_perdata, 'first_name' => $student->first_name, 'second_name' => $student->medium_name, 'evidence' => Client_Model_Mapper_Client::buildNumRow($student), 'last_name' => $student->last_name, 'district' => $student->num_district, 'sub_district' => $student->num_subdistrict, 'birth_date' => $student->birth_date, 'gender' => $student->gender, 'email' => $student->email, 'tel' => $student->client_fone, 'result' => $student->status_class, 'competencies' => array()); $competencies = $mapperStudentClass->listCompetencyClass($row->fk_id_fefpstudentclass, $student->id_perdata); foreach ($competencies as $competency) { $dataStudent['competencies'][] = array('id' => $competency->id_external, 'code' => $competency->external_code, 'result' => $competency->status); } $studentsClass[] = $dataStudent; } $dataClass['students'] = $studentsClass; $classes[] = $dataClass; } return $classes; }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $mapperFeContract = new Fefop_Model_Mapper_FEContract(); // Combo to search clients $clients = $mapperFeContract->listBeneficiaries(); $optClients[''] = ''; foreach ($clients as $row) { $optClients[$row['id_perdata']] = Client_Model_Mapper_Client::buildNumRow($row) . ' - ' . Client_Model_Mapper_Client::buildName($row); } $elements[] = $this->createElement('select', 'fk_id_perdata')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optClients)->setLabel('Benefisiariu'); // Combo to search enterprises $enterprises = $mapperFeContract->listEnterprises(); $optEnterprises[''] = ''; foreach ($enterprises as $row) { $optEnterprises[$row['id_fefpenterprise']] = $row['enterprise_name']; } $elements[] = $this->createElement('select', 'fk_id_fefpenterprise')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optEnterprises)->setLabel('Empreza'); // Combo to search institutes $intitutes = $mapperFeContract->listInstitutes(); $optInstitutes[''] = ''; foreach ($intitutes as $row) { $optInstitutes[$row['id_fefpeduinstitution']] = $row['institution']; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optInstitutes)->setLabel('Inst. Ensinu'); $dbDistrict = App_Model_DbTable_Factory::get('AddDistrict'); $districts = $dbDistrict->fetchAll(); $optCountry[''] = ''; foreach ($districts as $district) { $optCountry[$district['id_adddistrict']] = $district['District']; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->addMultiOptions($optCountry)->setLabel('Distritu'); $elements[] = $this->createElement('select', 'fk_id_addsubdistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setRegisterInArrayValidator(false)->setLabel('Sub-Distritu'); $mapperScholarityArea = new Register_Model_Mapper_ScholarityArea(); $sections = $mapperScholarityArea->fetchAll(); $optScholarityArea[''] = ''; foreach ($sections as $section) { $optScholarityArea[$section['id_scholarity_area']] = $section['scholarity_area']; } $elements[] = $this->createElement('select', 'fk_id_scholarity_area')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen focused')->setLabel('Area Kursu')->addMultiOptions($optScholarityArea); $dbOccupationTimor = App_Model_DbTable_Factory::get('PROFOcupationTimor'); $occupations = $dbOccupationTimor->fetchAll(); $optOccupations[''] = ''; foreach ($occupations as $occupation) { $optOccupations[$occupation['id_profocupationtimor']] = $occupation['acronym'] . ' ' . $occupation['ocupation_name_timor']; } $elements[] = $this->createElement('select', 'fk_id_profocupationtimor')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Okupasaun')->addMultiOptions($optOccupations); $elements[] = $this->createElement('text', 'date_start')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Inisiu'); $elements[] = $this->createElement('text', 'date_finish')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12 date-mask date')->setLabel('Loron Remata'); $this->addElements($elements); }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $mapperFeRegistration = new Fefop_Model_Mapper_FERegistration(); // Combo to search clients $clients = $mapperFeRegistration->listBeneficiaries(); $optClients[''] = ''; foreach ($clients as $row) { $optClients[$row['id_perdata']] = Client_Model_Mapper_Client::buildNumRow($row) . ' - ' . Client_Model_Mapper_Client::buildName($row); } $elements[] = $this->createElement('select', 'fk_id_perdata')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optClients)->setLabel('Benefisiariu'); // Combo to search enterprises $enterprises = $mapperFeRegistration->listEnterprises(); $optEnterprises[''] = ''; foreach ($enterprises as $row) { $optEnterprises[$row['id_fefpenterprise']] = $row['enterprise_name']; } $elements[] = $this->createElement('select', 'fk_id_fefpenterprise')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optEnterprises)->setLabel('Empreza'); // Combo to search institutes $intitutes = $mapperFeRegistration->listInstitutes(); $optInstitutes[''] = ''; foreach ($intitutes as $row) { $optInstitutes[$row['id_fefpeduinstitution']] = $row['institution']; } $elements[] = $this->createElement('select', 'fk_id_fefpeduinstitution')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optInstitutes)->setLabel('Inst. Ensinu'); $optIdentifier = array('selected' => "Formasaun iha servisu fatin ne'ebe hakarak"); $elements[] = $this->createElement('select', 'identifier')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen focused')->setLabel('Formasaun')->addMultiOptions($optIdentifier); $mapperScholarityArea = new Register_Model_Mapper_ScholarityArea(); $sections = $mapperScholarityArea->fetchAll(); $optScholarityArea[''] = ''; foreach ($sections as $section) { $optScholarityArea[$section['id_scholarity_area']] = $section['scholarity_area']; } $elements[] = $this->createElement('select', 'fk_id_scholarity_area')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen focused')->setLabel('Area Kursu')->addMultiOptions($optScholarityArea); $dbOccupationTimor = App_Model_DbTable_Factory::get('PROFOcupationTimor'); $occupations = $dbOccupationTimor->fetchAll(); $optOccupations[''] = ''; foreach ($occupations as $occupation) { $optOccupations[$occupation['id_profocupationtimor']] = $occupation['acronym'] . ' ' . $occupation['ocupation_name_timor']; } $elements[] = $this->createElement('select', 'fk_id_profocupationtimor')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Dezignasaun')->addMultiOptions($optOccupations); $dbScholarityLevel = App_Model_DbTable_Factory::get('PerLevelScholarity'); $levels = $dbScholarityLevel->fetchAll(array(), array('id_perlevelscholarity')); $optLevel[''] = ''; foreach ($levels as $level) { $optLevel[$level->id_perlevelscholarity] = $level->level_scholarity; } $elements[] = $this->createElement('select', 'fk_id_perlevelscholarity')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optLevel)->setLabel('Nivel'); $this->addElements($elements); }
public function init() { $this->setAttrib('class', 'horizontal-form')->setName('search'); $elements = array(); $dbDistrict = App_Model_DbTable_Factory::get('AddDistrict'); $districts = $dbDistrict->fetchAll(); $optCountry[''] = ''; foreach ($districts as $district) { $optCountry[$district['id_adddistrict']] = $district['District']; } $elements[] = $this->createElement('select', 'fk_id_adddistrict')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optCountry)->setLabel('Distritu'); $optModule[''] = ''; $mapperModule = new Fefop_Model_Mapper_Module(); $rows = $mapperModule->listModules(Fefop_Model_Mapper_Program::PCE); foreach ($rows as $row) { $optModule[$row['id_fefop_modules']] = $row['num_module'] . ' - ' . $row['module']; } $elements[] = $this->createElement('select', 'fk_id_fefop_modules')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->addMultiOptions($optModule)->setLabel('Modulu'); $mapperIsicDivision = new Register_Model_Mapper_IsicDivision(); $rows = $mapperIsicDivision->listAll(); $optDivisionTimor[''] = ''; foreach ($rows as $row) { $optDivisionTimor[$row->id_isicdivision] = $row->name_disivion; } $elements[] = $this->createElement('select', 'fk_id_isicdivision')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Setór atividade nian')->setAttrib('onchange', 'Fefop.PceContract.searchIsicClass(this)')->addMultiOptions($optDivisionTimor); $elements[] = $this->createElement('select', 'fk_id_isicclasstimor')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Área negósiu nian')->setRegisterInArrayValidator(false); $optPartisipants[''] = ''; $optPartisipants['S'] = 'Ema ida'; $optPartisipants['G'] = 'Grupu'; $elements[] = $this->createElement('select', 'partisipants')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Grupu')->addMultiOptions($optPartisipants); $mapperPce = new External_Model_Mapper_Pce(); $rows = $mapperPce->listBeneficiaries(); $optBeneficiaries[''] = ''; foreach ($rows as $row) { $optBeneficiaries[$row->id_perdata] = Client_Model_Mapper_Client::buildNumRow($row) . ' - ' . Client_Model_Mapper_Client::buildName($row); } $elements[] = $this->createElement('select', 'bussines_plan_developer')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel("Naran ema ne'ebé dezenvolve Planu Negósiu nian")->addMultiOptions($optBeneficiaries); $optIsSubmitted[''] = ''; $optIsSubmitted['1'] = 'Tiha ona'; $optIsSubmitted['0'] = 'Seidauk'; $elements[] = $this->createElement('select', 'submitted')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Submit')->addMultiOptions($optIsSubmitted); $optIsSubmitted[''] = ''; $optIsSubmitted['1'] = 'Tiha ona'; $optIsSubmitted['0'] = 'Seidauk'; $elements[] = $this->createElement('select', 'contract')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12')->setLabel('Iha Kontratu')->addMultiOptions($optIsSubmitted); $this->addElements($elements); }
/** * * @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 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; }
/** * */ 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; }
/** * */ public function exportAction() { $id = $this->_getParam('id'); $contract = $this->_mapper->detail($id); $data = $contract->toArray(); $data['contract'] = Fefop_Model_Mapper_Contract::buildNumById($contract->fk_id_fefop_contract); $data['date_start'] = $this->view->date($data['date_start']); $data['date_finish'] = $this->view->date($data['date_finish']); $data['date_inserted'] = $this->view->date($data['date_inserted']); $mapperInstitute = new Register_Model_Mapper_EducationInstitute(); $contacts = $mapperInstitute->listContacts($contract->fk_id_fefpeduinstitution)->toArray(); $beneficiaries = $this->_mapper->listBeneficiaries($id)->toArray(); foreach ($beneficiaries as $key => $beneficiary) { $beneficiaries[$key]['complete_nane'] = Client_Model_Mapper_Client::buildName($beneficiary); $beneficiaries[$key]['evidence'] = Client_Model_Mapper_Client::buildNumRow($beneficiary); } $excelPath = APPLICATION_PATH . '/../library/PHPExcel/'; require_once $excelPath . 'PHPExcel/IOFactory.php'; $objReader = PHPExcel_IOFactory::createReader('Excel2007'); $objPHPExcel = $objReader->load(APPLICATION_PATH . '/../public/forms/FEFOP/Contrato_FP_tet.xlsx'); $activeSheet = $objPHPExcel->getActiveSheet(); $activeSheet->setCellValue('S14', $data['contract']); $activeSheet->setCellValue('W12', $data['date_inserted']); $activeSheet->setCellValue('E17', $data['scholarity']); $activeSheet->setCellValue('O17', $data['level_scholarity']); $activeSheet->setCellValue('S17', $data['class_name']); $activeSheet->setCellValue('E20', $data['district']); $activeSheet->setCellValue('Q20', $data['date_start']); $activeSheet->setCellValue('Q21', $data['date_finish']); #$activeSheet->setCellValue( 'F10', $data['institute'] ); if (!empty($contacts)) { $activeSheet->setCellValue('G24', $contacts[0]['contact_name']); $activeSheet->setCellValue('S24', $contacts[0]['cell_fone']); $activeSheet->setCellValue('S25', $contacts[0]['email']); } $activeSheet->setCellValue('R31', $data['unit_cost']); $activeSheet->setCellValue('J29', count($beneficiaries)); $activeSheet->setCellValue('R29', $data['amount']); $startRow = 34; foreach ($beneficiaries as $beneficiary) { $activeSheet->setCellValue('F' . $startRow, $beneficiary['complete_nane']); $activeSheet->setCellValue('L' . $startRow, $beneficiary['evidence']); $activeSheet->setCellValue('N' . $startRow, $beneficiary['electoral']); $activeSheet->setCellValue('P' . $startRow, $beneficiary['gender']); $activeSheet->setCellValue('Q' . $startRow, empty($beneficiary['id_handicapped']) ? 'Lae' : 'Sin'); $activeSheet->setCellValue('R' . $startRow, $beneficiary['amount']); $startRow++; } 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; }