<?php extract($_POST);
$PageSecurity = 1;
$tabindex=0;
include('includes/DefinePaymentClass.php');
$title = _('Production Capacity Plan Report');
include('includes/SQL_CommonFunctions.inc');
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
		  	<td align="center" height="30" colspan="6" style="font-family:Arial, Helvetica, sans-serif; font-size:14px;"><div align="center"><strong><?php echo $title;?></strong></div></td>
    </tr>
	<tr>
		<td><div align="center">
			<form  action="" method="post">
			<table  border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#FFFFFF" style="border:1px solid #ccc;">
			  <tr>
				<th  align="left"><strong>Item Code</strong></th>
				<td ><select name="item_code" id="item_code" style="width:98%">
				   <option value="0">---Select---</option>
				  <?php 		
		$site_sql=DB_query("Select id,item_name from item_master where CategoryID='FG' ",$db);
		while($site_row=DB_fetch_array($site_sql)){
				?>
				  <option value="<?php echo $site_row['id'];?><?php echo ($_REQUEST['item_code']==$site_row['id']?'selected':'')?>"><?php echo $site_row['item_name'];?></option>
				  <?php } ?>
				</select></td>
				
			  </tr>	 
			 
    
  
		  </table>
		  <p align="center"><input type="Submit" name="Proceed" value="Proceed" /></p>
		  </form>
	  </div></td>
	</tr>    
     <tr>
    	<td>&nbsp;</td>
    </tr>
   
	</table>

	
	<table  border="0" cellspacing="1" cellpadding="2" align="center">
    	  <tr>
    	    <th ><strong>S.No.</strong></th>
    	    <th ><strong>Item Name</strong></th>
    	    <th ><strong>Machine Group Center</strong></th>
    	    <th ><strong>Speed Kph</strong></th>
    	    <th ><strong>Production Capacity</strong></th>
    	     <th ><strong>Westage Allow</strong></th>
    	    <th ><strong>Branch</strong></th>
    	    
    	        	     	      </tr>
    	  <?php 
    	 if(isset($_POST['Proceed']))
		 {		  	
    	$filter=array();		
		if($_REQUEST['item_code']!='0')
		$filter[]="item_id='".$_REQUEST['item_code']."'";
		
		if($filter!='')
		{
			
			$filter2=implode(" and ",$filter);
		}			
				
		if($_REQUEST['item_code']!='0')
		{
	  $sql="Select * from tbl_production_capacity_plan where  $filter2 ";
		}
		else{
		  $sql="Select * from tbl_production_capacity_plan"; }
		$result=DB_query($sql,$db);
		$i=1;
		 $mmm=DB_num_rows($result);
		if(DB_num_rows($result)>0)
		{			
		while($myrow=DB_fetch_array($result))
			{				
          ?>
    	  <tr bgcolor="#FFFFFF">
    	    <td><strong><?php echo $i;?></strong></td>
    	    <td><?php echo $itemname=$s->getField('item_master','id',$myrow['item_id'],'item_name');?></td>
 <td><?php echo $machinename=$s->getField('machine_group_center','id',$myrow['machine_group_id'],'machine_gp_location'); ?></td>
    	    <td><?php echo $myrow['speed_kph'];?></td>
    	    <td><?php echo $myrow['prod_capacity'];?></td>
    	    <td><?php echo $myrow['westage_allow'];?></td>
    	    <td><?php echo $branch=$s->getField('locations','loccode',$myrow['brach'],'locationname');?></td>
    	      <td><?php echo $myrow['total_hrs'];?></td>
    	       
    	    	       </tr>
    	  
  	  <?php $i++; }  }else
		{?>
		<tr><td colspan="12"><font color="#FF0000"><strong>No Record Found</strong></font></td></tr>
		<?php 	
		}
		}
	?></table>
	
<?php
include('includes/footer.inc');
?>