[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: product_report.php
<?php include("../admin/includes/functions/functions.php");?> <?php include("../admin/db/db.php");?> <?php error_reporting(E_ALL); ini_set('display_errors', 1); if(!isset($_SESSION['username_Xw211qAAsq4'])) { header('Location: ../auth/'); exit(); } else{ $pageTitle1 = 'Product Sales Report'; $shopname = $_SESSION['business_name_Xw211qAAsq4']; $currency = mysqli_query($new,"SELECT currency from barber_admin WHERE business_name = '$shopname'"); $fechC = mysqli_fetch_array($currency); $qurtyCurrency = $fechC['currency']; $newF = ""; $newT = ""; if(isset($_POST['god'])){ $fdate= test_input($_POST['fdate']); $tdate= test_input($_POST['tdate']); $newF = date("Y-m-d", strtotime($fdate)); $newT = date("Y-m-d", strtotime($tdate)); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title> <?php echo $shopname;?> - <?php echo $pageTitle1;?></title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- App favicon --> <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script> <link rel="shortcut icon" href="../assets/icon.png" type="image/x-icon"> <link rel="icon" href="../assets/icon.png" type="image/x-icon"> <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> <link href="plugins/daterangepicker/daterangepicker.css" rel="stylesheet" type="text/css" /> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/theme.min.css" rel="stylesheet" type="text/css" /> <style type="text/css"> .table-hover tbody tr:hover td, .table-hover tbody tr:hover th { background-color: #e6ecff; } </style> <!-- <style> #preloader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; background-color: #fff; } #loader { display: block; position: absolute; top: 50%; left: 50%; border: 16px solid #f3f3f3; border-top: 16px solid #3498db; border-radius: 50%; width: 70px; height: 70px; animation: spin 2s linear infinite; } .table-hover tbody tr:hover td, .table-hover tbody tr:hover th { background-color: #e6ecff; } </style> --> <style type="text/css"> .order-card { color: #fff; } .bg-c-blue { background: linear-gradient(45deg,#4099ff,#73b4ff); } .bg-c-green { background: linear-gradient(45deg,#2ed8b6,#59e0c5); } .bg-c-yellow { background: linear-gradient(45deg,#FFB64D,#ffcb80); } .bg-c-pink { background: linear-gradient(45deg,#FF5370,#ff869a); } .card { border-radius: 5px; -webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16); box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16); border: none; margin-bottom: 30px; -webkit-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; } .card .card-block { padding: 25px; } .order-card i { font-size: 26px; } .f-left { float: left; } .f-right { float: right; } </style> </head> <body> <div id="preloader"> <div id="loader"></div> </div> <!-- Begin page --> <div id="layout-wrapper"> <div class="header-border"></div> <?php include("includes/template/head.php");?> <?php include("includes/template/side.php");?> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <div class="row no-print"> <div class="col-md-4 col-xl-4"> <div class="card bg-c-blue order-card"> <div class="card-block"> <h6 class="m-b-20" style="color:#fff">Today Sales</h6> <h2 class="text-right"><span style="color:#fff"> <?php $tdate = date('Y-m-d'); $todayT = 0; // Initialize $todayT as a number // Prepare SQL statement with placeholders $stmtServices = $con->prepare("SELECT * FROM product_sales WHERE sold_date = ? AND business_name = ?"); $stmtServices->execute(array($tdate, $shopname)); // Bind parameters to avoid SQL injection $rowsServices = $stmtServices->fetchAll(); foreach ($rowsServices as $rowsService) { $price = $rowsService['total_amount']; $disc = $rowsService['discount']; // Calculate discounted amount $tdis = ($disc / 100) * $price; // Calculate total amount after discount $totalAmt = $price - $tdis; // Accumulate the total for todayT $todayT += $totalAmt; } // Format the total amount for display $todayTFormatted = number_format($todayT, 2); // Format to 2 decimal places echo $todayTFormatted . ' ' . $qurtyCurrency; // Display the formatted total with currency ?> </span></h2> </div> </div> </div> <div class="col-md-4 col-xl-4"> <div class="card bg-c-green order-card"> <div class="card-block"> <h6 class="m-b-20" style="color:#fff">A Weekly Sales</h6> <h2 class="text-right"><span style="color:#fff"> <?php $pastdate = date("Y-m-d", strtotime("-1 week")); $currentDate = date("Y-m-d"); $weekTotal = 0; // Initialize $weekTotal to accumulate total amount // Prepare SQL statement with placeholders $stmtServices = $con->prepare("SELECT * FROM product_sales WHERE sold_date BETWEEN ? AND ? AND business_name = ?"); $stmtServices->execute(array($pastdate, $currentDate, $shopname)); // Bind parameters to avoid SQL injection $rowsServices = $stmtServices->fetchAll(); foreach ($rowsServices as $rowsService) { $price = $rowsService['total_amount']; $disc = $rowsService['discount']; // Calculate discounted amount $discountedAmount = ($disc / 100) * $price; // Calculate total amount after discount $totalAmount = $price - $discountedAmount; // Accumulate the total for $weekTotal $weekTotal += $totalAmount; } // Format the total amount for display $formattedWeekTotal = number_format($weekTotal, 2); // Format to 2 decimal places echo $formattedWeekTotal . ' ' . $qurtyCurrency; // Display the formatted total with currency ?> </span></h2> </div> </div> </div> <div class="col-md-4 col-xl-4"> <div class="card bg-c-yellow order-card"> <div class="card-block"> <h6 class="m-b-20" style="color:#fff">A Month Sales</h6> <h2 class="text-right"><span style="color:#fff"> <?php $monthdate = date("Y-m-d", strtotime("-1 month")); // Date one month ago $currentDate = date("Y-m-d"); // Current date $monthlyTotal = 0; // Initialize $monthlyTotal to accumulate total amount // Prepare SQL statement with placeholders $stmtServices = $con->prepare("SELECT * FROM product_sales WHERE sold_date BETWEEN ? AND ? AND business_name = ?"); $stmtServices->execute(array($monthdate, $currentDate, $shopname)); // Bind parameters to avoid SQL injection $rowsServices = $stmtServices->fetchAll(); foreach ($rowsServices as $rowsService) { $price = $rowsService['total_amount']; $disc = $rowsService['discount']; // Calculate discounted amount $discountedAmount = ($disc / 100) * $price; // Calculate total amount after discount $totalAmount = $price - $discountedAmount; // Accumulate the total for $monthlyTotal $monthlyTotal += $totalAmount; } // Format the total amount for display $formattedMonthlyTotal = number_format($monthlyTotal, 2); // Format to 2 decimal places echo $formattedMonthlyTotal . ' ' . $qurtyCurrency; // Display the formatted total with currency ?> </span></h2> </div> </div> </div> </div> <div class="row"> <style> /* Table Styling */ .sales-table { width: 100%; border-collapse: collapse; margin-top: 20px; font-family: 'Arial', sans-serif; background-color: #fff; } .sales-table th, .sales-table td { padding: 12px 15px; text-align: left; border: 1px solid #e0e0e0; } .sales-table th { background-color: #4a90e2; color: white; font-weight: 600; text-transform: uppercase; font-size: 14px; } .sales-table td { font-size: 14px; color: #333; } .sales-table tr:nth-child(even) { background-color: #f8f9fa; } .sales-table tr:hover { background-color: #e9ecef; } .sales-table .total-row { background-color: #f1f3f5; font-weight: bold; } .sales-table .total-row td { border-top: 2px solid #4a90e2; } .sales-table small { font-size: 12px; color: #555; } .sales-table a { color: #4a90e2; text-decoration: none; } .sales-table a:hover { text-decoration: underline; } /* Card and Form Styling */ .card-body { padding: 20px; } .form-inline .col-md-4, .form-inline .col-md-2 { padding: 10px; } .form-control { border-radius: 5px; border: 1px solid #ced4da; padding: 8px; } .btn-primary { background-color: #4a90e2; border-color: #4a90e2; border-radius: 5px; padding: 8px 15px; font-weight: 500; } .btn-primary:hover { background-color: #357abd; border-color: #357abd; } .table-responsive { border-radius: 8px; overflow-x: auto; } h3 { color: #333; font-weight: 600; margin-bottom: 10px; } p { color: #555; font-size: 16px; } /* Responsive Adjustments */ @media (max-width: 768px) { .sales-table th, .sales-table td { font-size: 12px; padding: 8px; } .form-inline .col-md-4, .form-inline .col-md-2 { width: 100%; } } </style> <div class="col-12"> <div class="card"> <div class="card-body"> <form method="POST" class="form-inline" > <div class="col-md-4"> <label>Search from this Date</label> <div class="form-group"> <input type="date" class="form-control date" name="fdate" style="width:100%"> </div> </div> <div class="col-md-4"> <label>To that Date</label> <div class="form-group"> <input type="date" class="form-control date" name="tdate" style="width:100%"> </div> </div> <div class="col-md-2"> <div class="md-form"> <label>Click to search</label> <button type="submit" name="god" class="btn btn-primary" style="width:100%"> Search</button> </div> </div> </form> <div class="table-responsive"> <table class="table table-bordered"> <br /> <center><h4>Product sales Report</h4> From <?php echo $newF; ?> to. <?php echo $newT ;?> </center> <thead style="background-color:#428bca;border:#428bca;"> <tr style="color: #ffffff;"> <th>Buyer</th> <th>Total</th> <th>DisC(%)</th> <th>Disc Amt</th> <th>Net</th> <th>Paid</th> <th>Balance</th> <th>Total</th> <th>Payment</th> <th>Manage</th> </tr> </thead> <tbody> <tr> <?php $gross12 = 0; $stmt = $con->prepare(" SELECT s.sold_date AS sdate, s.total_amount AS total, s.po_id AS poid, s.discount AS discount, s.amount_paid AS amount_paid, s.payment_mode AS payment_mode, e.first_name AS fname, e.last_name AS lname FROM product_sales s JOIN clients e ON s.buy_id = e.client_id WHERE s.sold_date BETWEEN ? AND ? AND s.business_name = ? "); $stmt->execute(array($newF, $newT, $shopname)); $rows = $stmt->fetchAll(); foreach($rows as $service){ //$tt+= $service['sqty']*$service['pprice']; ?> <td style="width:30%"><?php echo $service['fname'].' '.$service['lname'];?></td> <td><?php echo number_format($service['total'],2);?></td> <td><?php echo $disc = $service['discount'];?> %</td> <td> <?php $total = $service['total']; $disc = $service['discount']; $money = ($disc / 100) * $total; echo $dis = number_format($money,2); ?> </td> <td><?php echo $total = number_format($service['total']- $money,2); $toto = $service['total'] - $money; $gross1 = $service['total'] - $money; ?></td> <td><?php echo $gross = number_format($service['amount_paid'],2); ?> </td> <td> <?php echo $balance = number_format($toto - $service['amount_paid'],2); ?> </td> <td><?php $gross12 = number_format($service['amount_paid'], 2); // Format to 2 decimal places echo $gross12 . ' ' . $qurtyCurrency; // Display the formatted total with ?> </td> <td><?php echo $service['payment_mode'];?></td> <td><li class="list-inline-item" data-toggle="tooltip" title="invoice"> <a href="invoice?INVOICEID=<?php echo $service['poid']; ?>" class="btn btn-primary btn-sm rounded-0" type="button"><i class="fa fa-check-circle"></i></a> </li></td> </tr> <?php } ?> <tr> <th scope="row"></th> <th scope="row"></th> <td colspan="1"></td> <td></td> <td></td> <td></td> <td></td> <td>Total : </b><?php echo number_format($gross12,2);?></td> <td></td> <td></td> </tr> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- container-fluid --> </div> <!-- End Page-content --> <?php include("includes/template/newfooter.php");?> </div> <!-- end main content--> </div> <!-- END layout-wrapper --> <!-- Overlay--> <div class="menu-overlay"></div> <?php include("includes/modals/ServicesModal.php");?> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/bootstrap.bundle.min.js"></script> <script src="assets/js/metismenu.min.js"></script> <script src="assets/js/waves.js"></script> <script src="assets/js/simplebar.min.js"></script> <script src="plugins/raphael/raphael.min.js"></script> <script src="assets/pages/dashboard-demo.js"></script> <script src="assets/js/theme.js"></script> <script src="plugins/autonumeric/autoNumeric-min.js"></script> <script src="plugins/bootstrap-datepicker/bootstrap-datepicker.min.js"></script> <script src="plugins/daterangepicker/daterangepicker.js"></script> <script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js"></script> <script src="plugins/moment/moment.js"></script> <script src="plugins/daterangepicker/daterangepicker.js"></script> <script src="plugins/select2/select2.min.js"></script> <script src="plugins/switchery/switchery.min.js"></script> <script src="plugins/bootstrap-colorpicker/bootstrap-colorpicker.min.js"></script> <script src="plugins/bootstrap-touchspin/jquery.bootstrap-touchspin.min.js"></script> <!-- Custom Js --> <script src="assets/pages/advanced-plugins-demo.js"></script> <script src="assets/pages/datatables-demo.js"></script> <script type="text/javascript"> document.onreadystatechange = function() { if (document.readyState !== "complete") { document.querySelector("#preloader").style.display = "block"; } else { document.querySelector("#preloader").style.display = "none"; } }; </script> <!-- jQuery --> </body> </html>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 60.08 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002