<?

include("$DOCUMENT_ROOT/s/config.php");
$template->basicheader();
include("header.php");

$result=$f->detailPegawai($login_nip);

    $debug=0;
    $menu = array (
		basename ( $PHP_SELF ) => "Lowongan Yang Dilamar",
		"riwayat_pindah_lowongan_pelamar.php" => "Riwayat Pindah"
    );
    $standar_button_off = "0";
    $navigation_off = "0";
    $title_off = "1";
    $cfg_reff_table = "rec_rencana_pemenuhan_peg";
    $title = "Lowongan Yang Dilamar";

    $cfg_title = "Lowongan Yang Dilamar";
    $cfg_subtitle = "Lowongan Yang Dilamar";
    $primary_key = "rpp_id";
    $attr_key1 = "rpp_id";
    $prefix_primary_key = "RPP";
    $_primary_key = $f->primary_key ( $primary_key );
    if (! $start)$start = '0';
    if (! $order)$order = 'rmr_id';
    if (! $sort)$sort = 'asc';
    if (! $page)$page = '0';
    if (! $num)$num = '10';
    $start = ($page - 1) * $num;
    if ($start < 0)$start = '0';
    echo $template->tab_top_relative ( $title, $menu );
	
$nip = $login_nip;
$mpp_id_curr = $f->getLastMppUsed();

$sql_check_notif = "select nip from REC_NOTIFIKASI_UNDANGAN where nip='".$login_nip."'";

if ($_POST) {
	$prioritas_1 = $_POST['prioritas_1'];	// 1/2
	$id_prioritas_1 = $_POST['id_prioritas_1'];	//328
	$prioritas_2 = $_POST['prioritas_2'];
	$id_prioritas_2 = $_POST['id_prioritas_2'];
	
	$sukses_update = false;
	if (!empty($id_prioritas_1)) {
		$sql_update_1 = "UPDATE rec_pelamar_internal SET PRIORITAS='$prioritas_1' WHERE ID = $id_prioritas_1";
		$result_update_1 = $db->Execute($sql_update_1);
		if(!$result_update_1) {
			$sukses_update = false;
		} else {
			$sukses_update = true;
		}
	}
	if (!empty($id_prioritas_2)) {
		$sql_update_2 = "UPDATE rec_pelamar_internal SET PRIORITAS='$prioritas_2' WHERE ID = $id_prioritas_2";
		$result_update_2 = $db->Execute($sql_update_2);
		if(!$result_update_2) {
			$sukses_update = false;
		} else {
			$sukses_update = true;
		}
	}
	if ($sukses_update) {
		header("location: ".$PHP_SELF."?s=1");
	} else {
		header("location: ".$PHP_SELF."?s=0");
	}
}

/*
echo "<script type=\"text/javascript\" src=\"/js/jquery-3.5.1.min.js\"></script>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/components/bootstrap/dist/css/bootstrap.min.css\">
<script src=\"/components/bootstrap/dist/js/bootstrap.min.js\"></script>
<script type=\"text/javascript\" src=\"/js/jquery.confirm.min.js\"></script>";
*/
echo "<script type=\"text/javascript\" src=\"/js/jquery-3.5.1.min.js\"></script>";

echo "<script type=\"text/javascript\">
function batal(nip, req_id, id_formasi, id_room){
	var txt;
	var r = confirm('Yakin akan membatalkan lamaran?');
	if (r == true) {
		//alert(req_id);
		$.ajax({
			method: \"POST\",
			dataType: \"json\",
			url: \"/lowongan_internal_v3_detail.php?act=jsonws&wsdata=dodelete\",
			data: { req_id: req_id, nip: nip, id_formasi: id_formasi, id_room: id_room },
			success: function(data) {
				if (data.status) {
					//$('#msgModalTitle').text(data.caption);
					//$('#msgModalBody').text(data.message);
					//$('#msgModalSubmit').hide();
					//$('#msgModalBatal').hide();
					//$('#msgModalForm :input').prop('disabled', true);
					//$('#msgModalreq_id').val('');
					//$('#msgModalreload').val('1');
					alert(data.message);
					window.location = 'list_lamaran.php';
				} else {
					console.log(data.message);
					alert(data.message);
				}
				//$('#msgModal').modal('handleUpdate');
			},
			error: function() {
				console.log('error');
				alert('Error');
			}
		});
	}
}

