<?php
include 'includes/config.php'; 
$bank_id = isset($_POST['bank_id']) ? $_POST['bank_id'] : '';
$supplier_id = isset($_POST['supplier_id']) ? $_POST['supplier_id'] : '';
$ref_no = isset($_POST['ref_no']) ? $_POST['ref_no'] : '';
$amount = isset($_POST['amount']) ? $_POST['amount'] : '';
$note = isset($_POST['note']) ? $_POST['note'] : '';
$date = isset($_POST['date']) ? $_POST['date'] : ''; 
$status = isset($_POST['status']) ? $_POST['status'] : '';

$query = "INSERT INTO bank_debit_amount (bank_id, supplier_id, ref_no, amount, note, date, status) 
          VALUES (:bank_id, :supplier_id, :ref_no, :amount, :note, :date, :status)";

$stmt = $conn->prepare($query);

$stmt->bindParam(':bank_id', $bank_id);
$stmt->bindParam(':supplier_id', $supplier_id);
$stmt->bindParam(':ref_no', $ref_no);
$stmt->bindParam(':amount', $amount);
$stmt->bindParam(':note', $note);
$stmt->bindParam(':date', $date);
$stmt->bindParam(':status', $status);

if ($stmt->execute()) {
    echo "Payment successfully added.";
} else {
    echo "Error adding payment.";
}
?>
