[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: receipt.php
<?php include("../admin/includes/functions/functions.php"); include("../admin/db/db.php"); if(!isset($_SESSION['username_Xw211qAAsq4'])) { header('Location: ../auth/'); exit(); } $shopname = $_SESSION['business_name_Xw211qAAsq4']; $stmtServices = $con->prepare("SELECT * FROM barber_admin WHERE business_name = ?"); $stmtServices->execute(array($shopname)); $rowsServices = $stmtServices->fetchAll(); foreach($rowsServices as $data) { $location = $data['location']; $number = $data['phone']; } if(isset($_GET['appid'])) { $do = htmlspecialchars($_GET['appid']); $stmt = $con->prepare("SELECT * FROM appointments a, clients c WHERE a.client_id = c.client_id AND a.appointment_id = ? AND a.business_name = ?"); $stmt->execute(array($do, $shopname)); $rows = $stmt->fetchAll(); foreach($rows as $service12) { $date = $service12['created']; $cfname = $service12['first_name']; $clname = $service12['last_name']; $cphone = $service12['phone_number']; $discount = $service12['discount']; } $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($do)); $rowsServices = $stmtServices->fetchAll(); $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($do)); $rowsEmployees = $stmtEmployees->fetchAll(); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Receipt #00<?php echo $do; ?></title> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.js"></script> <style type="text/css"> * { margin: 0; padding: 0; box-sizing: border-box; } body { background: #fff; padding: 0; margin: 0; font-family: 'Courier New', Courier, monospace; font-size: 12px; line-height: 1.4; } .receipt-wrapper { width: 300px; margin: 20px auto; } .receipt { width: 300px; /* Typical POS receipt width */ padding: 10px; background: #fff; color: #000; } .center { text-align: center; } .divider { border-top: 1px dashed #000; margin: 5px 0; } .item-row { display: flex; justify-content: space-between; } .total-row { font-weight: bold; } .header-text { font-size: 14px; font-weight: bold; } .print-btn { display: block; width: 100%; padding: 10px; margin-bottom: 10px; background: #333; color: white; border: none; cursor: pointer; font-family: 'Courier New', Courier, monospace; font-size: 12px; } .print-btn:hover { background: #555; } @media print { body { width: 80mm; margin: 0; padding: 0; } .receipt-wrapper { margin: 0; width: 100%; } .receipt { width: 100%; box-shadow: none; padding: 10px; } .print-btn { display: none; } /* Remove any height restrictions */ html, body, .receipt { height: auto !important; overflow: visible !important; } } </style> </head> <body> <div class="receipt-wrapper"> <button class="print-btn" onclick="printReceipt()">PRINT RECEIPT</button> <div class="receipt" id="invoice"> <div class="center"> <div class="header-text"><?php echo strtoupper($shopname); ?></div> <?php echo $location; ?><br> Tel: <?php echo $number; ?> </div> <div class="divider"></div> <div class="center"> RECEIPT #00<?php echo $do; ?> </div> <div> Date: <?php echo $date; ?><br> Staff: <?php foreach($rowsEmployees as $rowsEmployee) { echo $rowsEmployee['first_name'] . " " . $rowsEmployee['last_name']; } ?> </div> <div class="divider"></div> <!-- Services List --> <?php $total = 0; foreach($rowsServices as $rowsService) { $total += $rowsService['price']; ?> <div> <?php $serviceName = substr($rowsService['service_name'], 0, 25); echo str_pad($serviceName, 25, " ", STR_PAD_RIGHT); ?> <div class="item-row"> <span></span> <span>¢<?php echo number_format($rowsService['price'], 2); ?></span> </div> </div> <?php } ?> <div class="divider"></div> <!-- Totals --> <div class="item-row"> <span>SUBTOTAL</span> <span>¢<?php echo number_format($total, 2); ?></span> </div> <?php $discAmount = ($discount / 100) * $total; if($discount > 0) { ?> <div class="item-row"> <span>DISC (<?php echo number_format($discount, 2); ?>%)</span> <span>-¢<?php echo number_format($discAmount, 2); ?></span> </div> <?php } ?> <div class="item-row total-row"> <span>TOTAL</span> <span>¢<?php echo number_format($total - $discAmount, 2); ?></span> </div> <div class="divider"></div> <!-- Customer Info --> <div> Customer: <?php echo $cfname . ' ' . $clname; ?><br> Phone: <?php echo $cphone; ?> </div> <div class="divider"></div> <div class="center"> THANK YOU!<br> PLEASE COME AGAIN </div> </div> </div> <script> function printReceipt() { window.print(); } window.onload = function() { const invoice = document.getElementById("invoice"); const opt = { margin: [0.1, 0, 0.1, 0], filename: 'Receipt_00<?php echo $do; ?>.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2 }, jsPDF: { unit: 'in', format: 'custom', // Use custom size pageWidth: 3.15, // 80mm width pageHeight: 'auto', // Auto height orientation: 'portrait' } }; // Optional: Uncomment to auto-generate PDF // html2pdf().from(invoice).set(opt).save(); } </script> </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.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