<script type="text/javascript">
$(document).ready(function(){
	$("#ubah").focus();
	
	$("#ubah").click(function(){
		$("#txt_limit").focus();
	});
	
	$("#simpan").click(function(){
		simpan_data();
	});

	function simpan_data(){		
		var limit  		= $("#txt_limit").val();
		var ucapan 	= $("#txt_ucapan").val();
		
		$.ajax({
			type	: "POST",
			url	: "spv/standard/simpan.php",
			data	: "limit="+limit+					
					"&ucapan="+ucapan,
			timeout	: 2000,
			beforeSend	: function(){		
				$("#info").html("<img src='loading.gif' />");			
			},				  
			success	: function(data){
				$("#info").html(data);
				window.location.reload();
			}
		});
	}
	
	$("#keluar").click(function(){
		document.location='?module=home';
	});
});
</script>

<?php
include "../../inc/inc.koneksi.php";

$data	=mysql_query("SELECT * FROM standard");
$r			=mysql_fetch_assoc($data);

$limit			=$r[limit_pot];
$ucapan	=$r[ucapan];		
$update	=$r[lastupdate];
		
echo "<table width='100%' style='font:14px arial'>
	<tr>
		<td width='20%'>Maksimum Potongan Penjualan</td>
		<td>: Rp <input type='text' id='txt_limit' value='$limit' size='10' class='input'></td>
	</tr>
	<tr>
		<td>Memo Struk Belanja</td>
		<td>: <input type='text' id='txt_ucapan' value='$ucapan' size='50' lenght='50' class='input'></td>
	</tr>
	<tr>
		<td>Update Terakhir</td>
		<td>: <b>$update</b></td>
	</tr>
</table>
<hr>

<table width='100%'>
	<tr>
		<td align='center' style='font:14px arial'>
			<button id='simpan'>Simpan</button>
			<button id='ubah'>Ubah</button>
			<button id='keluar'>Tutup</button>
		</td>
	</tr>
</table>";

echo "<div id='tampil_update'></div>";
?>