function ubahprioritas(obj_id){
	console.log(obj_id);
	var prioritas_selected = $('#'+obj_id).children('option:selected').val();
	console.log(prioritas_selected);
	if (obj_id=='prioritas_1') {
		var ada_prioritas_2 = $('#prioritas_2').length;
		if (ada_prioritas_2>0) {
			console.log('ada id 2');
			if (prioritas_selected==1) {
				console.log('ubah id 2 jadi 2');
				$('#prioritas_2 option[value=1]').removeProp('selected');
				//$('#prioritas_2 option[value=2]').attr('selected', 'selected');
				$('#prioritas_2 option[value=2]').prop({selected: true});
			} else {
				console.log('ubah id 2 jadi 1');
				$('#prioritas_2 option[value=2]').removeProp('selected');
				//$('#prioritas_2 option[value=1]').attr('selected', 'selected');
				$('#prioritas_2 option[value=1]').prop({selected: true});
			}
		}
	}
	if (obj_id=='prioritas_2') {
		var ada_prioritas_1 = $('#prioritas_1').length;
		if (ada_prioritas_1>0) {
			console.log('ada id 1');
			if (prioritas_selected==1) {
				console.log('ubah id 1 jadi 2');
				$('#prioritas_1 option[value=1]').removeProp('selected');
				//$('#prioritas_1 option[value=2]').attr('selected', 'selected');
				$('#prioritas_1 option[value=2]').prop({selected: true});
			} else {
				console.log('ubah id 1 jadi 1');
				$('#prioritas_1 option[value=2]').removeProp('selected');
				//$('#prioritas_1 option[value=1]').attr('selected', 'selected');
				$('#prioritas_1 option[value=1]').prop({selected: true});
			}
		}
	}
}
</script>";

if (!empty($_GET['s'])) {
	if ($_GET['s']=='1') {
		echo "<p style=\"margin-left: 20px;color: blue;\"><b>Perubahan telah disimpan</b></p>";
	} else {
		echo "<p style=\"margin-left: 20px;color: red;\"><b>Perubahan gagal disimpan</b></p>";
	}
}

echo "<form method=\"post\" action=\"".$PHP_SELF."\">
	<table class=index width=100%>
        <tr>
            <th width=\"10px\">No</th>
            <th>Informasi Lowongan</th>
			<th>Tanggal Apply</th>
			<th>Status</th>
        </tr>";
		
// begin: cek apakah ada fto atau enggak
$sql_cek_fto = "SELECT * FROM dbo.REC_RENCANA_PEMENUHAN_PEG WHERE MPP_ID = '$mpp_id_curr' AND LEFT(TRIM(dampak), 5) = '[FTO]'";
$result_cek_fto = $db->Execute($sql_cek_fto);
if (!$result_cek_fto) {
	print $db->ErrorMsg();
}
$num_cek_fto = $result_cek_fto->RecordCount();
$ada_fto = false;
if ($num_cek_fto>0) {
	$ada_fto = true;
}
// end: cek apakah ada fto atau enggak

$sql1 = "SELECT DISTINCT
	a.tanggal_apply,
	a.status,
	b.req_id,
	b.ptk_id,
	b.satker,
	b.depkom,
	b.kantor,
	b.masa_dinas_minimal,
	b.sisa_dinas,
	b.tanggal_dinas,
	b.bidang,
	b.NM_PEND_UMUM,
	b.kd_pend_umum,
	b.posisi_jabatan,
	b.kd_jabatan,
	b.tanggal_publish,
	b.tanggal_selesai,
	b.jam_selesai,
	b.mpp_id,
	b.tanggal_buat,
	b.nilai1,
	b.nilai2,
	b.nilai3,
	b.closing_date,
	COALESCE(jml.jml_pelamar, 0) AS jml_pelamar,
	s.STATUS_PELAMAR,
	a.id_formasi,
	b.bisa,
	CASE WHEN pindah.nip IS NOT NULL THEN 1 ELSE 0 END AS pindah,
	b.keterangan,
	a.PRIORITAS,
	a.ID AS id_rec_pelamar_internal,
	r.NM_ROOM,
	r.ID AS ID_ROOM,
	ISNULL(a.lock_short_list, 0) as sts_lock_short_list,
	COALESCE(r.dampak,b.DAMPAK,'') AS dampak
