<!DOCTYPE html>
<?
include "../include/connect.php";
include "../include/qrgenerator/qrlib.php";

$d1 = mysql_fetch_array(mysql_query("SELECT * FROM doa_permohonan WHERE idpermohonan='$_REQUEST[lx]'",$doa));
$cc = mysql_num_rows(mysql_query("SELECT * FROM doa_cc_vw WHERE idpermohonan='$_REQUEST[lx]'",$doa));

$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
$PNG_WEB_DIR = 'temp/';
if (!file_exists($PNG_TEMP_DIR))
    mkdir($PNG_TEMP_DIR);


$filename = $PNG_TEMP_DIR.'test.png';
$errorCorrectionLevel = 'L';
$matrixPointSize = 4;
QRcode::png("$d1[nopermohonan]", $filename, "L", 10, 2);
?>
<html>
<style>
@media print {
html, body {
    width: 8.27in; /* was 9.5in */
    height: 9.5in; /* was 8.27in */
    display: block;
    /*font-size: auto; NOT A VALID PROPERTY */
}

@page {
    size: 8.27in 9.5in /* . Random dot? */;
}
}
</style>
<head>	<!-- Basic Page Info -->
	<meta charset="utf-8">
	<title>D O A - PT. Lautan Teduh Interniaga</title>
	<link rel="shortcut icon" href="../../favicon.png">

	<link href="https://fonts.googleapis.com/css?family=Work+Sans:300,400,500,600,700" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">

	<link rel="stylesheet" href="../vendors/styles/style.css">
	<link rel="stylesheet" type="text/css" href="../src/plugins/datatables/media/css/jquery.dataTables.css">
	<link rel="stylesheet" type="text/css" href="../src/plugins/datatables/media/css/dataTables.bootstrap4.css">
	<link rel="stylesheet" type="text/css" href="../src/plugins/datatables/media/css/responsive.dataTables.css">

