This commit is contained in:
Suvodip
2025-03-19 17:46:05 +05:30
parent 6e69bf9f35
commit 8bcf5c055d
13 changed files with 58 additions and 43 deletions

View File

@@ -5,7 +5,7 @@
<h2 class="mb-3 text-center">Customer List</h2>
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead class="bg-primary text-white text-center">
<thead class="text-white text-center" style="background-color: #374151;">
<tr>
<th>Sl No</th>
<th>Name</th>
@@ -19,6 +19,9 @@
</thead>
<tbody>
<?php
// var_dump($_SESSION);
$customerId = $_SESSION['customerId'];
// echo $customerId;
try {
// Connect to the database
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
@@ -26,15 +29,14 @@
// Fetch customer data
$stmt = $db->prepare("SELECT * FROM customers WHERE customerId = :customerId ORDER BY regDate DESC");
$stmt->bindParam(':customerId', $_SESSION['customerId']);
$stmt->bindParam(':customerId', $customerId);
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Fetch invoice data
$stmt2 = $db->prepare("SELECT * FROM invoice");
$stmt2->execute();
$invoiceContent = $stmt2->fetchAll(PDO::FETCH_ASSOC);
// Loop through each customer
$customerSerial = 1;
foreach ($content as $customer) {
@@ -59,8 +61,8 @@
<td><?php echo htmlspecialchars($invoice['totalAmount']); ?></td>
<td>
<a href="/my-account/emi-details/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn btn-primary btn-sm">EMI Details</a>
<a href="/my-account/print-invoice/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn btn-primary btn-sm">Print</a>
<a href="/my-account/emi-details/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn text-white btn-sm" style="background-color: #374151;">EMI Details</a>
<a href="/my-account/print-invoice/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn text-white btn-sm" style="background-color: #374151;">Print</a>
</td>
</tr>
<?php
@@ -75,7 +77,7 @@
<td><?php echo htmlspecialchars($customer['email']); ?></td>
<td colspan="3">No invoice available</td>
<td>
<a href="/my-account/emi-details/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn btn-primary btn-sm">EMI Details</a>
<a href="/my-account/emi-details/?customerId=<?php echo $customer['customerId'] . '&invoiceId=' . $invoice['invoiceId']; ?>" class="btn text-white btn-sm" style="background-color: #374151;">EMI Details</a>
</td>
</tr>
<?php