<?php
$modid=$_REQUEST['modid'];
$frmid=$_REQUEST['frmid'];
$rurl="&modid=".$modid."&frmid=".$frmid;
if(isset($_POST['button']))
{
header("location:index.php?route=daily_production_entrylist&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."");
exit;	
}
if(isset($_POST['Update']))
{
 $sql="update  job_route_card set  job_card_no='".$_REQUEST['job_card_no']."',job_card_date='".FormatDateForSQL($_REQUEST['job_card_date'])."'
            ,pps_no='".$_REQUEST['pps_no']."',job_type='".$_REQUEST['job_type']."',type_of_production='".$_REQUEST['type_of_production']."'
           ,code='".$_REQUEST['job_card_no']."',customer_name='".$_REQUEST['customer_name']."',sop_no='".$_REQUEST['sop_no']."'
           ,party_order_no='".$_REQUEST['party_order_no']."',order_date='".$_REQUEST['order_date']."',part_code='".$_REQUEST['partcode']."'
           ,item_name='".$_REQUEST['itemname']."',unit='".$_REQUEST['unit']."',production_load='".$_REQUEST['production_load']."'
           ,production_load_nw='".$_REQUEST['production_load_nw']."',production_load_gw='".$_REQUEST['production_load_gw']."'
           ,expected_produce_time='".$_REQUEST['expected_produce_time']."',remarks='".$_REQUEST['remarks']."',breakdown_type='".$_REQUEST['breakdown_type']."'
           ,breakdown_reason='".$_REQUEST['breakdown_reason']."',breakdown_desc='".$_REQUEST['breakdown_desc']."',breakdown_in_mintes='".$_REQUEST['breakdown_in_mintes']."'
           ,quality_rejection='".$_REQUEST['quality_rejection']."',deptid='".$_REQUEST['deptid']."'
           ,quality_insp_execu_name='".$_REQUEST['quality_insp_execu_name']."',rejection_type='".$_REQUEST['rejection_type']."'
           ,rejection_reason='".$_REQUEST['rejection_reason']."',rejection_desc='".$_REQUEST['rejection_desc']."',qunatity_rejection='".$_REQUEST['qunatity_rejection']."'
           ,quantity_qc='".$_REQUEST['quantity_qc']."',branch_code='".$_REQUEST['site']."' where id='".$_REQUEST['Id']."'";
           $query=DB_query($sql,$db);
          $qty=$_REQUEST['batch_no1'];
	        $qty1=count($qty);
						for($i=0;$i<$qty1;$i++)
					 {
					 $insert1="update  job_route_process set masterid='".$_REQUEST['Id']."',batch_no='".$_REQUEST['batch_no1'][$i]."',process_id='".$_REQUEST['process_name1'][$i]."'
					       ,process_flow_no='".$_REQUEST['process_flow_no1'][$i]."',qty_load='".$_REQUEST['qty_load1'][$i]."',
					            quality_inspection='".$_REQUEST['quality_inspection1'][$i]."',total_prod_qty='".$_REQUEST['total_production_qty1'][$i]."'
					            ,total_qc_pass='".$_REQUEST['total_qc_passed1'][$i]."',balance_qty='".$_REQUEST['balance_qty1'][$i]."',balance_wip='".$_REQUEST['balance_wip1'][$i]."'
					            where id='".$_REQUEST['batch_id'][$i]."'";	
								$updatedata=DB_query($insert1,$db);		
					 	
					 	}			 
					 
			$qty22=$_REQUEST['batch_no'];			
	        $qty2=count($qty22);
						for($i=0;$i<$qty2;$i++)
					 {
					 if($_REQUEST['batch_no'][$i]!='')
					 {	
					  $insert2="insert into job_route_process set masterid='".$_REQUEST['Id']."',batch_no='".$_REQUEST['batch_no'][$i]."',process_id='".$_REQUEST['process_name'][$i]."'
					       ,process_flow_no='".$_REQUEST['process_flow_no'][$i]."',qty_load='".$_REQUEST['qty_load'][$i]."',
					            quality_inspection='".$_REQUEST['quality_inspection'][$i]."',total_prod_qty='".$_REQUEST['total_production_qty'][$i]."'
	      ,total_qc_pass='".$_REQUEST['total_qc_passed'][$i]."',balance_qty='".$_REQUEST['balance_qty'][$i]."',balance_wip='".$_REQUEST['balance_wip'][$i]."'";	
								$updatedata1=DB_query($insert2,$db);		
					 }	
					 	}			 	
				
				
		   $s->pageLocation("index.php?route=job_route_cardlist&daction=Updated".$rurl);
		   
}
?>

<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.main-heading{
		font:16px Verdana, Geneva, sans-serif;
		color:#000;
		font-weight:bold;
}
.main-heading-1{
		font:14px Verdana, Geneva, sans-serif;
		color:#000;
		font-weight:bold;
}
.text{
		font:12px Verdana, Geneva, sans-serif;
		color:#000;
}
#text1{
		font:12px Verdana, Geneva, sans-serif;
		color:#000;
		padding-left:8px;
}
.border{
		border:1px solid #cccccc;
}
.border-btm-rht{
		border-bottom:1px solid #cccccc;
		border-right:1px solid #cccccc;
}
-->
</style>
<?php 
$sqldata=DB_query("select * from job_route_card where id='".$_REQUEST['Id']."'",$db);
$edit_sql=DB_fetch_array($sqldata);
?>
<body>	<form action="" method="post">
<fieldset style="margin:0px; padding:0px">
<table width="990" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td class="main-heading">Job Route Card</td>
  </tr>
  <tr><td>&nbsp;</td></tr>
  <tr>
  	<td><table width="100%">
  		<tr><td width="35%">&nbsp;</td><th width="7%">Branch</th>
  		<td align="center" width="55%"><select name="site">
    	<option value="0">---Select ----</option>
    	<?php
    	$branch=DB_query("select * from locations",$db);
		while($branch_row=DB_fetch_array($branch))
		{?>
		<option value="<?php echo $branch_row['loccode']; ?>"><?php echo $branch_row['locationname']; ?></option>	
		<?php	} 	 ?>
    	
    	
    </select></td>
  		</tr>
  		<tr><td>&nbsp;</td></tr>
  		
  	</table></td>
    
  </tr>
  <tr>
    <td align="left" valign="top"><table width="750" border="0" align="left" cellpadding="2" cellspacing="2">
      <tr class="text">
        <td width="100">Job Card No.</td>
        <td width="90">Job Card No.</td>
        <td width="100">PPS No.</td>
        <td width="90">PPS Date</td>
        <td width="120">Job Type</td>
        <td width="262">Type of Productions</td>
      </tr>
      <tr>
        <td align="left" valign="top"><input style="width:100px;" type="text" name="job_card_no" id="job_card_no1"  value="<?php echo $edit_sql['job_card_no']; ?>"/></td>
        <td align="left" valign="top"><input type="text" name="job_card_date" id="job_card_date"  class="datepicker" style="width:100px;" value="<?php echo $edit_sql['job_card_date']; ?>"/></td>
        <td align="left" valign="top"><input style="width:100px;" type="text" name="pps_no" id="pps_no"  value="<?php echo $edit_sql['pps_no']; ?>"/></td>
        <td align="left" valign="top"><input type="text" name="pps_date" id="pps_date"  class="datepicker" style="width:100px;" value="<?php echo $edit_sql['pps_date']; ?>"/></td>
        <td align="left" valign="top"><select style="width:120px;" name="job_type" id="job_type">          
        </select></td>
        <td align="left" valign="top"><select style="width:220px;" name="type_of_production" id="type_of_production">          
        </select></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table width="720" border="0" align="left" cellpadding="2" cellspacing="2">
      <tr class="text">
        <td width="90">Code</td>
        <td width="200">Customer Name</td>
        <td width="90">S.O.P No.</td>
        <td valign="top" ><table width="360">
        <tr><td width="120">S.O.P Date</td>
        <td width="120">Party Order No.</td>
        <td width="120">Order date</td></tr>  
        </table></td>        
      </tr>
      <tr>
        <td align="left" valign="top"><select style="width:90px;" name="code" id="code" >
          <option>00123456</option>
        </select></td>
        <td align="left" valign="top"><select style="width:200px;" name="customer_name" id="customer_name">
          <option>Javed Bakht</option>
        </select></td>
        <td align="left" valign="top">
        	<select style="width:90px;" name="sop_no" id="sop_no" onchange="generateCode(this.value);">
        	<option value="0">Select</option>	 
        	<?php 
        	 $sql="select * from salesorder";
			$query=DB_query($sql,$db);
			while($row=DB_fetch_array($query))
			{
			$sop='';
			if($row['id']==$edit_sql['sop_no'])
			{
			 $sop='selected';	
			}	
        	?>	
        	<option value="<?php echo $row['id']; ?>" <?php echo $sop;?>><?php echo $row['orderNo']; ?></option>
        	<?php } ?>	
             </select></td>
              <td valign="top"><table width="360">
              <tr id="sopdate"><td align="left" valign="top" id="sopdate" width="120"><input type="text" style="width:90px;" name="sop_date" id="sop_date" value="<?php echo $edit_sql['pps_date']; ?>" >
           </td>
        <td align="left" valign="top" width="120"><input type="text" style="width:120px;" name="party_order_no" id="party_order_no"  value="<?php echo $edit_sql['pps_date']; ?>">
       </td>
        <td align="left" valign="top" width="120"><input type="text" style="width:90px;" name="order_date" id="order_date"  value="<?php echo $edit_sql['pps_date']; ?>">
                </td></tr>	 	
              </table> </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table width="990" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="305" align="left" valign="top">
        <fieldset style="margin:0px; padding:0px;">
        <legend class="main-heading-1">Material Description</legend>
        <table width="305" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" valign="top"><table width="300" border="0" align="center" cellpadding="2" cellspacing="2">
      <tr>
        <td class="text">Part Code</td>
        <td><select style="width:200px;" name="partcode" id="partcode" onchange="getitem(this.value);">
        	<option value="0">--Select---</option>  
        	<?php
        	$itemdata=DB_query("select * from item_master where CategoryID!='FG'",$db);
        	while($item_row=DB_fetch_array($itemdata))
        	{
        	$item1='';
			if($item_row['id']==$edit_sql['part_code'])
			{
			$item1="selected";	
			}	
        	 ?>
        	 <option value="<?php echo $item_row['id'];  ?>"<?php echo $item1; ?>><?php echo $item_row['StockID']; ?></option>
        <?php } ?>
        </select></td>
      </tr><tr>
      	<td width="305" colspan="2"><div id="div_text">
      	<table width="100%">   		 
      <tr>
      	 <td class="text">Item Name</td>
        <td><input type="text" style="width:200px;" name="itemname"  value="<?php echo $edit_sql['item_name']; ?>"></td>
      </tr>
      <tr>
        <td width="78" class="text">Unit</td>
        <td width="208"><input type="text" style="width:80px;" name="unit"  value="<?php echo $edit_sql['unit']; ?>"></td>
      </tr>    		
      	</table></div></td>   
      </tr>
    
    </table></td>
  </tr>
  <tr>
    <td align="left" valign="top"><table width="300" border="0" align="center" cellpadding="2" cellspacing="2">
      <tr>
        <td width="182" class="text">Production load Qty (Qty)</td>
        <td width="104"><input style="width:100px;" type="text" name="production_load" id="production_load"  value="<?php echo $edit_sql['production_load']; ?>" /></td>
      </tr>
      <tr>
        <td class="text">Production load Qty (N.W.)</td>
        <td><input style="width:100px;" type="text" name="production_load_nw" id="production_load_nw"   value="<?php echo $edit_sql['production_load_nw']; ?>"/></td>
      </tr>
      <tr>
        <td class="text">Production load Qty (G.W.)</td>
        <td><input style="width:100px;" type="text" name="production_load_gw" id="production_load_gw"   value="<?php echo $edit_sql['production_load_gw']; ?>"/></td>
      </tr>
      <tr>
        <td class="text">Expected Produce Time</td>
        <td><input style="width:100px;" type="text" name="expected_produce_time" id="expected_produce_time"  value="<?php echo $edit_sql['expected_produce_time']; ?>"/></td>
      </tr>
      <tr>
        <td class="text">Tentative Production Date</td>
        <td><input type="text" style="width:105px;" name="tent_prod_date" id="tent_prod_date" class="datepicker"  value="<?php echo $edit_sql['tent_prod_date']; ?>">
          </td>
      </tr>
      <tr>
        <td class="text">Commitment Delivery Date</td>
        <td><input type="text" style="width:105px;" name="commit_delivery_date" id="commit_delivery_date" class="datepicker"  value="<?php echo $edit_sql['commit_delivery_date']; ?>">
          </td>
      </tr>
      <tr>
        <td class="text">Delivery Date of Customer</td>
        <td><input type="text" style="width:105px;" name="delivery_date" id="delivery_date" class="datepicker"  value="<?php echo $edit_sql['delivery_date']; ?>">
         </td>
      </tr>
      <tr>
        <td colspan="2" class="text">Remarks Note(By production)</td>
        </tr>
      <tr>
        <td colspan="2" align="left"><input style="width:285px; height:30px" type="text" name="remarks" id="remarks"  value="<?php echo $edit_sql['remarks']; ?>"/></td>
      </tr>
      </table></td>
  </tr>
