s11
parent
c27a11836a
commit
f4c9d21318
|
@ -43,20 +43,24 @@
|
|||
|
||||
|
||||
<div class="container-xxl mt-4">
|
||||
<h3 class="mb-3 ">Customer List</h3><hr>
|
||||
<div class="d-flex justify-content-between">
|
||||
<h3 class="">Customer List</h3>
|
||||
<button onclick="exportTableToExcel()" class="btn btn-sm text-white align-items-center" style="background-color: #374151; height: fit-content;">Export to Excel</button>
|
||||
</div><hr>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover w-100" style="font-size: 13px;">
|
||||
<table id="myTable" class="table table-bordered table-striped table-hover w-100" style="font-size: 13px;">
|
||||
<thead class="text-white text-center" style="background-color: #374151;">
|
||||
<tr>
|
||||
<th>Sl No</th>
|
||||
<th>Name</th>
|
||||
<th>Payment Start Date</th>
|
||||
<th>Payment End Date</th>
|
||||
<th>Number of Installments</th>
|
||||
<th>Start Date</th>
|
||||
<th>End Date</th>
|
||||
<th>Installments</th>
|
||||
<th>Monthly Payment Date</th>
|
||||
<th>Monthly Payment Amount</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Invoice</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -122,7 +126,7 @@
|
|||
<td>$<?php echo isset($emi['emiAmount']) ? htmlspecialchars($emi['emiAmount']) : '0.00'; ?></td>
|
||||
<td>$<?php echo isset($emi['totalAmount']) ? htmlspecialchars($emi['totalAmount']) : '0.00'; ?></td>
|
||||
|
||||
<td class="d-inline-flex gap-1">
|
||||
<td class="d-flex gap-1">
|
||||
<a href="/customers/generate-invoice/?customerId=<?php echo $customer['customerId']; ?>" class="btn btn-sm text-white" style="font-size: 13px; background-color: #374151;">New</a>
|
||||
<a href="/customers/edit-invoice/?customerId=<?php echo $customer['customerId'].'&invoiceId='.$invoice['invoiceId']; ?>" class="btn btn-sm text-white" style="font-size: 13px; background-color: #374151;">Edit</a>
|
||||
<a href="/customers/print-invoice/?customerId=<?php echo $customer['customerId'].'&invoiceId='.$invoice['invoiceId']; ?>" class="btn btn-sm text-white" style="font-size: 13px; background-color: #374151;">Print</a>
|
||||
|
@ -142,7 +146,7 @@
|
|||
<td><?php echo $customerSerial++; ?></td>
|
||||
<td><?php echo htmlspecialchars($customer['name']); ?></td>
|
||||
<td colspan="6" class="text-center">No EMI or Invoice Data</td>
|
||||
<td class="d-flex flex-wrap gap-1">
|
||||
<td class="d-flex gap-1">
|
||||
<a href="/customers/generate-invoice/?customerId=<?php echo $customer['customerId']; ?>" class="btn btn-sm text-white">New</a>
|
||||
<form method="post">
|
||||
<input type="hidden" name="customerId" value="<?php echo htmlspecialchars($customer['customerId']); ?>" />
|
||||
|
@ -162,3 +166,31 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
||||
<script>
|
||||
function exportTableToExcel() {
|
||||
let table = document.getElementById("myTable");
|
||||
let rows = table.querySelectorAll("tr");
|
||||
let data = [];
|
||||
|
||||
rows.forEach((row, rowIndex) => {
|
||||
let rowData = [];
|
||||
let cells = row.querySelectorAll("th, td");
|
||||
|
||||
cells.forEach((cell, cellIndex) => {
|
||||
if (cellIndex !== 8) { // Excluding the "Invoice" column (Index 8)
|
||||
rowData.push(cell.innerText);
|
||||
}
|
||||
});
|
||||
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
let wb = XLSX.utils.book_new();
|
||||
let ws = XLSX.utils.aoa_to_sheet(data); // Convert array to sheet
|
||||
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
|
||||
|
||||
// Save the file
|
||||
XLSX.writeFile(wb, "TableData.xlsx");
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue