[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: sales_report.php
<?php include("../admin/includes/functions/functions.php");?> <?php include("../admin/db/db.php");?> <?php if(!isset($_SESSION['username_Xw211qAAsq4'])) { header('Location: ../auth/'); exit(); } else{ $pageTitle1 = 'Sales Report'; $shopname = $_SESSION['business_name_Xw211qAAsq4']; 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)); $newstm = $con->prepare("SELECT s.service_name,sum(sb.price) as price,a.discount as discount,a.comRate as percentage from services s, true_price sb,appointments a where s.service_id = sb.service_id and sb.appointment_id = a.appointment_id and a.canceled = '0' and a.active = 'Yes'AND a.created between '$newF' AND '$newT' a.business_name = '$shopname'"); } ?> <div id="layout-wrapper"> <div class="header-border"></div> <header id="page-topbar"> <?php include("includes/template/header.php");?> </header> <title><?php echo $shopname?> || <?php echo $pageTitle1;?></title> <link href="plugins/daterangepicker/daterangepicker.css" rel="stylesheet" type="text/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> <div class="vertical-menu"> <?php include("includes/template/sidebar.php");?> </div> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <style> @media print { .no-print, .no-print * { display: block; } /* Sets print area element and all its content to display */ } </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> <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'); $stmtServices = $con->prepare("SELECT s.service_name,sum(sb.price) as price,a.discount as discount,a.comRate as percentage from services s, true_price sb,appointments a where s.service_id = sb.service_id and sb.appointment_id = a.appointment_id AND a.created = '$tdate' and a.canceled = '0' and a.active = 'Yes' and a.business_name = ?"); $stmtServices->execute(array($shopname)); $rowsServices = $stmtServices->fetchAll(); foreach($rowsServices as $rowsService) { if ($rowsService == true){ $tt2 =$rowsService['price']; $dds = $rowsService['discount']; $Disc = ($dds / 100) * $tt2; $afterDis = $tt2 - $Disc; $ComRaetPer = $rowsService['percentage']; $commission = ($ComRaetPer / 100) * $afterDis ; $gross1+= $afterDis-$commission; } } echo $todayss = number_format($tt2,2); ?> </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 Week Sales</h6> <h2 class="text-right"><span style="color:#fff"> <?php $pastdate= date("Y-m-d", strtotime("-1 week")); $crrntdte=date("Y-m-d"); $stmtServices = $con->prepare("SELECT s.service_name,sum(sb.price) as price,a.discount as discount,a.comRate as commission from services s, true_price sb,appointments a where s.service_id = sb.service_id and sb.appointment_id = a.appointment_id AND a.created between '$pastdate' AND '$crrntdte' and a.canceled = '0' and a.active = 'Yes' and a.business_name = ?"); $stmtServices->execute(array($shopname)); $rowsServices = $stmtServices->fetchAll(); foreach($rowsServices as $rowsService) { if ($rowsServices ==true){ $tt =$rowsService['price']; $dds = $rowsService['discount']; $Disc = ($dds / 100) * $tt; $afterDis = $tt-$Disc; $ComRaetPer = $rowsService['commission']; $commission = ($ComRaetPer / 100) * $afterDis ; $grosss+= $afterDis - $commission; } } echo $week = number_format($tt,2); ?> </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")); $crrntdte=date("Y-m-d"); $stmtServices = $con->prepare("SELECT s.service_name,sum(sb.price) as price,a.discount as discount,a.comRate as commission from services s, true_price sb,appointments a where s.service_id = sb.service_id and sb.appointment_id = a.appointment_id AND a.created between '$monthdate' AND '$crrntdte' and a.canceled = '0' and a.active = 'Yes' and a.business_name = ?"); $stmtServices->execute(array($shopname)); $rowsServices = $stmtServices->fetchAll(); foreach($rowsServices as $rowsService) { if($rowsServices ==true){ $ttt =$rowsService['price']; $dds = $rowsService['discount']; $Disc = ($dds / 100) * $ttt; $afterDis = $ttt - $Disc; $Com = $rowsService['commission']; $commission = ($Com / 100) * $afterDis ; $gross+= $afterDis-$commission; } } echo $monthly = number_format($ttt,2); ?> </span></h2> </div> </div> </div> </div> <div class="row"> <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="text" class="form-control date" name="fdate" id="birthdatepicker" data-toggle="daterangepicker" data-single-date-picker="true" style="width:100%"> </div> </div> <div class="col-md-4"> <label>To that Date</label> <div class="form-group"> <input type="text" class="form-control date" name="tdate" id="birthdatepicker" data-toggle="daterangepicker" data-single-date-picker="true" 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> <!--<button type="submit" name="god" class="btn btn-primary"> Search</button>--> </form> <div class="table-responsive"> <table class="table table-hover table-striped table-bordered"> <center><h3>Sales Report</h3> <p>From <b><?php echo $newF; ?></b> to. <b><?php echo $newT ;?></b> </center> <thead> <tr> <th style="width:20%">Booked Services</th> <th>Total</th> <th>Discount rate(%)</th> <th>Commission</th> <th>Net</th> <th>Info</th> </tr> </thead> <tbody> <?php $stmt = $con->prepare("SELECT * FROM appointments a , clients c WHERE a.client_id = c.client_id AND a.canceled = 0 and a.active = 'Yes' and a.created between '$newF' and '$newT' and a.business_name = '$shopname'"); $stmt->execute(); $rows = $stmt->fetchAll(); foreach($rows as $service){ ?> <tr> <td style="width:25%"> <?php $stmtServices = $con->prepare("SELECT service_name,price from services s, true_price sb where s.service_id = sb.service_id and sb.appointment_id = ?"); $stmtServices->execute(array($service['appointment_id'])); $rowsServices = $stmtServices->fetchAll(); foreach($rowsServices as $rowsService) { echo "-".$rowsService['service_name'].'-'.$rowsService['price']; if (next($rowsServices)==true) echo " <br> "; } ?></td> <td><?php $stmtServices = $con->prepare("SELECT service_name,sum(sb.price) as price from services s, true_price sb where s.service_id = sb.service_id and sb.appointment_id = ?"); $stmtServices->execute(array($service['appointment_id'])); $rowsServices = $stmtServices->fetchAll(); foreach($rowsServices as $rowsService) { if ($rowsServices ==true) echo $tt = $rowsService['price']; $dds = $service['discount']; $Disc = ($dds / 100) * $tt; $afterDis = $tt-$Disc; $percentage1 = $service['comRate']; $commission = ($percentage1 / 100) * $afterDis ; $grossw = $afterDis - $commission; } $grossTotal = number_format($grossw,2); ?></td> <td class="py-0 px-1"> <small>Discount: <?php if(empty($service['discount'])){ echo '0.00'. '%'; } else { echo $service['discount'].' %'; }?></small><br> <small>Disc Amt: <?php $dds = $service['discount']; $Disc = ($dds / 100) * $tt; $afterDis = $tt-$Disc; echo number_format($Disc,2).'¢'; $totalDis+= $Disc; ?> </small><br > <b><small>After Disc: <?php echo number_format($afterDis,2).'¢'; ?> </small></b> </td> <td class="py-0 px-1"> <small>Comm Rate : <?php echo $percentage1.' %';?></small><br> <small>Comm Amt: <?php $commission = ($percentage1 / 100) * $afterDis; echo number_format($commission,2).'¢'; $TotalCom+= $commission; ?> </small> </td> <td> <?php echo $prof = number_format($afterDis-$commission,2).' ¢';?> <?php $netTotal+= $afterDis - $commission;?> </td> <td class="py-0 px-1"> <small>Employee : <?php $stmtEmployees = $con->prepare("SELECT first_name,last_name from employees e, appointments a where e.employee_id = a.employee_id and a.appointment_id = ? "); $stmtEmployees->execute(array($service['appointment_id'])); $rowsEmployees = $stmtEmployees->fetchAll(); foreach($rowsEmployees as $rowsEmployee) { $namee = $rowsEmployee['first_name']." ".$rowsEmployee['last_name']; echo '<a href="receipt?appid='.$service['appointment_id'].'">'.$namee.'</a>'; } ?></small><br> <small>Status Done ?: <?php $idd = $service["appointment_id"]; echo $service['active'];?></small><br/> <small>Payment mode: <?php echo $service['payment_mode'];?></small> </td> <?php $print = "print_".$service["appointment_id"];?> <!-- <td> <ul> <li class="list-inline-item" data-toggle="tooltip" title="Details"> <a href="#" data-toggle="modal" data-target="#<?php echo $print; ?>" data-placement="top"><i class="fa fa-users" style="color:brown"></i></a> </li> <div class="modal fade" id="<?php echo $print; ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo $print; ?>" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="row justify-content-center"> <div class="col-lg-12 col-xl-12"> <div class="card"> <div class="card-body p-12"> <table class="table border-bottom border-gray-200 mt-3"> <tbody> <tr> <?php $cnt = 1; foreach($rowsServices as $rowsService) {?> </tr> <?php }?> </tbody> </table> <div class="mt-5"> <div class="d-flex justify-content-end"> <p class="text-muted me-3"> Subtotal:</p> <span> <?php echo number_format($tt,2);?></span> </div> <div class="d-flex justify-content-end"> <p class="text-muted me-3"> Disc: </p> <span> <?php echo $dds = number_format($service['discount'],1).'%'; $Disc = ($dds / 100) * $tt; $afterDis = $tt-$Disc; ?> </span> </div> <div class="d-flex justify-content-end"> <p class="text-muted me-3"> Disc Amt: </p> <span> <?php echo $Disc = number_format(($dds / 100) * $tt,2); ;?></span> </div> <div class="d-flex justify-content-end"> <p class="text-muted me-3"> After Disc: </p> <span> <?php echo $afterDis = number_format($tt-$Disc,2); ;?></span> </div> <div class="d-flex justify-content-end"> <p class="text-muted me-3"> ComRate: </p> <span> <?php echo $com = number_format($service['comRate'],1).'%'; ;?></span> </div> <div class="d-flex justify-content-end"> <p class="text-muted me-3"> ComRate Amt: </p> <span> <?php $percentage = $service['comRate']; echo number_format($commission = ($percentage / 100) * $afterDis,2) ; ;?></span> </div> <div class="d-flex justify-content-end mt-3"> <h5 class="me-3">Grand Profit: </h5> <h5><b><?php echo number_format($afterDis - $commission,2);?></b></h5> </div> </div> </div> </div> </div> </div> </div> </div> </div> </ul> </td> --> <?php } ?> </tr> <tr> <th scope="row"></th> <td colspan="1"></td> <td colspan="1">Total Discount : <b><?php echo $totalDis.'¢';?></b></td> <td>Total : <b><?php echo number_format($TotalCom,2).'¢';?></b></td> <td>Net Total : <b><?php echo $netTotal.'¢';?></b></td> </tr> </tbody> </table> </div> <!-- <button onclick="window.print()" class="btn btn-primary">Print</button> --> </div> </div> </div> </div> </div> </div> <?php include("includes/template/footer.php");?> </div> <!-- end main content--> </div> <!-- Overlay--> <div class="menu-overlay"></div> <?php include("includes/modals/VendorModal.php");?> <script src="plugins/daterangepicker/daterangepicker.js"></script> <!-- third party js ends --> <!-- Datatables init --> <script src="assets/pages/datatables-demo.js"></script> <!-- App js --> <script src="assets/js/theme.js"></script> </body> </html> <?php }?>
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.07 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