+
+
Sl No |
Name |
@@ -14,7 +14,7 @@
Number of Installments |
Monthly Payment Date |
Monthly Payment Amount |
- Totoal Amount |
+ Total Amount |
Action |
@@ -30,6 +30,11 @@
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ // Fetch EMI data
+ $stmt = $db->prepare("SELECT * FROM emi ORDER BY invoiceId ASC");
+ $stmt->execute();
+ $emiContent = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
// Fetch invoice data
$stmt2 = $db->prepare("SELECT * FROM invoice");
$stmt2->execute();
@@ -46,25 +51,42 @@
// If there are matching invoices, loop through them
if (!empty($matchingInvoices)) {
foreach ($matchingInvoices as $invoice) {
- ?>
+ // Find corresponding EMI records for this invoice
+ $matchingEMIs = array_filter($emiContent, function ($emi) use ($invoice) {
+ return $emi['invoiceId'] === $invoice['invoiceId'];
+ });
+
+ // If EMI exists, use its data; otherwise, display empty fields
+ // $emi = reset($matchingEMIs) ?: [];
+ $matchingEmis = array_filter($emiContent, function ($emi) use ($invoice) {
+ return $emi['invoiceId'] === $invoice['invoiceId'];
+ });
+
+ if (!empty($matchingEmis)) {
+ $emi = reset($matchingEmis); // Get the first matching EMI record safely
+ } else {
+ $emi = [];
+ }
+
+ ?>
|
- |
- $ |
- |
-
-
- |
- |
- $ |
-
-
- New Invoice
- Edit Invoice
-
-
- Payment
+
+
+
+ |
+ |
+ modify('+'.$emi['tenure']-'1'.'months')->format('d-m-Y') : 'N/A'; ?> |
+ |
+ |
+ $ |
+ $ |
+
+
+ New Invoice
+ Edit Invoice
+ Payment
|
|
|
- |
- |
- No invoice available |
+ No EMI or Invoice Data |
-
-
Create Invoice
-
- Additional Payment
-
|
Error: ' . $e->getMessage() . ' | ';
+ echo 'Error: ' . $e->getMessage() . ' |
';
}
?>
-
-