From 55874583eb898ca448206bcb9eb4376d2b7c9de3 Mon Sep 17 00:00:00 2001 From: Suvodip Date: Wed, 26 Mar 2025 11:53:18 +0530 Subject: [PATCH] s11 --- customers/.hta_slug/billing-details.php | 101 ++++++++++++----------- customers/.hta_slug/edit-invoice.php | 15 +--- customers/.hta_slug/generate-invoice.php | 2 +- customers/.hta_slug/list.php | 17 ++-- customers/.hta_slug/print-invoice.php | 99 ++++++++++++---------- my-account/.hta_slug/_home.php | 2 +- my-account/.hta_slug/emi-details.php | 2 +- 7 files changed, 122 insertions(+), 116 deletions(-) diff --git a/customers/.hta_slug/billing-details.php b/customers/.hta_slug/billing-details.php index c3aa1ca..f00462f 100644 --- a/customers/.hta_slug/billing-details.php +++ b/customers/.hta_slug/billing-details.php @@ -2,18 +2,39 @@ require('../.hta_config/conf.php'); $db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + $customerId = $_GET['customerId']; + $invoiceId = $_GET['invoiceId']; + + if($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['additional-payment'])){ + $adPaymentAmount = floatval($_POST['adPaymentAmount']); + $adPaymentDate = $_POST['adPaymentDate']; + $adPaymentSource = $_POST['adPaymentSource']; + $adPaymentTran = $_POST['adPaymentTran']; + $adPaymentRemarks = $_POST['adPaymentRemarks']; + // Insert additional payment record + try{ + $stmt3 = $db->prepare("INSERT INTO emi (customerId, invoiceId, adPaymentAmount, adPaymentDate, adPaymentSource, adPaymentTran, adPaymentRemarks, payStatus) VALUES (:customerId, :invoiceId, :adPaymentAmount, :adPaymentDate, :adPaymentSource, :adPaymentTran, :adPaymentRemarks, 1)"); + $stmt3->bindParam(':customerId', $customerId); + $stmt3->bindParam(':invoiceId', $invoiceId); + $stmt3->bindParam(':adPaymentAmount', $adPaymentAmount); + $stmt3->bindParam(':adPaymentDate', $adPaymentDate); + $stmt3->bindParam(':adPaymentSource', $adPaymentSource); + $stmt3->bindParam(':adPaymentTran', $adPaymentTran); + $stmt3->bindParam(':adPaymentRemarks', $adPaymentRemarks); + if ($stmt3->execute()) { + echo '
Additional Payment ' . htmlspecialchars($_POST['adPaymentAmount']) . ' applied successfully.
'; + } else { + echo '
Failed to record the additional payment.
'; + } + }catch(PDOException $e){ + echo '
Error: ' . $e->getMessage() . '
'; + } + } if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $adPaymentAmount = floatval($_POST['adPaymentAmount']); try { - // Get customer EMI details - $customerId = $_GET['customerId']; - $invoiceId = $_GET['invoiceId']; - $adPaymentAmount = floatval($_POST['adPaymentAmount']); - $adPaymentDate = $_POST['adPaymentDate']; - $adPaymentSource = $_POST['adPaymentSource']; - $adPaymentTran = $_POST['adPaymentTran']; - $adPaymentRemarks = $_POST['adPaymentRemarks']; - // Fetch EMIs of the customer (Assuming we have emiNumber in ascending order) $stmt = $db->prepare("SELECT * FROM emi WHERE customerId = :customerId AND invoiceId = :invoiceId ORDER BY emiNumber DESC"); $stmt->bindParam(':customerId', $customerId); @@ -52,20 +73,6 @@ $updateStmt->execute(); } - // Insert additional payment record - $stmt3 = $db->prepare("INSERT INTO emi (customerId, invoiceId, adPaymentAmount, adPaymentDate, adPaymentSource, adPaymentTran, adPaymentRemarks, payStatus) VALUES (:customerId, :invoiceId, :adPaymentAmount, :adPaymentDate, :adPaymentSource, :adPaymentTran, :adPaymentRemarks, 1)"); - $stmt3->bindParam(':customerId', $customerId); - $stmt3->bindParam(':invoiceId', $invoiceId); - $stmt3->bindParam(':adPaymentAmount', $adPaymentAmount); - $stmt3->bindParam(':adPaymentDate', $adPaymentDate); - $stmt3->bindParam(':adPaymentSource', $adPaymentSource); - $stmt3->bindParam(':adPaymentTran', $adPaymentTran); - $stmt3->bindParam(':adPaymentRemarks', $adPaymentRemarks); - if ($stmt3->execute()) { - echo '
Additional Payment ' . htmlspecialchars($_POST['adPaymentAmount']) . ' applied successfully.
'; - } else { - echo '
Failed to record the additional payment.
'; - } } catch (PDOException $e) { echo '
Error: ' . $e->getMessage() . '
'; } @@ -157,12 +164,12 @@ $frequency = $frequency !== null ? $frequency : 0; ?>
-

Installment Details

+

Installment Details


Customer Name:

Mobile Number:

-

Booking Date:

+

Installment Start Date:

Invoice Id:

Email:

@@ -216,31 +223,27 @@ - 0 ) { ?> -

Additional Payment Details

- - - - - - - +

Additional Payment Details

+
AmountPayment DateTransaction IdRemarks
+ + + + + + + + + + + + + + + - - - - - - - - - - - -
AmountPayment DateTransaction IdRemarks
$
$
- - + + +