<?php
include "koneksi.php";
if (!isset($_SESSION["UserID"])) {
	header("location:login.php?p=3");
}

// memanggil library FPDF
require('fpdf/fpdf.php');
// intance object dan memberikan pengaturan halaman PDF
$pdf = new FPDF('p','mm','A4');
// membuat halaman baru
$pdf->AddPage();
// setting jenis font yang akan digunakan
$pdf->SetFont('Arial','B',18);
// mencetak string 
$pdf->Cell(190,3,'PT.MULTI HIDRACHROME BALIKPAPAN',0,1,'C');
$pdf->SetFont('Arial','B',10);
$pdf->Cell(190,7,'',0,1,'C');
$pdf->Cell(190,2,'SLIP GAJI KARYAWAN',0,1,'C');
$timezone = time() + (60 * 60 * 1);
date_default_timezone_set('Asia/Jakarta');
$pdf->Cell(190,6,'Balikpapan,  '.date('d / M / yy / H:i:s a',$timezone),0,1,'C');




$idcuti = mysqli_real_escape_string($conn, $_GET["id"]);
//echo "idcutinya bang : " . $idcuti . "</br>";

//////query cuti
//////$q = "SELECT ck.id AS id, ck.alamat AS alamat, ck.sisa_cuti AS sisa_cuti, ck.tanggal_awal_cuti AS tanggal_awal_cuti, ck.tanggal_akhir_cuti AS tanggal_akhir_cuti, ck.tanggal_pengajuan_cuti AS tanggal_pengajuan_cuti, ck.alasan_cuti AS alasan_cuti, ck.tanggal_lapor_cuti AS tanggal_lapor_cuti, ck.id_jenis_cuti AS id_jenis_cuti,
      //////                                dk.nik AS nik, dk.nama_karyawan AS nama_karyawan, dk.jabatan AS jabatan, dk.departement AS departement, dk.status_kepegawaian AS status_kepegawaian, dk.asal_penerimaan AS asal_penerimaan, dk.sisa_cuti_tahun AS sisa_cuti_tahun						  
	  /////FROM cuti_karyawan ck INNER JOIN data_karyawan dk ON ck.id_data_karyawan = dk.id
	  /////WHERE ck.id = $idcuti";
/////$res = mysqli_query($conn, $q);

////$row = mysqli_fetch_array($res);


//$s = "SELECT * FROM jenis_cuti WHERE id=" .$row['id_jenis_cuti'];
//$resi = mysqli_query($conn,$s);

//$rowi = mysqli_fetch_array($resi);

//query untuk pengambilan data gaji
$q = "SELECT * FROM data_karyawan WHERE id=".$idcuti;
$res = mysqli_query($conn, $q);
$row = mysqli_fetch_array($res);



$pdf->SetFont('Arial','',9);
$pdf->Cell(130 , 1, '______________________________________________________________________________________________',0,1,'c');
$pdf->Cell(130 , 1, '',0,1,'c');

$pdf->Cell(100 , 5, 'NIK'.'                    : '.$row['nik'],0,0,'c');
$pdf->Cell(100,5,'DIV / DEP'.'                   : '.$row['departement'],0,1,'c');

$pdf->Cell(100 , 5, 'NAMA'.'               : '.$row['nama_karyawan'],0,0,'c');
$pdf->Cell(100,5,'HARI KALENDER'.'      : '.$row['departement'],0,1,'c');

$pdf->Cell(100 , 5, 'JABATAN'.'         : '.$row['jabatan'],0,0,'c');
$pdf->Cell(100,5,'HARI HADIR'.'               : '.$row['jabatan'],0,1,'c');


$pdf->Cell(130 , 1, '',0,1,'c');
$pdf->Cell(130 , 1, '_______________________________________________________________________________________________',0,1,'c');
$pdf->Cell(130 , 5, '',0,1,'c');
$pdf->Cell(130 , 1, 'PENERIMAAN'.'                                                                                 '.'POTONGAN',0,1,'c');
$pdf->Cell(130 , 3, '_______________________________________________________________________________________________',0,1,'c');

$pdf->Cell(100 , 5, 'GAJI POKOK'.'             : '.$row['gaji'],0,0,'c');
$pdf->Cell(100,5,'PRORATE HARI HADIR'.'  : '.$row['jabatan'],0,1,'c');

$pdf->Cell(100 , 5, 'Tj. JABATAN'.'             : '.$row['tunjangan_jabatan'],0,0,'c');
$pdf->Cell(100,5,'PINJAMAN'.'                       : '.$row['tunjangan_operasional'],0,1,'c');