</head>
<body style="background:#fff;padding:10px">
	<img src="../../images/headersurat.jpg" width='100%'>
	<div class="clearfix"></div>
	<div style="border-bottom:2px #000 solid;margin-bottom: 2px"></div>
	<div style="border-bottom:1px #000 solid"></div>

	<?
	$dX = mysql_fetch_array(mysql_query("SELECT * FROM doa_jenispermohonan_vw WHERE idjenispermohonan='$d1[idjenispermohonan]'",$doa));
	$dY = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_divisi WHERE iddivisi='$dX[iddivisi]'",$isas));

	if($d1[hakakses]=="Kepala Cabang" OR $d1[hakakses]=="Admin Dealer")
		{
		$dP = mysql_fetch_array(mysql_query("SELECT * FROM penjualan_karyawan_vw WHERE user='$d1[user]'",$isas));
		$dZ = mysql_fetch_array(mysql_query("SELECT * FROM fkt_dealer WHERE kode_lks='$d1[kodedealer]'",$isas));
		$asal = strtoupper($d1[hakakses])." - $dZ[subyek] ($dP[nama])";
		}
	else{
		$dZ 	= mysql_fetch_array(mysql_query("SELECT * FROM karyaone_divisi WHERE iddivisi='$d1[iddivisi]'",$isas));
		$asal   = strtoupper($d1[hakakses]);
		}
	?>

	<div class="row"style="margin-top:20px">
		<div class="col-2 text-center">
			<?echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" style="width: 100%;"/>'?>
			<h5 style="text-align:center;font-size:1em"><small><b><?echo $d1[nopermohonan]?></br><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_input]))?></b></small></h5>
		</div>
		<div class="col-10">
			<div class="modal-body">
				<div class="" style="margin-top:-10px; font-size:16px">
					<div class="form-group row">
						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">PEMOHON <span style="float: right">:</span></label>
						<div class=" col-8">
							<input class="form-control"  style="border:none; background:none;font-size:16px" type="text" value="<?echo $asal?>" name="posisi" disabled="">
						</div>

						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">PERMOHONAN KE<span style="float: right">:</span></label>
						<div class=" col-8">
							<input class="form-control" style="border:none; background:none;font-size:16px" type="text" value="<?echo strtoupper($dX[namadivisi])?> - <?echo strtoupper($dX[jenispermohonan])?>" name="posisi" disabled="">
						</div>
					</div>
					<hr style="border:#000 solid 1px">

					<div class="form-group row">
						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">POSISI (PIC)<span style="float: right">:</span></label>
						<div class=" col-8">
							<input class="form-control"  style="border:none; background:none;font-size:16px" type="text" value="<?echo strtoupper($d1[posisi])?>" name="kegunaan" disabled="">
						</div>

						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">KEGUNAAN <span style="float: right">:</span></label>
						<div class=" col-8">
							<input class="form-control"  style="border:none; background:none;font-size:16px" type="text" value="<?echo strtoupper($d1[kegunaan])?>" name="kegunaan" disabled="">
						</div>

						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">QUANTITY <span style="float: right">:</span></label>
						<div class=" col-8">
							<input class="form-control" style="border:none; background:none;font-size:16px" type="text" value="<?echo $d1[qty]?>" name="qty" maxlength="3" onkeypress="return buat_angka(event,'1234567890')" disabled="">
						</div>

						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">URAIAN <span style="float: right">:</span></label>
						<div class=" col-8">
							<div style="border:none; background:none;font-size:16px;padding:10px"><?echo strtoupper(nl2br($d1[keterangan]))?></div>
						</div>
					</div>
				<?
				include "../trackpencairan.php";
				//if($d1[pencairanfinance]=="YA" AND ($d1[sts_cair_spv]!=0 OR $d1[sts_cair_man]!=0 OR $d1[sts_cair_coo]!=0 OR $d1[sts_cair_ceo]!=0))
				if($d1[pencairanfinance]=="YA")
					{
				?>
					<hr style="border:#000 solid 1px">
					<div class="form-group row" style="font-size:16px">

						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">PENCAIRAN FINANCE  <span style="float: right">:</span></label>
						<div class=" col-2">
							<input class="form-control" style="border:none; background:none;font-size:16px" type="text" value="<?echo $d1[pencairanfinance]?>"  disabled="">
						</div>
						<label class="weight-400 col-4 col-form-label" style="font-weight: bold">ESTIMASI BIAYA  <span style="float: right">:</span></label>
						<div class=" col-2">
							<input class="form-control" style="border:none; background:none;font-size:16px" type="text" value="<?echo number_format($d1[estimasi])?>"  disabled="">
						</div>
						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">STATUS PENCAIRAN  <span style="float: right">:</span></label>
						<div class=" col-8">
							<div style="padding:10px"><?echo $stspencairan?></div>
						</div>
					</div>
					<div class="form-group row" style="font-size:16px">
						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">TANGGAL PENCAIRAN  <span style="float: right">:</span></label>
						<div class=" col-8">
							<div style="padding:10px"><?echo $tglpencairan?></div>
						</div>
					</div>
				<?
					}
				?>
				</div>
			</div>

			<?
			if($cc>0)
				{
			?>
				<hr style="border: 1px solid #000;width:100%">
				<div class=" col-12" style="font-size:16px">
					<div class="form-group row">
						<label class="weight-400 col-4  col-form-label" style="font-weight: bold">TEMBUSAN <span style="float: right">:</span></label>
						<div class=" col-8">
							<div class="form-group row">
			<?
							$qcv = mysql_query("SELECT * FROM doa_cc_vw WHERE idpermohonan='$_REQUEST[lx]'",$doa);
							while($dcv = mysql_fetch_array($qcv))
								{
								if(empty($dcv[note]))
									{
									$note = "<i style='color:red'>Tidak ada.</i>";
									$wktu = "";
									}
								else{
									$note = $dcv[note];
									$wktu = "</br><i style='font-weight:normal;font-size:12px'>".date("d-m-Y H:i:s",strtotime($dcv[tglrespon]))."</i>";
									}
			?>
								<label class="weight-400 col-12 col-form-label" style="font-weight: bold">Note <?echo $dcv[jabatan]?> <?echo $wktu?></label>
								<div class=" col-12 mb-10" style="border-bottom: solid #ddd 1px; width:100%">
									<?echo $note?>
								</div>
			<?
								}
			?>
							</div>
						</div>
					</div>
				</div>
			<?
				}
			?>

		</div>
		<hr style="border: 1px solid #000;width:100%">
		<div class="col-12 text-center mb-20">
			<h5 style="font-size:16px"><b>PERSETUJUAN</b></h5>
		</div>
