🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:make-payment.php
<?php require_once __DIR__ . '/../config/config.php'; require_once __DIR__ . '/../includes/functions.php'; if (!isLoggedIn()) redirect(SITE_URL . 'customer/login.php'); $booking_id = isset($_GET['booking_id']) ? intval($_GET['booking_id']) : 0; $booking = getBooking($booking_id); if (!$booking || $booking['customer_id'] != $_SESSION['customer_id']) redirect('dashboard.php'); $msg = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $amount = floatval($_POST['amount']); $method = cleanInput($_POST['payment_method']); $transaction_id = cleanInput($_POST['transaction_id']); $notes = cleanInput($_POST['notes']); $receipt = ''; if (!empty($_FILES['receipt']['name'])) { $upload = uploadFile($_FILES['receipt'], __DIR__ . '/../uploads/payments/'); if ($upload) $receipt = $upload; else $msg = '<div class="alert alert-danger">File upload failed.</div>'; } if (!$msg) { $stmt = $conn->prepare("INSERT INTO payments (booking_id, customer_id, amount, payment_type, payment_method, transaction_id, receipt_image, notes) VALUES (?, ?, ?, 'advance', ?, ?, ?, ?)"); $stmt->bind_param("iissss", $booking_id, $_SESSION['customer_id'], $amount, $method, $transaction_id, $receipt, $notes); if ($stmt->execute()) { $stmt = $conn->prepare("UPDATE bookings SET advance_amount = advance_amount + ?, balance_amount = total_price - advance_amount, payment_status = 'advance_paid', status = 'waiting_payment' WHERE id = ?"); $stmt->bind_param("di", $amount, $booking_id); $stmt->execute(); addNotification('Payment Submitted', 'Payment of ' . formatPrice($amount) . ' received for booking ' . $booking['booking_id'], SITE_URL . 'admin/payments.php', 'admin'); $msg = '<div class="alert alert-success">Payment submitted! Awaiting admin verification.</div>'; } else { $msg = '<div class="alert alert-danger">Payment submission failed.</div>'; } } } define('PAGE_TITLE', 'Make Payment'); include 'dashboard-header.php'; ?> <div class="d-flex justify-content-between align-items-center mb-4"> <h4 class="fw-bold text-navy mb-0"><i class="bi bi-credit-card text-warning me-2"></i>Make Payment</h4> <a href="booking-details.php?id=<?= $booking_id ?>" class="btn btn-outline-premium btn-sm"><i class="bi bi-arrow-left me-1"></i>Back</a> </div> <?= $msg ?> <div class="row g-4"> <div class="col-lg-7"> <div class="premium-card p-4"> <h5 class="fw-bold mb-3">Payment Details</h5> <form method="post" enctype="multipart/form-data"> <div class="row g-3"> <div class="col-md-6"><label class="form-label">Booking</label><input type="text" class="form-control" value="<?= $booking['booking_id'] ?> - <?= $booking['package_name'] ?>" disabled></div> <div class="col-md-6"><label class="form-label">Total Amount</label><input type="text" class="form-control" value="<?= formatPrice($booking['total_price']) ?>" disabled></div> <div class="col-md-6"><label class="form-label">Advance Amount *</label><input type="number" name="amount" class="form-control" required step="0.01" min="1" max="<?= $booking['total_price'] - $booking['advance_amount'] ?>" placeholder="Enter amount"></div> <div class="col-md-6"><label class="form-label">Payment Method *</label><select name="payment_method" class="form-select" required><option value="">Select</option><option>Bank Transfer</option><option>Cash Deposit</option><option>Online Payment</option><option>Other</option></select></div> <div class="col-md-6"><label class="form-label">Transaction ID</label><input type="text" name="transaction_id" class="form-control" placeholder="Reference number"></div> <div class="col-md-6"><label class="form-label">Upload Receipt</label><input type="file" name="receipt" class="form-control" accept="image/*"></div> <div class="col-12"><label class="form-label">Notes</label><textarea name="notes" class="form-control" rows="2" placeholder="Any payment notes"></textarea></div> <div class="col-12"><button type="submit" class="btn btn-premium"><i class="bi bi-check-circle me-2"></i>Submit Payment</button></div> </div> </form> </div> </div> <div class="col-lg-5"> <div class="premium-card p-4"> <h5 class="fw-bold mb-3"><i class="bi bi-bank text-warning me-2"></i>Bank Details</h5> <p class="mb-1"><strong>Bank:</strong> <?= getSetting('bank_name') ?></p> <p class="mb-1"><strong>Account Name:</strong> <?= getSetting('bank_account_name') ?></p> <p class="mb-1"><strong>Account No:</strong> <?= getSetting('bank_account_no') ?></p> <p class="mb-0"><strong>Branch:</strong> <?= getSetting('bank_branch') ?></p> <hr> <p class="text-muted small mb-0">After making the payment, upload the receipt or provide transaction details. We will verify and update your booking status.</p> </div> </div> </div> <?php include 'dashboard-footer.php'; ?>
Save Changes
Cancel
Create New File
Create New Folder