<link rel="stylesheet" href="css/new_mxerp.css">

<?php extract($_POST);
$PageSecurity = 1;
$tabindex=0;
include('includes/DefinePaymentClass.php');
$title = _('Hot Foil Sampling Audit Report');
include('includes/SQL_CommonFunctions.inc');
?>

<div class="body_contain">
<div class="tab_div">

   <h1><?php echo $title;?></h1>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

   <tr>
		<td><div align="center">
			<form  action="" method="post">
			   <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
			  <tr>
			    <td class="tabledata" style="width:146px;">Job Card No</td>
				<td ><select name="jobcard" id="jobcard" style="width:100%">
				   <option value="0">---Select---</option>
				  <?php 		
		$site_sql=DB_query("Select id,job_card_no from job_route_card where CompanyId='".$_SESSION['ACGCompanyId']."'",$db);
		while($site_row=DB_fetch_array($site_sql)){
				?>
				  <option value="<?php echo $site_row['id'];?><?php echo ($_REQUEST['jobcard']==$site_row['id']?'selected':'')?>"><?php echo $site_row['job_card_no'];?></option>
				  <?php } ?>
				</select></td>
			  </tr>	 
		  </table>
		  <p align="left" style="padding-left:10px;"><input type="Submit" name="Proceed" value="Proceed" /></p>
		  </form>
	  </div></td>
	</tr>    
   
	</table>	
	<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
              <tr>
               <td class="tabledata">Hot Foil Slip No</td>
               <td class="tabledata">Job Card No</td>
               <td class="tabledata">Item Name </td>
	       <td class="tabledata">Customer Name</td>
	       <td class="tabledata">Shift </td>
               <td class="tabledata">Machine</td>
               <td class="tabledata">Operator</td>
               <td class="tabledata">Action</td>                  
              </tr>
    	  <?php 
    	 if(isset($_POST['Proceed']))
		 {		  	
    	$filter=array();		
		if($_REQUEST['jobcard']!='0')
		$filter[]="A.job_card_id='".$_REQUEST['jobcard']."'";
		if($filter!='')
		{
			if($_REQUEST['jobcard']!='0'){$filter2=implode(" and ",$filter)." group by job_card_id";}
			else
			$filter2=implode(" and ",$filter);
		}			
				
		if($_REQUEST['jobcard']!='0')
		{
		 $sql="Select A.*, B.* ,A.id  from tbl_inprocess_audit_hotfoil A, tbl_inprocess_audit_checkpoint_details B where B.parent_id=A.id and $filter2 ";	
	 		}
		else{
		  $sql="Select A.*, B.*,A.id  from tbl_inprocess_audit_hotfoil A, tbl_inprocess_audit_checkpoint_details B where B.parent_id=A.id "; }
		$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="#c1c1c1">
    	    <td><?php echo $myrow['hotfoil_slip'];   ?></td>
    	    <td><?php echo $jobcard=$s->getField('job_route_card','id',$myrow['job_card_id'],'job_card_no'); ?></td>
	 	  <td><?php echo $myrow['item_name'];?></td>
    	    <td><?php echo $myrow['customer_name'];?></td>
    	     <td><?php echo $myrow['shift'];?></td>
    	       	      <td><?php echo $myrow['machine'];?></td>
    	       <td><?php echo $myrow['operator'];?></td>
    	         <td><a href="index.php?route=view_process_audit_data&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=edit&Id=<?php echo $myrow['id'];?>">View</a> &nbsp;&nbsp;  <a href="">Print</a></td>
    	            	    	       </tr>
    	  
  	  <?php $i++; }  }else
		{?>
		<tr><td colspan="8"><font color="#FF0000">No Record Found</font></td></tr>
		<?php 	
		}
		}
	?></table>
	

</div></div>


     <?php
//include('includes/footer.inc');
?>
<script language="JavaScript">
function getdata(data)
{
if (data.length==0)
  {
  document.getElementById("hotfoil").innerHTML="";
 
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("hotfoil").innerHTML=xmlhttp.responseText;
      }
  }
 
xmlhttp.open("GET","get_entryslip_jobcard.php?data="+data,true);
xmlhttp.send();	
	
	
}	
	
	
	
</script>