<?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,5,'SURAT KEPUTUSAN',0,1,'C');
$pdf->Cell(190,5,'NOMOR : 199/MGT/MHB_SK/IX/2020',0,1,'C');
$pdf->SetFont('Arial','',10);
$pdf->Cell(190,5,'Tentang : Demosi',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');
$pdf->SetFont('Arial','B',10);



$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_demosi WHERE id=".$idcuti;
$res = mysqli_query($conn, $q);
$row = mysqli_fetch_array($res);

$pdf->Cell(20 , 5, '',0,1,'c');
$pdf->Cell(20 , 5, '',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, 'Menimbang      :',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '1   Perlu adanya peningkatan efektivitas kerja berdasarkan kemampuan karyawan',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '2   Dalam rangka memenuhi kebutuhan dan kepentingan perusahaan.',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '3   Prestasi, dedikasi dan motivasi kerja Sdr '.$row['nama'],0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '     selama bekerja di Departemen/Section '.$row['jabatan_lama'],0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, 'Mengingat        :',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '1   Rencana jangka panjang perusahaan.',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '2   Hasil keputusan Meeting Management PT.Multi Hidrachrome Balikpapan.',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '3   Usulan Demosi yang disetujui oleh Atasan langsung.',0,1,'c');


$pdf->Cell(20 , 5, '',0,1,'c');
$pdf->Cell(20 , 5, '',0,1,'c');
$pdf->Cell(20 , 5, '',0,1,'c');
$pdf->Cell(20 , 5, '',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, 'Menetapkan       :',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '1   Terhitung tanggal  '.date('d / M / yy'). ' memutuskan karyawan :',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','B',11);
$pdf->Cell(20 , 5, '      Nama                  :  '.$row['nama'],0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','B',11);
$pdf->Cell(20 , 5, '      No. Karyawan    :  '.$row['nik'],0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','B',11);
$pdf->Cell(20 , 5, '      Jabatan Lama    :  '.$row['divisi_lama'],0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','B',11);
$pdf->Cell(20 , 5, '      Jabatan Baru     :  '.$row['divisi_baru'],0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '2   Dalam melaksanakan tugas dan tanggung jawab, Sdr '.$row['nama'],0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '     melaporkan dan bertanggung jawab langsung kepada Departemen, '.$row['divisi_baru'],0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '3   Demosi tersebut merupakan kebijakan perusahaan dalam memberikan kesempatan',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '     mengembangkan karier dan mengoptimalkan kontribusi kerja karyawan Yang bersangkutan',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '     dalam menunjang kemajuan perusahaan.',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '4   Surat keputusan ini berlaku sejak tanggal ',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '5   Surat keputusan ini sewaktu-waktu ditinjau kembali apabila terdapat kekeliruan atau',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, '',0,0,'c');
$pdf->SetFont('Arial','',11);
$pdf->Cell(20 , 5, '     adanya pertimbangan dengan alasan yang kuat.',0,1,'c');

$pdf->Cell(20 , 5, '',0,1,'c');
$pdf->Cell(20 , 5, '',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, 'Ditetapkan di     :',0,0,'c');
$pdf->SetFont('Arial','B',11);
$pdf->Cell(20 , 5, '  Balikpapan',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, 'Pada tanggal     :',0,0,'c');
$pdf->SetFont('Arial','B',11);
$pdf->Cell(20 , 5, '  '.$row['tanggal_disetujui'],0,1,'c');

$pdf->Cell(20 , 5, '',0,1,'c');
$pdf->Cell(20 , 5, '',0,1,'c');

$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, 'Arbain',0,1,'c');
$pdf->SetFont('Arial','B',11);
$pdf->Cell(35 , 5, 'HC&GA MANAGER (Acc.Sistem)',0,1,'c');

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

$pdf->Cell(35 , 5, 'cc.',0,1,'c');
$pdf->Cell(35 , 5, ' 1. Dir',0,1,'c');
$pdf->Cell(35 , 5, ' 2. Yth. Dept Head terkait',0,1,'c');
$pdf->Cell(35 , 5, ' 3. Arsip',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();


?>