
<?php include("conn.php");
$page='Items Out';
$location_page='item_out';
?>
<!DOCTYPE html>
<html lang="en">
<?php include("common/head.php")?>
<style>
    #panel {
  display: none;
}
#panel1 {
  display: none;
}
</style>
<body>
<?php include("common/menu.php")?>
<!---side nav bar end-->
<?php include("common/tittle.php")?>
            <!--Nav menu end-->
            <!--Nav menu end-->

          

            <!--Main body Start-->
            <div class="col-sm-12 mt-2">
            
               <!--search section start-->


               <center>

               <?php include('inventory_button.php')?>
              
              </center>            
      <hr class="bg-success">
                <!--search section end-->
                <!--Orders start-->
                
            <?php 
            $today= date("F j, Y ,h:ia");
            $order_id='T'.date('ymdhi').mt_rand(10,100);
            
    

      
            ?>
                <div style="font-family: 'Convergence'!important;" id="myList" class="menu-analytics row no-gutters">
                    <div class="daily-report ">
                       <!--- <div class="daily-report-item
                    ">
                                    <b><i class="fa fa-money" aria-hidden="true"></i></b>
                                    <p class="text-center order-text-order-managment"><b>Revenue</b></p>
                                    <p class="text-center order-text-order-managment"><b></b></p>
                        </div> --->

                  
                    </div>


                    <div  id="collapseOne" class="  col-sm-12  " data-parent="#accordions">
                    <h5 class="text-center">Items added to stock</h5>
                    <button class="btn btn-primary btn-sm m-4"  data-toggle="modal" data-target="#exampleModal">Item out</button>

                    <table id="example_table" class="table-customer table-striped   w-100 table-bordered">
                        <thead>
                        <tr>
                            <th>id</th>
                            <th>Item Name</th>
                            <th>Quantity</th>
                            <th>Unit</th>
                            <th>Receiver</th>
                            <th>purpose</th>
                            <th>Date out</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php


$sql7="select * from inventory_out  ";
$result7 = mysqli_query($conn,$sql7)or die( mysqli_error($conn));
while ($row7=mysqli_fetch_array($result7)) {
 $data=$row7['id'];
   $item_name=$row7['item_name'];
   $unit=$row7['units'];
   $quantity=$row7['quantity'];
   $datein=$row7['date'];
   $reciever=$row7['recirver'];
   $purpose=$row7['perpose'];
   $by=$row7['by'];

   
   
   $status=0;

 $text='';

 if ($status==='1') {
   $text='In stock';
   $read='btn-success';
   $de='deactivate';
   $sta=0;
 }
                            else {
   $text='Out of stock';
   $read='btn-danger';
  $de='activate';
  $sta=1;
 }

?>
                        <tr>
                            <td><?php echo $data ?></td>
                            <td><?php echo $item_name ?></td>
                            <td><?php echo $quantity ?></td> 
                            <td><?php echo $unit ?></td>
                            <td><?php echo $reciever ?></td>
                            <td><?php echo  $purpose ?></td>
                            <td><?php echo  $datein ?></td>
                        </tr>
                        <?php } ?>
                        </tbody>
                        <thead>
                        <th>id</th>
                            <th>Item Name</th>
                            <th>Quantity</th>
                            <th>Unit</th>
                            <th>Receiver</th>
                            <th>purpose</th>
                            <th>Action</th>
                        </thead>
                    </table>
    

                </div>

                    <!-- <div id="chart_div" style="width: 100%; height: 500px;"></div>--->
        
                </div>

         
              
            </div>
            <!--Main body end-->

           
            <!-- Small modal -->
<div id="dataModal"  class="modal fade bd-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div id="employee_detail" class="modal-content text-dark">
     
    
    
    </div>
  </div>
</div>
             <!-- Modal Add users -->
             <div  class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content ">
        <div class="modal-header">
          <h5 class="modal-title text-center text-dark" id="exampleModalLabel"> Item out</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">


