Ejemplo n.º 1
0
 protected function footer($objPHPExcel, $start, $file_name, $format, $html_title)
 {
     $start++;
     $jemaat = get_jemaat_from_user_id(Yii::app()->user->getId());
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Dicetak oleh: " . $jemaat->real_name);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Pada tanggal " . get_date_today('dd/MM/yyyy') . " jam " . get_time_now());
     ob_end_clean();
     ob_start();
     if ($format == 'excel') {
         header('Content-Type: application/vnd.ms-excel');
         header("Content-Disposition: attachment;filename={$file_name}.xls");
         header('Cache-Control: max-age=0');
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
         $objWriter->save('php://output');
     } else {
         $objPHPExcel->getActiveSheet()->setShowGridlines(false);
         $mPDF1 = Yii::app()->ePdf->mpdf();
         $mPDF1 = Yii::app()->ePdf->mpdf('', 'A4');
         $objWriter = new PHPExcel_Writer_HTML($objPHPExcel);
         $header = $objWriter->generateHTMLHeader(true);
         $header = str_replace("<body>", "<body onload='window.print();'>", $header);
         $header = str_replace("Untitled Spreadsheet", $html_title, $header);
         $html = $header . $objWriter->generateStyles(true) . $objWriter->generateSheetData() . $objWriter->generateHTMLFooter();
         if ($format == 'pdf') {
             $mPDF1->WriteHTML($html);
             $mPDF1->Output('MutasiKasDitangan.pdf', 'D');
         } else {
             echo $html;
         }
     }
 }
 public function view()
 {
     $objWriter = new PHPExcel_Writer_HTML($this->getPHPExcelObj());
     $html['header'] = $objWriter->generateHTMLHeader();
     $html['style'] = $objWriter->generateStyles(true);
     // do not write <style> and </style>
     $html['body'] = $objWriter->generateSheetData();
     $html['footer'] = $objWriter->generateHTMLFooter();
     return $html;
 }
Ejemplo n.º 3
0
 public function generate($format = "Excel5", $docName = "Tabelle")
 {
     switch ($format) {
         case 'Excel2007':
             include dirname(__FILE__) . '/../3rdParty/Classes/PHPExcel/Writer/Excel2007.php';
             $writer = new PHPExcel_Writer_Excel2007($this);
             $ext = 'xlsx';
             $header = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
             //supprime le pre-calcul
             $writer->setPreCalculateFormulas(false);
             break;
         case 'Excel2003':
             include dirname(__FILE__) . '/../3rdParty/Classes/PHPExcel/Writer/Excel2007.php';
             $writer = new PHPExcel_Writer_Excel2007($this);
             $writer->setOffice2003Compatibility(true);
             $ext = 'xlsx';
             //supprime le pre-calcul
             $writer->setPreCalculateFormulas(false);
             break;
         case 'Excel5':
             include dirname(__FILE__) . '/../3rdParty/Classes/PHPExcel/Writer/Excel5.php';
             $writer = new PHPExcel_Writer_Excel5($this);
             $ext = 'xls';
             break;
         case 'CSV':
             include dirname(__FILE__) . '/../3rdParty/Classes/PHPExcel/Writer/CSV.php';
             $writer = new PHPExcel_Writer_CSV($this);
             $writer->setDelimiter(",");
             //l'op�rateur de s�paration est la virgule
             $writer->setSheetIndex(0);
             //Une seule feuille possible
             $ext = 'csv';
             break;
         case 'PDF':
             include dirname(__FILE__) . '/../3rdParty/Classes/PHPExcel/Writer/PDF.php';
             $writer = new PHPExcel_Writer_PDF($this);
             $writer->setSheetIndex(0);
             //Une seule feuille possible
             $ext = 'pdf';
             break;
         case 'HTML':
             include dirname(__FILE__) . '/../3rdParty/Classes/PHPExcel/Writer/HTML.php';
             $writer = new PHPExcel_Writer_HTML($this);
             $writer->setSheetIndex(0);
             //Une seule feuille possible
             $ext = 'html';
             break;
     }
     header('Content-type:' . $header);
     header('Content-Disposition:inline;filename=' . $docName . '.' . $ext);
     $writer->save('php://output');
 }
