<script src="<?php echo base_url();?>assets/choosen.js"></script>
<link rel="stylesheet" href="<?php echo base_url();?>assets/style.css">
  
 <?php echo form_open(base_url(''),array('class'=>"form-horizontal add_fg_stock", 'id'=>"add_fg_stock")); ?>
                                    
                <?php if($this->session->flashdata('fg_stock_success')){ ?>
        <div class="alert alert-success solid" style='text-align:center;'><?php echo $this->session->flashdata('fg_stock_success'); ?></div>
    <?php } ?> 

     <div id='fg_stock_success' class='alert alert-success solid' style='display:none;'></div>   
<div class="row">
         <div class="col-lg-6 col-md-6 col-sm-12">
            <div class="form-group">
               
                <input type="hidden" name="created" id="created" value="<?php echo date('Y-m-d H:i:s'); ?>" class="form-control required">
            </div>
        </div>

        <div class="col-lg-6 col-md-6 col-sm-12">
            <div class="form-group">
               
                <input type="hidden" value="<?php echo date('Y-m-d H:i:s'); ?>" name="modified" id="modified" class="form-control required">
            </div>
        </div>
        <input type="hidden" value="<?php echo date('Y-m-d'); ?>" name="insert_date" id="insert_date" class="form-control required">


          <input type="hidden" name="user_id" id="user_id" value="<?php echo $this->session->userdata('id');?>">

          			 <div class="col-lg-3 col-md-6 col-sm-12">
                       <div class="form-group">
                            <label class="form-label">Machine:</label>
                             <select class="form-control machine"name="machine" required="required" id="machine">
                                <option>Select Option</option>
                                <?php  if(!empty($get_machine_data)){   ?>

                                    <?php foreach($get_machine_data as $get_machine){ ?>

                                    <option value="<?php echo $get_machine['machine']; ?>"><?php echo machine_name($get_machine['machine']); ?></option>

                                <?php } } ?>
                                
                            </select>
                         </div>
                        </div>

                     <div class="col-lg-3 col-md-6 col-sm-12" >
                       <div class="form-group">
                        <label class="form-label">Item:</label>
                       <input type="text" id="product_name" name="product_name" readonly="readonly"  placeholder="Product Name" required="required"  class="form-control product_name">
                     </div>
                    </div>

                    <div class="col-lg-3 col-md-6 col-sm-12">
                       <div class="form-group">
                        <label class="form-label">Job #:</label>
                       <input type="text" id="job" readonly="readonly" name="job" placeholder="JOB NO" required="required"  class="form-control job">
                     </div>
                    </div>


                  


                          <div class="col-lg-2 col-md-6 col-sm-12" id="range1_max_div" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Rang1 Max:</label>
                           <input type="text" id="range1_max" name="range1_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range1_min_div" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range1 Min:</label>
                           <input type="text" id="range1_min" name="range1_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range2_max_div" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range2 Max:</label>
                           <input type="text" id="range2_max" name="range2_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range2_min_div" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range2 Min:</label>
                           <input type="text" id="range2_min" name="range2_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range3" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range3 Max:</label>
                           <input type="text" id="range3_max" name="range3_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range4" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range3 Min:</label>
                           <input type="text" id="range3_min" name="range3_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range5" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range4 Max:</label>
                           <input type="text" id="range4_max" name="range4_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range6" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range4 Min:</label>
                           <input type="text" id="range4_min" name="range4_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range7" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range5 Max:</label>
                           <input type="text" id="range5_max" name="range5_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range8" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range5 Min:</label>
                           <input type="text" id="range5_min" name="range5_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>



                        <div class="col-lg-2 col-md-6 col-sm-12" id="range9" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">INJ-P Range Max:</label>
                           <input type="text" id="range1_injp_max" name="range1_injp_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range10" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">INJ-P Range Min:</label>
                           <input type="text" id="range1_injp_min" name="range1_injp_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>


                        <div class="col-lg-2 col-md-6 col-sm-12" id="range11" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range INJ-S Max:</label>
                           <input type="text" id="range2_injs_max" name="range2_injs_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range12" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range INJ-S Min:</label>
                           <input type="text" id="range2_injs_min" name="range2_injs_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range13" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range INJ-T Sec Max:</label>
                           <input type="text" id="range3_injt_sec_max" name="range3_injt_sec_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range14" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range INJ-T Sec Min:</label>
                           <input type="text" id="range3_injt_sec_min" name="range3_injt_sec_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range15" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range C-T Sec Max:</label>
                           <input type="text" id="range4_ct_sec_max" name="range4_ct_sec_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range16" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range C-T Sec Min:</label>
                           <input type="text" id="range4_ct_sec_min" name="range4_ct_sec_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range17" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range Doz mm Max:</label>
                           <input type="text" id="range5_doz_mm_max" name="range5_doz_mm_max" readonly="readonly"  class="form-control">
                         </div>
                        </div>

                        <div class="col-lg-2 col-md-6 col-sm-12" id="range18" style="display:none;">
                           <div class="form-group">
                            <label class="form-label badge badge-warning">Range Doz mm Min:</label>
                           <input type="text" id="range5_doz_mm_min" name="range5_doz_mm_min" readonly="readonly"  class="form-control">
                         </div>
                        </div>
                                        
                     

                        <div class="col-lg-12">


                        
                        </div>

                        <div class="col-lg-3 col-md-6 col-sm-12">
                               <div class="form-group">
                                    <label class="form-label">Die Condition</label>
                                    <select class="form-control" required="required" name="die_condition" id="die_condition">
                                     <option>Select Option</option>
                                     <option value="Good">Good</option>
                                     <option value="Bad">Bad</option>
                                        
                            </select>
                         </div>
                        </div>


                                                    <hr/>
                            <div class="col-lg-12 col-md-6 col-sm-12">
                         <h3> All Heaters Setting C || INJ-P || INJ-S || INJ-T Sec || C-T Sec || DOZmm<hr/></h3>
                     </div>


                      <div class="col-lg-2 col-md-6 col-sm-12">

                        <div class="form-group">
                            <label class="form-label">Range 1</label>
                             <input type="text" id="rang_1" name="rang_1" placeholder="Range" required="required"  class="form-control heater1">
                        </div>
                    </div>
                   <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Range 2</label>
                             <input type="text" id="rang_2" name="rang_2" placeholder="Range" required="required"  class="form-control heater2">
                        </div>
                    </div>


                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Range 3</label>
                             <input type="text" id="rang_3" name="rang_3" placeholder="Range" required="required"  class="form-control rang_3">
                        </div>
                    </div>



                     <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Range 4</label>
                             <input type="text" id="rang_4" name="rang_4" placeholder="Range" required="required"  class="form-control rang_4">
                        </div>
                    </div>

                          
                    <div class="col-lg-3 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Range 5</label>
                             <input type="text" id="rang_5" name="rang_5" placeholder="Range" required="required"  class="form-control rang_5">
                        </div>
                    </div>


                  

                      <div class="col-lg-2 col-md-6 col-sm-12">
                         
                        <div class="form-group">
                            <label class="form-label">Range  INJ-P</label>
                             <input type="text" id="rang_6" name="rang_6" placeholder="Range" required="required"  class="form-control rang_6">
                        </div>
                    </div>
                   <div class="col-lg-2 col-md-6 col-sm-12">
                   
                        <div class="form-group">
                            <label class="form-label">Range INJ-S</label>
                             <input type="text" id="rang_7" name="rang_7" placeholder="Range" required="required"  class="form-control rang_7">
                        </div>
                    </div>


                    <div class="col-lg-2 col-md-6 col-sm-12">
                        

                        <div class="form-group">
                            <label class="form-label">Range INJ-T Sec.</label>
                             <input type="text" id="rang_8" name="rang_8" placeholder="Range" required="required"  class="form-control rang_8">
                        </div>
                    </div>



                     <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">C-T Sec</label>
                             <input type="text" id="rang_9" name="rang_9" placeholder="Range" required="required"  class="form-control rang_9">
                        </div>
                    </div>

                          
                    <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">DOZ mm</label>
                             <input type="text" id="rang_10" name="rang_10" placeholder="Range" required="required"  class="form-control rang_10">
                        </div>
                    </div>


                      <div class="col-lg-3 col-md-6 col-sm-12">
                               <div class="form-group">
                                    <label class="form-label">Pieces Quality</label>
                                    <select class="form-control" required="required" name="pieces_quality" id="pieces_quality">
                                     <option>Select Option</option>
                                     <option value="sp">S-P</option>
                                     <option value="wp">W-P</option>
                                     <option value="ok">OK-PCS</option>
                                        
                            </select>
                         </div>
                        </div>



                      <div class="col-lg-3 col-md-6 col-sm-12">
                               <div class="form-group">
                                    <label class="form-label">Mould Cooling</label>
                                    <select class="form-control" required="required" name="mould_cooling" id="mould_cooling">
                                     <option>Select Option</option>
                                     <option value="hot">HOT</option>
                                     <option value="normal">Normal</option>
                                     <option value="cold">Cold</option>
                                        
                            </select>
                         </div>
                        </div>


                         <div class="col-lg-2 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Oil Temperature</label>
                             <input type="text" id="m_o_t" name="m_o_t" placeholder="M-T-O Range" required="required"  class="form-control rang_10">
                        </div>
                    </div>


                    <div class="col-lg-3 col-md-6 col-sm-12">
                               <div class="form-group">
                                    <label class="form-label">Shift</label>
                                    <select class="form-control" required="required" name="shift" id="shift">
                                     <option>Select Option</option>
                                     <option value="day">Day</option>
                                     <option value="night">Night</option>
                                        
                            </select>
                         </div>
                        </div>



                    <div class="col-lg-6 col-md-6 col-sm-12">
                    <div class="form-group">
                                    <label class="form-label">Remarks</label>
                                    <select class="form-control" required="required" name="remarks" id="remarks">
                                     <option>Select Option</option>
                                     <option value="Machine issue">Machine Issue</option>
                                     <option value="Die problem">Die Problem</option>
                                      <option value="None">None</option> 
                                      <option value="OK Pcs">OK Pcs</option> 
                            </select>
                         </div>
                        </div>

                  

                 </div>

                  <?php form_close();?>
               <button type="submit" id="dis_submit" class="btn btn-primary">Save <i class="icon-arrow-right14 position-right"></i></button>
                <div class="col-12">
					<div class="card">
						    <div class="card-body">
                                <button type="button" class="btn btn-rounded btn-success" onclick="btnExport_monthly();"><span class="btn-icon-left text-success"><i class="fa fa-download color-success"></i>
                                    </span>Download</button>
                               <br/><br/><br/>
                                <div class="table-responsive">

                                    <table  id="example" class="table table-striped table-bordered" style="font-size:10px;">
                                        <thead>
                                            <tr>
                                                
                                                <th>Machine</th>
                                                <th>Item</th>
                                                <th>Job#</th>
                                                <th>Die</th>
                                                <th>Range 1</th>
                                                <th>Range 2</th>
                                                <th>Range 3</th>
                                                <th>Range 4</th>
                                                <th>Range 5</th>
                                                <th>Range 6</th>
                                                <th>Range 7</th>
                                                <th>Range 8</th>
                                                <th>Range 9</th>
                                                <th>Range 10</th>
                                                <th>Quality</th>
                                                <th>Cooling</th>
                                                <th>Temperature</th>
                                                <th>Shift</th>
                                                <th>Remarks</th>
                                                <th>Date/Time</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                          
                                        </tbody>
                                        <tbody>
                                        <?php
                                        if(!empty($get_supervisor_data)){
                                         foreach($get_supervisor_data as $get_supervisor_datas){ ?>
                                        
                                      <tr>
                                        <td><strong><?php 
                                        //$machine =  machine_from_production($get_supervisor_datas['machine']); 
                                        echo machine_name($get_supervisor_datas['machine']);

                                    ?></strong></td>
                                        <td><strong><?php echo $get_supervisor_datas['product_name']; ?></strong></td>      
                                        <td><?php echo $get_supervisor_datas['job']; ?></td>
                                        <td><?php echo $get_supervisor_datas['die_condition']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_1']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_2']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_3']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_4']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_5']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_6']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_7']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_8']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_9']; ?></td>
                                        <td><?php echo $get_supervisor_datas['rang_10']; ?></td>
                                        <td><?php echo $get_supervisor_datas['pieces_quality']; ?></td>
                                        <td><?php echo $get_supervisor_datas['mould_cooling']; ?></td>
                                        <td><?php echo $get_supervisor_datas['m_o_t']; ?></td>
                                        <td><?php echo $get_supervisor_datas['shift']; ?></td>
                                        <td><?php echo $get_supervisor_datas['remarks']; ?></td>
                                        <td><?php echo $get_supervisor_datas['created']; ?></td>
                                        <td><a href="#" class="btn btn-sm btn-primary"><i class="la la-pencil"></i></a></td>
                                      </tr>
                                      <?php } } ?>
                                        </tbody>
                                    </table>
                                </div>
                                
                            </div>
                            </div>
                            </div>



      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <style>
        .redborder{
            border:1px solid red;
        }
        </style>

        <SCRIPT language=Javascript>
       
       $("#rang_1").keyup(function(){
      var range1_max  = parseInt($('#range1_max').val());
      var range1_min  = parseInt($('#range1_min').val());
        var rang_1 = parseInt($('#rang_1').val());
        if(range1_max >= rang_1 && rang_1 >= range1_min){
          $('#rang_1').css('border-color', 'green'); 
        }else{
          $('#rang_1').css('border-color', 'red'); 
        }
        
      });


      $("#rang_2").keyup(function(){
      var range2_max  = parseInt($('#range2_max').val());
      var range2_min  = parseInt($('#range2_min').val());
        var rang_2 = parseInt($('#rang_2').val());
        if(range2_max >= rang_2 && rang_2 >= range2_min){
          $('#rang_2').css('border-color', 'green'); 
        }else{
          $('#rang_2').css('border-color', 'red'); 
        }
        
      });


      $("#rang_3").keyup(function(){
      var range3_max  = parseInt($('#range3_max').val());
      var range3_min  = parseInt($('#range3_min').val());
        var rang_3 = parseInt($('#rang_3').val());
        if(range3_max >= rang_3 && rang_3 >= range3_min){
          $('#rang_3').css('border-color', 'green'); 
        }else{
          $('#rang_3').css('border-color', 'red'); 
        }
        
      });


      $("#rang_4").keyup(function(){
      var range4_max  = parseInt($('#range4_max').val());
      var range4_min  = parseInt($('#range4_min').val());
        var rang_4 = parseInt($('#rang_4').val());
        if(range4_max >= rang_4 && rang_4 >= range4_min){
          $('#rang_4').css('border-color', 'green'); 
        }else{
          $('#rang_4').css('border-color', 'red'); 
        }
        
      });


      $("#rang_5").keyup(function(){
      var range5_max  = parseInt($('#range5_max').val());
      var range5_min  = parseInt($('#range5_min').val());
        var rang_5 = parseInt($('#rang_5').val());
        if(range5_max >= rang_5 && rang_5 >= range5_min){
          $('#rang_5').css('border-color', 'green'); 
        }else{
          $('#rang_5').css('border-color', 'red'); 
        }
        
      });


      $("#rang_6").keyup(function(){
      var range1_injp_max  = parseInt($('#range1_injp_max').val());
      var range1_injp_min  = parseInt($('#range1_injp_min').val());
        var rang_6 = parseInt($('#rang_6').val());
        if(range1_injp_max >= rang_6 && rang_6 >= range1_injp_min){
          $('#rang_6').css('border-color', 'green'); 
        }else{
          $('#rang_6').css('border-color', 'red'); 
        }
        
      });


      $("#rang_7").keyup(function(){
      var range2_injs_max  = parseInt($('#range2_injs_max').val());
      var range2_injs_min  = parseInt($('#range2_injs_min').val());
        var rang_7 = parseInt($('#rang_7').val());
        if(range2_injs_max >= rang_7 && rang_7 >= range2_injs_min){
          $('#rang_7').css('border-color', 'green'); 
        }else{
          $('#rang_7').css('border-color', 'red'); 
        }
        
      });


      $("#rang_8").keyup(function(){
      var range3_injt_sec_max  = parseInt($('#range3_injt_sec_max').val());
      var range3_injt_sec_min  = parseInt($('#range3_injt_sec_min').val());
        var rang_8 = parseInt($('#rang_8').val());
        if(range3_injt_sec_max >= rang_8 && rang_8 >= range3_injt_sec_min){
          $('#rang_8').css('border-color', 'green'); 
        }else{
          $('#rang_8').css('border-color', 'red'); 
        }
        
      });


      $("#rang_9").keyup(function(){
      var range4_ct_sec_max  = parseInt($('#range4_ct_sec_max').val());
      var range4_ct_sec_min  = parseInt($('#range4_ct_sec_min').val());
        var rang_9 = parseInt($('#rang_9').val());
        if(range4_ct_sec_max >= rang_9 && rang_9 >= range4_ct_sec_min){
          $('#rang_9').css('border-color', 'green'); 
        }else{
          $('#rang_9').css('border-color', 'red'); 
        }
        
      });


      $("#rang_10").keyup(function(){
      var range5_doz_mm_max  = parseInt($('#range5_doz_mm_max').val());
      var range5_doz_mm_min  = parseInt($('#range5_doz_mm_min').val());
        var rang_10 = parseInt($('#rang_10').val());
        if(range5_doz_mm_max >= rang_10 && rang_10 >= range5_doz_mm_min){
          $('#rang_10').css('border-color', 'green'); 
        }else{
          $('#rang_10').css('border-color', 'red'); 
        }
        
      });



       function isNumberKey(evt)
       {
          var charCode = (evt.which) ? evt.which : evt.keyCode;
          if (charCode != 46 && charCode > 31 
            && (charCode < 48 || charCode > 57))
             return false;

          return true;
       }
       //-->
    </SCRIPT>


    <script type='text/javascript'>


          $(".machine").chosen();


         $("#machine").change(function() {

                
    
                var machine =  this.value;
                //alert(id);
                $('#range1_max_div').show();
                $('#range1_min_div').show();
                $('#range2_max_div').show();
                $('#range3').show();
                $('#range4').show();
                $('#range5').show();
                $('#range6').show();
                $('#range7').show();
                $('#range8').show();
                $('#range9').show();
                $('#range10').show();
                $('#range11').show();
                $('#range12').show();
                $('#range13').show();
                $('#range14').show();
                $('#range15').show();
                $('#range16').show();
                $('#range17').show();
                $('#range18').show();

                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Order_qc/get_item_production'); ?>',
                            data:{machine:machine},
                            dataType:'json',
                            success:function(data){

                                    $('#product_name').val(data.product_name);
                                    $('#job').val(data.job);


                                        $('#range1_max').val(data.range1_max);
                                        $('#range1_min').val(data.range1_min);
                                        $('#range2_max').val(data.range2_max);
                                        $('#range2_min').val(data.range2_min);
                                        $('#range3_max').val(data.range3_max);
                                        $('#range3_min').val(data.range3_min);
                                        $('#range4_max').val(data.range4_max);
                                        $('#range4_min').val(data.range4_min);
                                        $('#range5_max').val(data.range5_max);
                                        $('#range5_min').val(data.range5_min);

                                        $('#range1_injp_max').val(data.range1_injp_max);
                                        $('#range1_injp_min').val(data.range1_injp_min);
                                        $('#range2_injs_max').val(data.range2_injs_max);
                                        $('#range2_injs_min').val(data.range2_injs_min);
                                        $('#range3_injt_sec_max').val(data.range3_injt_sec_max);
                                        $('#range3_injt_sec_min').val(data.range3_injt_sec_min);
                                        $('#range4_ct_sec_max').val(data.range4_ct_sec_max);
                                        $('#range4_ct_sec_min').val(data.range4_ct_sec_min);
                                        $('#range5_doz_mm_max').val(data.range5_doz_mm_max);
                                        $('#range5_doz_mm_min').val(data.range5_doz_mm_min);
                                    
                                    /*$('#total_qty').val(data.total_qty);*/
                                      
                                  
                            },
                            error:function(data){console.log(data.responseText);}
                        });

    });


        
    var add_fg_stocks = $('#add_fg_stock');   
    
    add_fg_stocks.on('submit',function(e){
  //$("#dis_submit").attr('disabled', true);
        e.preventDefault();
        
        var add_fg = add_fg_stocks.serialize();
         
     
          if (confirm('Are you sure you want to Add.?')) {
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Order_qc/add_supervisor_range_qcs'); ?>',
                data:add_fg,
                dataType:'json',
                success:function(data){
                
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#fg_stock_success').show().html('Added Successfully');
                       setTimeout(function(){location.href="<?php echo base_url('Order_qc/qc_production_on_machine/'); ?>"} , 2000);
                    }else{
                        console.log('third'+data);          
                    }
                },
                error:function(data){console.log(data.responseText);}
            });
        }
        
    });

    
  </script>