diff --git a/customers/.hta_slug/billing-details.php b/customers/.hta_slug/billing-details.php index 3dd60b3..833f06b 100644 --- a/customers/.hta_slug/billing-details.php +++ b/customers/.hta_slug/billing-details.php @@ -61,7 +61,6 @@ $stmt3->bindParam(':adPaymentSource', $adPaymentSource); $stmt3->bindParam(':adPaymentTran', $adPaymentTran); $stmt3->bindParam(':adPaymentRemarks', $adPaymentRemarks); - if ($stmt3->execute()) { echo '
Additional Payment ' . htmlspecialchars($_POST['adPaymentAmount']) . ' applied successfully.
'; } else { @@ -92,14 +91,15 @@ echo '
Error: ' . $e->getMessage() . '
'; } - if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['emiId'], $_POST['payStatus'])) { + if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['emiId'], $_POST['payStatus'], )) { header('Content-Type: application/json'); ob_end_clean(); // Clears any accidental HTML output try { - $stmt = $db->prepare("UPDATE emi SET payStatus = :payStatus WHERE customerId = :customerId AND id = :emiId"); + $stmt = $db->prepare("UPDATE emi SET payStatus = :payStatus, paymentDate = :paymentDate WHERE customerId = :customerId AND id = :emiId"); $stmt->bindParam(':customerId', $_GET['customerId']); $stmt->bindParam(':payStatus', $_POST['payStatus'], PDO::PARAM_INT); $stmt->bindParam(':emiId', $_POST['emiId'], PDO::PARAM_INT); + $stmt->bindParam(':paymentDate', $_POST['paymentDate']); $stmt->execute(); // Ensure no previous output before JSON @@ -183,28 +183,37 @@ Number of EMI EMI Amount EMI Date + EMI Payment Date Payment Status Action - - - - $ - - - - - - - - - - + + + + $ + + + + + + + + + + + + + + + + + @@ -264,7 +273,7 @@ @@ -278,13 +287,16 @@ document.addEventListener("DOMContentLoaded", function () { document.querySelectorAll(".paymentStatus").forEach(select => { select.addEventListener("change", function () { + let row = this.closest("tr"); let emiId = this.getAttribute("data-emi-id"); let newStatus = this.value; + let paymentDateInput = row.querySelector("#paymentDateId"); + let paymentDate = paymentDateInput ? paymentDateInput.value : ""; fetch(window.location.href, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, - body: `emiId=${emiId}&payStatus=${newStatus}` + body: `emiId=${emiId}&payStatus=${newStatus}&paymentDate=${paymentDate}` }) .then(response => response.json()) .then(data => { @@ -303,6 +315,7 @@ }); }); }); + function addAutoAddRemarks() { const emiAmount = ; const addPayAmount = parseFloat(document.getElementById('adPaymentAmount').value) || 0; @@ -312,6 +325,8 @@ `EMI Amount: ${emiAmount}. Extra ${extraAmount > 0 ? extraAmount.toFixed(2) : "0.00"} Settled in last EMI `; } + // document.getElementById('paymentDateId').value = new Date(); + \ No newline at end of file diff --git a/customers/.hta_slug/edit-invoice.php b/customers/.hta_slug/edit-invoice.php index 3ae919f..3cbc66b 100644 --- a/customers/.hta_slug/edit-invoice.php +++ b/customers/.hta_slug/edit-invoice.php @@ -112,7 +112,7 @@
- +
@@ -125,11 +125,11 @@
- +
@@ -185,7 +185,7 @@
- $label) { @@ -194,6 +194,8 @@ } ?> + +
@@ -223,25 +225,27 @@ - + - + - + - + + + diff --git a/customers/.hta_slug/list.php b/customers/.hta_slug/list.php index 186d755..d9cf697 100644 --- a/customers/.hta_slug/list.php +++ b/customers/.hta_slug/list.php @@ -122,7 +122,7 @@ $ $ - + New Edit Print