<?php
include "../../include/config.php";
$start = isset($_REQUEST['start'])? $_REQUEST['start'] : '';
$end   = isset($_REQUEST['end'])? $_REQUEST['end'] : '';
$jenis = isset($_REQUEST['jenis'])? $_REQUEST['jenis'] : '';
if(isset($_REQUEST['proses'])=="PROSES"){
	#query
	$no=1;
	$qh = mysql_query("select * from log_outgoing where tgl_dokpab between '$start' and '$end' and jenis_dokpab='$jenis' and sumber='CIE' order by no_dokpab, no_urut asc");	
	while($dh=mysql_fetch_array($qh)){
		echo "$no. $dh[no_dokpab]==>$dh[no_urut]==>$dh[nilai]<br>";
		mysql_query("UPDATE outgoing_detail SET outd_price_usd='$dh[nilai]' where outd_hid in(select id from outgoing where 
		outh_docdate between '$start' and '$end' and outh_doctype='$jenis' and sumber='CIESA' and outh_status=20 and outh_docno='$dh[no_dokpab]') and no_urut='$dh[no_urut]'");
	  $no++;	
	}
}
?>
<form action="maintenance_out.php" method="post" name="form" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
	  <td colspan="9">Periode :
	      <input type="text" name="start" size="9" value="<?=$start;?>" style="border-collapse:inherit">&nbsp;s/d&nbsp;
	      <input type="text" name="end" size="9" value="<?=$end;?>" style="border-collapse:inheri">
		  <select name="jenis">
			<?php
			  $dataSql = mysql_query("SELECT id,doc_type FROM document_type WHERE doc_status=2 ORDER BY  id ASC");
			  while ($dataRow = mysql_fetch_array($dataSql)) {
				if ($dataRow['doc_type']== $jenis) {
					$cek = " selected";
				} else { $cek=""; }
				echo "<option value='$dataRow[doc_type]' $cek>$dataRow[doc_type]</option>";
			  }
			  $sqlData ="";
			?>
		  </select>
	      <input type="submit" name="proses" value="PROSES" style="cursor:pointer">
		</td>
	</tr>
</table>
</form>