Example #1
1
 public function execute()
 {
     $this->form_validation->set_rules('event', 'Event', 'trim');
     $this->form_validation->set_rules('date_from', 'Date From', 'trim');
     $this->form_validation->set_rules('date_to', 'Date To', 'trim');
     if ($this->form_validation->run() === false) {
         $this->session->set_flashdata('alert', '<div class="alert alert-danger">' . validation_errors() . '</div>');
         $data['content'] = $this->load->view('export', '', true);
         $this->load->view('template', $data);
     } else {
         ini_set('memory_limit', '-1');
         require_once "../assets/phpexcel/PHPExcel.php";
         $excel = new PHPExcel();
         $excel->setActiveSheetIndex(0);
         $active_sheet = $excel->getActiveSheet();
         $active_sheet->setTitle('Candidate');
         //style
         $active_sheet->getStyle("A1:AC1")->getFont()->setBold(true);
         //header
         $active_sheet->setCellValue('A1', 'No');
         $active_sheet->setCellValue('B1', 'Event');
         $active_sheet->setCellValue('C1', 'Serial Number');
         $active_sheet->setCellValue('D1', 'Name of Contacts');
         $active_sheet->setCellValue('E1', 'Job Title');
         $active_sheet->setCellValue('F1', 'Departement');
         $active_sheet->setCellValue('G1', 'Company');
         $active_sheet->setCellValue('H1', 'Telephone');
         $active_sheet->setCellValue('I1', 'Mobile');
         $active_sheet->setCellValue('J1', 'Actcode');
         $active_sheet->setCellValue('K1', 'New Name');
         $active_sheet->setCellValue('L1', 'New Title');
         $active_sheet->setCellValue('M1', 'New Telephone');
         $active_sheet->setCellValue('N1', 'New Mobile');
         $active_sheet->setCellValue('O1', 'Email');
         $active_sheet->setCellValue('P1', 'Mobile Sms');
         $active_sheet->setCellValue('Q1', 'Distribution Date');
         $active_sheet->setCellValue('R1', 'Status');
         $active_sheet->setCellValue('S1', 'Call History');
         $event = $this->input->post('event');
         $date_from = format_ymd($this->input->post('date_from'));
         $date_to = format_ymd($this->input->post('date_to'));
         $result = $this->export_model->export($event, $date_from, $date_to)->result();
         $i = 2;
         foreach ($result as $r) {
             $active_sheet->setCellValue('A' . $i, $i - 1);
             $active_sheet->setCellValue('B' . $i, $r->event_name);
             $active_sheet->setCellValueExplicit('C' . $i, $r->sn);
             $active_sheet->setCellValue('D' . $i, $r->name);
             $active_sheet->setCellValue('E' . $i, $r->title);
             $active_sheet->setCellValue('F' . $i, $r->dept);
             $active_sheet->setCellValue('G' . $i, $r->company);
             $active_sheet->setCellValueExplicit('H' . $i, $r->tlp);
             $active_sheet->setCellValueExplicit('I' . $i, $r->mobile);
             $active_sheet->setCellValue('J' . $i, $r->actcode);
             $active_sheet->setCellValue('K' . $i, $r->name_new);
             $active_sheet->setCellValue('L' . $i, $r->title_new);
             $active_sheet->setCellValueExplicit('M' . $i, $r->tlp_new);
             $active_sheet->setCellValueExplicit('N' . $i, $r->mobile_new);
             $active_sheet->setCellValue('O' . $i, $r->email);
             $active_sheet->setCellValueExplicit('P' . $i, $r->mobile_sms);
             $active_sheet->setCellValue('Q' . $i, PHPExcel_Shared_Date::PHPToExcel(date_to_excel($r->dist_date)));
             $active_sheet->getStyle('Q' . $i)->getNumberFormat()->setFormatCode('dd/mm/yyyy');
             $active_sheet->setCellValue('R' . $i, $r->status_name);
             $active_sheet->setCellValue('S' . $i, $this->callhis_model->get_note($r->id));
             $i++;
         }
         $filename = 'Candidate_' . date('Ymd_His') . '.xlsx';
         header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
         header('Content-Disposition: attachment;filename="' . $filename . '"');
         header('Cache-Control: max-age=0');
         $objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
         $objWriter->save('php://output');
     }
 }
