<script type="text/javascript">
$(document).ready(function(){
	$("#mulai").click(function(){		
		cari_data();
		$("#txt_kwprs").focus();
	});
	
	function cari_data(){
		var no=1;
		$.ajax({
			type	: "POST",
			url		: "modul/default/cari_data.php",
			data	: "no="+no,
			dataType: "json",
			success	: function(data){
				$("#txt_kwprs").val(data.kwprs);
				$("#txt_kwkar").val(data.kwkar);
				$("#txt_kwtot").val(data.kwtot);
				$("#txt_tkprs").val(data.tkprs);
				$("#txt_tkkar").val(data.tkkar);
				$("#txt_tktot").val(data.tktot);
				$("#txt_ptkpwp").val(data.ptkpwp);
				$("#txt_ptkpis").val(data.ptkpis);
				$("#txt_ptkpan").val(data.ptkpan);
				$("#txt_maxanak").val(data.maxanak);
				$("#txt_prosbj").val(data.prosbj);
				$("#txt_maxbj").val(data.maxbj);
				$("#txt_netgaji1").val(data.netgaji1);
				$("#txt_prospph1").val(data.prospph1);
				$("#txt_netgaji2").val(data.netgaji2);
				$("#txt_prospph2").val(data.prospph2);
				$("#txt_netgaji3").val(data.netgaji3);
				$("#txt_prospph3").val(data.prospph3);
				$("#txt_prospph4").val(data.prospph4);
				$("#t_netgaji1").val(data.netgaji1);
				$("#t_netgaji2").val(data.netgaji2);
				$("#t_netgaji3").val(data.netgaji3);
				$("#t_netgaji3a").val(data.netgaji3);
			}
		});
	}
	
	$("#txt_kwprs").keyup(function(){		
		hitung_kwtot();
	});
	
	$("#txt_kwkar").keyup(function(){
		hitung_kwtot();
	});
	
	function hitung_kwtot(){
		var kwprs = $("#txt_kwprs").val();
		var kwkar = $("#txt_kwkar").val();
		var kwtot = parseFloat(kwprs)+parseFloat(kwkar);
		
		$("#txt_kwtot").val(kwtot);
	}
	
	$("#txt_tkprs").keyup(function(){
		hitung_tktot();
	});
	
	$("#txt_tkkar").keyup(function(){
		hitung_tktot();
	});
	
	function hitung_tktot(){
		var tkprs = $("#txt_tkprs").val();
		var tkkar = $("#txt_tkkar").val();
		var tktot = parseFloat(tkprs)+parseFloat(tkkar);
		
		$("#txt_tktot").val(tktot);
	}
	
	$("#txt_netgaji1").keyup(function(){
		var netgaji1 = $("#txt_netgaji1").val();
		$("#t_netgaji1").val(netgaji1);		
	});
	
	$("#txt_netgaji2").keyup(function(){
		var netgaji2 = $("#txt_netgaji2").val();
		$("#t_netgaji2").val(netgaji2);
	});
	
	$("#txt_netgaji3").keyup(function(){
		var netgaji3 = $("#txt_netgaji3").val();
		$("#t_netgaji3").val(netgaji3);
		$("#t_netgaji3a").val(netgaji3);
	});
	
	$("#simpan").click(function(){
		simpan_data();
		return false;
	});

	function simpan_data(){
		var	kwprs  	= $("#txt_kwprs").val();
		var	kwkar   = $("#txt_kwkar").val();
		var	tkprs  	= $("#txt_tkprs").val();
		var	tkkar   = $("#txt_tkkar").val();
		var	ptkpwp 	= $("#txt_ptkpwp").val();
		var	ptkpis  = $("#txt_ptkpis").val();
		var	ptkpan 	= $("#txt_ptkpan").val();
		var	maxanak = $("#txt_maxanak").val();
		var	prosbj 	= $("#txt_prosbj").val();
		var	maxbj   = $("#txt_maxbj").val();
		var	netgaji1= $("#txt_netgaji1").val();
		var	prospph1= $("#txt_prospph1").val();
		var	netgaji2= $("#txt_netgaji2").val();
		var	prospph2= $("#txt_prospph2").val();
		var	netgaji3= $("#txt_netgaji3").val();
		var	prospph3= $("#txt_prospph3").val();
		var	prospph4= $("#txt_prospph4").val();
		
		var error = false;
 
		if(error == false){
		$.ajax({
			type	: "POST",
			url		: "modul/default/simpan.php",
			data	: "kwprs="+kwprs+
					"&kwkar="+kwkar+
					"&tkprs="+tkprs+
					"&tkkar="+tkkar+
					"&ptkpwp="+ptkpwp+
					"&ptkpis="+ptkpis+
					"&ptkpan="+ptkpan+
					"&maxanak="+maxanak+
					"&prosbj="+prosbj+
					"&maxbj="+maxbj+
					"&netgaji1="+netgaji1+
					"&prospph1="+prospph1+
					"&netgaji2="+netgaji2+
					"&prospph2="+prospph2+
					"&netgaji3="+netgaji3+
					"&prospph3="+prospph3+
					"&prospph4="+prospph4,					
					
			timeout	: 2000,
			beforeSend	: function(){		
				$("#info").html("<img src='loading.gif' />");			
			},				  
			success	: function(data){
				$("#info").html(data);		
				$("#akses").val(1);
				$(".input").val('');							
			}
		});
		}
		return false;
	}
	
	$("#keluar").click(function(){
		document.location='?module=home';
	});
});
</script>