<form method="post" action="inventorys/inventory_item_out.php" class="row">



            <div  id="select_item" class="input-group col-sm-6 col-12 mb-3 ">
       
        <?php 
    $query ="SELECT item_name,item_id FROM inventory_cat ";
    $result = $conn->query($query);
    if($result->num_rows> 0){
      $options= mysqli_fetch_all($result, MYSQLI_ASSOC);
    }
?>
                  <select class="form-control" name="item_name">
                  <option value="nan">Select Item</option>
                  <?php 
  foreach ($options as $option) {
  ?>
    <option value="<?php echo $option['item_id']; ?>"><?php echo $option['item_name']; ?> </option>
    <?php 
    }
   ?>
                  </select>
      </div>




                <div class="form-group col-sm-4 mb-3">
                 
                  <input type="number" class="form-control" name="quantity" id="exampleFormControlInput1" placeholder="Quantity" required>
                </div>

                <div class="form-group  col-sm-12 mb-3">
                  <input type="text" class="form-control" name="reciever" id="exampleFormControlInput1" placeholder=" Receivers Name with (posisition)"   required >
                </div>

                <div class="form-group  col-sm-12 mb-3">
                  <input type="text" class="form-control" name="purpose" id="exampleFormControlInput1" placeholder="  Please State where you are going to use the item"  required >
                </div>

                <div class="form-group  col-sm-12 mb-3">
                  <input type="text" class="form-control" name="discription" id="exampleFormControlInput1" placeholder=" Item discription"  required >
                </div>

                <input type="hidden" name="datein" value="<?php echo $today ?>">
                <input type="hidden" name="by" value="<?php echo $id_user ?>">
                
                
                  <button class="btn btn-success btn-sm btn-block"  name="submit">Submit</button>
</form>



        </div>
        <div class="modal-footer">
        </div>
      </div>
    </div>
  </div>

          


          
            <!--Invoice Section end-->



    
    <!--  isotope plugin cdn  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="sha256-CBrpuqrMhXwcLLUd5tvQ4euBHCdh7wGlDfNz8vbu/iI=" crossorigin="anonymous"></script>
    <script src="js/script.js"></script>
    <!--  isotope plugin cdn  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="sha256-CBrpuqrMhXwcLLUd5tvQ4euBHCdh7wGlDfNz8vbu/iI=" crossorigin="anonymous"></script>
    <script src="js/script.js"></script>
     <!-- jQuery js-->
     <!-- jQuery Datatable js -->
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" ></script>
     <script src="https://cdn.datatables.net/2.0.5/js/dataTables.js"></script>
     <script src="https://cdn.datatables.net/buttons/3.0.2/js/dataTables.buttons.js"></script>
     <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
     <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.html5.min.js"></script>
     <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.print.min.js"></script>
     <script>
         $(document).ready( function () {
        new DataTable('#example_table', {
            autoFill: true,
            pageLength : 20,
    lengthMenu: [[5, 10, 20, -1], [5, 10, 20, 'Todos']],
    layout: {
        topStart: {
            buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
        }
    }
});
       } );
       </script>
     <script>
   

       $(document).ready(function(){  
      $('.view_data').click(function(){  
           var employee_id = $(this).attr("id");  
           $.ajax({  
                url:"inventory_details.php",  
                method:"post",  
                data:{employee_id:employee_id},  
                success:function(data){  
                     $('#employee_detail').html(data);  
                     $('#dataModal').modal("show");  
                }  
           });  
      });  
 });  
       </script>
    <!--google graph-->
   
 

    <script>
function myFunction() {
  document.getElementById("panel").style.display = "block";
  document.getElementById("select_item").style.display = "none";
}

function myFunctions() {
  document.getElementById("panel1").style.display = "block";
  document.getElementById("select_item1").style.display = "none";
}
</script>
</body>

</html>