<link rel="stylesheet" href="css/new_mxerp.css">
<?php
$date=date('d/m/Y');
 $time=date('h:i', time());
 $period=date(A);
 $timestamp = date("H:i", time());
 $modid=$_REQUEST['modid'];
$frmid=$_REQUEST['frmid'];
$rurl="&modid=".$modid."&frmid=".$frmid;
if($_REQUEST['Save'])
{
$fstatus=true;
  if($_REQUEST['site']=='000')
  {
  	  $msgErr[]="Please Select Branch Name"	;
      $fstatus=false;
  }
  if($_REQUEST['job_ticket']=='')
  {
  	  $msgErr[]="Please Enter Job Ticket No"	;
      $fstatus=false;
  }	
	 if($_REQUEST['date']=='')
  {
  	  $msgErr[]="Please Select  Date";
      $fstatus=false;
  }
    if($_REQUEST['item']=='')
  {
  	  $msgErr[]="Please Select Item  Name"	;
      $fstatus=false;
  }
  if($_REQUEST['customer_name']=='')
  {
  	  $msgErr[]="Please Enter Customer Name"	;
      $fstatus=false;
  }
   if($_REQUEST['lamination_slip']=='')
  {
  	  $msgErr[]="Must Enter Entry Slip"	;
      $fstatus=false;
  }
  if($_REQUEST['operator']=='')
  {
  	  $msgErr[]="Must Enter Machine Operator"	;
      $fstatus=false;
  }
	 if($_REQUEST['shift']=='')
  {
  	  $msgErr[]="Must Enter Shift"	;
      $fstatus=false;
  }
	 if($_REQUEST['machine']=='')
  {
  	  $msgErr[]="Must Enter Machine Center"	;
      $fstatus=false;
  }
 
  if($_REQUEST['approved']=='0')
  {
  	  $msgErr[]="Please Select Approved By"	;
      $fstatus=false;
  } 
	
}
if($_REQUEST['Save']!='' and $fstatus)
{
 $data['branch_id'] = $_REQUEST['site'];
 $data['job_card_id'] = $_REQUEST['job_ticket'];	
 $data['lamination_slip'] = $_REQUEST['lamination_slip'];
  $data['date'] = FormatDateForSQL($_REQUEST['date']);
 $data['item_name'] = $_REQUEST['item'];
 $data['customer_name'] = $_REQUEST['customer_name'];
 $data['shift'] = $_REQUEST['shift'];
 $data['machine'] = $_REQUEST['machine'];
 $data['operator'] = $_REQUEST['operator'];
 $data['lamination_size'] = $_REQUEST['lamination_film'];
 $data['fevicol_used'] = $_REQUEST['fevicol_used'];
 $data['film_quality'] = $_REQUEST['film_quality'];
 $data['window_lamination'] = $_REQUEST['window_lam'];
 $data['remarks'] = $_REQUEST['remarks1'];
 $data['created_by'] = $_REQUEST['created'];
 $data['approved_by'] = $_REQUEST['approved'];
  $data['CompanyId']=$_SESSION['ACGCompanyId'];
 
 $inprocess_printing=$s->insertRecord('tbl_inprocess_audit_laminations', $data);
 $insertResult = DB_query($inprocess_printing,$db,$ErrMsg); 
		if(!$insertResult)
			{
			  die("Not Inserted".DB_error_msg($db));
			}
			$Lastreq_id=DB_Last_Insert_ID($db,'tbl_inprocess_audit_hotfoil',$ErrMsg);
			if($Lastreq_id!='')
			{
			$data1['parent_id']=$Lastreq_id;	
			$data1['fevicol_apply_date']=FormatDateForSQL($_REQUEST['fevicol_apply_date']);
			$data1['fevicol_apply_time']=$_REQUEST['fevicol_apply_time'];	
			$data1['matter_cut_period']=$_REQUEST['fevicol_apply_matter'];	
			$data1['fevicol_remarks']=$_REQUEST['matter_remarks'];	
			$data1['air_bubble_date']=FormatDateForSQL($_REQUEST['air_bubble_date']);	
			$data1['air_bubble_time']=$_REQUEST['air_bubble_time'];	
			$data1['start_AMPM_bubble']=$_REQUEST['start_AMPM_bubble'];	
			$data1['bubble_remarks']=$_REQUEST['bubble_remarks'];	
			$data1['wrinkless_date']=FormatDateForSQL($_REQUEST['wrinkless_date']);	
			$data1['wrinkless_time']=$_REQUEST['wrinkless_time'];	
			$data1['start_AMPM_wrinkless']=$_REQUEST['start_AMPM_wrinkless'];
			$data1['wrinkless_remarks']=$_REQUEST['wrinkless_remarks'];
			$data1['cross_lamination_date']=FormatDateForSQL($_REQUEST['cross_lamination_date']);
			$data1['cross_lamination_time']=$_REQUEST['cross_lamination_time'];
			$data1['start_AMPM_cross']=$_REQUEST['start_AMPM_cross'];	
			$data1['cross_lamination_remarks']=$_REQUEST['cross_lamination_remarks'];
			$data1['short_lamination_date']=FormatDateForSQL($_REQUEST['short_lamination_date']);
			$data1['short_lamination_time']=$_REQUEST['short_lamination_time'];
			$data1['start_AMPM_short']=$_REQUEST['start_AMPM_short'];
			$data1['short_lamination_remarks']=$_REQUEST['short_lamination_remarks'];		
			$data1['rewinding_date']=FormatDateForSQL($_REQUEST['rewinding_date']);	
			$data1['rewinding_time']=$_REQUEST['rewinding_time'];	
			$data1['start_AMPM_rewinding']=$_REQUEST['start_AMPM_rewinding'];	
			$data1['rewinding_remarks']=$_REQUEST['rewinding_remarks'];			
			$data1['dyne_date']=FormatDateForSQL($_REQUEST['dyne_date']);	
			$data1['dyne_time']=$_REQUEST['dyne_time'];	
			$data1['start_AMPM_dyne']=$_REQUEST['start_AMPM_dyne'];				
			$data1['dyne_remarks']=$_REQUEST['dyne_remarks'];
			
			
			
			$insert_data=$s->insertRecord('tbl_inprocess_audit_lamination_details', $data1);
					$insertResult = DB_query($insert_data,$db,$ErrMsg);
			}
$s->pageLocation('index.php?route=view_process_laminationaudit&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'].$rurl);
 }
 
