This commit is contained in:
Suvodip
2025-03-25 20:33:59 +05:30
parent d9b4921a12
commit 321e617580
6 changed files with 176 additions and 31 deletions

View File

@@ -41,47 +41,64 @@ try {
die('<div class="alert alert-danger text-center">Error: ' . $e->getMessage() . '</div>');
}
?>
<?php
$currentOutstanding = 0;
$totalAmount = 0;
$bookingDate = null;
$currentOutstanding = 0;
$totalAmount = 0;
$bookingDate = null;
$tenure = null;
$frequency = null;
foreach ($emiPlans as $emi) {
$totalAmount = $emi['totalAmount'];
if ($bookingDate === null && !empty($emi['bookingDate'])) {
$bookingDate = $emi['bookingDate'];
}
if ($emi['payStatus'] == 0) {
$currentOutstanding += $emi['emiAmount'];
}
if ($tenure === null && isset($emi['tenure'])) {
$tenure = $emi['tenure'];
}
if ($frequency === null && isset($emi['frequency'])) {
$frequency = $emi['frequency'];
}
}
$currentOutstanding = round($currentOutstanding);
$tenure = $tenure !== null ? $tenure : 0;
$frequency = $frequency !== null ? $frequency : 0;
?>
<div class="container mt-4">
<h2 class="mb-3">EMI Details</h2>
<h2 class="mb-3">Installment Details</h2>
<div class="d-flex justify-content-between">
<div>
<p>Customer Name: <strong><?php echo $customer['name']; ?></strong></p>
<p>Mobile Number: <strong><?php echo $customer['mobile']; ?></strong></p>
<p>EMI Booking Date: <strong><?php echo $emiPlans[0]['bookingDate']; ?></strong></p>
<p>EMI Booking Date: <strong><?php echo $emiPlans[0]['invoiceId']; ?></strong></p>
<p>Installment Start Date: <strong><?php echo $bookingDate ? htmlspecialchars($bookingDate) : 'N/A'; ?></strong></p>
<p>Booking Date: <strong><?php echo $emiPlans[0]['invoiceId']; ?></strong></p>
</div>
<div>
<?php
$currentOutstanding = 0;
$totalAmount = 0;
foreach ($emiPlans as $emi) {
$totalAmount = $emi['totalAmount'];
if ($emi['payStatus'] == 0) {
$currentOutstanding += $emi['emiAmount'];
}
}
?>
<p>Total Amount: <strong><?php echo $totalAmount; ?></strong></p>
<p>Outstanding: <strong><?php echo round($currentOutstanding); ?></strong></p>
<p>Tenure: <strong><?php echo $emiPlans[0] ? $emiPlans[0]['tenure'] : 0; ?></strong></p>
<p>Frequency: <strong><?php echo $emiPlans[0] ? $emiPlans[0]['frequency'] : 0; ?></strong></p>
<p>Total Amount: <strong>&#36;<?php echo $totalAmount; ?></strong></p>
<p>Outstanding: <strong>&#36;<?php echo round($currentOutstanding); ?></strong></p>
<p>Tenure: <strong><?php echo $tenure; ?></strong></p>
<p>Frequency: <strong><?php echo $frequency; ?></strong></p>
</div>
</div>
<table class="table table-striped table-bordered">
<thead class="text-white text-center" style="background-color: #374151;">
<tr>
<th>Number of EMI</th>
<th>EMI Amount</th>
<th>EMI Date</th>
<th>Installment</th>
<th>Amount</th>
<th>Date</th>
<th>Payment Status</th>
<th>Outstanding</th>
</tr>
</thead>
<tbody>
<?php foreach ($emiPlans as $emi) { ?>
<?php foreach ($emiPlans as $emi) {
if ($emi['emiAmount'] !== null) { ?>
<tr id="row-<?= $emi['id']; ?>">
<td><?= $emi['emiNumber']; ?></td>
<td>$<?= number_format($emi['emiAmount'], 2); ?></td>
@@ -93,7 +110,7 @@ try {
</td>
<td>$<?= number_format($emi['outstanding'], 2); ?></td>
</tr>
<?php } ?>
<?php } } ?>
</tbody>
</table>
</div>