Files
dailySalePaymentReport/Resources/views/export.blade.php

153 lines
6.1 KiB
PHP

<table>
<thead>
<tr>
<th colspan="7" style="font-size: 16px; font-weight: bold;">Daily Sale Payment Report - {{ $report_date }}</th>
</tr>
<tr>
<th colspan="7" style="font-size: 14px; font-weight: bold;">Sales Table (Daily Sale)</th>
</tr>
<tr>
<th style="font-weight: bold; background-color: #cccccc;">Date</th>
<th style="font-weight: bold; background-color: #cccccc;">Reference Number</th>
<th style="font-weight: bold; background-color: #cccccc;">Cashier</th>
<th style="font-weight: bold; background-color: #cccccc;">Customer</th>
<th style="font-weight: bold; background-color: #cccccc;">Grand Total</th>
@foreach($paymentOptions as $option)
<th style="font-weight: bold; background-color: #cccccc;">{{ $option->name }}</th>
@endforeach
<th style="font-weight: bold; background-color: #cccccc;">Due Amount</th>
</tr>
</thead>
<tbody>
@php
$tot_grand = 0;
$tot_due = 0;
$option_totals = [];
foreach ($paymentOptions as $opt) {
$option_totals[$opt->id] = 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>{{ number_format($sale->grand_total, 2) }}</td>
@foreach($paymentOptions as $option)
<td>{{ number_format($sale->methods[$option->id] ?? 0, 2) }}</td>
@endforeach
<td>{{ number_format($sale->due_amount, 2) }}</td>
</tr>
@php
$tot_grand += $sale->grand_total;
$tot_due += $sale->due_amount;
foreach ($paymentOptions as $opt) {
$option_totals[$opt->id] += ($sale->methods[$opt->id] ?? 0);
}
@endphp
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="4" style="font-weight: bold; text-align: right;">Total</td>
<td style="font-weight: bold;">{{ number_format($tot_grand, 2) }}</td>
@foreach($paymentOptions as $option)
<td style="font-weight: bold;">{{ number_format($option_totals[$option->id], 2) }}</td>
@endforeach
<td style="font-weight: bold;">{{ number_format($tot_due, 2) }}</td>
</tr>
</tfoot>
</table>
<table>
<tr><td></td></tr>
</table>
<table>
<thead>
<tr>
<th colspan="5" style="font-size: 14px; font-weight: bold;">Credit Sale Collections</th>
</tr>
<tr>
<th style="font-weight: bold; background-color: #cccccc;">Original Bill Date</th>
<th style="font-weight: bold; background-color: #cccccc;">Reference Number</th>
<th style="font-weight: bold; background-color: #cccccc;">Cashier</th>
<th style="font-weight: bold; background-color: #cccccc;">Customer</th>
<th style="font-weight: bold; background-color: #cccccc;">Grand Total</th>
@foreach ($paymentOptions as $option)
<th style="font-weight: bold; background-color: #cccccc;">{{ $option->name }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach ($creditCollections as $row)
<tr>
<td>{{ \Carbon\Carbon::parse($row['date'])->format('Y-m-d') }}</td>
<td>{{ $row['reference'] }}</td>
<td>{{ $row['cashier'] }}</td>
<td>{{ $row['customer'] }}</td>
<td>{{ number_format($row['grand_total'], 2) }}</td>
@foreach ($paymentOptions as $option)
<td>{{ number_format($row['methods'][$option->id] ?? 0, 2) }}</td>
@endforeach
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="4" style="font-weight: bold; text-align: right;">Total</td>
<td style="font-weight: bold;">{{ number_format($creditTotals['grand_total'], 2) }}</td>
@foreach ($paymentOptions as $option)
<td style="font-weight: bold;">{{ number_format($creditTotals['methods'][$option->id] ?? 0, 2) }}</td>
@endforeach
</tr>
</tfoot>
</table>
<table>
<tr><td></td></tr>
</table>
<table>
<thead>
<tr>
<th colspan="4" style="font-size: 14px; font-weight: bold;">Payment Method Summary</th>
</tr>
<tr>
<th style="font-weight: bold; background-color: #cccccc;">Payment Option</th>
<th style="font-weight: bold; background-color: #cccccc;">Sale Amount</th>
<th style="font-weight: bold; background-color: #cccccc;">Received Amount</th>
<th style="font-weight: bold; background-color: #cccccc;">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>{{ number_format($summary['sale_amount'], 2) }}</td>
<td>{{ number_format($summary['received_amount'], 2) }}</td>
<td>{{ 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>
<tr>
<td style="font-weight: bold; text-align: right;">Grand Total</td>
<td style="font-weight: bold;">{{ number_format($grand_sale, 2) }}</td>
<td style="font-weight: bold;">{{ number_format($grand_received, 2) }}</td>
<td style="font-weight: bold;">{{ number_format($grand_total, 2) }}</td>
</tr>
</tfoot>
</table>