<?php include("../../include/dbconnect.php"); 



$inv_date = substr($invdate,6,4).'-'.substr($invdate,3,2).'-'.substr($invdate,0,2);
$tc_date = substr($tcdate,6,4).'-'.substr($tcdate,3,2).'-'.substr($tcdate,0,2);
$min_dt = substr($mindate,6,4).'-'.substr($mindate,3,2).'-'.substr($mindate,0,2);

$query = "select matpo_record  from mat_purreg where record ='$record' ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_row($result);
$matpo_record = $row[0];

$query = "select indent_record  from matpo where record ='$matpo_record' ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_row($result);
$indent_record = $row[0];	
	



// UPDATE STOCK 




			$query= "update matindent set received_qty = '$receipt' where record='$indent_record'";
			mysql_query($query) or die(mysql_error());

			$query= "update matpo set received_qty = $receipt,rejected_qty = $rejected_qty,min_no ='$min_no',min_date='$min_dt'  where record ='$matpo_record'";
			mysql_query($query) or die(mysql_error());			

			$query="update mat_purreg set receipt='$receipt',issue='$issue',balance='$balance',rejected_qty='$rejected_qty',invno='$inv_no',inv_date='$inv_date',inspector='$inspector',incharge_qc='$incharge_qc',status='$status' where record ='$record' ";
			mysql_query($query) or die (mysql_error());
			
			$query= "update stktrans set prqty = $receipt  where mat_pur_record ='$record'";
			mysql_query($query) or die(mysql_error());
				
					


?>

<br>
<br>
<br>

<br><br><font size=1><center><a href= "matin.php">Make another MIN</center></font>
<br><br><font size=1><center><a href= "/wilson/stores.html">Return to index page</center></font>
