<script language="javascript">
	$(document).ready(function() {
		$("#bkdate").datepicker({
			dateFormat: "yy-mm-dd",
			changeMonth: true,
			changeYear: true,
		});
	});

	function save_click() {
		if (form.py_tipe.value == 0) {
			alert("Silakan pilih tipe penyusutan.");
			form.py_tipe.focus();
			return false;
		} else if (form.py_nmbarang.value == "") {
			alert("Silakan isi nama barang.");
			form.py_nmbarang.focus();
			return false;
		} else if ((form.py_stbarang.value == "")) {
			alert("Silakan isi satuan.");
			form.py_stbarang.focus();
			return false;
		} else if ((form.py_umur.value == "")) {
			alert("Silakan isi umur barang.");
			form.py_umur.focus();
			return false;
		} else if ((form.py_nilai.value == "")) {
			alert("Silakan isi nilai barang.");
			form.py_nilai.focus();
			return false;
		} else {
			var a = confirm("Apakah anda yakin akan menyimpan data?");
			if (a == true) {
				form.action = '?page=Proses-Penyusutan&Act=SAVE';
				form.method = 'post';
				form.submit();
				return true;
			}
		}
	}

	function close_click() {
		form.action = '?page=Proses-Penyusutan&Act=CLOSE'
		form.method = 'post';
		form.submit();
		return true;
	}
</script>
<form action="#" method="post" name="form" enctype="multipart/form-data">
	<table width="100%">
		<tr>
			<th colspan="4">INPUT DATA MASTER PENYUSUTAN</th>
		</tr>
		<tr>
			<td colspan="4">&nbsp;</td>
		</tr>
		<tr>
			<td width="15%">Tanggal</td>
			<td width="35%">: <input type="hidden" name="py_id" size="27" value="<?= $py_id; ?>">
				<input type="text" name="py_tanggal" value="<?php if (empty($py_tanggal)) {
																$py_tanggal = $date;
															}
															echo $py_tanggal; ?>" size="12" id="bkdate" readonly="true"
					style="background-color:#CCFFFF " />
			</td>
			<td width="15%">&nbsp;</td>
			<td width="35%">&nbsp;</td>
		</tr>
		<tr>
			<td>Tipe Penyusutan</td>
			<td>:
				<select name="py_tipe">
					<option value="0" selected="selected">PILIH</option>
					<?php
					$dataSql = mysql_query("SELECT id, pyt_tipe FROM penyusutan_tipe WHERE pyt_status=10 ORDER BY id ASC");
					while ($dataRow = mysql_fetch_array($dataSql)) {
						if ($dataRow['id'] == $py_tipe) {
							$cek = " selected";
						} else {
							$cek = "";
						}
						echo "<option value='$dataRow[id]' $cek>$dataRow[pyt_tipe]</option>";
					}
					$sqlData = "";
					?>
				</select>
			</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>Nama Barang</td>
			<td>: <input type="text" name="py_nmbarang" size="50" value="<?= $py_nmbarang; ?>"></td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>Satuan Barang</td>
			<td>: <input type="text" name="py_stbarang" size="10" value="<?= $py_stbarang; ?>"></td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>Jumlah</td>
			<td>: <input type="text" name="py_jumlah" size="5" value="<?= $py_jumlah; ?>" style="text-align:center"></td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>Tarif</td>
			<td>: <input type="text" name="py_tarif" size="5" value="<?= $py_tarif; ?>" style="text-align:center">%</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>Umur</td>
			<td>: <input type="text" name="py_umur" size="5" value="<?= $py_umur; ?>" style="text-align:center">bulan</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>Nilai</td>
			<td>: <input type="text" name="py_nilai" size="15" value="<?= $py_nilai; ?>" style="text-align:right"></td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td colspan="4">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="4" align="center">
				<input type="button" name="btnSave" value="SIMPAN" style="cursor:pointer" onclick="save_click();">
				<input type="button" name="btnclose" value="BATAL" style="cursor:pointer" onclick="close_click();" />
			</td>
		</tr>
	</table>
</form>