FROM
	rec_pelamar_internal a
	INNER JOIN
		(
			SELECT
				b.req_id,
				a.ptk_id,
				e.nm_unit_org AS satker,
				f.nm_unit_org AS depkom,
				c.nm_kantor AS kantor,
				m.masa_dinas_minimal,
				m.sisa_dinas,
				m.tanggal_dinas,
				g.nm_unit_org AS bidang,
				n.NM_PEND_UMUM,
				ISNULL(n.KD_PEND_UMUM, 0) AS kd_pend_umum,
				j.posisi AS posisi_jabatan,
				a.kd_jabatan,
				b.tanggal_publish,
				b.tanggal_selesai,
				b.jam_selesai,
				m.kd_gol,
				a.mpp_id,
				m.tanggal_buat,
				h.NM_GOLONGAN,
				m.nilai_kinerja AS nilai1,
				m.nilai_kinerja_1 AS nilai2,
				m.nilai_kinerja_2 AS nilai3,
				DATEADD(DAY, 0, DATEDIFF(DAY, 0, b.tanggal_selesai))
				+ DATEADD(DAY, 0 - DATEDIFF(DAY, 0, b.jam_selesai), b.jam_selesai) AS closing_date,
				d.KD_UNIT_ES1,
				CASE
					WHEN CAST(convert(varchar, b.tanggal_selesai, 23) + ' ' + b.jam_selesai AS DATETIME) > GETDATE() THEN 1
					ELSE 0
				END AS bisa,
				b.keterangan,
				o.DAMPAK
			FROM
				rec_ptk a
				LEFT JOIN
				rec_permintaan_advertising b ON
					a.ptk_id = b.req_id
				LEFT JOIN
				SPG_08_KANTOR c ON
					a.kd_kantor = c.kd_kantor
				LEFT JOIN
				spg_08_unit_organisasi d ON
					a.kd_unit_org = d.kd_unit_org
				LEFT JOIN
				SPG_08_UNIT_ORGANISASI e ON
					d.KD_UNIT_ES3 = e.KD_UNIT_ORG
				LEFT JOIN
				SPG_08_UNIT_ORGANISASI f ON
					d.KD_UNIT_ES2 = f.KD_UNIT_ORG
				LEFT JOIN
				SPG_08_UNIT_ORGANISASI g ON
					d.KD_UNIT_ES1 = g.KD_UNIT_ORG
				LEFT JOIN
				SPG_08_JABATAN_UNIT j ON
					(
						a.KD_JABATAN = j.KD_JABATAN
						AND a.KD_UNIT_ORG = j.KD_UNIT_ORG
					)
				LEFT JOIN
				SPG_08_JABATAN_STR k ON
					a.kd_jabatan = k.KD_JABATAN_STR
				LEFT JOIN
				SPG_JABATAN_PANGKAT l ON
					a.kd_jabatan = l.KD_JABATAN_STR
				LEFT JOIN
				REC_PERSYARATAN m ON
					(
						m.KD_GOL = l.KD_GOL
						AND m.periode = a.mpp_id
					)
				LEFT JOIN
				spg_golongan h ON
					m.kd_gol = h.kd_gol
				LEFT JOIN
				spg_eselon i ON
					h.KD_ESELON = i.KD_ESELON
				LEFT JOIN
				SPG_JNS_PEND_UMUM n ON
					m.PENDIDIKAN = n.KD_PEND_UMUM
				LEFT JOIN
				REC_RENCANA_PEMENUHAN_PEG o ON a.ID_FORMASI = o.ID_FORMASI
			WHERE
				b.ram_id = 'RAM-000020'
				AND b.rac_id = 'RAC-000001'
		) b ON
		a.req_id = b.req_id
	INNER JOIN REC_STATUS_PELAMAR as s ON a.status = s.KD_STATUS_PELAMAR
	OUTER APPLY
	(
		SELECT
			--REQ_ID,
			ID_FORMASI,
			SUM(jml_pelamar) AS jml_pelamar
		FROM
			(
				SELECT
					--REQ_ID,
					ID_FORMASI,
					COUNT(*) AS jml_pelamar
				FROM
					rec_pelamar_internal
				WHERE
					--REQ_ID	= b.req_id
					ID_FORMASI = a.ID_FORMASI
					AND (ID_ROOM = a.ID_ROOM OR ISNULL(a.ID_ROOM,'')='')
				GROUP BY
					--REQ_ID
					ID_FORMASI
				UNION ALL
				SELECT
					--REQ_ID	,
					ID_FORMASI,
					COUNT(*) AS jml_pelamar
				FROM
					rec_pelamar_internal_history
				WHERE
					--REQ_ID	= b.req_id
					ID_FORMASI = a.ID_FORMASI
					AND (ID_ROOM = a.ID_ROOM OR ISNULL(a.ID_ROOM,'')='')
					AND STATUS = '11'
				GROUP BY
					--REQ_ID
					ID_FORMASI
			) AS x
		GROUP BY
			ID_FORMASI
	) AS jml
	OUTER APPLY
	(
		SELECT 
			x.NIP
		FROM 
			REC_PELAMAR_INTERNAL_HISTORY AS x
			INNER JOIN
			REC_RENCANA_PEMENUHAN_PEG AS y ON x.ID_FORMASI = y.ID_FORMASI
		WHERE
			x.STATUS = '9'
			AND y.mpp_id = b.mpp_id
			AND x.NIP = a.nip
			AND x.ID_PELAMAR = a.ID_SEBELUMNYA
		GROUP BY
			x.NIP
	) AS pindah
	LEFT JOIN REC_ROOM_FORMASI_FUNCTIONAL AS r ON a.ID_ROOM = r.ID
