<?php
$time_now=mktime(date('h')+5,date('i')+30,date('s'));
$time1=date('h:i:s',$time_now);
if(isset($_POST['Update']))
{
 $update_production="update daily_production_process  set machine_center_id='".$_REQUEST['machine_center_id']."',production_operator_id='".$_REQUEST['production_operator_id']."',
          shift_of_production='".$_REQUEST['shift_of_production']."',process_prod_date='".FormatDateForSQL($_REQUEST['process_pro_date'])."',process_in_time='".$_REQUEST['process_in_time']."'
          ,process_out_time='".$_REQUEST['procee_out_time']."',last_pend_qty_wip='".$_REQUEST['last_pend_qty_wip']."',production_qty='".$_REQUEST['production_qty']."'
           ,process_qty_check='".$_REQUEST['production_qty_check']."',production_qty_qc='".$_REQUEST['production_qty_qc']."',process_name='".$_REQUEST['processname']."' where daily_id='".$_REQUEST['Id']."'";
$update1=DB_query($update_production,$db);
 
 $update_breakdown="update daily_rejection_process set daily_id='".$_REQUEST['Id']."',quality_rejec_appli='".$_REQUEST['quality_rejec_appli']."'
          ,rejection_qc_date='".FormatDateForSQL($_REQUEST['rejection_qc_date'])."',deptid='".$_REQUEST['deptid']."',executive_name='".$_REQUEST['executive_name']."',
          rejection_type='".$_REQUEST['rejection_qc_date']."',rejection_reason='".$_REQUEST['rejection_reason']."'
          ,rejection_desc='".$_REQUEST['rejection_desc']."',quantity_rejection='".$_REQUEST['quantity_rejection']."'
          ,quantity_qc='".$_REQUEST['quantity_qc']."' where id='".$_REQUEST['breakdown_id']."'";	
 $update2=DB_query($update_breakdown,$db);     
 
  $update_rejection="update daily_production_breakdown set daily_id='".$_REQUEST['Id']."',breakdown_applicable='".$_REQUEST['breakdown_applicable']."'
         ,breakdown_intimation_date='".FormatDateForSQL($_REQUEST['breakdown_intimation_date'])."',maintenance_dept='".$_REQUEST['maintenance_dept']."'
        ,maintenance_executive_name='".$_REQUEST['maintenance_executive_name']."',breakdown_type='".$_REQUEST['breakdown_type']."'
        ,breakdown_reason='".$_REQUEST['breakdown_reason']."',breakdown_desc='".$_REQUEST['breakdown_desc']."',breakdown_minute='".$_REQUEST['breakdown_minute']."'
        where id='".$_REQUEST['rejection_id']."'";
         $update3=DB_query($update_rejection,$db); 
}






$sql=DB_query("select * from daily_production_process where daily_id='".$_REQUEST['Id']."'",$db);
$sql_edit=DB_fetch_array($sql);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Daily Production Entry</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.main-heading{
		font:18px Verdana, Geneva, sans-serif;
		color:#000;
}
.text{
		font:12px Verdana, Geneva, sans-serif;
		color:#000;
}

-->
</style></head>

<body>
	<form action="" method="Post">
<table width="990" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
    <td colspan="2" align="center" valign="top" class="main-heading">Edit Daily Production Entry</td>
  </tr>
  <tr>
    <td width="476" align="left" valign="top">&nbsp;</td>
    <td width="514" align="right" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td align="left" valign="top"><fieldset style="margin:0px; padding:0px;">
    <legend align="center" class="text"><strong>Process Production</strong></legend>