Ejemplo n.º 4
0
 /**
  *  Create a new PHPExcel_Writer_PDF
  *
  *  @param     PHPExcel    $phpExcel    PHPExcel object
  */
 public function __construct(PHPExcel $phpExcel)
 {
     parent::__construct($phpExcel);
     $this->setUseInlineCss(TRUE);
     $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
 }
 protected function getWriter()
 {
     $writer = new \PHPExcel_Writer_HTML($this->objPHPExcel);
     $writer->setPreCalculateFormulas(false);
     return $writer;
 }
Ejemplo n.º 6
0
 /**
  * Create a new PHPExcel_Writer_PDF
  *
  * @param 	PHPExcel	$phpExcel	PHPExcel object
  */
 public function __construct(PHPExcel $phpExcel)
 {
     parent::__construct($phpExcel);
     $this->setUseInlineCss(true);
     $this->_tempDir = sys_get_temp_dir();
 }
 public function actionPrint($id)
 {
     if (Yii::app()->request->isAjaxRequest) {
         return;
     }
     //        if (isset($_POST) && !empty($_POST)) {
     $pinjam = $this->loadModel($id, 'MtKembaliKendaraan');
     //        $pinjam = new MtKembaliKendaraan;
     $image = dirname(Yii::app()->getBasePath()) . '/images/mahkotrans.png';
     $start = 1;
     $file_name = 'KembaliKendaraan' . $pinjam->doc_ref_kembali;
     $worksheet_name = 'Kembali Kendaraan ' . $pinjam->doc_ref_kembali;
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getDefaultStyle()->getFont()->setSize(9);
     $objPHPExcel->setActiveSheetIndex(0)->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setName('Logo');
     $objDrawing->setDescription('Logo');
     $objDrawing->setPath($image);
     $objDrawing->setHeight(30);
     $objDrawing1 = clone $objDrawing;
     $start_body = $start;
     $objPHPExcel->setActiveSheetIndex(0);
     $objDrawing1->setWorksheet($objPHPExcel->getActiveSheet());
     $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
     $objDrawing1->setCoordinates("A{$start}");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "MAHKOTRANS")->getStyle("A{$start}")->getFont()->setSize(14);
     $start++;
     $objPHPExcel->getActiveSheet()->setTitle($worksheet_name);
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Villa Seturan Indah Blok D-10 Depok Sleman Yogyakarta 55281")->getStyle("A{$start}")->getFont()->setSize(6);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Telp. (0274) 7439982, 085292750055, 087838488822")->getStyle("A{$start}")->getFont()->setSize(6);
     $styleArray = array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start_body}:G{$start}")->applyFromArray($styleArray);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "PENGEMBALIAN KENDARAAN")->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}")->getFont()->setSize(12);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Nomor Sewa / Kembali")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->doc_ref . " / " . $pinjam->doc_ref_kembali)->setCellValue("D{$start}", "Tanggal")->setCellValue("E{$start}", ": " . $pinjam->trans_date);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Nama Konsumen")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->idPelanggan->nama)->setCellValue("D{$start}", "Kelompok Konsumen")->setCellValue("E{$start}", ": " . $pinjam->idPinjam->idKelompok->nama);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Tanda Pengenal")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->tanda_pengenal)->setCellValue("D{$start}", "No. Identitas")->setCellValue("E{$start}", ": " . $pinjam->idPinjam->no_identitas);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Jaminan")->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->jaminan . ", " . $pinjam->idPinjam->jaminan_desc);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Rencana Kembali")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->tgl_rencana_kembali)->setCellValue("D{$start}", "Kembali")->setCellValue("E{$start}", ": " . $pinjam->tgl_kembali);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Nopol / Jenis Mobil")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->idMobil->nopol . " / " . $pinjam->idPinjam->idMobil->jenis)->setCellValue("D{$start}", "Season")->setCellValue("E{$start}", $pinjam->idPinjam->season == 0 ? ": Low" : ": High");
     $start++;
     $styleArray = array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_DASHED)));
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "PERHITUNGAN ONGKOS SEWA")->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}")->getFont()->setSize(12);
     $start++;
     $start_body = $start;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Nama Item")->setCellValue("C{$start}", "Jumlah")->setCellValue("D{$start}", "Tarif")->setCellValue("G{$start}", "Total")->getStyle("B{$start}:G{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}:G{$start}")->applyFromArray($styleArray);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Mobil")->setCellValue("B{$start}", "Extend Per Bulan")->setCellValue("C{$start}", $pinjam->extend_bln)->setCellValue("D{$start}", $pinjam->idPinjam->trf_bulan)->setCellValue("G{$start}", $pinjam->extend_bln * $pinjam->idPinjam->trf_bulan);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", $pinjam->extend_hari)->setCellValue("B{$start}", "Extend Per Hari")->setCellValue("D{$start}", $pinjam->idPinjam->trf_hari)->setCellValue("G{$start}", $pinjam->extend_hari * $pinjam->idPinjam->trf_hari);
     $start++;
     $extend_jam = $pinjam->extend_jam > 0 ? 1 : 0;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", $extend_jam)->setCellValue("B{$start}", "Extend Per 12 Jam")->setCellValue("D{$start}", $pinjam->idPinjam->trf_jam)->setCellValue("G{$start}", $extend_jam * $pinjam->idPinjam->trf_jam);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", $pinjam->overtime_jam)->setCellValue("B{$start}", "Overtime Per Jam")->setCellValue("D{$start}", $pinjam->idPinjam->trf_over_persen)->setCellValue("G{$start}", $pinjam->overtime_jam * $pinjam->idPinjam->trf_over_persen);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}:G{$start}")->applyFromArray($styleArray);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:B{$start}")->setCellValue("A{$start}", "Lembar 1 : Untuk Konsumen")->setCellValue("C{$start}", "Total Extend")->setCellValue("G{$start}", $pinjam->ongkos_extend);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Total Sewa")->setCellValue("G{$start}", $pinjam->ongkos_sewa);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Driver")->setCellValue("G{$start}", $pinjam->ongkos_driver);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Bensin")->setCellValue("G{$start}", $pinjam->ongkos_bbm);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Total")->setCellValue("G{$start}", $pinjam->total_ongkos);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Diskon")->setCellValue("G{$start}", $pinjam->disc);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("C{$start}:F{$start}")->setCellValue("C{$start}", "DP " . $pinjam->trans_via . " / No. Bukti : " . $pinjam->no_bukti_bayar)->setCellValue("G{$start}", $pinjam->idPinjam->dp);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Pelunasan")->setCellValue("G{$start}", $pinjam->pelunasan);
     //        $start++;
     //        $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A$start:G$start")->
     //                setCellValue("A$start", "  ");
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:B{$start}")->setCellValue("A{$start}", "Penyewa,")->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("D{$start}:G{$start}")->setCellValue("D{$start}", "Managemen Mahkotrans,")->getStyle("D{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:B{$start}")->getStyle("A{$start}")->applyFromArray($styleArray);
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("D{$start}:G{$start}")->getStyle("D{$start}")->applyFromArray($styleArray);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("C{$start_body}:G{$start}")->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_ACCOUNTING);
     //=================================================================================================================
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objDrawing->setCoordinates("A{$start}");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "MAHKOTRANS")->getStyle("A{$start}")->getFont()->setSize(14);
     $start++;
     $objPHPExcel->getActiveSheet()->setTitle($worksheet_name);
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Villa Seturan Indah Blok D-10 Depok Sleman Yogyakarta 55281")->getStyle("A{$start}")->getFont()->setSize(6);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Telp. (0274) 7439982, 085292750055, 087838488822")->getStyle("A{$start}")->getFont()->setSize(6);
     $styleArray = array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start_body}:G{$start}")->applyFromArray($styleArray);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "PENGEMBALIAN KENDARAAN")->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}")->getFont()->setSize(12);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Nomor Sewa / Kembali")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->doc_ref . " / " . $pinjam->doc_ref_kembali)->setCellValue("D{$start}", "Tanggal")->setCellValue("E{$start}", ": " . $pinjam->trans_date);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Nama Konsumen")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->idPelanggan->nama)->setCellValue("D{$start}", "Kelompok Konsumen")->setCellValue("E{$start}", ": " . $pinjam->idPinjam->idKelompok->nama);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Tanda Pengenal")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->tanda_pengenal)->setCellValue("D{$start}", "No. Identitas")->setCellValue("E{$start}", ": " . $pinjam->idPinjam->no_identitas);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Jaminan")->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->jaminan . ", " . $pinjam->idPinjam->jaminan_desc);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Rencana Kembali")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->tgl_rencana_kembali)->setCellValue("D{$start}", "Kembali")->setCellValue("E{$start}", ": " . $pinjam->tgl_kembali);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Nopol / Jenis Mobil")->setCellValue("B{$start}", ": " . $pinjam->idPinjam->idMobil->nopol . " / " . $pinjam->idPinjam->idMobil->jenis)->setCellValue("D{$start}", "Season")->setCellValue("E{$start}", $pinjam->idPinjam->season == 0 ? ": Low" : ": High");
     $start++;
     $styleArray = array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_DASHED)));
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "PERHITUNGAN ONGKOS SEWA")->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}")->getFont()->setSize(12);
     $start++;
     $start_body = $start;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Nama Item")->setCellValue("C{$start}", "Jumlah")->setCellValue("D{$start}", "Tarif")->setCellValue("G{$start}", "Total")->getStyle("B{$start}:G{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}:G{$start}")->applyFromArray($styleArray);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Mobil")->setCellValue("B{$start}", "Extend Per Bulan")->setCellValue("C{$start}", $pinjam->extend_bln)->setCellValue("D{$start}", $pinjam->idPinjam->trf_bulan)->setCellValue("G{$start}", $pinjam->extend_bln * $pinjam->idPinjam->trf_bulan);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", $pinjam->extend_hari)->setCellValue("B{$start}", "Extend Per Hari")->setCellValue("D{$start}", $pinjam->idPinjam->trf_hari)->setCellValue("G{$start}", $pinjam->extend_hari * $pinjam->idPinjam->trf_hari);
     $start++;
     $extend_jam = $pinjam->extend_jam > 0 ? 1 : 0;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", $extend_jam)->setCellValue("B{$start}", "Extend Per 12 Jam")->setCellValue("D{$start}", $pinjam->idPinjam->trf_jam)->setCellValue("G{$start}", $extend_jam * $pinjam->idPinjam->trf_jam);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", $pinjam->overtime_jam)->setCellValue("B{$start}", "Overtime Per Jam")->setCellValue("D{$start}", $pinjam->idPinjam->trf_over_persen)->setCellValue("G{$start}", $pinjam->overtime_jam * $pinjam->idPinjam->trf_over_persen);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}:G{$start}")->applyFromArray($styleArray);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:B{$start}")->setCellValue("A{$start}", "Lembar 2 : Untuk Arsip")->setCellValue("C{$start}", "Total Extend")->setCellValue("G{$start}", $pinjam->ongkos_extend);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Total Sewa")->setCellValue("G{$start}", $pinjam->ongkos_sewa);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Driver")->setCellValue("G{$start}", $pinjam->ongkos_driver);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Bensin")->setCellValue("G{$start}", $pinjam->ongkos_bbm);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Total")->setCellValue("G{$start}", $pinjam->total_ongkos);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Diskon")->setCellValue("G{$start}", $pinjam->disc);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("C{$start}:F{$start}")->setCellValue("C{$start}", "DP " . $pinjam->trans_via . " / No. Bukti : " . $pinjam->no_bukti_bayar)->setCellValue("G{$start}", $pinjam->idPinjam->dp);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("C{$start}", "Pelunasan")->setCellValue("G{$start}", $pinjam->pelunasan);
     //        $start++;
     //        $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A$start:G$start")->
     //                setCellValue("A$start", "  ");
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:B{$start}")->setCellValue("A{$start}", "Penyewa,")->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("D{$start}:G{$start}")->setCellValue("D{$start}", "Managemen Mahkotrans,")->getStyle("D{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:B{$start}")->getStyle("A{$start}")->applyFromArray($styleArray);
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("D{$start}:G{$start}")->getStyle("D{$start}")->applyFromArray($styleArray);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("C{$start_body}:G{$start}")->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_ACCOUNTING);
     ob_end_clean();
     ob_start();
     $objPHPExcel->getActiveSheet()->setShowGridlines(false);
     $mPDF1 = Yii::app()->ePdf->mpdf('', 'A4', 0, '', 5, 5, 6, 0, 0, 0, 'P');
     $objWriter = new PHPExcel_Writer_HTML($objPHPExcel);
     $html = $objWriter->generateStyles(true) . $objWriter->generateSheetData();
     $html = str_replace('.' . $image, app()->getBaseUrl(true) . '/images/mahkotrans.png', $html);
     $mPDF1->WriteHTML($html);
     $mPDF1->Output($file_name, 'D');
     Yii::app()->end();
 }