$pdf->Cell(100 , 5, 'Tj. OPERASIONAL'.'    : '.$row['tunjangan_jabatan'],0,0,'c');
$pdf->Cell(100,5,'BPJS - TK (JHT)'.'              : '.$row['tunjangan_operasional'],0,1,'c');

$pdf->Cell(100 , 5, 'Tj. KOMUNIKASI'.'       : '.$row['tunjangan_komunikatif'],0,0,'c');
$pdf->Cell(100,5,'BPJS - TK (JPN)'.'              : '.$row['bpjs_jaminan_pensiun'],0,1,'c');

$pdf->Cell(100 , 5, 'Tj. MAKAN'.'                 : '.$row['tunjangan_makan'],0,0,'c');
$pdf->Cell(100,5,'BPJS - KES'.'                      : '.$row['no_bpjs_kesehatan'],0,1,'c');

$pdf->Cell(100 , 5, 'INSENTIF SHIFT'.'       : '.$row['tunjangan_transport'],0,0,'c');
$pdf->Cell(100,5,'SAKIT = '.'0'.' Hari'.'                 : '.$row['no_bpjs_kesehatan'],0,1,'c');

$pdf->Cell(100 , 5, '',0,0,'c');
$pdf->Cell(100,5,'TERLAMBAT (MNT)         : '.'0'.' Menit',0,1,'c');

$pdf->Cell(100 , 5, '',0,0,'c');
$pdf->Cell(100,3,'TERLAMBAT (Rp.)           : '.'0',0,1,'c');

$pdf->Cell(130 , 3, '_______________________________________________________________________________________________',0,1,'c');

$pdf->Cell(100 , 5, 'Total Penerimaan      '.': '.$row['jabatan'],0,0,'c');
$pdf->Cell(50,5,'Total Potongan                 : '.'0',0,1,'c');

$pdf->Cell(130 , 3, '_______________________________________________________________________________________________',0,1,'c');
$pdf->Cell(100 , 5, 'Take Home Pay      '.': '.$row['jabatan'],0,0,'c');
$pdf->Cell(50,5,'Balikpapan,                 : '.date('M - yy'),0,1,'c');



$pdf->Cell(130 , 5, 'Transfer Ke Bank UOB'.'                            Diketahui,'.'                   Dibuat,'.'                  Diterima,',0,1,'c');
$pdf->Cell(130 , 5, 'No. A/C :',0,1,'c');
$pdf->Cell(130 , 5, 'a.n         : '.$row['nama_karyawan'],0,1,'c');
$pdf->Cell(130 , 5, 'Ttl          : '.$row['nama_karyawan'],0,1,'c');
$pdf->Cell(130 , 5, '                                                                    '.'ARBAIN'.'                      SUCI'.'              '.$row['nama_karyawan'],0,1,'c');
$pdf->Cell(130 , 5, '                                                                   '.'HC & GA'.'                    PAYROL'.'              '.$row['departement'],0,1,'c');




$no = 1;
$pdf->Ln();
$row = mysqli_fetch_array($res);
$pdf->SetFont('Arial','B',20);
$pdf->Cell(190,7,$row['alamat'],0,1,'C');

// Memberikan space kebawah agar tidak terlalu rapat
//$pdf->Cell(10,7,'',0,1);

//$pdf->SetFont('Arial','B',10);
//$pdf->Cell(15,6,'No',1,0,'C');
//$pdf->Cell(40,6,'NRP',1,0,'C');
//$pdf->Cell(85,6,'NAMA MAHASISWA',1,0,'C');
//$pdf->Cell(47,6,'TTD',1,0,'C');





//$mahasiswa = mysqli_query($link, "SELECT mk.nrp AS nrp, m.nama AS nama, k.nama_kelas AS namakelas, mt.nama AS namamatkul
//FROM 
//mahasiswa_kelas mk
//INNER JOIN kelas k ON mk.kode_kelas = k.kode_kelas 
//INNER JOIN mahasiswa m ON m.nrp = mk.nrp
//INNER JOIN matakuliah mt ON k.kode_mk = mt.kode_mk
//");

$no = 1;
$pdf->Ln();
while ($row = mysqli_fetch_array($res)){
	//$pdf->SetFont('Arial','B',10);
	//$pdf->SetFillColor(255,255,255);
	//$pdf->Cell(15,6,$no++,1,0,'C',true);
	//$pdf->Cell(40,6,$row['nik'],1,0,'C');
	//$pdf->Cell(85,6,$row['nama_karyawan'],1,0,'L');
	//$pdf->Cell(47,6,"",1,0,'C');
	//$pdf->Ln();
}

$pdf->Output();


?>