<table width="485" border="0" align="left" cellpadding="2" cellspacing="2">
      <tr>
        <td width="223" align="left" class="text">Process Name :</td>
        <td width="248" align="left" valign="top"><select style="width:200px;" name="processname" id="processname">
        <option value="000">--Select---</option>
        <?php 
        $process=DB_query("select * from production_process_master",$db);
		while($row_process=DB_fetch_array($process))
		{
		$k='';
		if($row_process['id']==$sql_edit['process_name'])
		{
		$k="selected";	
		}	        
        ?> 
        <option value="<?php echo $row_process['id']; ?>" <?php echo $k; ?>><?php echo $row_process['manuf_process_name']; ?></option> 
        <?php } ?>
        </select> 
          *</td>
      </tr>
      <tr>
        <td align="left" class="text">Process Parameter :</td>
        <td align="left" valign="top"><select style="width:200px;" name="process_para" id="process_para">
          <option value="0">---Select---</option>
        </select></td>
      </tr>
      <tr>
        <td align="left" class="text">Machine Center :</td>
        <td align="left" valign="top"><select style="width:200px;" name="machine_center_id" id="machine_center_id">
          <option  value="000">--Select---</option>
          <?php
          $machine=DB_query("select * from machine_center",$db);
		  while($row_machine=DB_fetch_array($machine))
		  {
		  $m='';
		  if($row_machine['id']==$sql_edit['machine_center_id'])
		  {
		  $m="selected";	
		  }	 
          ?>
         <option value="<?php echo $row_machine['id']; ?>" <?php echo $m; ?>><?php echo $row_machine['code']; ?></option> 
         <?php } ?>
        </select>
          *</td>
      </tr>
      <tr>
        <td align="left" class="text">Production Operator :</td>
        <td align="left" valign="top"><select style="width:200px;" name="production_operator_id" id="production_operator_id">
          <option value="000">--Select---</option>
          <?php
          $production=DB_query("select * from production_operator_master",$db);
		  while($row_prod=DB_fetch_array($production))
		  {
		  $p='';
		  if($row_prod['id']==$sql_edit['production_operator_id'])
		  {
		  $p="selected";	
		  }	 
          ?>
          <option value="<?php echo $row_prod['id']; ?>" <?php echo $p; ?>><?php echo $row_prod['operator_name']; ?></option>
          <?php } ?>
        </select>
          *</td>
      </tr>
      <tr>
        <td align="left" class="text">Shift of Production :</td>
        <td align="left" valign="top"><select style="width:120px;" name="shift_of_production" id="shift_of_production">
          <option value="000">--Select--</option>
          <?php 
          $shift=DB_query("select * from production_shift",$db);
		  while($row_shift=DB_fetch_array($shift))
		  {
		  $s='';
		  if($row_shift['id']==$sql_edit['shift_of_production'])
		  {
		  $s="selected";	
		  }	         
          ?>
          <option  value="<?php echo $row_shift['id']; ?>" <?php echo $s; ?>><?php echo $row_shift['shift_name']; ?></option>
          <?php } ?>
        </select>
          *</td>
      </tr>
      <tr>
        <td align="left" class="text">Process Production Date :</td>
        <td align="left" valign="top"><input type="text" style="width:120px;" name="process_pro_date" id="process_pro_date" class="datepicker" value="<?php echo $sql_edit['process_prod_date'];?>">
          </td>
      </tr>
      <tr>
        <td align="left" class="text">Process In Time :</td>
        <td align="left" valign="top"><input type="text" style="width:120px;" name="process_in_time" id="process_in_time" value="<?php echo $sql_edit['process_in_time'] ?>" ></td>
      </tr>
      <tr>
        <td align="left" class="text">Process Out Time :</td>
        <td align="left" valign="top"><input type="text" style="width:120px;" name="procee_out_time" id="procee_out_time" class="datepicker" value="<?php echo $sql_edit['process_out_time'] ?>">
         </td>
      </tr>
      <tr>
        <td align="left" class="text">Last Pending WIP Qty :</td>
        <td align="left" valign="top"><input style="width:116px" type="text" name="last_pend_qty_wip" id="last_pend_qty_wip"  value="<?php echo $sql_edit['last_pend_qty_wip'] ?>"/></td>
      </tr>
      <tr>
        <td align="left" class="text">Production Quantity :</td>
        <td align="left" valign="top"><input style="width:116px" type="text" name="production_qty" id="production_qty"  value="<?php echo $sql_edit['production_qty'] ?>"/>
          *</td>
      </tr>
      <tr>
        <td align="left" class="text">Process Quality Check Required :</td>
        <td align="left" valign="top"><input type="text" style="width:120px;" name="production_qty_check" id="production_qty_check" value="<?php echo $sql_edit['process_qty_check'] ?>">
          </td>
      </tr>
      <tr>
        <td align="left" class="text">Production Quantity With QC :</td>
        <td align="left" valign="top"><input style="width:116px" type="text" name="production_qty_qc" id="production_qty_qc" value="<?php echo $sql_edit['production_qty_qc'] ?>"/>
          *</td>
      </tr>
      </table>
