 
         <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">

                         <input type="hidden" value="<?php echo date('Y-m-d'); ?>" name="insert_date" id="insert_date" class="form-control required">
                     </div>
                 </div>
                 <p><?php //print_r($all_data); die; ?></p>
                   <input type="hidden" name="user_id" id="user_id" value="<?php echo $this->session->userdata('id');?>">

                    <input type="hidden" value="<?php echo $all_data[0]['machine']; ?>" name="machine_id" id="machine_id" >
            
          <div class="col-lg-3 col-md-6 col-sm-12">
             <div class="form-group">
                <label class="form-label">Raw Materials:</label>
                
            <select class="form-control material_id"   name="material_id" required="required" id="material_id">
                   <option>Select </option> 
                 <?php

                             $pro_id = product_name($all_data[0]['product_id']);


                             $material = product_match($pro_id);
                    ?>
                    
                  
                  <option value="<?php echo $material; ?>"><?php echo material_name($material); ?></option>
                                        
             </select>

             </div>
           </div>

           <div class="col-lg-3 col-md-6 col-sm-12">
            <div class="form-group">
                <label class="form-label">Code</label>
                <input type="text" id="code"  disabled="disabled"  placeholder="Product Code" class="form-control code">
            </div>
         </div>

         <input type="hidden" name="product_id" id="product_id" value="<?php echo $all_data[0]['product_id']; ?>">

                  <div class="col-lg-3 col-md-6 col-sm-12">
                   <div class="form-group">
                       <label class="form-label">Product:</label>

                   
                         <input type="text" readonly="readonly" class="form-control qcr" value="<?php echo product_name($all_data[0]['product_id']); ?>">
                      
                   
                  </div> 
                                               
                    </div>

                     <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Job No:</label>
                                <?php  
                                     $proname = product_name($all_data[0]['product_id']);
                                 $job = product_match_job($proname,$all_data[0]['so_id']); ?>
                                  <input type="number" id="job" value="<?php echo $job; ?>" name="job" readonly="readonly" required="required"  class="form-control job">
                             </div> 
                             
                           </div>


                     <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">QCR:</label>
                                  <input type="number" id="qcr" name="qcr" required="required"  class="form-control qcr">
                             </div> 
                             
                           </div>

                         
                    <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Material QTY Bag:</label>
                                  <input type="number" id="quantity" name="quantity" required="required"  class="form-control quantity">
                             </div> 
                             
                           </div>

                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Total Material IN Stock Bag:</label>
                                  <input type="text" id="total_qty" name="total_qty" readonly="readonly" required="required"  class="form-control total_qty">
                             </div> 
                             
                           </div>

                           

                            <div class="col-lg-3 col-md-6 col-sm-12">
                               <div class="form-group">
                                   <label class="form-label">Color Material:</label>

                              <select class="form-control color_code"   name="color_id"  id="color_id">
                                 <option value="">Select Color Material</option> 
                                    <?php 


                                     $color = product_match_color_id($pro_id,$all_data[0]['so_id']); ?>
                                     <option value="<?php echo $color; ?>"><?php echo material_name($color); ?></option>
                                  
                               </select>
                              </div> 
                                                           
                                </div>


                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Color Ratio:</label>
                                  <input type="number" id="color_ratio" name="color_ratio"   class="form-control color_ratio">
                             </div> 
                             
                           </div>


                            <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Color Qty:</label>
                                <input type="text" id="qty" name="qty"   class="form-control qty" onkeypress="return isNumberKey(event)">
                             </div> 
                             
                           </div>

                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Total Color IN Stock:</label>
                                  <input type="text" id="total_qty_color" name="total_qty_color" readonly="readonly"  class="form-control total_qty_color">
                             </div> 
                             
                           </div>

                          



                           <!-- <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">W Lot:</label>
                                  <input type="number" id="wlot" name="wlot"   class="form-control wlot">
                             </div> 
                             
                           </div> 




                        <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Total Waste:</label>
                                  <input type="text" id="weight_wast"  name="weight_wast" readonly="readonly"  class="form-control weight_wast">
                             </div> 
                             
                           </div>  -->

                           
                           

                          

                           <div class="col-lg-3 col-md-6 col-sm-12">
                                   <div class="form-group">
                                                    <label class="form-label">IN/OUT:</label>
                                                    <select class="form-control" required="required" id="inout">
                                                   
                                                        
                                                        <option value="0">Out</option>
                                                      
                                                    </select>
                                                 </div>
                                                </div>

                          <input type="hidden" id="type" name="type" readonly="readonly"  class="form-control type" >
                         

                        <div class="col-lg-6 col-md-6 col-sm-12">
                            <div class="form-group">
                                <label class="form-label">Remarks:</label>
                                <textarea  class="form-control remarks" name="remarks" id="remarks"></textarea>  
                             </div>
                         </div>                    
                         </div>
                        
<script>


    function isNumber(evt, element) {

  var charCode = (evt.which) ? evt.which : event.keyCode

      if (
        (charCode != 45 || $(element).val().indexOf('-') != -1) && // “-” CHECK MINUS, AND ONLY ONE.
        (charCode != 46 || $(element).val().indexOf('.') != -1) && // “.” CHECK DOT, AND ONLY ONE.
        (charCode < 48 || charCode > 57))
        return false;
    
      return true;
    }
   
    $("#material_id").change(function() {

                
    
                var material_id =  this.value;
                //alert(id);

                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Stock/get_material_code_production'); ?>',
                            data:{material_id:material_id},
                            dataType:'json',
                            success:function(data){
                            
                                    $('#code').val(data.codes);
                                    $('#type').val(data.type);
                                    $('#total_qty').val(data.total_qty);
                                  //  $('#wast_stock').val(data.wast_stock);
                                    
                            },
                            error:function(data){console.log(data.responseText);}
                        });

    });


    

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

                
    
                var color_code =  this.value;
                //alert(id);

                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Stock/get_color_code_production'); ?>',
                            data:{color_code:color_code},
                            dataType:'json',
                            success:function(data){
                            
                                  
                                    $('#total_qty_color').val(data.total_qty_color);
                                  
                            },
                            error:function(data){console.log(data.responseText);}
                        });

    });



  /*  $("#machine_id").change(function() {

                
    
                var machine_id =  this.value;
                //alert(id);

                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Stock/get_machine_code_production'); ?>',
                            data:{machine_id:machine_id},
                            dataType:'json',
                            success:function(data){
                            
                                   
                                    $('#weight_wast').val(data.total_qty);
                                    $('#wlot').val(data.wast_lot);
                            },
                            error:function(data){console.log(data.responseText);}
                        });

    });*/

</script>

                   
                                 
                             