export pdf
This commit is contained in:
187
Resources/views/export/pdf.blade.php
Normal file
187
Resources/views/export/pdf.blade.php
Normal file
@@ -0,0 +1,187 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
h2,
|
||||
h4 {
|
||||
margin: 5px 0;
|
||||
color: #00489f;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
border: 1px solid #999;
|
||||
padding: 4px 6px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #078bce;
|
||||
color: white;
|
||||
}
|
||||
|
||||
tfoot td {
|
||||
background-color: #cdd4da;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Sunbeam Lanka Tailoring - Daily Sale Payment Report</h2>
|
||||
<p>Date: {{ $report_date }}</p>
|
||||
|
||||
<h4>Sales Table (Daily Sale)</h4>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Reference Number</th>
|
||||
<th>Cashier</th>
|
||||
<th>Customer</th>
|
||||
<th>Grand Total</th>
|
||||
@foreach($paymentOptions as $option)
|
||||
<th>{{ $option->name }}</th>
|
||||
@endforeach
|
||||
<th>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 class="text-right">{{ number_format($sale->grand_total, 2) }}</td>
|
||||
@foreach($paymentOptions as $option)
|
||||
<td class="text-right">{{ number_format($sale->methods[$option->id] ?? 0, 2) }}</td>
|
||||
@endforeach
|
||||
<td class="text-right">{{ 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" class="text-right">Total</td>
|
||||
<td class="text-right">{{ number_format($tot_grand, 2) }}</td>
|
||||
@foreach($paymentOptions as $option)
|
||||
<td class="text-right">{{ number_format($option_totals[$option->id], 2) }}</td>
|
||||
@endforeach
|
||||
<td class="text-right">{{ number_format($tot_due, 2) }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<div style="page-break-inside: avoid;">
|
||||
<h4>Credit Sale Collections</h4>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Original Bill Date</th>
|
||||
<th>Reference Number</th>
|
||||
<th>Cashier</th>
|
||||
<th>Customer</th>
|
||||
<th>Grand Total</th>
|
||||
@foreach ($paymentOptions as $option)
|
||||
<th>{{ $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 class="text-right">{{ number_format($row['grand_total'], 2) }}</td>
|
||||
@foreach ($paymentOptions as $option)
|
||||
<td class="text-right">{{ number_format($row['methods'][$option->id] ?? 0, 2) }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4" class="text-right">Total</td>
|
||||
<td class="text-right">{{ number_format($creditTotals['grand_total'], 2) }}</td>
|
||||
@foreach ($paymentOptions as $option)
|
||||
<td class="text-right">{{ number_format($creditTotals['methods'][$option->id] ?? 0, 2) }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="page-break-inside: avoid;">
|
||||
<h4>Payment Method Summary</h4>
|
||||
|
||||
<table style="width: 60%;">
|
||||
<thead>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user