<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="function/dataTables/media/css/demo_page.css">
<link rel="stylesheet" href="function/dataTables/media/css/demo_table_jui.css">
<link rel="stylesheet" href="function/dataTables/media/themes/smoothness/jquery-ui-1.8.4.custom.css">
<script type="text/javascript" src="function/dataTables/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript">
	$(document).ready(function(){ 
		$("#fromdate").datepicker({
			dateFormat : "yy-mm-dd",
			changeMonth : true,
			changeYear : true,
		});
	});
	$(document).ready(function(){
		$("#todate").datepicker({
			dateFormat : "yy-mm-dd",
			changeMonth : true,
			changeYear : true,
		});
	});
	$(document).ready( function () {
		var oTable = $('#myTables').dataTable( {
			 "sDom": 'R<"H"lfr>t<"F"ip>',
			 "bJQueryUI": true,
			 "sPaginationType": "full_numbers",
			 "iDisplayLength" :25
		});
	});
	function setTrColor(obj, color)
	{
		obj.style.backgroundColor=color;
		obj.onmouseout = function(){
				obj.style.backgroundColor=''; 
		}
	}	
	function savep_click(){
		form.action ='?page=Proses-Stock-Opname&Act=SAVEP';
		form.method = 'post';
		form.submit();			
		return true;
	}
	function close_click(){
		form.action ='?page=Proses-Stock-Opname&Act=CLOSE';
		form.method = 'post';
		form.submit();			
		return true;
	}
	function pcls_click(pcls){
		form.action ='?page=Proses-Stock-Opname&Act=SELP&pcls='+pcls;
		form.method = 'post';
		form.submit();			
		return true;
	}
</script>
</head>
<body>
<?php
	$sbulan = substr($start_date,5,2);
	$stahun = substr($start_date,0,4);
	$ebulan = substr($end_date,5,2);
	$etahun = substr($end_date,0,4);		
?>
<form action="#" method="post" name="form">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
	<tdalign="center"><h1><b>PERIODE AKTIF</b></h1></td>
  </tr>
  <tr>
	<td>Periode:
		  <select name="pcls" onchange="pcls_click(this.value)">
			  <?php if($pcls=="1"){?>
			  <option value="0">Pilih</option>
			  <option value="1" selected="selected">Per Bulan</option>
			  <option value="3">Per 3 Bulan</option>
			  <?php }elseif($pcls=="3"){?>
			  <option value="0">Pilih</option>
			  <option value="1">Per Bulan</option>
			  <option value="3" selected="selected">Per 3 Bulan</option>
			  <?php }else{ ?>
			  <option value="0" selected="selected">Pilih</option>
			  <option value="1">Per Bulan</option>
			  <option value="3">Per 3 Bulan</option>
			  <?php } ?>
		  </select>
		  <?php if($pcls=="1"){?>
		  <select name="sbulan">
			   <?php
				$bln = array('','Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
				for($n=1; $n<=12; $n++){
				if ($n == $sbulan) {
					$cek = " selected";
				} else { $cek=""; }
			   ?>
				<option value="<?=$n;?>" <?=$cek;?>><?=$bln[$n];?></option>
			   <?php } ?>
		  </select>
		  <?php }elseif($pcls=="3"){?>
		  <select name="periode">
			  <?php if($sbulan=="01" && $ebulan=="03"){?>
			  <option value="per0">Pilih</option>
			  <option value="per1" selected="selected">Periode 1 (Januari ~ Maret)</option>
			  <option value="per2">Periode 2 (April ~ Juni)</option>
			  <option value="per3">Periode 3 (Juli ~ September)</option>
			  <option value="per4">Periode 4 (Oktober ~ Desember)</option>
			  <?php }elseif($sbulan=="04" && $ebulan=="06"){?>
			  <option value="per0">Pilih</option>
			  <option value="per1">Periode 1 (Januari ~ Maret)</option>
			  <option value="per2" selected="selected">Periode 2 (April ~ Juni)</option>
			  <option value="per3">Periode 3 (Juli ~ September)</option>
			  <option value="per4">Periode 4 (Oktober ~ Desember)</option>
			  <?php }elseif($sbulan=="07" && $ebulan=="09"){?>
			  <option value="per0">Pilih</option>
			  <option value="per1">Periode 1 (Januari ~ Maret)</option>
			  <option value="per2">Periode 2 (April ~ Juni)</option>
			  <option value="per3" selected="selected">Periode 3 (Juli ~ September)</option>
			  <option value="per4">Periode 4 (Oktober ~ Desember)</option>
			  <?php }elseif($sbulan=="10" && $ebulan=="12"){?>
			  <option value="per0">Pilih</option>
			  <option value="per1">Periode 1 (Januari ~ Maret)</option>
			  <option value="per2">Periode 2 (April ~ Juni)</option>
			  <option value="per3">Periode 3 (Juli ~ September)</option>
			  <option value="per4" selected="selected">Periode 4 (Oktober ~ Desember)</option>
			  <?php }else{?>
			  <option value="per0" selected="selected">Pilih</option>
			  <option value="per1">Periode 1 (Januari ~ Maret)</option>
			  <option value="per2">Periode 2 (April ~ Juni)</option>
			  <option value="per3">Periode 3 (Juli ~ September)</option>
			  <option value="per4">Periode 4 (Oktober ~ Desember)</option>
			  <?php } ?>
	      </select>
		  <?php } ?>
		  <input type="text" size="4" name="ptahun" value="<?=$etahun;?>" />  	 
		  <input type="button" name="save" value="SIMPAN" style="cursor:pointer" onclick="savep_click();">
		  <input type="button" name="close" value="TUTUP" style="cursor:pointer" onClick="close_click();" />
	</td>		
  </tr>
</table>
</form>
</body>
</html>
