<?php 
if(!isset($_SESSION)) { 
  session_start(); 
  include('../includes/dbcon.php');
}
if(empty($_SESSION['hrm_id'])):
header('Location:../index.php');
endif;




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


<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>SalesHub | Item Management </title>
  <!-- plugins:css -->
  <?php include('../includes/commonheader.php');?>

</head>
<body>
 <?php include('../includes/header.php');?>
 <?php include('../includes/leftsidebar.php');?>
           <!-- partial -->
 <div class="main-panel">        
        <div class="content-wrapper">      
             
         <div class="col-12 grid-margin">
              <div class="card">
                <div class="card-body">
<div class="table-responsive">
                    <table id="order-listing" class="table">
                       <thead>
  <tr class="bg-primary text-white">
   
    <th width="8%">#</th>
    <th width="10%">Item Name</th>
    <th width="10%">Description</th>
    <th width="10%">Category</th>
    <th width="10%">Type</th> 
    <th width="10%">Sales Price</th> 
    <th width="10%">Cost Price</th>   
    <th width="5%">QOH</th> 
    <th width="5%">ROL</th> 
    <th width="10%">Case</th>
    <th width="10%">Unit</th>
    <th width="25%">Actions</th>   

   
    </tr>
  </thead>
<tbody>
<?php
$rcount=0;

//echo$tt;

$sql="SELECT * from view_item_master"  ;

$query=mysqli_query($con,$sql)or die(mysqli_error()); 

              while($row=mysqli_fetch_array($query)){   $rcount=$rcount+1;
                $item_name=$row['item_name']; 
                 $item_id=$row['item_id']; 
                $description=$row['description']; 
                $cat_des=$row['cat_des'];
                $type_des=$row['type_des'];
                $sp=$row['sales_price'];
                $cp=$row['cost_price'];
                $qoh=$row['qoh'];
                $rol=$row['rol'];
                 $case_id=$row['case_id'];
                  $unit_des=$row['unit_des'];
              ?>   

               <tr>       
                  <td> <?php echo $rcount;   ?></td>
            <td> <?php echo $item_name;   ?></td>
             <td> <?php echo $description;   ?></td>
            <td> <?php echo $cat_des;   ?></td>
            <td><?php echo $type_des; ?></td>
           <td> <?php echo $sp;   ?></td>
            <td><?php echo $cp; ?></td>
            <td> <?php echo  $qoh;   ?></td>
            <td><?php echo $rol; ?></td>   
             <td><?php echo $case_id; ?></td>     
   <td><?php echo $unit_des; ?></td>   


<td>
              <form method="post" action="#" enctype="multipart/form-data">
                  
                  <input type="hidden" class="form-control pull-right" id="tid" name="tid"  value=" <?php echo $item_id; ?>">   
                   <input type="hidden" name="fname" id="fname" class="form-control todo-list-input" placeholder="Add To-do" value="<?php echo basename($_SERVER['PHP_SELF']);  ?>">
                    <input type="hidden" class="form-control" id="s1_remarks" name="s1_remarks" placeholder="Remarks">

                       <button type="submit" formaction="#" class="btn btn-outline-success btn-rounded btn-icon">
                        <i class="fas fa-check text-success"></i>
                      </button>

                       <button type="button" class="btn btn-outline-info btn-rounded btn-icon"  data-toggle="modal" data-target="#addvoucher_edit<?php echo $row['item_id'];?>">
                          <i class="fa fa-edit"></i>
                        </button>

                        <button type="submit" formaction="task_remove.php" class="btn btn-outline-secondary btn-rounded btn-icon">
                        <i class="fas fa-trash text-danger"></i>
                      </button>
              </form>
              </td> 

<!----------------------End of modal------------------------->

                    
            

         
             </tr>
                
                    <?php }  ?>
                    </tbody>
                    </table>
                  </div>
 </div> </div> </div>

        </div>  <!----- <div class="content-wrapper">------>
  </div>

 </div><!-----End of main panel--~~~~~~~~~~~~~~~~~~~~~~~--------------->
 </div><!-----Dont Delete this DIV--~~~~~~~~~~~~~~~~~~~~~~~--------------->
  <!-- container-scroller -->
<?php include('../includes/footer.php');?>
<?php include('../includes/commonjs.php');?>
 
</body>


</html>

<script>
    $( document ).ready(function() {
         // alert("Please Select Order Type");

    });



</script>

 <!-- End custom js for this page-->
  <script>
  $(function () {
    //Initialize Select2 Elements
    $('.select2').select2()

    //Initialize Select2 Elements
    $('.select2bs4').select2({
      theme: 'bootstrap4'
    })
  })

</script>