</table>

        </fieldset>
        </td>
        <td width="685" align="left" valign="top">
        <fieldset>
        <legend class="main-heading-1">Process Involved Information</legend>
        <div style="margin:0px; padding:0px; overflow:scroll; width:600px; height:316px;">
        <p align="left">
         <input type="button" onclick="addRow('dataTable')" value="Add More" />&nbsp;
      <input type="button" class="crmbutton small delete"  onclick="deleteRow('dataTable')" value="Delete" />
         </p>	
        	<table width="950" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
          <tr class="text">
          	<td align="center" class="border-btm-rht">Action</td>
          	<td align="center" class="border-btm-rht">Batch No</td>
            <td align="center" class="border-btm-rht">Process Name</td>
            <td align="center" class="border-btm-rht">Process Flow No</td>
          	<td align="center" class="border-btm-rht">Qty load</td>
            <td align="center" class="border-btm-rht">Quality Inspection</td>
             <td align="center" class="border-btm-rht">Total Production Qty</td>
              <td align="center" class="border-btm-rht">Total QC Passed</td>
               <td align="center" class="border-btm-rht">Balance Qty OF QC Department</td>
                <td align="center" class="border-btm-rht">Balance WIP of Production Qty</td>
            </tr>
            <?php
            $i=1;            
            $process=DB_query("select * from job_route_process where masterid='".$_REQUEST['Id']."'",$db);
            while($rowdata=DB_fetch_array($process))
			{      
            
             ?>
            <tr>
          	<td class="border-btm-rht"><?php echo $i; ?></td>
            <td class="border-btm-rht"><input type="text" name="batch_no1[]"   value="<?php echo $rowdata['batch_no']; ?>" /></td>
            <td class="border-btm-rht"><select  name="process_name1[]" value="<?php echo $rowdata['batch_no']; ?>">
            	<option value="0">Select </option>
            	<?php
            	$sql=DB_query("select * from production_process_master",$db);
				while($rowsql=DB_fetch_array($sql))
				{
				$k1='';
				if($rowsql['id']==$rowdata['process_id'])
				{
				$k1="selected";	
				}					
            	 ?>
            	 <option value="<?php echo $rowsql['id']; ?>"<?php echo $k1;?><?php echo $rowsql['manuf_process_name']; ?></option>
            	<?php } ?></select></td>
            <td class="border-btm-rht"><input type="text" name="process_flow_no1[]" value="<?php echo $rowdata['process_flow_no']; ?>" /></td>
            <td class="border-btm-rht"><input type="text" name="qty_load1[]" value="<?php echo $rowdata['qty_load']; ?>" /></td>
            <td class="border-btm-rht"><input type="text" name="quality_inspection1[]"   id="quality_inspection1" value="<?php echo $rowdata['quality_inspection']; ?>"/></td>
            <td class="border-btm-rht"><input type="text" name="total_production_qty1[]" id="total_production_qty1" value="<?php echo $rowdata['total_prod_qty']; ?>"/></td>
            <td class="border-btm-rht"><input type="text" name="total_qc_passed1[]"  id="total_qc_passed1" onchange="calqc(this);"  value="<?php echo $rowdata['total_qc_passed']; ?>"/></td>
            <td class="border-btm-rht"><input type="text" name="balance_qty1[]" id="balance_qty1"  value="<?php echo $rowdata['balance_qty']; ?>"/></td>
            <td class="border-btm-rht"><input type="text" name="balance_wip1[]" id="balance_wip1" value="<?php echo $rowdata['balance_wip']; ?>"/>
            <input type="hidden" name="batch_id[]" value="<?php echo $rowdata['id']; ?>" />	
            	
            </td>   
        </tr>
            <?php $i++; }?>
            
             <tbody id="dataTable">
          <tr>
          	<td class="border-btm-rht"><input type="checkbox" name="chk" /></td>
            <td class="border-btm-rht"><input type="text" name="batch_no[]"   /></td>
            <td class="border-btm-rht"><select  name="process_name[]">
            	<option value="0">Select </option>
            	<?php
            	$sql=DB_query("select * from production_process_master",$db);
				while($rowsql=DB_fetch_array($sql))
				{			
            	 ?>
            	 <option value="<?php echo $rowsql['id']; ?>"><?php echo $rowsql['manuf_process_name']; ?></option>
            	<?php } ?></select></td>
            <td class="border-btm-rht"><input type="text" name="process_flow_no[]"  /></td>
            <td class="border-btm-rht"><input type="text" name="qty_load[]"  /></td>
            <td class="border-btm-rht"><input type="text" name="quality_inspection[]"   id="quality_inspection"/></td>
            <td class="border-btm-rht"><input type="text" name="total_production_qty[]" id="total_production_qty" /></td>
            <td class="border-btm-rht"><input type="text" name="total_qc_passed[]"  id="total_qc_passed" onchange="calqc(this);" /></td>
            <td class="border-btm-rht"><input type="text" name="balance_qty[]" id="balance_qty" /></td>
            <td class="border-btm-rht"><input type="text" name="balance_wip[]" id="balance_wip" /></td>   
        </tr><//tbody>
        </table></div>
         </fieldset>
        </td>
      </tr>
    </table></td>
  </tr><tr><td>&nbsp;</td>
  </tr> <tr><td>&nbsp;</td>
  </tr>
  <tr>
    <td><div style="margin:0px; float:left; padding:0px; overflow:scroll; width:990px; height:150px;"><table width="970" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><table width="1015" border="0" align="left" cellpadding="0" cellspacing="0" class="border">
          <tr class="text">
            <td width="482" height="20" align="center" class="border-btm-rht">Breakdown Process Production</td>
            <td width="482" height="20" align="center" class="border-btm-rht">QC Rejection Precess Production</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="1015" border="0" align="left" cellpadding="0" cellspacing="0">
          <tr class="text1">
            <td align="left" class="border-btm-rht" id="text1">Breakdown Type</td>
            <td align="left" class="border-btm-rht" id="text1">Breakdown Reason</td>
            <td align="left" class="border-btm-rht" id="text1">Breakdown Description</td>
            <td align="left" class="border-btm-rht" id="text1">Breakdown in Minutes</td>
            <td align="left" class="border-btm-rht" id="text1">Quality Rejection Applicable</td>
            <td align="left" class="border-btm-rht" id="text1">Rejection QC Date &amp; time</td>
            <td align="left" class="border-btm-rht" id="text1">Department</td>
            <td align="left" class="border-btm-rht" id="text1">Quality Inspector Executive Name</td>
            <td align="left" class="border-btm-rht" id="text1">Rejection Type</td>
            <td align="left" class="border-btm-rht" id="text1">Rejection Reason</td>
            <td align="left" class="border-btm-rht" id="text1">Rejection Description</td>
            <td align="left" class="border-btm-rht" id="text1">Quantity Rejection</td>
            <td align="left" class="border-btm-rht" id="text1">Quantity QC Ok</td>
            </tr>
             <tr class="text1">
            <td align="left" class="border-btm-rht" id="text1"><select name="breakdown_type" id="breakdown_type">
            	<option value="0">--Select--</option>
            	<?php
            	$breaktype=DB_query("select * from break_down_master",$db);
				while($break_row=DB_fetch_array($breaktype))
				{
				$break='';
				if($break_row['id']==$edit_sql['breakdown_type'])
				{
				$break="selected";	
				}	            	
            	 ?>
            	 <option value="<?php echo $break_row['id']; ?>" <?php echo $break; ?>><?php echo $break_row['brack_down_type']; ?></option>
            	 <?php } ?>
            	</select>         	
            	
            	</td>
            <td align="left" class="border-btm-rht" id="text1"><select name="breakdown_reason" id="breakdown_reason">
            	<option value="0">--Select--</option>
            	<?php
            	$breaktype=DB_query("select * from break_down_master",$db);
				while($break_row=DB_fetch_array($breaktype))
				{
					$break1='';
				if($break_row['id']==$edit_sql['breakdown_reason'])
				{
				$break1="selected";	
				}	                    	
            	 ?>
            	 <option value="<?php echo $break_row['id']; ?>"<?php echo $break1;?>><?php echo $break_row['brack_down_type']; ?></option>
            	 <?php } ?>
            	
            </select> </td>
            <td align="left" class="border-btm-rht" id="text1"><input type="text" name="breakdown_desc" value="<?php echo $edit_sql['breakdown_desc']; ?>"/></td>
            <td align="left" class="border-btm-rht" id="text1"><input type="text" name="breakdown_in_mintes" value="<?php echo $edit_sql['breakdown_in_mintes']; ?>"/></td>
            <td align="left" class="border-btm-rht" id="text1"><select name="quality_rejection" id="quality_rejection" >
            	<option value="0">--Select--</option>
            	<option value="Yes" <?php if($edit_sql['quality_rejection']=='Yes'){?> selected="selected" <?php } ?>>Yes</option>
            	<option value="NO" <?php if($edit_sql['quality_rejection']=='No'){?> selected="selected" <?php } ?>>No</option>
            	</select></td>
            <td align="left" class="border-btm-rht" id="text1"><input type="text" name="rejection_qc_date" id="rejection_qc_date"  class="datepicker" value="<?php echo $edit_sql['rejection_qc_date']; ?>" /></td>
            <td align="left" class="border-btm-rht" id="text1"><select name="deptid" id="deptid">
            	<option value="0">--Select--</option>
            	<?php
            	$depart=DB_query("select * from deptmaster",$db);
            	while($depart_row=DB_fetch_array($depart))
				{
				$dep='';
				if($depart_row['id']==$edit_sql['deptid'])
				{
				$dep="selected";	
				}	
            	 ?>
            	 <option value="<?php echo $depart_row['id']; ?>"<?php echo $dep; ?>><?php echo $depart_row['deptname']; ?></option>
            	 <?php } ?>
            	</select>
            	</td>
            <td align="left" class="border-btm-rht" id="text1"><input type="text" name="quality_insp_execu_name" id="quality_inspector_ex_name"  value="<?php echo $edit_sql['quality_inspector_ex_name']; ?>"/></td>
            <td align="left" class="border-btm-rht" id="text1"><input type="text" name="rejection_type" id="rejection_type"   value="<?php echo $edit_sql['rejection_type']; ?>"/></td>
            <td align="left" class="border-btm-rht" id="text1"><input type="text" name="rejection_reason" id="rejection_reason"  value="<?php echo $edit_sql['rejection_reason']; ?>" /></td>
            <td align="left" class="border-btm-rht" id="text1"><input type="text" name="rejection_desc" id="rejection_desc"   value="<?php echo $edit_sql['rejection_desc']; ?>"/></td>
            <td align="left" class="border-btm-rht" id="text1"><input type="text" name="qunatity_rejection" id="qunatity_rejection"   value="<?php echo $edit_sql['qunatity_rejection']; ?>"/></td>
            <td align="left" class="border-btm-rht" id="text1"><select name="quantity_qc" id="quantity_qc">
            	<option value="0">--Select--</option>
            	<option value="Yes" <?php if($edit_sql['quantity_qc']=='Yes'){ ?> selected="selected" <?php }?>>Yes</option>
            	<option value="NO"<?php if($edit_sql['quantity_qc']=='No'){ ?> selected="selected" <?php }?>>No</option>
            	</select></td>
            </tr>
          </table></td>
      </tr>
      </table></div></td>
  </tr>
  <tr>
    <td><table width="990" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="252">
        <fieldset style="margin:0px; padding:0px;">
        <legend>Drawing By</legend>
        <table width="250" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="125" height="25" align="left" valign="top" class="text"><input type="radio" name="radio" id="radio" value="radio" />
      Company</td>
    <td width="125" height="25" align="left" valign="top"><span class="text">
      <input type="radio" name="radio" id="radio2" value="radio" />