</fieldset></td>
    <td align="right" valign="top"><fieldset style="margin:0px; padding:0px;">
      <legend align="center" class="text"><strong>QC Rejection Process Production</strong></legend>
      <?php
      $qcsql=DB_query("select * from daily_rejection_process where daily_id='".$_REQUEST['Id']."'",$db);
         $Qc_edit=DB_fetch_array($qcsql); 
      ?>
      <table width="485" border="0" align="center" cellpadding="2" cellspacing="2">
        <tr>
          <td width="223" align="left" class="text">Quality Rejection Applicable :</td>
          <td width="248" align="left" valign="top"><select style="width:120px;" name="quality_rejec_appli" id="quality_rejec_appli">
            <option value="0">--Select---</option>
           <option value="Yes" <?php if($Qc_edit['quality_rejec_appli']=='Yes'){?> selected="selected" <?php } ?>>Yes</option>
            <option value="No" <?php if($Qc_edit['quality_rejec_appli']=='No'){?> selected="selected" <?php } ?>>No</option>
          </select></td>
          </tr>
        <tr>
          <td align="left" class="text">Rejection QC Date &amp; Time :</td>
          <td align="left" valign="top"><input type="text" style="width:120px;" name="rejection_qc_date" id="rejection_qc_date" class="datepicker" value="<?php echo $Qc_edit['rejection_qc_date'];?>">
           </td>
          </tr>
        <tr>
          <td align="left" class="text">Department :</td>
          <td align="left" valign="top">
          	<select name="deptid" id="deptid" style="width:120px;">
            	<option value="0">--Select--</option>
            	<?php
            	$depart=DB_query("select * from deptmaster",$db);
            	while($depart_row=DB_fetch_array($depart))
				{
				$d='';
				if($depart_row['id']==$Qc_edit['deptid'])	
				{
				$d="selected";	
				}
            	 ?>
            	 <option value="<?php echo $depart_row['id']; ?>" <?php echo $d; ?>><?php echo $depart_row['deptname']; ?></option>
            	 <?php } ?>
            	</select>
          	</td>
          </tr>
        <tr>
          <td align="left" class="text">Quality Inspector Executive Name :</td>
          <td align="left" valign="top"><input style="width:200px" type="text" name="executive_name" id="executive_name"  value="<?php echo $Qc_edit['executive_name'];?>"/></td>
          </tr>
        <tr>
          <td align="left" class="text">Rejection Type :</td>
          <td align="left" valign="top"><input type="text" style="width:205px;" name="rejection_type" id="rejection_type" value="<?php echo $Qc_edit['rejection_type'];?>">
          </select></td>
          </tr>
        <tr>
          <td align="left" class="text">Rejection Reason :</td>
          <td align="left" valign="top"><input type="text" style="width:205px;" name="rejection_reason" id="rejection_reason" value="<?php echo $Qc_edit['rejection_reason'];?>">
         </td>
          </tr>
        <tr>
          <td align="left" class="text">Rejection Description :</td>
          <td align="left" valign="top"><input style="width:200px" type="text" name="rejection_desc" id="rejection_desc" value="<?php echo $Qc_edit['rejection_desc'];?>"/></td>
          </tr>
        <tr>
          <td align="left" class="text">Quantity Rejection :</td>
          <td align="left" valign="top"><input style="width:116px" type="text" name="quantity_rejection" id="quantity_rejection"  value="<?php echo $Qc_edit['quantity_rejection'];?>"/>
          	<input type="hidden" name="rejection_id" value="<?php echo $break_edit['id']; ?>" />
          	
          </td>
          </tr>
        <tr>
          <td align="left" class="text">Quantity QC OK :</td>
          <td align="left" valign="top"><select  style="width:116px"  name="quantity_qc" id="quantity_qc" />
          	<option value="0">--Select--</option>
            	<option value="Yes" <?php if($Qc_edit['quantity_qc']=='Yes') {?> selected="selected" <?php } ?>>Yes</option>
            	<option value="NO" <?php if($Qc_edit['quantity_qc']=='No') {?> selected="selected" <?php } ?>>No</option>
            </select>          	
          </td>
        </tr>
      </table>
    </fieldset></td>
  </tr>
  <tr>
    <td align="left" valign="top">&nbsp;</td>
    <td align="right" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td align="left" valign="top"><fieldset style="margin:0px; padding:0px;">
      <legend align="center" class="text"><strong>Breakdown Process Production</strong></legend>
      <?php
      $breaksql=DB_query("select * from daily_production_breakdown where daily_id='".$_REQUEST['Id']."'",$db);
         $break_edit=DB_fetch_array($breaksql); 
      ?>
      <table width="485" border="0" align="left" cellpadding="2" cellspacing="2">
        <tr>
          <td width="237" align="left" class="text">Breakdown Applicable :</td>
          <td width="234" align="left" valign="top"><select style="width:120px;" name="breakdown_applicable" id="breakdown_applicable">
          <option value="0">--Select--</option>
             <option value="Yes" <?php if($break_edit['breakdown_applicable']=='Yes'){?> selected="selected" <?php } ?>>Yes</option>
            <option value="No" <?php if($break_edit['breakdown_applicable']=='No'){?> selected="selected" <?php } ?>>No</option>
          </select></td>
          </tr>
        <tr>
          <td align="left" class="text">Breakdown Intimation Date &amp; Time :</td>
          <td align="left" valign="top"><select style="width:120px;" name="breakdown_intimation_date" id="breakdown_intimation_date" class="datepicker" value="<?php echo $break_edit['breakdown_intimation_date']; ?>">
            <option>27/04/2012</option>
          </select><input type="hidden" name="breakdown_id" value="<?php echo $break_edit['id']; ?>" /></td>
          </tr>
        <tr>
          <td align="left" class="text">Maintenance Department :</td>
          <td align="left" valign="top"><select style="width:120px;" name="maintenance_dept" id="maintenance_dept">
          	<option value="0">--Select--</option>
          </select></td>
          </tr>
        <tr>
          <td align="left" class="text">Maintenance Executive Name :</td>
          <td align="left" valign="top"><input style="width:200px" type="text" name="maintenance_executive_name" id="maintenance_executive_name"  value="<?php echo $break_edit['maintenance_executive_name']; ?>"/></td>
          </tr>
        <tr>
          <td align="left" class="text">Breakdown Type :</td>
          <td align="left" valign="top"><select style="width:205px;" 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))
				{
				$br='';
				if($break_row['id']==$break_edit['breakdown_type'])
				{
				$br="selected";	
				}	            	
            	 ?>
            	 <option value="<?php echo $break_row['id']; ?>"<?php echo $br; ?>><?php echo $break_row['brack_down_type']; ?></option>
            	 <?php } ?>
          </select></td>
          </tr>
        <tr>
          <td align="left" class="text">Breakdown Reason :</td>
          <td align="left" valign="top"><input type="text" style="width:205px;" name="breakdown_reason" id="breakdown_reason" value="<?php echo $break_edit['breakdown_reason']; ?>"></td>
          </tr>
        <tr>
          <td align="left" class="text">Breakdown Description :</td>
          <td align="left" valign="top"><input style="width:200px" type="text" name="breakdown_desc" id="breakdown_desc" value="<?php echo $break_edit['breakdown_desc']; ?>" /></td>
          </tr>
        <tr>
          <td align="left" class="text">Breakdown in Minutes :</td>
          <td align="left" valign="top"><input style="width:116px" type="text" name="breakdown_minute" id="breakdown_minute"  value="<?php echo $break_edit['breakdown_minute']; ?>"/></td>
          </tr>
      </table>
    </fieldset></td>
    <td align="right" valign="top"><input style="width:100px; height:30px;" type="submit" name="Update" id="button" value="Update"  />
    <input style="width:100px; height:30px;" type="submit" name="button2" id="button2" value="Close" /></td>
  </tr>
  <tr>
    <td align="left" valign="top">&nbsp;</td>
    <td align="right" valign="top">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
