<?php
$sql=DB_query("select * from daily_production_process where daily_id='".$_REQUEST['Id']."'",$db);
$rowdata1=DB_fetch_array($sql);
?>
<p align="center"><strong><h2 align="center"> View Daily Production Entry  Against Job Card</h2></strong></p>
<br>
<p align="center"><strong>Branch:</strong>
	 <?php
	
 		$sql = "SELECT loccode, locationname FROM locations where loccode='".$rowdata1['branch_id']."'";
	 	$resultStkLocs = DB_query($sql,$db);
		?>
	<select name="site" style="width:100px" >
	
      <?php    
			while ($myrow=DB_fetch_array($resultStkLocs))
				{
				?>
      <option value="<?php echo $myrow['loccode']; ?>"><?php echo $myrow['locationname'];?></option>
      <?php  }	?> 
    </select></p>
   
<p align="left"><strong>General Details</strong></p>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
    <tr>
        <td nowrap="nowrap" colspan="2" width="50%" valign="top">
        <div id="enquiryId" style="width:100%; margin:0 auto;">
            <table width="100%" cellpadding="2" cellspacing="1" border="0">
            	
            	<tr>
                 <th align="left" width="24%"><strong>Entry Slip No.</strong></th>
                    <td width="27%" id="vouchar"><input type="text" name="entry_slip" style="width:100%;" id="entry_slip" value="<?php echo $rowdata1['entry_slip_no']; ?>"/></td>
                    	<th align="left" width="20%"><strong>Job Card  No.</strong></th>
                     <td><select  name="job_ticket" id="job_ticket" style="width:100%"  >
                    	
                    	<?php
                    	$sql=DB_query("select * from job_route_card where id='".$rowdata1['job_card_id']."'",$db);
						while($row=DB_fetch_array($sql))
						{ 
                    	?>
                    	<option value="<?php echo $row['id']; ?>"><?php echo $row['job_card_no']; ?></option>
                    	<?php } ?></select>
                     </td>
      </tr>
      </table></div></td>
      </tr> 
      <tr>       	
    <td valign="top">
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td colspan="4" id="quoteId">
     
        <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" >
    <tr>
        <td nowrap="nowrap" colspan="2" width="50%" valign="top">
        <div id="enquiryId" style="width:100%; margin:0 auto;">
            <table width="100%" cellpadding="2" cellspacing="1" border="0">
                <tr><tr>
                 <th align="left" width="24%"><strong>Item</strong></th>
                    <td width="27%" id="vouchar"><input type="text" name="item_name1" style="width:100%;" id="item_name1" value="<?php echo $rowdata1['item']; ?>"/></td>
                    	<th align="left" width="20%"><strong>Job Card Date</strong></th>
                     <td><input type="text" name="job_date" id="job_date" style="width:100%;" value="<?php echo $rowdata1['job_card_data']; ?>"></td>                  
      </tr>
        </table></div>      
        </td>
        </tr>
    </table></td></tr></table></td></tr>
    <tr>
        <td nowrap="nowrap" colspan="2" width="50%" valign="top">
        <div id="enquiryId" style="width:100%; margin:0 auto;">
            <table width="100%" cellpadding="2" cellspacing="1" border="0">
            	 <tr>
        <th align="left" width="24%"><strong>PP Slip No/Date</strong></th>
        <td width="27%" id="vouchar"><input type="text" name="pp_slip" style="width:100%;" id="pp_slip" value="<?php echo $rowdata1['pp_slip_date']; ?>"/></td><td></td><td></td>
      </tr>
      </table></div></td>
      </tr> 
   
   <tr><td><p align="left"><strong> Daily Production Details: </strong></p>
                    <table width="100%" cellpadding="2" cellspacing="1" border="0">
                <tr>     <th align="left" width="5%"><strong>Process Name</strong></th>
                    <td width="27%" >
                    	<select name="process_name" style="width:100%" >
                     	
                     	<?php
                     	$data=DB_query("select * from production_process_master where id='".$rowdata1['process_name']."'",$db);
                     	while($row=DB_fetch_array($data))
						{
                     	 ?>
                     	<option value="<?php echo $row['id']; ?>"><?php echo $row['manuf_process_name']; ?></option>
                     	<?php } ?>
                     </select>
                    	
                    	</td>
                    <th  align="left"><strong>Machine Center</strong></th>
                     <td><select name="machine" style="width:100%" >
                     	
                     	<?php
                     	$data=DB_query("select * from machine_center where id='".$rowdata1['machine_center']."'",$db);
                     	while($row=DB_fetch_array($data))
						{
                     	 ?>
                     	<option value="<?php echo $row['id']; ?>"><?php echo $row['code']; ?></option>
                     	<?php } ?>
                     </select></td>
                     </tr>
                     <tr>
                     	  <th width="33%"  align="left" ><strong>Machine Operator</strong></th>
                     <td  width="25%">
                     	<select name="machine_operator" style="width:100%" >
                                          	<?php
                     	$data1=DB_query("select * from production_operator_master where id='".$rowdata1['machine_operator']."'",$db);
                     	while($row1=DB_fetch_array($data1))
						{
                     	 ?>
                     	<option value="<?php echo $row1['id']; ?>"><?php echo $row1['operator_name']; ?></option>
                     	<?php } ?>
                     </select>
                     	
                     	
                     	
                     	
                     </td>
                       	<th width="24%" align="left"><strong>Process Start Time
                       		</strong></th>
                    <td width="27%"><input type="text" name="startdate" id="startdate" value="<?php echo $rowdata1['process_in_date'];?>"  style="width:60%"  class="datepicker"  />
                    	 <input type="text" name="starttime" id="starttime" value="<?php echo $rowdata1['process_in_time'];?>"  style="width:35%" />
                    </td></tr>
                    <tr>
                      <th align="left"><strong>Process End Time</strong></th>
                     <td><input type="text" name="enddate" id="enddate" value="<?php echo $rowdata1['process_out_date'];?>"  style="width:60%" class="datepicker" /> 
                     	<input type="text" name="endTime" id="endTime" value="<?php echo $rowdata1['process_out_time'];?>" style="width:35%" />
                     
                  	<th width="15%" align="left"><strong>Production Shift</strong></th>
                    <td width="27%"><select name="production_shift" style="width:100%;"><option value="0">Select</option>
                    	<?php
                    	$shift=DB_query("select * from production_shift where id='".$rowdata1['production_shift']."'",$db);
                    	while($shift_row=DB_fetch_array($shift))
						{
                    	?>
                    	<option value="<?php echo $shift_row['id']; ?>"><?php echo $shift_row['shift_name']; ?></option>
                    	<?php } ?>
                    	
                    </select>
                    	
                    	
                    	
                     </td></tr>   
                     <tr>
                  	<th width="24%" align="left"><strong>Process Producion Date</strong></th>
                    <td width="27%"><input type="text" name="process_prod_date" style="width:100%;" value="<?php echo $rowdata1['process_prod_date']; ?>">
                    	</td>
                      <th align="left"><strong>Actual Production/Print Qty</strong></th>
                     <td><input type="text" name="actual_prod_qty" style="width:100%;" id="actual_prod_qty" value="<?php echo $rowdata1['actual_prod_qty']; ?>"/>
                     	
                     	
                     	
                     </td><//tr>
                 <tr>
                  	<th width="24%" align="left"><strong>Total Process Hrs</strong></th>
                    <td width="27%"><input type="text" name="total_process_hrs" style="width:100%;" readonly="readonly" value="<?php echo $rowdata1['total_hrs']; ?>" />
                     </td>
                  	<th width="24%" align="left"><strong>Rejection allowed %</strong></th>
                    <td width="27%"><input type="text" name="rejection_allowed" id="rejection_allowed" style="width:100%;" value="<?php echo $rowdata1['rejection_allow']; ?>">
                    </td></tr>
                    <tr>
                      <th >After Rejection Qty</th>
                     <td><input type="text"  name="rejqty" id="rejqty" onfocus="percentage()" style="width:100%;" value="<?php echo $rowdata1['after_rejection']; ?>"/></td>                     
                  	<td ></td>
                    <td >
                     </td></tr>  
                 </table></td></tr>
                <tr><td> <p align="center"><strong>BreakDown Process Production</strong></p>
                 
                 <table width="100%" cellpadding="2" cellspacing="1" border="0" align="center" >
                 <?php 
                 $break=DB_query("select * from daily_production_breakdown where daily_id='".$_REQUEST['Id']."'",$db);
				 $breakdaily=DB_fetch_array($break);
                 ?>	
                 <tr>
          <th width="24%" align="left" class="text">Breakdown Applicable :</th>
          <td width="27%" align="left" valign="top"><select style="width:100%;" name="breakdown_applicable" id="breakdown_applicable">
          <option value="0">--Select--</option>
            	<option value="Yes"<?php if($breakdaily['breakdown_applicable']=="Yes"){ ?> selected="selected" <?php } ?>>Yes</option>
            	<option value="NO" <?php if($breakdaily['breakdown_applicable']=="Yes"){ ?> selected="selected" <?php } ?>>No</option>
          </select></td>          
          <th  align="left" class="text">Breakdown Type :</th>
          <td align="left" valign="top"><select style="width:100%;" name="breakdown_type" id="breakdown_type">
          	
            	<?php
            	$breaktype=DB_query("select * from break_down_master where id='".$breakdaily['breakdown_type']."' ",$db);
				while($break_row=DB_fetch_array($breaktype))
				{            	
            	 ?>
            	 <option value="<?php echo $break_row['id']; ?>"><?php echo $break_row['brack_down_type']; ?></option>
            	 <?php } ?>
          </select></td>
          
          </tr>
        <tr>
          <th align="left" width="27%">Maintenance Department :</th>
          <td align="left" valign="top" width="24%"><select style="width:100%;" name="maintenance_dept" id="maintenance_dept">
          
          	<?php
            	$depart=DB_query("select * from deptmaster where id='".$breakdaily['maintenance_dept']."'",$db);
            	while($depart_row=DB_fetch_array($depart))
				{
            	 ?>
            	 <option value="<?php echo $depart_row['id']; ?>"><?php echo $depart_row['deptname']; ?></option>
            	 <?php } ?>
          </select></td>
           <th align="left" class="text">Maintenance Executive Name :</th>
          <td align="left" valign="top"><select name="maintennace_ex_name" style="width:100%;" >
          	<option value="0">--Select--</option>
          	<?php
            	$depart1=DB_query("select * from production_maintenance_master where id='".$breakdaily['maintenance_executive_name']."'",$db);
            	while($depart_row1=DB_fetch_array($depart1))
				{
            	 ?>
            	 <option value="<?php echo $depart_row1['id']; ?>"><?php  echo $depart_row1['maintenance_name']; ?></option>
            	 <?php } ?>
          </select>
          </td>
        </tr>
            <tr>
            	<th align="left" class="text">Breakdown Intimation Date &amp; Time :</th>
          <td align="left" valign="top"><input type="text" name="break_down_strat_date" id="break_down_strat_date" value="<?php echo $breakdaily['break_down_strat_date'];?>"   style="width:60%" class="datepicker" /> 
                     	<input type="text" name="break_down_s_time" id="break_down_s_time" value="<?php echo $breakdaily['break_down_s_time'];?>" style="width:35%" /></td>
            	
            	<th align="left" class="text">Breakdown Intimation End Date &amp; Time :</th>
          <td align="left" valign="top"><input type="text" name="break_down_end_date" id="break_down_end_date" value="<?php echo  $breakdaily['break_down_end_date'] ?>"   style="width:60%" class="datepicker" /> 
                     	<input type="text" name="break_down_e_time" id="break_down_e_time" value="<?php echo $breakdaily['break_down_e_time'];?>" style="width:35%" /></td>
          
           </tr><tr>
           	 <th  align="left" class="text">Breakdown Reason :</th>
           <td align="left" valign="top">
          	<select style="width:100%;" name="breakdown_reason" id="breakdown_reason">
          	            	<?php
            	$breaktype1=DB_query("select * from break_down_type where id='".$breakdaily['breakdown_reason']."'",$db);
				while($break_row1=DB_fetch_array($breaktype1))
				{            	
            	 ?>
            	 <option value="<?php echo $break_row1['id']; ?>"><?php echo $break_row1['breakdown_reason']; ?></option>
            	 <?php } ?>
          </select>
          	
          	</td>  
         
          <th  align="left" class="text">Breakdown in Minutes :</th>
          <td align="left" valign="top"><input style="width:100%;" type="text" name="breakdown_minute" id="breakdown_minute" 
          	value="<?php echo $breakdaily['breakdown_minute']; ?>"/></td>
          
          </tr>
          <tr>
       <th  align="left" class="text">Breakdown Description :</th>
          <td align="left" valign="top" colspan="3"><input style="width:100%;" type="text" name="breakdown_desc" id="breakdown_desc" 
          	value="<?php echo $breakdaily['breakdown_desc']; ?>"
          	/></td>
            
            </tr>    
           </table></td></tr>
                <tr><td> <p align="center"><strong>Raw Material Consumptions</strong></p>
               <div align="center"><div style="overflow: auto; width: 900px; height: 150px;">
               	               	<table width="100%" border="0" cellspacing="2" cellpadding="2" >
              <tr>
               <th align='center'><strong>S.No</strong></th>
               <th align='center' ><strong>Item Code </strong></th>
               <th align='center' width='25%'><strong>Item Name </strong></th>
				<th align='center'><strong>Unit</strong></th>
				<th align='center'><strong> Group </strong></th>
               <th align='center'><strong>Make</strong></th>
                <th align='center'><strong>Grade</strong></th>
               <th align='center'><strong>Gsm</strong></th>
                <th align='center'><strong>Size</strong></th>
               <th align='center'><strong>Total Req Qty</strong></th>
               <th align='center'><strong>Act Consume Qty</strong></th>
                 <th align='center'><strong>Diff. Qty</strong></th>
                  
              </tr>
             <?php
 
              $i=1;
              $j=0;
			 
              $sqldata=DB_query("select * from daily_raw_material_consu where daily_id='".$_REQUEST['Id']."'",$db);
			  while($row5=DB_fetch_array($sqldata))
			  {                
              ?>
          <tr>
              <td align='center'><?php echo $i; ?></td>
               	<td align='center'><input type='text' name='item_code[]'  value="<?php echo $row5['item_code']; ?>" readonly/></td>
               <td align='center' width='25%'><input type='text' name='itemname[]'  value="<?php echo $row5['item_name']; ?>" readonly/></td>
				<td align='center'><input type='text' name='unit[]'  value="<?php echo $row5['unit']; ?>" readonly/></td>
				<td align='center'><input type='text'  name='group[]'  value="<?php echo $row5['group1']; ?>" readonly/></td>
                <td align='center'><input type='text'  name='make[]'   value="<?php echo $row5['make'];?>" readonly/></td>
               <td align='center'><input type='text'  name='grade[]'  value="<?php echo $row5['grade']; ?>" readonly/></td>
               <td align='center'><input type='text'  name='gsm[]'    value="<?php echo $row5['gsm']; ?>" readonly/></td>
                <td align='center'><input type='text'  name='size[]'   value="<?php echo$row5['size']; ?>" readonly/></td>
                <td align='center'><input type='text'  name='total_req_qty[]'  value="<?php echo $row5['total_req_qty']; ?>" id='total_req_qty_$j' readonly/></td> 
               <td align='center'><input type='text'  name='act_cons[]'  value="<?php echo $row5['total_req_qty']; ?>" /></td>  
               <td align='center'><input type='text'  name='diff_qty[]'  value="<?php echo $row5['total_req_qty']; ?>"/></td>
             </tr>
             <?php 
               $i++; $j++; }
