<!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" :10
		});
	});
	function setTrColor(obj, color)
	{
		obj.style.backgroundColor=color;
		obj.onmouseout = function(){
				obj.style.backgroundColor=''; 
		}
	}
	function save_click(){
		form.action ='?page=Proses-Penyusutan&Act=AUTS';
		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>
</head>
<body>
<form action="#" method="post" name="form" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
	<td colspan="10" align="center"><h1><b>DATA BARANG MODAL/ASSET</b></h1></td>
  </tr>
  <tr>
	<td colspan="10">Proses :
	     <!--<select id="bulan" name="bulan">
		   <?php
			$bln = array('','Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
			for($n=1; $n<=12; $n++){
			if ($n == $bulan) {
				$cek = " selected";
			} else { $cek=""; }
		   ?>
		   	<option value="<?=$n;?>" <?=$cek;?>><?=$bln[$n];?></option>
		   <?php } ?>
		  </select>
		  <input type="text" id="tahun" name="tahun" size="4" value="<?=$tahun;?>">
		  <input type="text" id="fromdate" name="fromdate" size="9" value="<?=$fromdate;?>" style="border-collapse:inherit"  readonly="true">&nbsp;s/d&nbsp;
	      <input type="text" id="todate" name="todate" size="9" value="<?=$todate;?>" style="border-collapse:inheri" readonly="true">
	      <input type="button" name="cari" value="CARI" style="cursor:pointer" onclick="search_click();">-->
		  <input type="button" name="save" value="SIMPAN" style="cursor:pointer" onClick="save_click();" />
		  <input type="button" name="close" value="TUTUP" style="cursor:pointer" onClick="close_click();" />
	</td>		
  </tr>
</table>  
<table id="myTables" class="display" cellpadding="0" cellspacing="0">
	<thead>	
  <tr>
	<th>No</th>
	<th>Kode Barang</th>
	<th>Nama Barang</th>
	<th>Satuan</th>
	<th>Jumlah</th>
	<th>Nilai</th>
	<th>Umur</th>
	<th>Tarif</th>
	<th>Jenis</th>
  </tr>
  </thead>
	<tbody>
  <?php
	$no=1; $gtprice=0;
	$qd = mysql_query("SELECT a.id, a.incd_qty, a.incd_price, c.prod_code, c.prod_name, c.prod_sat FROM incoming_detail a
	      INNER JOIN incoming b ON b.id=a.incd_hid
		  INNER JOIN product c ON c.id=a.incd_prodid 
		  WHERE b.inch_status=20 AND b.inch_paytype IN('Kas','HT') AND c.prod_cat=2 ORDER BY c.prod_code ASC");
	while($dd=mysql_fetch_array($qd)){		
		$q = mysql_fetch_array(mysql_query("SELECT id FROM penyusutan WHERE py_incdid='$dd[id]' AND py_status<>100"));
		if(empty($q['id'])){
	?> 
	 <tr onmouseover="setTrColor(this, '#FF9900');"> 
		<td align="center"><?=$no;?>.</td>
		<td align="left"><?=$dd['prod_code'];?></td>
		<td align="left"><?=$dd['prod_name'];?></td>
        <td align="center"><?=$dd['prod_sat'];?></td>
        <td align="center"><?=number_format($dd['incd_qty'],2,',','.');?></td>
        <td align="right"><?=number_format($dd['incd_price'],2,',','.');?></td>
        <td align="center"><input type="text" name="py_umur[<?=$dd['id'];?>]" size="5" style="text-align:center"/>&nbsp;bulan</td>
		<td align="center"><input type="text" name="py_tarif[<?=$dd['id'];?>]" size="5" style="text-align:center"/>&nbsp;%</td>
	  	<td align="center">
		   <input type="hidden" name="py_kdbarang[<?=$dd['id'];?>]" value="<?=$dd['prod_code'];?>" />
		   <input type="hidden" name="py_nmbarang[<?=$dd['id'];?>]" value="<?=$dd['prod_name'];?>" />
		   <input type="hidden" name="py_stbarang[<?=$dd['id'];?>]" value="<?=$dd['prod_sat'];?>" />
		   <input type="hidden" name="py_jumlah[<?=$dd['id'];?>]" value="<?=$dd['incd_qty'];?>" />
		   <input type="hidden" name="py_nilai[<?=$dd['id'];?>]" value="<?=$dd['incd_price'];?>" />
           <input type="hidden" name="py_incdid[<?=$dd['id'];?>]" value="<?=$dd['id'];?>" />
		   <select name="py_tipe[<?=$dd['id'];?>]">
		   <option value="BLANK" 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)) {
				echo "<option value='$dataRow[id]'>$dataRow[pyt_tipe]</option>";
			  }
			?>
		 </select>
		</td>
	  </tr>	  
  <?php $no++; } }  ?> 
  </tbody> 
</table>
</form>
</body>
</html>
