View file File name : receipt.php Content :<?php require_once '_helpers.php'; $invoice_id = $_GET['id'] ?? null; if (!$invoice_id) { http_response_code(400); die("Error: Invoice ID is required."); } $conn = get_db_connection(); $business = $conn->query("SELECT * FROM business_settings LIMIT 1")->fetch_assoc(); $invoice_data = get_invoice_details($conn, $invoice_id); $conn->close(); if (!$invoice_data || $invoice_data['invoice']['status'] !== 'Paid' || empty($invoice_data['invoice']['paid_at'])) { http_response_code(404); die("Paid invoice not found for ID: " . htmlspecialchars($invoice_id)); } $invoice = $invoice_data['invoice']; $numeric_id = preg_replace('/[^0-9]/', '', $invoice['id']); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Receipt for Invoice #<?php echo htmlspecialchars($numeric_id); ?></title> <script src="https://cdn.tailwindcss.com"></script> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> <style> body { font-family: 'Inter', sans-serif; } :root { --primary: <?php echo htmlspecialchars($business['primary_color'] ?? '217 91% 60%'); ?>; } .bg-primary { background-color: hsl(var(--primary)); } .text-primary { color: hsl(var(--primary)); } @media print { .no-print { display: none; } body { background-color: white; } .print-card { box-shadow: none; border: none; } } </style> </head> <body class="bg-slate-100"> <div class="max-w-3xl mx-auto p-4 sm:p-6 lg:p-8 space-y-4"> <div class="no-print flex justify-between items-center"> <button onclick="window.print()" class="px-4 py-2 border rounded-full text-sm font-medium hover:bg-slate-50">Print</button> <a href="invoice-details.php?id=<?php echo htmlspecialchars($invoice['id']); ?>" class="px-4 py-2 border rounded-full text-sm font-medium hover:bg-slate-50">Back to Invoice #<?php echo htmlspecialchars($numeric_id); ?></a> </div> <div id="receipt-content" class="bg-white p-8 md:p-12 rounded-lg shadow-sm print-card"> <div class="space-y-12"> <div class="text-center space-y-4"> <?php if (!empty($business['logo'])): ?> <img src="<?php echo htmlspecialchars($business['logo']); ?>" alt="Company Logo" class="w-48 h-auto mx-auto"> <?php else: ?> <div class="w-48 h-20 bg-slate-100 flex items-center justify-center mx-auto text-slate-400">Your Logo</div> <?php endif; ?> <h1 class="text-4xl font-bold tracking-tight">Payment Receipt</h1> <p class="text-lg text-slate-500">Invoice #<?php echo htmlspecialchars($numeric_id); ?></p> <p class="text-slate-500">for <?php echo htmlspecialchars($invoice['customer_name']); ?> paid on <?php echo date('M d, Y', strtotime($invoice['paid_at'])); ?></p> </div> <div class="text-center text-sm text-slate-500"> <p class="font-semibold text-slate-800"><?php echo htmlspecialchars($business['name']); ?></p> <p><?php echo htmlspecialchars($business['address'] ?? ''); ?>, <?php echo htmlspecialchars($business['city_state_zip'] ?? ''); ?></p> <p><?php echo htmlspecialchars($business['country'] ?? ''); ?></p> <p><?php echo htmlspecialchars($business['phone'] ?? ''); ?></p> </div> <hr /> <div class="space-y-6 text-center"> <div> <p class="text-sm text-slate-500 uppercase tracking-wider">Payment Amount</p> <p class="text-3xl font-bold"><?php echo format_currency($invoice['total']); ?> BZD</p> </div> <div> <p class="text-sm text-slate-500 uppercase tracking-wider">Payment Method</p> <p class="text-lg font-medium"><?php echo htmlspecialchars($invoice['paymentAccount'] ?: $invoice['paymentMethod'] ?: 'N/A'); ?></p> </div> </div> <div class="flex justify-center"> <div class="border-2 border-green-500 rounded-md p-2 text-green-500 font-bold text-3xl tracking-widest -rotate-12 transform"> PAID </div> </div> </div> </div> <p class="text-center text-xs text-slate-500"> Thanks for your business. If this receipt was sent in error, please contact <a href="mailto:<?php echo htmlspecialchars($business['email'] ?? ''); ?>" class="text-primary hover:underline"><?php echo htmlspecialchars($business['email'] ?? ''); ?></a> </p> </div> </body> </html>