WHERE
	a.nip = '$login_nip'
	AND b.mpp_id = '$mpp_id_curr'
UNION ALL
SELECT DISTINCT
	a.tanggal_apply,
	a.status,
	b.req_id,
	b.ptk_id,
	b.satker,
	b.depkom,
	b.kantor,
	b.masa_dinas_minimal,
	b.sisa_dinas,
	b.tanggal_dinas,
	b.bidang,
	b.NM_PEND_UMUM,
	b.kd_pend_umum,
	b.posisi_jabatan,
	b.kd_jabatan,
	b.tanggal_publish,
	b.tanggal_selesai,
	b.jam_selesai,
	b.mpp_id,
	b.tanggal_buat,
	b.nilai1,
	b.nilai2,
	b.nilai3,
	b.closing_date,
	COALESCE(jml.jml_pelamar, 0) AS jml_pelamar,
	s.STATUS_PELAMAR,
	a.id_formasi,
	b.bisa,
	CASE WHEN pindah.nip IS NOT NULL THEN 1 ELSE 0 END AS pindah,
	b.keterangan,
	a.PRIORITAS,
	a.ID_PELAMAR AS id_rec_pelamar_internal,
	r.NM_ROOM,
	r.ID AS ID_ROOM,
	'0' as sts_lock_short_list,
	COALESCE(r.dampak,b.DAMPAK,'') AS dampak