Example #2
0
 function export()
 {
     $order_column = $this->input->get('order_column') != '' ? $this->input->get('order_column') : 'id';
     $order_type = $this->input->get('order_type') != '' ? $this->input->get('order_type') : 'desc';
     require_once "../assets/phpexcel/PHPExcel.php";
     $excel = new PHPExcel();
     $excel->setActiveSheetIndex(0);
     $active_sheet = $excel->getActiveSheet();
     $active_sheet->setTitle('Barang Keluar List');
     //style
     $active_sheet->getStyle("A1:G1")->getFont()->setBold(true);
     //header
     $active_sheet->setCellValue('A1', 'No');
     $active_sheet->setCellValue('B1', 'Barang Name');
     $active_sheet->setCellValue('C1', 'Tanggal');
     $active_sheet->setCellValue('D1', 'Banyak');
     $active_sheet->setCellValue('E1', 'Retur');
     $active_sheet->setCellValue('F1', 'Vendor');
     $active_sheet->setCellValue('G1', 'Operator');
     $active_sheet->setCellValue('H1', 'Keterangan');
     $result = $this->mdl_barang_keluar->export($order_column, $order_type)->result();
     $i = 2;
     foreach ($result as $r) {
         $active_sheet->setCellValue('A' . $i, $i - 1);
         $active_sheet->setCellValue('B' . $i, $r->barang_name);
         $active_sheet->setCellValue('C' . $i, PHPExcel_Shared_Date::PHPToExcel(date_to_excel($r->tanggal)));
         $active_sheet->getStyle('C' . $i)->getNumberFormat()->setFormatCode('dd/mm/yyyy');
         $active_sheet->setCellValue('D' . $i, $r->banyak);
         $active_sheet->setCellValue('E' . $i, $r->retur);
         $active_sheet->setCellValue('F' . $i, $r->vendor_name);
         $active_sheet->setCellValue('G' . $i, $r->operator);
         $active_sheet->setCellValue('H' . $i, $r->keterangan);
         $i++;
     }
     $filename = 'LIST_BARANG_KELUAR_' . date('Ymd_His') . '.xlsx';
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="' . $filename . '"');
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
     $objWriter->save('php://output');
 }