Coustomer</span></td>
  </tr>
</table>
        </fieldset>
        </td>
        <td width="738"><input style="width:150px; height:30px;" type="submit" name="button" id="button" value="Daily Production Entry"/>
          <input style="width:150px; height:30px;" type="submit" name="View" id="button2" value="View Marketing Notes" />
          <input style="width:150px; height:30px;" type="submit" name="Document" id="button3" value="Document Attachments" />
          <input style="width:140px; height:30px;" type="submit" name="Demand" id="button4" value="Demand Material Slip" />
          <input style="width:45px; margin-left:25px; height:30px;" type="submit" name="Update" id="Update" value="Update" />
          <input style="width:50px; height:30px;" type="submit" name="Close" id="button6" value="Close" /></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  </table>

</fieldset>  
</form>   
</body>

<script language="JavaScript">    
function generateCode(str) 
{	 
	if (str.length==0)
  {
  document.getElementById("sopdate").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("sopdate").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","job_routepop.php?site="+str,true);
xmlhttp.send();
}



function getitem(str)
{	
if (str.length==0)
  {
  document.getElementById("div_text").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("div_text").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getitemcode.php?site1="+str,true);
xmlhttp.send();
} 
function calqc(obj)
{  
	      var amount='';
	      var rowCount = document.getElementById('dataTable').rows.length;
	      var arr = obj.id.split("_");
	      var rowx1=0;
	   if (arr[1]==undefined)
	   {
	    var nm='';
	    var t=document.getElementById('total_production_qty').value;
	    var k=document.getElementById('total_qc_passed').value;
        var amount=t-k;
        document.getElementById('balance_qty').value=amount;
        //document.getElementById('balance_wip').value=amount;
       }
	 else
	 {
	 var nm='_'+arr[1];
	 }
	  for(var i=1;i<=rowCount;i++)
	{   var t=document.getElementById('total_production_qty'+nm).value;
	        var k=document.getElementById('total_qc_passed'+nm).value;
          var amount=t-k;
        document.getElementById('balance_qty'+nm).value=amount;
         document.getElementById('balance_wip'+nm).value=amount;
		}
		
			
	}
	
</script>