FROM
	dbo.REC_PELAMAR_INTERNAL_HISTORY a
	INNER JOIN
		(
			SELECT
				b.req_id,
				a.ptk_id,
				e.nm_unit_org AS satker,
				f.nm_unit_org AS depkom,
				c.nm_kantor AS kantor,
				m.masa_dinas_minimal,
				m.sisa_dinas,
				m.tanggal_dinas,
				g.nm_unit_org AS bidang,
				n.NM_PEND_UMUM,
				ISNULL(n.KD_PEND_UMUM, 0) AS kd_pend_umum,
				j.posisi AS posisi_jabatan,
				a.kd_jabatan,
				b.tanggal_publish,
				b.tanggal_selesai,
				b.jam_selesai,
				m.kd_gol,
				a.mpp_id,
				m.tanggal_buat,
				h.NM_GOLONGAN,
				m.nilai_kinerja AS nilai1,
				m.nilai_kinerja_1 AS nilai2,
				m.nilai_kinerja_2 AS nilai3,
				DATEADD(DAY, 0, DATEDIFF(DAY, 0, b.tanggal_selesai))
				+ DATEADD(DAY, 0 - DATEDIFF(DAY, 0, b.jam_selesai), b.jam_selesai) AS closing_date,
				d.KD_UNIT_ES1,
				CASE
					WHEN CAST(convert(varchar, b.tanggal_selesai, 23) + ' ' + b.jam_selesai AS DATETIME) > GETDATE() THEN 1
					ELSE 0
				END AS bisa,
				b.keterangan,
				o.DAMPAK
			FROM
				rec_ptk a
				LEFT JOIN
				rec_permintaan_advertising b ON
					a.ptk_id = b.req_id
				LEFT JOIN
				SPG_08_KANTOR c ON
					a.kd_kantor = c.kd_kantor
				LEFT JOIN
				spg_08_unit_organisasi d ON
					a.kd_unit_org = d.kd_unit_org
				LEFT JOIN
				SPG_08_UNIT_ORGANISASI e ON
					d.KD_UNIT_ES3 = e.KD_UNIT_ORG
				LEFT JOIN
				SPG_08_UNIT_ORGANISASI f ON
					d.KD_UNIT_ES2 = f.KD_UNIT_ORG
				LEFT JOIN
				SPG_08_UNIT_ORGANISASI g ON
					d.KD_UNIT_ES1 = g.KD_UNIT_ORG
				LEFT JOIN
				SPG_08_JABATAN_UNIT j ON
					(
						a.KD_JABATAN = j.KD_JABATAN
						AND a.KD_UNIT_ORG = j.KD_UNIT_ORG
					)
				LEFT JOIN
				SPG_08_JABATAN_STR k ON
					a.kd_jabatan = k.KD_JABATAN_STR
				LEFT JOIN
				SPG_JABATAN_PANGKAT l ON
					a.kd_jabatan = l.KD_JABATAN_STR
				LEFT JOIN
				REC_PERSYARATAN m ON
					(
						m.KD_GOL = l.KD_GOL
						AND m.periode = a.mpp_id
					)
				LEFT JOIN
				spg_golongan h ON
					m.kd_gol = h.kd_gol
				LEFT JOIN
				spg_eselon i ON
					h.KD_ESELON = i.KD_ESELON
				LEFT JOIN
				SPG_JNS_PEND_UMUM n ON
					m.PENDIDIKAN = n.KD_PEND_UMUM
				LEFT JOIN
				REC_RENCANA_PEMENUHAN_PEG o ON a.ID_FORMASI = o.ID_FORMASI
			WHERE
				b.ram_id = 'RAM-000020'
				AND b.rac_id = 'RAC-000001'
		) b ON
		a.req_id = b.req_id
	INNER JOIN REC_STATUS_PELAMAR as s ON a.status = s.KD_STATUS_PELAMAR
	OUTER APPLY
	(
		SELECT
			--REQ_ID,
			ID_FORMASI,
			SUM(jml_pelamar) AS jml_pelamar
		FROM
			(
				SELECT
					--REQ_ID,
					ID_FORMASI,
					COUNT(*) AS jml_pelamar
				FROM
					rec_pelamar_internal
				WHERE
					--REQ_ID	= b.req_id
					ID_FORMASI = a.ID_FORMASI
					AND (ID_ROOM = a.ID_ROOM OR ISNULL(a.ID_ROOM,'')='')
				GROUP BY
					--REQ_ID
					ID_FORMASI
				UNION ALL
				SELECT
					--REQ_ID	,
					ID_FORMASI,
					COUNT(*) AS jml_pelamar
				FROM
					rec_pelamar_internal_history
				WHERE
					--REQ_ID	= b.req_id
					ID_FORMASI = a.ID_FORMASI
					AND (ID_ROOM = a.ID_ROOM OR ISNULL(a.ID_ROOM,'')='')
					AND STATUS = '11'
				GROUP BY
					--REQ_ID
					ID_FORMASI
			) AS x
		GROUP BY
			ID_FORMASI
	) AS jml
	OUTER APPLY
	(
		SELECT 
			x.NIP
		FROM 
			REC_PELAMAR_INTERNAL_HISTORY AS x
			INNER JOIN
			REC_RENCANA_PEMENUHAN_PEG AS y ON x.ID_FORMASI = y.ID_FORMASI
		WHERE
			x.STATUS = '9'
			AND y.mpp_id = b.mpp_id
			AND x.NIP = a.nip
			AND x.ID_PELAMAR = a.ID_PELAMAR_SEBELUMNYA
		GROUP BY
			x.NIP
	) AS pindah
	LEFT JOIN REC_ROOM_FORMASI_FUNCTIONAL AS r ON a.ID_ROOM = r.ID
WHERE
	a.nip = '$login_nip'
	AND a.STATUS = '11'
	AND b.mpp_id = '$mpp_id_curr'";
	