Example #3
0
 function export()
 {
     ini_set('memory_limit', '-1');
     require_once "../assets/phpexcel/PHPExcel.php";
     $excel = new PHPExcel();
     $excel->setActiveSheetIndex(0);
     $active_sheet = $excel->getActiveSheet();
     $active_sheet->setTitle('Individual List');
     //style
     $active_sheet->getStyle("A1:AC1")->getFont()->setBold(true);
     //header
     $active_sheet->setCellValue('A1', 'No');
     $active_sheet->setCellValue('B1', 'Code');
     $active_sheet->setCellValue('C1', 'Campaign');
     $active_sheet->setCellValue('D1', 'MOP ID');
     $active_sheet->setCellValue('E1', 'Firstname');
     $active_sheet->setCellValue('F1', 'Lastname');
     $active_sheet->setCellValue('G1', 'Nickname');
     $active_sheet->setCellValue('H1', 'Sex');
     $active_sheet->setCellValue('I1', 'Day Of Birth');
     $active_sheet->setCellValue('J1', 'ID Type');
     $active_sheet->setCellValue('K1', 'ID Number');
     $active_sheet->setCellValue('L1', 'Telephone');
     $active_sheet->setCellValue('M1', 'Email');
     $active_sheet->setCellValue('N1', 'Fb');
     $active_sheet->setCellValue('O1', 'Tw');
     $active_sheet->setCellValue('P1', 'Address');
     $active_sheet->setCellValue('Q1', 'City');
     $active_sheet->setCellValue('R1', 'Pos Code');
     $active_sheet->setCellValue('S1', 'Curr Brand');
     $active_sheet->setCellValue('T1', 'Sec Brand');
     $active_sheet->setCellValue('U1', 'Source Type');
     $active_sheet->setCellValue('V1', 'Source User');
     $active_sheet->setCellValue('W1', 'Survey Date');
     $active_sheet->setCellValue('X1', 'Upload Date');
     $active_sheet->setCellValue('Y1', 'Entry Date');
     $active_sheet->setCellValue('Z1', 'Verification Date');
     $active_sheet->setCellValue('AA1', 'Referred by');
     $active_sheet->setCellValue('AB1', 'DRN Number');
     $active_sheet->setCellValue('AC1', 'Status Verification');
     $result = $this->mdl_individual->export()->result();
     $i = 2;
     foreach ($result as $r) {
         $active_sheet->setCellValue('A' . $i, $i - 1);
         $active_sheet->setCellValueExplicit('B' . $i, $r->id);
         $active_sheet->setCellValueExplicit('C' . $i, $r->campaign_id);
         $active_sheet->setCellValue('D' . $i, $r->mop_id);
         $active_sheet->setCellValue('E' . $i, $r->firstname);
         $active_sheet->setCellValue('F' . $i, $r->lastname);
         $active_sheet->setCellValue('G' . $i, $r->nickname);
         $active_sheet->setCellValue('H' . $i, $r->sex);
         $active_sheet->setCellValue('I' . $i, PHPExcel_Shared_Date::PHPToExcel(date_to_excel($r->dob)));
         $active_sheet->getStyle('I' . $i)->getNumberFormat()->setFormatCode('dd/mm/yyyy');
         $active_sheet->setCellValue('J' . $i, $r->id_type);
         $active_sheet->setCellValueExplicit('K' . $i, $r->id_number);
         $active_sheet->setCellValueExplicit('L' . $i, $r->tlp);
         $active_sheet->setCellValue('M' . $i, $r->email);
         $active_sheet->setCellValue('N' . $i, $r->fb);
         $active_sheet->setCellValue('O' . $i, $r->tw);
         $active_sheet->setCellValue('P' . $i, $r->address);
         $active_sheet->setCellValue('Q' . $i, $r->city);
         $active_sheet->setCellValueExplicit('R' . $i, $r->pos_code);
         $active_sheet->setCellValue('S' . $i, $r->brand);
         $active_sheet->setCellValue('T' . $i, $r->brand_);
         $active_sheet->setCellValue('U' . $i, $r->source_type);
         $active_sheet->setCellValue('V' . $i, $r->source_user);
         $active_sheet->setCellValue('W' . $i, PHPExcel_Shared_Date::PHPToExcel(date_to_excel($r->survey_date)));
         $active_sheet->getStyle('W' . $i)->getNumberFormat()->setFormatCode('dd/mm/yyyy');
         $active_sheet->setCellValue('X' . $i, PHPExcel_Shared_Date::PHPToExcel(date_to_excel($r->upload_date)));
         $active_sheet->getStyle('X' . $i)->getNumberFormat()->setFormatCode('dd/mm/yyyy');
         $active_sheet->setCellValue('Y' . $i, PHPExcel_Shared_Date::PHPToExcel(date_to_excel($r->entry_date)));
         $active_sheet->getStyle('Y' . $i)->getNumberFormat()->setFormatCode('dd/mm/yyyy');
         $active_sheet->setCellValue('Z' . $i, PHPExcel_Shared_Date::PHPToExcel(date_to_excel($r->verifikasi_date)));
         $active_sheet->getStyle('Z' . $i)->getNumberFormat()->setFormatCode('dd/mm/yyyy');
         $active_sheet->setCellValue('AA' . $i, $r->referred);
         $active_sheet->setCellValueExplicit('AB' . $i, $r->drn_number);
         $active_sheet->setCellValue('AC' . $i, $r->status_verifikasi);
         $i++;
     }
     $filename = 'LIST_INDIVIDUAL_' . date('Ymd_His') . '.xlsx';
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="' . $filename . '"');
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
     $objWriter->save('php://output');
 }