?>	</table>
               	 	
      	      </div></div></td></tr>
            
                 
                 <tr><td><table width="100%" cellpadding="2" cellspacing="1" border="0">
                <tr>
                 <th align="left" colspan="2" width="25%"><strong>Remarks</strong></th>
                    <td colspan="2" width="75%"><textarea name="remarks" style="width:100%" ><?php echo $rowdata1['remarks']; ?></textarea>
                    	</td>
                   
                </tr> </table></td></tr>
             <tr><td> <table width="100%" cellpadding="2" cellspacing="1" border="0">
                <tr>
                 <th align="left"  width="25%"><strong>Created By</strong></th>
                    <td  ><input type="text" name="created" style="width:100%" value="<?php echo $rowdata1['created']; ?>">
                    	</td>
				     <th>Approved By PPC Head</th><td><select name="approved"  style="width:100%">
					<option value="0">Select</option>
				<option value="Yes"<?php if($rowdata1['approved_by']=='Yes') { ?> selected="selected" <?php } ?>>Yes</option>
	<option value="No" <?php if($rowdata1['approved_by']=='No') { ?> selected="selected" <?php } ?>>No</option>
	<option value="Pending" <?php if($rowdata1['approved_by']=='Pending') { ?> selected="selected" <?php } ?>>Pending</option>
					</select></td></tr>
										</table></td></tr></table>
									

