<? ob_start();
session_start();
 include("../../include/dbconnect.php");
 $count=1;
for($ind=0;$ind < count($porecord);$ind++)
{
	if($matselect[$ind]=="Yes")
	{
		$count ++;
	}
}
if($count >2)
{
?>
<script language="JavaScript">
	alert("At a time, MIN can be prepared for one material.  Please remove Tick marks and re submit");

</script>

<?
exit;
}
?>

<title>MIN Preparation</title>
<body background="blater01.gif" topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=861>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2" align="center"><font class="Wf"><b>INWARD MATERIAL INSPECTION ENTRY</b></font></td>
</tr><tr valign="top"><td colspan=2>
<font class="Wf">&nbsp;</font>
</td>
</tr>
</table>


<form method="POST"  name="inspection" action="con_post.php">
<table border=0 cellpadding=3 cellspacing=4 width="590">


<SCRIPT LANGUAGE="JavaScript" src="../../include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>

<table width="862" border="1"  cellpadding="1">  
<?
for($ind=0;$ind < count($porecord);$ind++)
{
	if($matselect[$ind]=="Yes")
	{
		$query = "select supplier.name,rawmaterial.prodname,po_no,po_date,qty-received_qty,specifications,remarks,matpo.unit from matpo,rawmaterial,supplier where matpo.record ='$porecord[$ind]' and supplier.bcode = matpo.bcode and matpo.prodcode = rawmaterial.prodcode ";
		$result = mysql_query($query) or die(mysql_error());
		while($row = mysql_fetch_row($result))
		{
			$date1 = substr($row[3],8,2).'-'.substr($row[3],5,2).'-'.substr($row[3],0,4);
			
			
			?>

			<tr >
			<td width="53"  bgcolor="#D2D2FF"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>PO No</b></font></td>
			<td width="68"  bgcolor="#FFCEE7"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Date</b></font></td>
			<td width="167" bgcolor="#EAE2C4"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Supplier Name</b></font></td>	
			<td width="193" bgcolor="#CCCC66"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Material</b></font></td>
		
			<td width="68"  bgcolor="#FFFFDD"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Pending Qty</b></font></td>
			<td width="157" bgcolor="#D0E8E8"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b> Specificatins</b></font>	</td>												

			</tr>
			<tr >
			<td width="53"  bgcolor="#D2D2FF" align="center"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b><?	echo($row[2]); ?></b></font></td>
			<td width="68" bgcolor="#FFCEE7"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b><?	echo($date1); ?></b></font></td>
			<td width="167" bgcolor="#EAE2C4"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b><?	echo($row[0]); ?></b></font></td>
			<td bgcolor="#CCCC66"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b><?	echo($row[1]); ?></b></font></td>
	
			<td width="68" align="center" bgcolor="#FFFFDD"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b><?	echo($row[4]); ?><?	echo($row[7]); ?></b></font></td>
			<td width="157" bgcolor="#D0E8E8"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b> <textarea readonly  cols="20" rows="2"><?	echo($row[5]); ?></textarea></b></font>

													
			</tr>
			</table>
			<input type="hidden" name="p_record" value="<? echo($porecord[$ind]);?>">

			<table width="862" border="1"  cellpadding="1">  
			
			<tr>
			<td width="53"  bgcolor="#D2D2FF"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Invoice No</b></font></td>
			<td><input type="text"    onKeyPress="return event.keyCode!=13"   name="invno" size="15" value=""></td>
              <td width="25%" align="center" valign="top" bgcolor="#D2D2FF"><span id="lbl_invdate"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Invoice Date</b></font> </span></td>
              
    <td width="26%"> 
      <?
						 // echo $invdate;
						  if(empty($invdate))
						  {
						   $invdate=strftime ("%d/%m/%Y", mktime (0,0,0,date("m"),date("d"),date("Y"))); 
						  }
						?>
		<input name="invdate" type="text" class="text_box_button" value="<?=$invdate?>" size="15" readonly  >						
      <A HREF="#" onClick="cal.select(document.inspection.invdate,'anchor1','dd/MM/yyyy'); return false;"NAME="anchor1" ID="anchor1"><img  src="../../images/cal.gif" border="0">
      
      </A> <BR>
			  </td>
			</tr>
			

			</table>

			
			<table width="862" border="1"  cellpadding="1">  
			<tr bgcolor="#FFB0B0">
			<td  align="center"><font  color="#990000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Accepted Qty<blink>(Unit as per Stock Register)</blink></b></font></td>			
			<td  align="center"><font  color="#990000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b> Qty<blink>(In Nos, If required)</blink></b></font></td>
			<td   align="center"><font color="#990000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Rejected Qty(<blink>KGS)</blink></b></font></td>			

			</tr>
			<tr>
			<td  align="center" bgcolor="#E1B7FB"><input type="text"    onKeyPress="return event.keyCode!=13"   name="accepted_qty" value=""></td>			
			<td  align="center" bgcolor="#E1B7FB"><input type="text"    onKeyPress="return event.keyCode!=13"   name="accepted_qty_nos" value=""></td>			
			<td  align="center" bgcolor="#E1B7FB"><input type="text"    onKeyPress="return event.keyCode!=13"   name="rejected_qty" value=""></td>			

			</tr>
						</table>			
			
			<table width="862" border="1"  cellpadding="1">  
			<tr bgcolor="#FFB0B0">
			<td  align="center"><font  color="#990000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Inspector</b></font></td>
			<td   align="center"><font color="#990000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Incharge Q.C</b></font></td>			
			<td   align="center"><font color="#990000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Accepted / Rejected</b></font></td>						
			</tr>
			<tr>
			<td  align="center" bgcolor="#E1B7FB"><input type="text"    onKeyPress="return event.keyCode!=13"   name="inspector" value=""></td>			
			
    <td  align="center" bgcolor="#E1B7FB"><input type="text"    onKeyPress="return event.keyCode!=13"   name="incharge_qc" value=""></td>			
			<td  align="center" bgcolor="#E1B7FB"><input type="text"    onKeyPress="return event.keyCode!=13"   name="status" value="Accepted / Rejected"></td>			
			</tr>
						</table>
						
						
									
			
			
			

<?
			
			
			
			
						
		}		
	}
}

?>
<table cellpading=0 cellspacing=10 width= 50>
<tr>
<td>
 <blockquote>  <input type =submit name=submit value = "Submit"></blockquote>
</table>

<center><font color="#000080"><font size="+1"><a href="/wilson/stores.html">Exit </a></font></center>

</body>
</form>