Example #4
0
 function day()
 {
     require_once "../assets/phpexcel/PHPExcel.php";
     $excel = new PHPExcel();
     $excel->setActiveSheetIndex(0);
     $active_sheet = $excel->getActiveSheet();
     $active_sheet->setTitle('Online Day Report');
     //style
     $active_sheet->getStyle("A1:I2")->getFont()->setBold(true);
     $active_sheet->mergeCells('E1:I1');
     $active_sheet->mergeCells('A1:A2');
     $active_sheet->mergeCells('B1:B2');
     $active_sheet->mergeCells('C1:C2');
     $active_sheet->mergeCells('D1:D2');
     $active_sheet->getStyle("A1:I2")->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
     $active_sheet->getStyle("A1:I2")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     //header
     $active_sheet->setCellValue('A1', 'Periode');
     $active_sheet->setCellValue('B1', 'Jumlah Data Masuk');
     $active_sheet->setCellValue('C1', 'Verified Online');
     $active_sheet->setCellValue('D1', 'Verified Webmail');
     $active_sheet->setCellValue('E1', 'Unverified');
     $active_sheet->setCellValue('E2', 'GIID copy is not legible');
     $active_sheet->setCellValue('F2', 'GIID doesn\'t match');
     $active_sheet->setCellValue('G2', 'Image is not ID');
     $active_sheet->setCellValue('H2', 'Did not attach image');
     $active_sheet->setCellValue('I2', 'Jumlah unverified');
     $result = $this->ci->mdl_report_online->day()->result();
     $i = 3;
     $total = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0);
     foreach ($result as $r) {
         $active_sheet->setCellValue('A' . $i, PHPExcel_Shared_Date::PHPToExcel(date_to_excel($r->entry_date)));
         $active_sheet->getStyle('A' . $i)->getNumberFormat()->setFormatCode('dd MMM yyyy');
         $active_sheet->setCellValue('B' . $i, $r->count);
         $active_sheet->setCellValue('C' . $i, $r->vo);
         $active_sheet->setCellValue('D' . $i, $r->vw);
         $active_sheet->setCellValue('E' . $i, $r->leg);
         $active_sheet->setCellValue('F' . $i, $r->mat);
         $active_sheet->setCellValue('G' . $i, $r->id);
         $active_sheet->setCellValue('H' . $i, $r->img);
         $active_sheet->setCellValue('I' . $i, $r->un);
         $total[1] += $r->count;
         $total[2] += $r->vo;
         $total[3] += $r->vw;
         $total[4] += $r->leg;
         $total[5] += $r->mat;
         $total[6] += $r->id;
         $total[7] += $r->img;
         $total[8] += $r->un;
         $i++;
     }
     $active_sheet->setCellValue('A' . $i, 'Total');
     $active_sheet->setCellValue('B' . $i, $total[1]);
     $active_sheet->setCellValue('C' . $i, $total[2]);
     $active_sheet->setCellValue('D' . $i, $total[3]);
     $active_sheet->setCellValue('E' . $i, $total[4]);
     $active_sheet->setCellValue('F' . $i, $total[5]);
     $active_sheet->setCellValue('G' . $i, $total[6]);
     $active_sheet->setCellValue('H' . $i, $total[7]);
     $active_sheet->setCellValue('I' . $i, $total[8]);
     $active_sheet->getStyle("A" . $i . ":" . "I" . $i)->getFont()->setBold(true);
     $filename = 'Online Day Report ' . date('Ymd_His') . '.xlsx';
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="' . $filename . '"');
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
     $objWriter->save('php://output');
 }