//$f->pre($sql1);
$rs1 = $db->Execute($sql1);
$no = 0;
while($row = $rs1->FetchRow()){
	foreach($row as $key=>$val){
		$key=strtolower($key);
		$$key=$val;
	}
	$no++;
	if ($no % 2 === 0) {
		$oddeven = 'even';
	} else {
		$oddeven = 'odd';
	}
	
	$label_dampak = "";
	if ($ada_fto) {
		$label_dampak = $dampak;
	}
		
	//echo "<tr class=\"$oddeven\">
	echo "<tr>
            <td valign=top style='text-align:right;'>$no.</td>
            <td valign=top>
				<table border=\"0\" style=\"border-collapse: initial; width: 100%;\">
				<tr>
					<td width=\"120px\" style=\"border: none;\"><B>Kantor</B></td>
					<td width=\"4\" style=\"border: none;\">:</td>
					<td style=\"border: none;\">$kantor</td>
				</tr>
				<tr>
					<td style=\"border: none;\"><B>Bidang</B></td>
					<td width=\"4\" style=\"border: none;\">:</td>
					<td style=\"border: none;\">$bidang</td>
				</tr>
				<tr>
					<td style=\"border: none;\"><B>Satuan Kerja</B></td>
					<td width=\"4\" style=\"border: none;\">:</td>
					<td style=\"border: none;\">$satker</td>
				</tr>
				<tr>
					<td style=\"border: none;\"><B>Formasi</B></td>
					<td width=\"4\" style=\"border: none;\">:</td>
					<td style=\"border: none;\">".$posisi_jabatan." ".$nm_room." ".$label_dampak."</td>
				</tr>
				<tr>
					<td style=\"border: none;\"><B>Batas Akhir</B></td>
					<td width=\"4\" style=\"border: none;\">:</td>
					<td style=\"border: none;\">".$f->convert_date_id($tanggal_selesai)." Pukul $jam_selesai WIB</td>
				</tr>
				<tr>
					<td style=\"border: none;\"><b>Keterangan </b></td>
					<td width=\"4\" style=\"border: none;\">:</td>
					<td style=\"border: none;\">".html_entity_decode($keterangan)."</td>
				</tr>
				<tr>
					<td style=\"border: none;\"><b>Jumlah Pelamar </b></td>
					<td width=\"4\" style=\"border: none;\">:</td>
					<td style=\"border: none;\">$jml_pelamar</td>
				</tr>
				<tr>
					<td style=\"border: none;\"><b>Prioritas Lamaran</b></td>
					<td width=\"4\" style=\"border: none;\">:</td>
					<td style=\"border: none;\"><select name=\"prioritas_$no\" id=\"prioritas_$no\" class=\"prioritas\" onchange=\"ubahprioritas('prioritas_$no')\"";
	if (($status=='0') and ($bisa=='1')) {
		echo "";
	} else {
		echo " disabled";
	}
	echo ">";
	if (empty($prioritas)) {
		echo "<option value=\"\"></option>";
	}
	echo "<option value=\"1\"";
	if($prioritas==1) { echo " selected"; }
	echo ">Pertama</option>
								<option value=\"2\"";
	if($prioritas==2) { echo " selected"; }
	echo ">Kedua</option></select><input type=\"hidden\" name=\"id_prioritas_$no\" id=\"id_prioritas_$no\" value=\"$id_rec_pelamar_internal\">&nbsp;";
	if (($status=='0') and ($bisa=='1')) {
		echo "<input type=\"submit\" class=\"btn2\" value=\"Simpan\">";
	}
	echo "</td></tr></table>";
	if ($pindah=='1') {
		echo "<br><font style=\"color: #ff0000;\"><b>*lamaran dipindahkan</b></font>";
	}
	echo "	</td>
            <td valign=top>".$f->convert_date_id($tanggal_apply)."</td>
            <td valign=top>" . (($status == '5' && $sts_lock_short_list == '0' && !$f->check_exist_value($sql_check_notif)) ? 'Long List' : $status_pelamar);
	if (($status=='0') and ($bisa=='1')) {
			echo "<br><br><input class=\"btn3\" type=\"button\" value=\"Batal\" onClick=\"batal('".base64_encode($nip)."','$req_id','$id_formasi','$id_room')\">";
	}
	echo "</td>
        </tr>"; 

}

echo"</table></form>";
	

$template->tab_bottom();
include("$DOCUMENT_ROOT/kepegawaian/aktivitas_pegawai/footer.php");
?>