Ejemplo n.º 8
0
 /**
  * @Title: exports_exc
  * @Description: todo(导出execl或者PDF或者直接打印)
  * @param 导出的数据 $date
  * @param 导出文件模板路径 $filePath
  * @param 状态值 $step	1:表示答应或者导出execl 其他代表导出PDF
  * @param 其他指定坐标信息 $tsdate		$tsdate=array('A1'=>$_POST['projectname'].$proname);
  * @param 打印标记 $isprint	1表示打印
  * @param 审核信息数组 $auditdate
  * @author liminggang
  * @date 2014-5-5 下午5:47:53
  * @throws
  */
 public function exports_exc($date, $filePath, $step = 1, $tsdate = array(), $isprint, $auditdate = array())
 {
     import('@.ORG.PHPExcel', '', $ext = '.php');
     //创建一个PHPExcel对象
     $objReader = PHPExcel_IOFactory::createReader('Excel5');
     $objPHPExcel = $objReader->load($filePath);
     /**读取excel文件中的第一个工作表*/
     $currentSheet = $objPHPExcel->getSheet(0);
     /**取得最大的列号*/
     $allColumn = $currentSheet->getHighestColumn();
     /**取得一共有多少行*/
     $allRow = $currentSheet->getHighestRow();
     for ($currentRow = 2; $currentRow <= $allRow; $currentRow++) {
         /**从第A列开始输出*/
         for ($currentColumn = 'A'; $currentColumn <= $allColumn; $currentColumn++) {
             $val = $currentSheet->getCellByColumnAndRow(ord($currentColumn) - 65, $currentRow)->getValue();
             /**ord()将字符转为十进制数*/
             /**如果输出汉字有乱码,则需将输出内容用iconv函数进行编码转换,如下将gb2312编码转为utf-8编码输出
              * 如果存在ereg判断汉字问题。则必须用utf-8,不然不识别汉字
              * */
             $val = iconv('utf-8', 'utf-8', $val) . "\t";
             $val = trim($val);
             if (isset($date[$val])) {
                 $objPHPExcel->getActiveSheet()->setCellValue($currentColumn . $currentRow, $date[$val], '');
             }
         }
     }
     if ($auditdate) {
         $coutnrow = $allRow + 1;
         $style = array('font' => array('name' => '黑体', 'bold' => true, 'italic' => false), 'borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM), 'top' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM), 'left' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM), 'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER));
         foreach ($auditdate as $k => $v) {
             for ($currentColumn = 'A'; $currentColumn <= $allColumn; $currentColumn++) {
                 $objPHPExcel->getActiveSheet()->getStyle($currentColumn . $coutnrow)->applyFromArray($style);
             }
             $objPHPExcel->getActiveSheet()->setCellValue("A" . $coutnrow, $v['name']);
             $objPHPExcel->getActiveSheet()->mergeCells("B" . $coutnrow . ":" . $allColumn . $coutnrow)->setCellValue("B" . $coutnrow, $v['doinfo']);
             $objPHPExcel->getActiveSheet()->getDefaultRowDimension()->setRowHeight(40);
             $coutnrow++;
         }
     }
     foreach ($tsdate as $row => $d) {
         $objPHPExcel->getActiveSheet()->setCellValue($row, $d);
     }
     if ($step == 1) {
         if ($isprint == 1) {
             //打印
             $objExcel = new PHPExcel();
             $objWriteHTML = new PHPExcel_Writer_HTML($objPHPExcel);
             //输出网页格式的对象
             $objWriteHTML->save(UPLOAD_Sample . "tbprint.html");
             echo json_encode(UPLOAD_Sample . "tbprint.html");
         } else {
             //转execl
             $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
             ob_end_clean();
             //清除缓冲区,避免乱码
             header('Content-Type: application/vnd.ms-excel');
             header('Content-Disposition: attachment;filename="' . time() . '.xls"');
             header('Cache-Control: max-age=0');
             $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
             $objWriter->save('php://output');
         }
     } else {
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'pdf');
         //设置文件头信息
         header('Content-Type: application/pdf');
         header('Content-Disposition: attachment;filename="' . time() . '.pdf"');
         header('Cache-Control: max-age=0');
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'pdf');
         //设置字体
         $objWriter->SetFont('arialunicid0-chinese-simplified');
         $objWriter->save('php://output');
     }
     exit;
 }