?>

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


<form action="" method="post" >
<h1>In Process Audit For Lamination/Window Laminations</h1>
<br>
<table width="70%">	
<?php if(count($msgErr)>0){?>
   <tr>
   <td colspan="4"><?php
   for($i=0;$i<count($msgErr);$i++)
   {
     echo "<div class='error'>".$msgErr[$i].'</div>';
   }
    ?></td>
   </tr>
   <?php } ?>	
	</table>

<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
<tr>
<td class="tabledata" style="width:146px;">Branch</td>

<td><?php
	
 		$sql = 'SELECT loccode, locationname FROM locations';
	 	$resultStkLocs = DB_query($sql,$db);
		?>
	<select name="site" style="width:100%" onchange="getdata(this.value);" >
	<option value="000">Select</option>
      <?php    
			while ($myrow=DB_fetch_array($resultStkLocs))
				{
				?>
      <option value="<?php echo $myrow['loccode']; ?>"><?php echo $myrow['locationname'];?></option>
      <?php  }	?> 
    </select></td>
 </tr>
 </table>
   
<h3>General Details</h3>
<table cellpadding="0" cellspacing="0" border="1" align="center">
    <tr>
        <td nowrap="nowrap" colspan="2" width="50%" valign="top">
        <div id="enquiryId" style="width:100%; margin:0 auto;">
	   <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
            	<tr>
                 <td class="tabledata" style="width:146px;">Lamination Slip.</td>
                    <td id="hotfoil"><input type="text"  name="lamination_slip" id="lamination_slip" style="width:100%"  >                    	
                    	</td>
                    	<td class="tabledata">Date</td>
                     <td><input type="text" id="date" name="date" style="width:100%;" class="datepicker"/>
                     </td>
      </tr>
            	<tr>
                 <td class="tabledata">Job Card  No.</td>
                    <td id="vouchar"><select  name="job_ticket" id="job_ticket" style="width:100%" onchange="getdata1(this.value);" >
                    	<option value="0">Select</option> 
                    	<?php
                    	$sql=DB_query("select * from job_route_card",$db);
						while($row=DB_fetch_array($sql))
						{ 
                    	?>
                    	<option value="<?php echo $row['id']; ?>"><?php echo $row['job_card_no']; ?></option>
                    	<?php } ?></select>                   	
                    	
                    	</td>
                    	<td class="tabledata">Item Name..</td>
                     <td><input type="text" id="item" name="item" style="width:100%;"/>
                     </td>
      </tr>
            	<tr>
                 <td class="tabledata">Customer</td>
                    <td id="vouchar"><input type="text" name="customer_name" style="width:100%;" id="customer_name"/></td>
                    	<td class="tabledata">Shift</td>
                     <td><input type="text" name="shift" style="width:100%" id="shift">            	                 	
                       	
                     </td>
       </tr>
      </table></div></td>
      </tr> 
   
    <tr>
        <td nowrap="nowrap" colspan="2" width="50%" valign="top">
        <div id="enquiryId" style="width:810px;">
	   <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
            	 <tr>
        <td class="tabledata" style="width:146px;">Machine</td>
        <td id="vouchar" style="width:246px;"><input type="text" name="machine" id="machine" style="width:100%" >
                     	
        	
        	
        	</td>
     
        <td class="tabledata" style="width:136px;">Operator</td>
        <td  id="vouchar"><input type="text" name="operator" style="width:100%" id="operator" >
                     	
        	
        	
        	</td>
      </tr>
      
      </table></div></td>
      </tr> 
      <tr><td>&nbsp;</td></tr>
   
   <tr><td><h3>Initial Check Point</h3>
      <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
                 <tr>
        <td class="tabledata">Lamination film quality,size and thickness used as per job card</td>
        <td><table width="100%" border="0">
        	
                    <tr><td>&nbsp;</td><td class="tabledata">Yes</td><td><input type="radio" name="lamination_film" value="Yes" /></td><td class="tabledata">No</td>
                    	<td><input type="radio" name="lamination_film" value="No" /></td></tr>	
                               	
                    </table></td>
     </tr>
     <tr>
        <td class="tabledata">Fevicol used as per job card</td>
        <td><table width="100%" border="0">
                    <tr><td>&nbsp;</td><td class="tabledata">Yes</td><td><input type="radio" name="fevicol_used" value="Yes" /></td>
                    	<td class="tabledata">No</td><td><input type="radio" name="fevicol_used" value="No" /></td></tr>	
                               	
                    </table></td>
      </tr>
       <tr>
        <td class="tabledata">Film quality/micron</td>
        <td><table width="100%" border="0">
                    <tr><td>&nbsp;</td><td class="tabledata">Yes</td><td><input type="radio" name="film_quality" value="Yes" /></td>
                    	<td class="tabledata">No</td><td><input type="radio" name="film_quality" value="No" /></td></tr>	
                               	
                    </table></td>
      </tr>
      <tr>
        <td class="tabledata">If window lamination to be done in the job(should be free from fevicol on window area)</td>
        <td><table width="100%" border="0">
                    <tr><td>&nbsp;</td><td class="tabledata">Yes</td><td><input type="radio" name="window_lam" value="Yes" /></td>
                    	<td class="tabledata">No</td><td><input type="radio" name="window_lam" value="No" /></td></tr>	
                               	
                    </table></td>
      </tr>
                    
                 </table></td></tr>
                                 
                <tr><td>&nbsp;</td></tr>
                <tr><td> <h3>Check Point Details</h3>
                 
		   <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
            <tr>
          <td class="tabledata">Check Point</td>
          <td class="tabledata" valign="top"><center>Observations</center></td>          
          <td class="tabledata"><center>Remarks</center></td>
          </tr>  
           <tr>
          	<td>Fevicol apply properly</stong></td><td>
          	<table border="0">
          	<tr><td><input type="text" class="datepicker" name="fevicol_apply_date" /></td>
          	<td><input type="text"  name="fevicol_apply_time" value="<?php echo $timestamp; ?>" /></td>
          	<td><select name="fevicol_apply_matter" id="start_AMPM_matter" style="width:40px">
	 <option value="AM"<?php echo ($_REQUEST['fevicol_apply_matter']=='AM'?'selected':'')?>>AM</option>
	 <option value="PM"<?php echo ($_REQUEST['fevicol_apply_matter']=='PM'?'selected':'')?>>PM</option>
	 </select></td>
          	</tr>	
          	</table>	
          	</td><td><textarea style="width:100%;height:25px;" name="matter_remarks"></textarea></td>
          </tr>     
          <tr>
          	<td> Air Bubble</td><td>
          	<table border="0">
          	<tr><td><input type="text" class="datepicker" name="air_bubble_date" /></td>
          		<td><input type="text"  name="air_bubble_time" value="<?php echo $timestamp; ?>" /></td>
          	<td><select name="start_AMPM_bubble" id="start_AMPM_bubble" style="width:40px">
	 <option value="AM"<?php echo ($_REQUEST['start_AMPM_bubble']=='AM'?'selected':'')?>>AM</option>
	 <option value="PM"<?php echo ($_REQUEST['start_AMPM_bubble']=='PM'?'selected':'')?>>PM</option>
	 </select></td>	
          		
          	</tr>	
          	</table>	
          	</td><td><textarea style="width:100%;height:25px;" name="bubble_remarks"></textarea></td>
          </tr>     
          <tr>
          	<td>Wrinkless</td><td>
          	<table border="0">
          		
          	<tr><td><input type="text" class="datepicker" name="wrinkless_date" /></td>
          		<td><input type="text" name="wrinkless_time" value="<?php echo $timestamp; ?>"  /></td>
          		<td><select name="start_AMPM_wrinkless" id="start_AMPM_wrinkless" style="width:40px">
	 <option value="AM"<?php echo ($_REQUEST['start_AMPM_wrinkless']=='AM'?'selected':'')?>>AM</option>
	 <option value="PM"<?php echo ($_REQUEST['start_AMPM_wrinkless']=='PM'?'selected':'')?>>PM</option>
	 </select></td>
          	</tr>	
          	</table>	
          		
          	</td><td><textarea style="width:100%;height:25px;" name="wrinkless_remarks"></textarea></td>
          </tr>     
          <tr>
          	<td>Cross Lamination</td><td>
          	<table border="0">
          	<tr><td><input type="text" class="datepicker"  name="cross_lamination_date"/></td>
          		<td><input type="text"  name="cross_lamination_time" value="<?php echo $timestamp; ?>" /></td>
          		<td><select name="start_AMPM_cross" id="start_AMPM_cross" style="width:40px">
	 <option value="AM"<?php echo ($_REQUEST['start_AMPM_cross']=='AM'?'selected':'')?>>AM</option>
	 <option value="PM"<?php echo ($_REQUEST['start_AMPM_cross']=='PM'?'selected':'')?>>PM</option>
	 </select></td>
          	</tr>	
          	</table>	
          	</td><td><textarea style="width:100%;height:25px;" name="cross_lamination_remarks"></textarea></td>
          </tr>     
          <tr>
          	<td>Short Lamination</td><td>
          	<table border="0">
          		
          	<tr><td><input type="text" class="datepicker" name="short_lamination_date" /></td>
          		<td><input type="text"  name="short_lamination_time" value="<?php echo $timestamp; ?>" /></td>
          		<td><select name="start_AMPM_short" id="start_AMPM_short" style="width:40px">
	 <option value="AM"<?php echo ($_REQUEST['start_AMPM_short']=='AM'?'selected':'')?>>AM</option>
	 <option value="PM"<?php echo ($_REQUEST['start_AMPM_short']=='PM'?'selected':'')?>>PM</option>
	 </select></td>
          	</tr>	
          	</table>
          	</td><td><textarea style="width:100%;height:25px;" name="short_lamination_remarks"></textarea></td>
          </tr>     
           <tr>
          	<td>Rewinding should be proper</td><td>
          	<table border="0">
          		
          	<tr><td><input type="text" class="datepicker" name="rewinding_date" /></td>
          		<td><input type="text"  name="rewinding_time" value="<?php echo $timestamp; ?>" /></td>
          		<td><select name="start_AMPM_rewinding" id="start_AMPM_rewinding" style="width:40px">
	 <option value="AM"<?php echo ($_REQUEST['start_AMPM_rewinding']=='AM'?'selected':'')?>>AM</option>
	 <option value="PM"<?php echo ($_REQUEST['start_AMPM_rewinding']=='PM'?'selected':'')?>>PM</option>
	 </select></td>
          	</tr>	
          	</table>
          	</td><td><textarea style="width:100%;height:25px;" name="rewinding_remarks"></textarea></td>
          </tr>  
          <tr>
          	<td>Dyne should be value 42+</td><td>
          	<table border="0">
          		
          	<tr><td><input type="text" class="datepicker" name="dyne_date" /></td>
          		<td><input type="text"  name="dyne_time" value="<?php echo $timestamp; ?>" /></td>
          		<td><select name="start_AMPM_dyne" id="start_AMPM_dyne" style="width:40px">
	 <option value="AM"<?php echo ($_REQUEST['start_AMPM_dyne']=='AM'?'selected':'')?>>AM</option>
	 <option value="PM"<?php echo ($_REQUEST['start_AMPM_dyne']=='PM'?'selected':'')?>>PM</option>
	 </select></td>
          	</tr>	
          	</table>
          	</td><td><textarea style="width:100%;height:25px;" name="dyne_remarks"></textarea></td>
          </tr>  
                </table></td></tr>
                 <tr><td><table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
                <tr>
                 <td class="tabledata" style="width:146px;">Remarks</td>
                    <td colspan="2"><textarea name="remarks1" style="width:100%" ></textarea>
                    	</td>
                   
                </tr> </table></td></tr>
             <tr><td><table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
                <tr>
                 <td class="tabledata" style="width:146px;">Created By</td>
                    <td  ><input type="text" name="created" style="width:100%">
                    	</td>
				     <td class="tabledata">Approved By QA Head</td><td><select name="approved"  style="width:100%">
					<option value="0">Select</option>
					<option value="Yes">Yes</option>
					<option value="No">No</option>
					<option value="Pending">Pending</option>
					</select></td></tr>
										</table></td></tr></table>
						<p align="center"><input type="submit" name="Save" value="Save" /></p>				

</form>


</div></div>



<script language="JavaScript"> 
 function getdata1(str)
{

var xmlhttp;
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)
    {
	 var data=xmlhttp.responseText.split("__");	
		document.getElementById("customer_name").value=data[1];
	document.getElementById("shift").value=data[4];
	document.getElementById("machine").value=data[2];
	document.getElementById("operator").value=data[3];
	document.getElementById("item").value=data[0];
	
    }
  }
  xmlhttp.open("GET","get_inprocess_audit.php?site="+str,true);
xmlhttp.send();

//xmlhttp.open("GET","getSort.php?s="+str+"&cat="+cat,true);

}


function getdata(str9) 
{	 
	
if (str9.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?site9="+str9,true);
xmlhttp.send();
}




</script>
