78 lines
2.3 KiB
PHP
78 lines
2.3 KiB
PHP
<?php
|
|
|
|
require_once '../../assets/excel/PHPExcel.php';
|
|
|
|
// koneksi ke database
|
|
include('../koneksi.php');
|
|
|
|
|
|
$a=$_GET['a'];
|
|
$tm1=$_GET['tm1'];
|
|
$tm1=str_replace('/','-',$tm1);
|
|
$tt1=date('Y',strtotime($tm1));
|
|
$bb1=date('m',strtotime($tm1));
|
|
$hh1=date('d',strtotime($tm1));
|
|
|
|
$ts1=$_GET['ts1'];
|
|
$ts1=str_replace('/','-',$ts1);
|
|
$tt2=date('Y',strtotime($ts1));
|
|
$bb2=date('m',strtotime($ts1));
|
|
$hh2=date('d',strtotime($ts1));
|
|
|
|
|
|
|
|
$objPHPExcel = new PHPExcel();
|
|
|
|
|
|
|
|
$objPHPExcel->getSheet(0)->setTitle('INFO RAPAT');
|
|
$objPHPExcel->getSheet(0)
|
|
->setCellValue('A1', 'No')
|
|
->setCellValue('B1', 'Tanggal')
|
|
->setCellValue('C1', 'Jam')
|
|
->setCellValue('D1', 'Acara')
|
|
->setCellValue('E1', 'Ruangan');
|
|
|
|
$query = "SELECT waktu_mulai,
|
|
waktu_selesai,
|
|
tujuan,
|
|
(SELECT nama FROM data_ruangan WHERE id=tempat),
|
|
(SELECT nama FROM data_pegawai WHERE id=notulis),
|
|
(SELECT nama FROM satuan_kerja WHERE id=perencana_rapat),
|
|
st_batal,id,tgl_acara,row_number() OVER (ORDER BY tgl_acara, waktu_mulai)
|
|
FROM riwayat_kegiatan
|
|
WHERE tgl_acara::DATE BETWEEN '$tt1-$bb1-$hh1' AND '$tt2-$bb2-$hh2' AND st_pesan='PJ'
|
|
ORDER BY tgl_acara ASC, waktu_mulai ASC";
|
|
$hasil = pg_query($query);
|
|
$baris = 2;
|
|
$a=1;
|
|
while ($data = pg_fetch_array($hasil))
|
|
{
|
|
|
|
$jam_mulai=date('H:i',strtotime($data[0]));
|
|
$jam_selesai=date('H:i',strtotime($data[1]));
|
|
$tujuan=ucwords(strtolower($data[2]));
|
|
$tanggal_acara=date('d-m-Y',strtotime($data['tgl_acara']));
|
|
$objPHPExcel->getSheet(0)
|
|
->setCellValue('A'.$baris, $data[9])
|
|
->setCellValue('B'.$baris, $tanggal_acara)
|
|
->setCellValue('C'.$baris, $jam_mulai.' - '.$jam_selesai)
|
|
->setCellValue('D'.$baris, $tujuan)
|
|
->setCellValue('E'.$baris, $data[3]);
|
|
$a++;
|
|
$baris++;
|
|
}
|
|
|
|
$objPHPExcel->setActiveSheetIndex(0);
|
|
|
|
header('Content-Type: application/vnd.ms-excel');
|
|
header('Content-Disposition: attachment;filename="info_rapat.xls"');
|
|
header('Cache-Control: max-age=0');
|
|
|
|
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
|
$objWriter->save('php://output');
|
|
exit;
|
|
|
|
?>
|
|
|