Ejemplo n.º 9
0
 public function actionMutasiKasDiTangan()
 {
     if (Yii::app()->request->isAjaxRequest) {
         return;
     }
     if (isset($_POST) && !empty($_POST)) {
         $format = $_POST['format'];
         $start_date = $_POST['trans_date_mulai'];
         $end_date = $_POST['trans_date_sampai'];
         $start = 1;
         $file_name = 'MutasiKas';
         $worksheet_name = 'Mutasi Kas';
         $objPHPExcel = new PHPExcel();
         $objPHPExcel->getDefaultStyle()->getFont()->setSize(10);
         $objPHPExcel->setActiveSheetIndex(0)->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
         $objPHPExcel->setActiveSheetIndex(0)->getPageMargins()->setLeft(0.1 / 2.54);
         $objPHPExcel->setActiveSheetIndex(0)->getPageMargins()->setRight(0.1 / 2.54);
         $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "MUTASI KAS DI TANGAN")->getStyle("A{$start}")->getFont()->setSize(18)->setBold(true);
         $start++;
         $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "PONDOK ASUH HARAPAN")->getStyle("A{$start}")->getFont()->setSize(14)->setBold(true);
         $start++;
         $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "PERIODE: " . sql2long_date($start_date) . " - " . sql2long_date($end_date))->getStyle("A{$start}")->getFont()->setSize(12)->setBold(true);
         $objPHPExcel->getActiveSheet()->setTitle($worksheet_name);
         $start++;
         $start++;
         $start_body = $start;
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Doc. Ref")->setCellValue("B{$start}", "Tanggal")->setCellValue("C{$start}", "Payee/Payor")->setCellValue("D{$start}", "Nama Rekening")->setCellValue("E{$start}", "Kas Masuk")->setCellValue("F{$start}", "Kas Keluar")->setCellValue("G{$start}", "Saldo Kas")->getStyle("A{$start}:G{$start}")->getFont()->setBold(true);
         $start++;
         $rows = Pah::get_mutasi_kas_ditangan($start_date, $end_date);
         $nomer = 1;
         $saldo = 0;
         foreach ($rows as $row) {
             $saldo += $row['saldo'];
             //                $kas_masuk = $row['kas_masuk'] == 0 ? '' : ($format == 'excel' ? $row['kas_masuk'] : number_format($row['kas_masuk']));
             //                $kas_keluar = $row['kas_keluar'] == 0 ? '' : ($format == 'excel' ? -$row['kas_keluar'] : number_format(-$row['kas_keluar']));
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", $nomer)->setCellValue("B{$start}", sql2date($row['trans_date']))->setCellValue("C{$start}", Pah::get_payee_payoor($row['type'], $row['trans_no']))->setCellValue("D{$start}", $row['nama_rekening'])->setCellValue("E{$start}", $kas_masuk)->setCellValue("F{$start}", $kas_keluar)->setCellValue("G{$start}", $format == 'excel' ? $saldo : number_format($saldo));
             $nomer++;
             $start++;
         }
         $end_body = $start - 1;
         $styleArray = array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
         $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start_body}:G{$end_body}")->applyFromArray($styleArray);
         $start_row = $start_body + 1;
         if ($format == 'excel') {
             $objPHPExcel->setActiveSheetIndex(0)->getStyle("E{$start_row}:G{$end_body}")->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_ACCOUNTING);
         } else {
             $objPHPExcel->setActiveSheetIndex(0)->getStyle("E{$start_body}:G{$end_body}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
         }
         $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension("A")->setAutoSize(true);
         $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension("B")->setAutoSize(true);
         $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension("C")->setAutoSize(true);
         $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension("D")->setAutoSize(true);
         $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension("E")->setAutoSize(true);
         $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension("F")->setAutoSize(true);
         $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension("G")->setAutoSize(true);
         $start++;
         $jemaat = get_jemaat_from_user_id(Yii::app()->user->getId());
         $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Dicetak oleh: " . $jemaat->real_name);
         $start++;
         $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Pada tanggal " . get_date_today('dd/MM/yyyy') . " jam " . get_time_now());
         ob_end_clean();
         ob_start();
         if ($format == 'excel') {
             header('Content-Type: application/vnd.ms-excel');
             header("Content-Disposition: attachment;filename={$file_name}.xls");
             header('Cache-Control: max-age=0');
             $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
             $objWriter->save('php://output');
         } else {
             $objPHPExcel->getActiveSheet()->setShowGridlines(false);
             $mPDF1 = Yii::app()->ePdf->mpdf();
             $mPDF1 = Yii::app()->ePdf->mpdf('', 'A4');
             $objWriter = new PHPExcel_Writer_HTML($objPHPExcel);
             $header = $objWriter->generateHTMLHeader(true);
             $header = str_replace("<body>", "<body onload='window.print();'>", $header);
             $header = str_replace("Untitled Spreadsheet", "Mutasi Kas di Tangan", $header);
             $html = $header . $objWriter->generateStyles(true) . $objWriter->generateSheetData() . $objWriter->generateHTMLFooter();
             if ($format == 'pdf') {
                 $mPDF1->WriteHTML($html);
                 $mPDF1->Output('MutasiKasDitangan.pdf', 'D');
             } else {
                 echo $html;
             }
             //                header('Content-Type: application/pdf');
             //                header("Content-Disposition: attachment;filename='$file_name.pdf'");
             //                header('Cache-Control: max-age=0');
             //                $objPHPExcel->getActiveSheet()->setShowGridlines(false);
             //                $rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
             //                $rendererLibraryPath = Yii::app()->basePath . '/vendors/mpdf';
             //                if (!PHPExcel_Settings::setPdfRenderer($rendererName,$rendererLibraryPath)) {
             //                    die(
             //                        'Please set the $rendererName and $rendererLibraryPath values' .
             //                            PHP_EOL .
             //                            ' as appropriate for your directory structure'
             //                    );
             //                }
             //
             //                $objWriter = new PHPExcel_Writer_PDF($objPHPExcel);
             //                $objWriter->save('php://output');
         }
         Yii::app()->end();
     }
 }
