<?php 
ob_start();
$PageSecurity = 4;
$PageName = 'Purchase Requisition';
include('includes/DefinePOClass.php');
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
include('includes/DefineSuppTransClass.php');


?>


<form id="myform" name="" action="" method="post" onsubmit="return validateForm()" >
<input type="hidden" name="modelid" id="modelid" value="<?php echo $_REQUEST['id']; ?>" />
<div id="ItemListDiv">
<table width="100%" border="0" style="border:1px solid #333333;" align="right" cellspacing="0" cellpadding="3">
<tr style="height:30px;">
	<td style="border-bottom:1px solid #FF0000;"><strong>Sr No.</strong></td>
	<td style="border-bottom:1px solid #FF0000;"><strong>Sub Item Name.</strong></td>
	<td style="border-bottom:1px solid #FF0000;"><strong>Sub Item Code.</strong></td>
	<td style="border-bottom:1px solid #FF0000;"><strong>Quantity</strong></td>
</tr>
<?php 

$z=0;
$t=0;
$SQLmappedVenderList=DB_query("SELECT * FROM item_master WHERE make='".$_REQUEST['id']."' ",$db);
$numrow=DB_num_rows($SQLmappedVenderList);
if($numrow>0)
{
while($GetVendor=DB_fetch_array($SQLmappedVenderList))
{

$sql_query=DB_query("select * from prd_model_sub_group where parentid='".$_REQUEST['id']."' 
                     and mst_itemid='".$GetVendor['id']."'",$db);

$row_query=DB_fetch_array($sql_query);
if($row_query['qty']!='')
{
$t=$t+1;
$qty=$row_query['qty'];
$disable="disabled";
}
else
{
$qty='';
$disable="";
}


?>
<tr style="height:25px;">
	<td ><?php echo $z+1; ?></td>
	<td><?php echo $GetVendor['item_name']; ?>	</td>
	<td><?php echo $GetVendor['StockID']; ?>	</td>
	<td><input type="text" name="quantity[<?php echo $GetVendor['id']; ?>]" id="quantity_<?php echo $z; ?>" value="<?php echo $qty; ?>" <?php if($disable!='') { ?> readonly="readonly" <?php } ?> >	</td>
	<td ><input type="checkbox" name="vendorId[]" id="vendorId_<?php echo $z; ?>" <?php echo $disabled; ?> <?php echo $checked; ?> value="<?php echo $GetVendor['id']; ?>"
	onclick="getDetails('<?php echo $z ; ?>')" <?php echo $disable; ?>></td>
</tr>
<?php $z++;} ?>
<input type="hidden" name="count" id="count" value="<?php echo $z; ?>">
	</tr> 
	
	          <?php if($t<$numrow)
			  { ?>
				<tr>
				<td colspan="5"><input type="submit" name="Save" value="Save" class="search"></td></tr>
				<?php } ?>
			<?php 	}  else { ?>
			
			<tr><td colspan="5">No Records Found </td></tr>
			
			<?php } ?>
			
				
</table>

</div>
</form>