<?php
echo "<input type='hidden' id='akses'>";

echo "<table align='right'>
		<tr>
			<td>
				<button name='mulai' id='mulai'>Ubah</button>
				<button name='simpan' id='simpan'>Rekam</button>
				<button name='keluar' id='keluar'>Keluar</button>
			</td>
		</tr>
		</table>";
		
		echo "<p><b>Prosentase Potongan BPJS dari Gaji Pokok :</b></p>
			<table>
			<tr>
				<td>Kawin</td>
				<td>--</td>
				<td>Perusahaan</td>
				<td>:</td>
				<td><input type='text' name='txt_kwprs' id='txt_kwprs' size='5' lenght='5' class='input'> %</td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td>Karyawan</td>
				<td>:</td>
				<td><input type='text' name='txt_kwkar' id='txt_kwkar' size='5' lenght='5' class='input'> %</td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td>Total</td>
				<td>:</td>
				<td><input type='text' name='txt_kwtot' id='txt_kwtot' size='5' lenght='5' class='input' > %</td>
			</tr>
			<tr>
				<td>Tidak Kawin</td>
				<td>--</td>
				<td>Perusahaan</td>
				<td>:</td>
				<td><input type='text' name='txt_tkprs' id='txt_tkprs' size='5' lenght='5' class='input' > %</td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td>Karyawan</td>
				<td>:</td>
				<td><input type='text' name='txt_tkkar' id='txt_tkkar' size='5' lenght='5' class='input' > %</td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td>Total</td>
				<td>:</td>
				<td><input type='text' name='txt_tktot' id='txt_tktot' size='5' lenght='5' class='input' > %</td>
			</tr>
			</table>
			<hr>
			
			<p><b>Ketentuan PTKP dan Biaya Jabatan :</b></p>			
			<table>			
			<tr>
				<td>PTKP Wajib Pajak</td>
				<td>: Rp</td>				
				<td><input type='text' name='txt_ptkpwp' id='txt_ptkpwp' size='10' lenght='10' class='input' > per tahun</td>
			</tr>
			<tr>
				<td>Status Kawin</td>
				<td>: Rp</td>				
				<td><input type='text' name='txt_ptkpis' id='txt_ptkpis' size='10' lenght='10' class='input' > per tahun</td>
			</tr>
			<tr>
				<td>Tanggungan Anak</td>
				<td>: Rp</td>
				<td align='right'><input type='text' name='txt_ptkpan' id='txt_ptkpan' size='10' lenght='10' class='input' > per anak per tahun</td>
				<td>Maksimal <input type='text' name='txt_maxanak' id='txt_maxanak' size='2' lenght='2' class='input' > orang</td>
			</tr>
			<tr>
				<td>Biaya Jabatan</td>
				<td>:</td>
				<td><input type='text' name='txt_prosbj' id='txt_prosbj' size='5' lenght='5' class='input' > % x Penghasilan Bruto</td>
				<td>Maksimal Rp <input type='text' name='txt_maxbj' id='txt_maxbj' size='10' lenght='10' class='input' > per tahun</td>
			</tr>
			</table>			
			<hr>
			
			<p><b>Ketentuan Tarip PPh Pasal 21 :</b></p>			
			<table>
			<tr>
				<td>Penghasilan Netto s/d</td>
				<td>Rp</td>
				<td><input type='text' name='txt_netgaji1' id='txt_netgaji1' size='10' lenght='10' class='input' ></td>
				<td>:</td>
				<td><input type='text' name='txt_prospph1' id='txt_prospph1' size='5' lenght='5' class='input' > % x Penghasilan Netto</td>
			</tr>			
			<tr>
				<td></td>
				<td>Rp</td>
				<td><input type='text' name='txt_netgaji2' id='txt_netgaji2' size='10' lenght='10' class='input' ></td>
				<td>:</td>
				<td><input type='text' name='txt_prospph2' id='txt_prospph2' size='5' lenght='5' class='input' > % x Penghasilan Netto - Rp <input type='text' name='t_netgaji1' id='t_netgaji1' size='10' lenght='10' class='input' readonly/></td>
			</tr>
			<tr>
				<td></td>
				<td>Rp</td>
				<td><input type='text' name='txt_netgaji3' id='txt_netgaji3' size='10' lenght='10' class='input' ></td>
				<td>:</td>
				<td><input type='text' name='txt_prospph3' id='txt_prospph3' size='5' lenght='5' class='input' > % x Penghasilan Netto - Rp <input type='text' name='t_netgaji2' id='t_netgaji2' size='10' lenght='10' class='input' readonly/></td>
			</tr>
			<tr>
				<td align='right'>lebih dari</td>
				<td>Rp</td>
				<td align='right'><input type='text' name='t_netgaji3' id='t_netgaji3' size='10' lenght='10' class='input' ></td>
				<td>:</td>
				<td align='right'><input type='text' name='txt_prospph4' id='txt_prospph4' size='5' lenght='5' class='input' > % x Penghasilan Netto - Rp <input type='text' name='t_netgaji3a' id='t_netgaji3a' size='10' lenght='10' class='input' readonly/></td>
			</tr>
		</table>
		<hr>";
?>