Ejemplo n.º 10
0
		function generateBook($book, $format) {

			$this->book= $book;			
			
			if (!$book->bookId)
				$bookName= "spreadsheet-1";	
			else	
				$bookName= "spreadsheet-$book->bookId";
							
			$filename= "default-".rand(1,9999);
			

			/*SET SPREADSHEET PROPERTIES*/
			if ($format!= "ods"){

				$this->objPHPExcel = new PHPExcel();
				$this->objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
				$this->objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
				$this->objPHPExcel->getProperties()->setTitle("Test Document");
				$this->objPHPExcel->getProperties()->setSubject("Test Document");
				$this->objPHPExcel->getProperties()->setDescription("Test document generated using PHP classes.");
				$this->objPHPExcel->getProperties()->setKeywords("office php");
				$this->objPHPExcel->getProperties()->setCategory("Test result file");

			}
			else{
				$this->objPHPOds= new PHPOds(); //create a new ods file
			}

			/*GENERATE THE SHEETS*/
			$this->_generateSheets($format);


			global $cnf;
			$currentDir= $cnf['path']['Temp']."/";  // Get the Storage Folder


			switch($format){

				case "ods":
							saveOds($this->objPHPOds,"$filename.$format"); //save the object to a ods file
							break;

				case "pdf":
							$objWriter1 = new PHPExcel_Writer_PDF($this->objPHPExcel);
							$objWriter1->writeAllSheets();
							$objWriter1->setTempDir($currentDir);
							$objWriter1->save("$filename.$format");	//save the object to a pdf file
							break;

				case "xls":
							$objWriter2 = new PHPExcel_Writer_Excel5($this->objPHPExcel);
							$objWriter2->setTempDir($currentDir);
							$objWriter2->save("$filename.$format");	//save the object to a xls file
							break;

				case "xlsx":
							$objWriter3 = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel2007');
							$objWriter3->save($currentDir."$filename.$format"); //save the object to a xlsx file
							break;

				case "csv":
							$objWriter4 = new PHPExcel_Writer_CSV($this->objPHPExcel);
							//$objWriter4->setTempDir($currentDir);
							$objWriter4->setDelimiter(';');
							$objWriter4->setEnclosure('');
							$objWriter4->setLineEnding("\r\n");
							$objWriter4->save("$filename.$format");	//save the object to a CSV file
							break;
							
				case "html":
							$objWriter5 = new PHPExcel_Writer_HTML($this->objPHPExcel);
							$objWriter5->writeAllSheets();
							//$objWriter5->setTempDir($currentDir);
							$objWriter5->save("$filename.$format");	//save the object to a HTML file
							break;
							

			}

			if ($format != "ods")
				$this->_send("$filename.$format", $format, $bookName);

		}
Ejemplo n.º 11
0
 public function actionPrint($id)
 {
     if (Yii::app()->request->isAjaxRequest) {
         return;
     }
     //        if (isset($_POST) && !empty($_POST)) {
     $kas_masuk = $this->loadModel($id, 'MtKasMasuk');
     //        $pinjam = new MtPinjamKendaraan;
     $image = dirname(Yii::app()->getBasePath()) . '/images/mahkotrans.png';
     $start = 1;
     $file_name = 'KasMasuk' . $kas_masuk->doc_ref;
     $worksheet_name = 'Kas Masuk ' . $kas_masuk->doc_ref;
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getDefaultStyle()->getFont()->setSize(9);
     $objPHPExcel->setActiveSheetIndex(0)->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setName('Logo');
     $objDrawing->setDescription('Logo');
     $objDrawing->setPath($image);
     $objDrawing->setHeight(30);
     $objDrawing1 = clone $objDrawing;
     $start_body = $start;
     $objPHPExcel->setActiveSheetIndex(0);
     $objDrawing1->setWorksheet($objPHPExcel->getActiveSheet());
     $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
     $objDrawing1->setCoordinates("A{$start}");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "MAHKOTRANS")->getStyle("A{$start}")->getFont()->setSize(14);
     $start++;
     $objPHPExcel->getActiveSheet()->setTitle($worksheet_name);
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Villa Seturan Indah Blok D-10 Depok Sleman Yogyakarta 55281")->getStyle("A{$start}")->getFont()->setSize(6);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Telp. (0274) 7439982, 085292750055, 087838488822")->getStyle("A{$start}")->getFont()->setSize(6);
     $styleArray = array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start_body}:G{$start}")->applyFromArray($styleArray);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "KUITANSI")->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}")->getFont()->setSize(12);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "No : " . $kas_masuk->doc_ref)->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", "                                                                                          ")->getStyle("B{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Telah terima dari");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", ': ' . $kas_masuk->dari);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Sebagai pembayaran");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", ': ' . $kas_masuk->note);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Uang sejumlah");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", ': Rp ' . number_format($kas_masuk->amount, 2));
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("D{$start}:G{$start}")->setCellValue("D{$start}", "Yogyakarta, " . get_date_today('dd MMMM yyyy'))->getStyle("D{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("D{$start}:G{$start}")->setCellValue("D{$start}", "Staf Mahkotrans")->getStyle("D{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     //=================================================================================================================
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objDrawing->setCoordinates("A{$start}");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "MAHKOTRANS")->getStyle("A{$start}")->getFont()->setSize(14);
     $start++;
     $objPHPExcel->getActiveSheet()->setTitle($worksheet_name);
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Villa Seturan Indah Blok D-10 Depok Sleman Yogyakarta 55281")->getStyle("A{$start}")->getFont()->setSize(6);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "Telp. (0274) 7439982, 085292750055, 087838488822")->getStyle("A{$start}")->getFont()->setSize(6);
     $styleArray = array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start_body}:G{$start}")->applyFromArray($styleArray);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "KUITANSI")->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getStyle("A{$start}")->getFont()->setSize(12);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "No : " . $kas_masuk->doc_ref)->getStyle("A{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", "                                                                                          ")->getStyle("B{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Telah terima dari");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", ': ' . $kas_masuk->dari);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Sebagai pembayaran");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", ': ' . $kas_masuk->note);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$start}", "Uang sejumlah");
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("B{$start}:G{$start}")->setCellValue("B{$start}", ': Rp ' . number_format($kas_masuk->amount, 2));
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("D{$start}:G{$start}")->setCellValue("D{$start}", "Yogyakarta, " . get_date_today('dd MMMM yyyy'))->getStyle("D{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A{$start}:G{$start}")->setCellValue("A{$start}", "  ")->getStyle("A{$start}")->getFont()->setSize(16)->setBold(true);
     $start++;
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells("D{$start}:G{$start}")->setCellValue("D{$start}", "Staf Mahkotrans")->getStyle("D{$start}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     ob_end_clean();
     ob_start();
     $objPHPExcel->getActiveSheet()->setShowGridlines(false);
     $mPDF1 = Yii::app()->ePdf->mpdf('', 'A4', 0, '', 10, 10, 5, 0, 0, 0, 'P');
     $objWriter = new PHPExcel_Writer_HTML($objPHPExcel);
     $html = $objWriter->generateStyles(true) . $objWriter->generateSheetData();
     $html = str_replace('.' . $image, app()->getBaseUrl(true) . '/images/mahkotrans.png', $html);
     $mPDF1->WriteHTML($html);
     $mPDF1->Output($file_name, 'D');
     Yii::app()->end();
 }