<!DOCTYPE html>
<html lang="en">


<!-- Mirrored from edumin.dexignlab.com/xhtml/add-departments.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Nov 2020 13:56:15 GMT -->
<head>
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Rizwan </title>
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="<?php echo base_url();?>assets/images/favicon.png">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/bootstrap-select/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/css/style.css">
    <!-- Pick date -->
   <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/pickadate/themes/default.css">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/pickadate/themes/default.date.css">
     <link href="<?php echo base_url();?>assets/vendor/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
    <!-- Custom Stylesheet -->
    


</head>

<body>

    <!--*******************
        Preloader start
    ********************-->
        <div id="preloader">
        <div class="sk-three-bounce">
            <div class="sk-child sk-bounce1"></div>
            <div class="sk-child sk-bounce2"></div>
            <div class="sk-child sk-bounce3"></div>
        </div>
    </div>
    <!--*******************
        Preloader end
    ********************-->

    <!--**********************************
        Main wrapper start
    ***********************************-->
    <div id="main-wrapper">

      <?php  $this->load->view('header'); ?>
        
        <!--**********************************
            Content body start
        ***********************************-->
        <div class="content-body">
            <!-- row -->
            <div class="container-fluid">
                    
                <div class="row page-titles mx-0" style=" width: 35%;background-color: #71A6E3; color:#fff;">
                    <div class="col-sm-6 p-md-0">
                        <div class="welcome-text">
                            <p>Job #:<b><?php echo $get_details_mould[0]['job']; ?></b></p>
                             <p>Item # : <b><?php echo $get_details_mould[0]['product_name']; ?></b></p>
                            <p>Quantity : <b><?php echo $get_details_mould[0]['p_qty']; ?></b></p>
                            <p>Machine : <b><?php  $machine_id = production_machine_id($get_details_mould[0]['id']); 
                                 echo machine_name($machine_id); ?> </b></p>
                        </div>
                    </div>
                   
                </div>
                
            <div class="row">
               <div class="col-12">
                  <div class="col-xl-12 col-xxl-12 col-sm-12">
                    <div class="card">

                     <?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 id='fg_stock_danger' class='alert alert-danger solid' style='display:none;'></div> 
         
          <div class="card-body">  
      <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'); ?>" name="insert_date" id="insert_date" class="form-control required">

                    <input type="hidden" name="so_id" id="so_id" value="<?php echo $get_details_mould[0]['so_id']; ?>">
                    
                    <input type="hidden" value="<?php echo $this->uri->segment('3'); ?>" name="production_id" id="production_id" class="form-control required">
                </div>
            </div>

              <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">Raw Materials:</label>
                                <select class="form-control material_id" data-live-search="true"  name="material_id" required="required" id="material_id">
                                    <option value="<?php echo $get_details_mould[0]['material_id']; ?>"><?php echo material_name($get_details_mould[0]['material_id']); ?></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>
 -->

                    <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_id" data-live-search="true"  name="machine_id" required="required" id="machine_id">
                                  <?php $machine_id = production_machine_id($get_details_mould[0]['id']); ?>
                                <option value="<?php echo $machine_id; ?>"><?php echo machine_name($machine_id); ?></option>
                               
                            </select>
                             </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" readonly="readonly" value="<?php echo $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">Color Code:</label>
                                  <input type="number" readonly="readonly" id="color_code" value="<?php echo $code; ?>" name="color_code" required="required"  class="form-control color_code">
                             </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" readonly="readonly" id="color_ratio" value="<?php echo $getcolor_id; ?>" name="color_ratio" required="required"  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">BOM Required:</label>
                                  <input type="number" readonly="readonly" value="<?php echo  get_bom_requir_productoin($this->uri->segment('3')); ?>" required="required"  class="form-control qty">
                             </div> 
                             
                           </div>

                         <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">QTY:</label>
                                  <input type="number" id="qty" name="qty" required="required"  class="form-control qty">
                             </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" readonly="readonly" required="required"  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">Waste QTY:</label>
                                  <input type="text" id="qty_wast"  name="qty_wast" required="required"  class="form-control qty_wast">
                             </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" readonly="readonly"  name="weight_wast" required="required"  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">Total IN Stock:</label>
                                  <input type="text" id="total_qty" name="total_qty" disabled="disabled" 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">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>

                  <?php form_close();?>
                <button type="submit" id="dis_submit" class="btn btn-primary">Save <i class="icon-arrow-right14 position-right"></i></button>


                 </div>
                    </div>
                    
                    </div>
                   </div>
                 </div>
                </div>
            </div>
       
        <!--**********************************
            Content body end
        ***********************************-->


        <!--**********************************
            Footer start
        ***********************************-->
        
        <!--**********************************
            Footer end
        ***********************************-->

        <!--**********************************
           Support ticket button start
        ***********************************-->

        <!--**********************************
           Support ticket button end
        ***********************************-->


    </div>
    

    <div class="modal fade bd-example-modal-lg" style="width: 100%;" tabindex="-1" role="dialog" aria-hidden="true">
              <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                      <div class="modal-header">
                        
                          <button type="button" class="close" data-dismiss="modal"><span>&times;</span>
                          </button>
                      </div>
                      <div class="modal-body">
                    
                   
                         <div class="card-body" id="invoice_details">
                    
                          </div>
                      



                      </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>
       <!--
       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'>
     
        $( document ).ready(function() {

               
                
                 var material_id = $('#material_id').val();
             
                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Stock/get_material_stock_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);}
                        });

    });



     $( document ).ready(function() {   
    
                 var material_id = $('#material_id').val();
               
                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Stock/get_waste_out_production'); ?>',
                            data:{material_id:material_id},
                            dataType:'json',
                            success:function(data){
                            
                                   
                                    $('#weight_wast').val(data.total_qty);
                                    $('#wlot').val(data.wlot);
                            },
                            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();
         var inout = $('#inout').val();
           var total_qty = parseInt($("#total_qty").val());
            var qty = parseInt($("#qty").val());
           
            if (total_qty < qty) {
                alert("Quantity Greater Then  Quantity..!");
               
            }else{



      if(inout==0){
              if (confirm('Are you sure you want to Add Stock Out.?')) {
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Requisition/out_stock_production'); ?>',
                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(' Stock added Successfully');
                       setTimeout(function(){location.href="<?php echo base_url('Requisition/compound_production_department/'); ?>"} , 2000);
                    }else if(data.status=='condition'){
                        console.log('third'+data);  
                         $('#fg_stock_danger').show().html('Today Compound Production Completed..!');

                    }
                },
                error:function(data){console.log(data.responseText);}
            });

        }
        }
      }
    });

    
  </script>

       <?php  $this->load->view('footer'); ?>
        
</body>

<!-- Mirrored from edumin.dexignlab.com/xhtml/add-departments.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Nov 2020 13:56:15 GMT -->
</html> 