Refactor DailySalePaymentReportModule Table 1 logic with date filtering

This commit is contained in:
2026-07-03 14:50:27 +05:30
parent f2ad6093d2
commit 8477dbcb82
2 changed files with 122 additions and 13 deletions

View File

@@ -90,21 +90,58 @@
</tr>
</thead>
<tbody>
{{-- @foreach ($sales_data as $sale) --}}
<!-- Data rows will come here -->
{{-- @endforeach --}}
@php
// යටින් පෙන්නන්න ඕන එකතුවට බින්දුවෙන් විචල්‍යයන් හදාගන්නවා
$tot_grand = 0;
$tot_cash = 0;
$tot_card1 = 0;
$tot_card2 = 0;
$tot_card3 = 0;
$tot_online = 0;
$tot_link = 0;
$tot_due = 0;
@endphp
@foreach ($sales_data as $sale)
<tr>
<td>{{ $sale->date }}</td>
<td>{{ $sale->reference_no }}</td>
<td>{{ $sale->cashier }}</td>
<td>{{ $sale->customer }}</td>
<td class="text-right">{{ number_format($sale->grand_total, 2) }}</td>
<td class="text-right">{{ number_format($sale->cash, 2) }}</td>
<td class="text-right">{{ number_format($sale->card1, 2) }}</td>
<td class="text-right">{{ number_format($sale->card2, 2) }}</td>
<td class="text-right">{{ number_format($sale->card3, 2) }}</td>
<td class="text-right">{{ number_format($sale->online_transfer, 2) }}</td>
<td class="text-right">{{ number_format($sale->link_pay, 2) }}</td>
<td class="text-right">{{ number_format($sale->due_amount, 2) }}</td>
</tr>
@php
// ටේබල් එක යටින් පෙන්වන්න ඔක්කොම එකතු කරනවා
$tot_grand += $sale->grand_total;
$tot_cash += $sale->cash;
$tot_card1 += $sale->card1;
$tot_card2 += $sale->card2;
$tot_card3 += $sale->card3;
$tot_online += $sale->online_transfer;
$tot_link += $sale->link_pay;
$tot_due += $sale->due_amount;
@endphp
@endforeach
</tbody>
<tfoot style="background-color: #cdd4da; font-weight: bold;">
<tr>
<td colspan="4" class="text-right">Total</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td class="text-right">{{ number_format($tot_grand, 2) }}</td>
<td class="text-right">{{ number_format($tot_cash, 2) }}</td>
<td class="text-right">{{ number_format($tot_card1, 2) }}</td>
<td class="text-right">{{ number_format($tot_card2, 2) }}</td>
<td class="text-right">{{ number_format($tot_card3, 2) }}</td>
<td class="text-right">{{ number_format($tot_online, 2) }}</td>
<td class="text-right">{{ number_format($tot_link, 2) }}</td>
<td class="text-right">{{ number_format($tot_due, 2) }}</td>
</tr>
</tfoot>
</table>