<?
if($d1[sts_aom]!=0)
	{
	$dNK = mysql_fetch_array(mysql_query("SELECT * FROM fkt_dealer WHERE kode_lks='$d1[kodedealer]'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>ASM</br><?echo strtoupper($dNK[aom])?></b></h5>
			<img src="../../images/approval/aom.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_aom]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_aom])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_aom]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_gm_sales]!=0)
	{
	$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='RETAIL HEAD'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>RETAIL HEAD</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/gm_sales.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_gm_sales]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_gm_sales])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_gm_sales]</p>";}
			?>
		</div>
	</div>
<?
	}
if($d1[sts_asd]!=0)
	{
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>ASD</b></h5>
			<img src="../../images/approval/asd.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_asd]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_asd])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_asd]</p>";}
			?>
		</div>
	</div>
<?
	}
if($d1[sts_teknik]!=0)
	{
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>TEKNIK</br>AMINNUDIN</b></h5>
			<img src="../../images/approval/asd.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_teknik]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_teknik])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_teknik]</p>";}
			?>
		</div>
	</div>
<?
	}
if($d1[sts_umum]!=0)
	{
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>UMUM</br>SULTOMY IDHAM</b></h5>
			<img src="../../images/approval/asd.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_umum]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_umum])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_umum]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_koadmin]!=0)
	{
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>Koadmin</b></h5>
			<img src="../../images/approval/koadmin.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_koadmin]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_koadmin])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_koadmin]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_it]!=0)
	{
	$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='SUPERVISOR IT'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>SUPERVISOR IT</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/it.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_it]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_it])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_it]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_edu]!=0)
	{
	$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER EDUCATION'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER EDUCATION</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_mkt.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_edu]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_mkt])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_mkt]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_mkt]!=0)
	{
	$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER MARKETING SUPPORT'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER MARKETING SUPPORT</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_mkt.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_mkt]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_mkt])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_mkt]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_svc]!=0)
	{
	$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER SERVICE'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER SERVICE</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_svc.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_svc]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_svc])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_svc]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_fin]!=0)
	{
	$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER FINANCE'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER FINANCE</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_fin.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_fin]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_fin])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_fin]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_acc]!=0)
	{
		$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER ACCOUNTING'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER  ACCOUNTING</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_acc.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_acc]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_acc])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_acc]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_hrd]!=0)
	{
		$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER HRD'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER HRD</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_hrd.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_hrd]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_hrd])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_hrd]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_adm]!=0)
	{
		$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER ADMINISTRASI'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER ADMINISTRASI</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_adm.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_adm]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_adm])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_adm]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_ga]!=0)
	{
		$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER UMUM'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER UMUM</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_ga.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_ga]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_ga])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_ga]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_man_part]!=0)
	{
		$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='MANAGER SPAREPART'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>MANAGER SPAREPART</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/man_part.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_man_part]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_man_part])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_man_part]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_coo]!=0)
	{
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>COO</br>HANNA</b></h5>
			<img src="../../images/approval/coo.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_coo]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_coo])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_coo]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_cbo]!=0)
	{
		$dNK = mysql_fetch_array(mysql_query("SELECT * FROM karyaone_karyawan WHERE role='BUSINESS HEAD'",$isas));
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>BUSINESS HEAD</br><?echo $dNK[nama]?></b></h5>
			<img src="../../images/approval/cbo.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_cbo]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_cbo])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_cbo]</p>";}
			?>
		</div>
	</div>
<?
	}

if($d1[sts_ceo]!=0)
	{
?>
	<div class="col-4 text-center">
		<div style="border:solid #000 2px;min-height:300px;font-size:16px">
			<h5><b>CEO</br>BRYAN GUAN</b></h5>
			<img src="../../images/approval/coo.png" width='30%'>
			<p><?echo date("d-m-Y H:i:s",strtotime($d1[wkt_ceo]))?></p>
			<hr>
			<b>Note</b>
			<?
			if(empty($d1[ket_ceo])){echo "</br><i style='color:red'>Tidak ada.</i>";}
			else{echo "<p>$d1[ket_ceo]</p>";}
			?>
		</div>
	</div>
<?
	}
?>
	</div>

    <div class="clearfix"></div>

</body>
<script>
//window.print();
</script>