Implement dynamic Payment Method Summary (Table 3)

This commit is contained in:
2026-07-03 16:14:19 +05:30
2 changed files with 111 additions and 76 deletions

View File

@@ -63,8 +63,8 @@
<i class="fa fa-file-text-o"></i> Export CSV
</button>
<!-- <button class="btn btn-secondary" onclick="window.print()" style="border-radius: 10px;">
<i class="fa fa-print"></i> Print Report
</button> -->
<i class="fa fa-print"></i> Print Report
</button> -->
</div>
</div>
@@ -174,80 +174,63 @@
<tfoot style="background-color: #cdd4da; font-weight: bold;">
<tr>
<td colspan="4" class="text-right">Total</td>
<td>0.00</td>
<td>{{ number_format($creditTotals['grand_total'], 2) }}</td>
@foreach ($paymentOptions as $option)
<td>0.00</td>
<td>{{ number_format($creditTotals['methods'][$option->id] ?? 0, 2) }}</td>
@endforeach
</tr>
</tfoot>
</table>
</div>
</div>
<div class="container-fluid mt-5 mb-5">
<!-- Payment Method Summary Table -->
<h4 class="mb-3" style="color: #00489f; font-weight: bold;">Payment Method Summary</h4>
<div class="table-responsive">
<table style="border-radius: 15px; background-color: #e0e5ea; width: 60%;"
class="table table-hover table-bordered">
<thead
style="border-radius: 50px; background: linear-gradient(to right, #078bce, #1a1d1e); color: white;">
<tr>
<th>Payment Option</th>
<th>Sale Amount</th>
<th>Received Amount</th>
<th>Total Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cash</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Card 1</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Card 2</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Card 3</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Online Transfer</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>Link Pay</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</tbody>
<tfoot style="background-color: #cdd4da; font-weight: bold;">
<tr>
<td class="text-right">Grand Total</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</tfoot>
</table>
<div class="container-fluid mt-5 mb-5">
<!-- Payment Method Summary Table -->
<h4 class="mb-3" style="color: #00489f; font-weight: bold;">Payment Method Summary</h4>
<div class="table-responsive">
<table style="border-radius: 15px; background-color: #e0e5ea; width: 60%;"
class="table table-hover table-bordered">
<thead
style="border-radius: 50px; background: linear-gradient(to right, #078bce, #1a1d1e); color: white;">
<tr>
<th>Payment Option</th>
<th>Sale Amount</th>
<th>Received Amount</th>
<th>Total Amount</th>
</tr>
</thead>
<tbody>
@php
$grand_sale = 0;
$grand_received = 0;
$grand_total = 0;
@endphp
@foreach ($summaryData as $summary)
<tr>
<td>{{ $summary['name'] }}</td>
<td class="text-right">{{ number_format($summary['sale_amount'], 2) }}</td>
<td class="text-right">{{ number_format($summary['received_amount'], 2) }}</td>
<td class="text-right">{{ number_format($summary['total_amount'], 2) }}</td>
</tr>
@php
$grand_sale += $summary['sale_amount'];
$grand_received += $summary['received_amount'];
$grand_total += $summary['total_amount'];
@endphp
@endforeach
</tbody>
<tfoot style="background-color: #cdd4da; font-weight: bold;">
<tr>
<td class="text-right">Grand Total</td>
<td class="text-right">{{ number_format($grand_sale, 2) }}</td>
<td class="text-right">{{ number_format($grand_received, 2) }}</td>
<td class="text-right">{{ number_format($grand_total, 2) }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</section>
<style>