akuntansi-sia/resources/views/reports/sale_pdf.blade.php

63 lines
1.9 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<title>Laporan Penjualan</title>
<style>
body { font-family: sans-serif; font-size: 12px; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; }
.header { text-align: center; margin-bottom: 20px; }
.footer { position: fixed; bottom: 0; width: 100%; text-align: right; font-size: 10px; }
</style>
</head>
<body>
<div class="header">
<h2>Laporan Penjualan</h2>
<p>Warkop Cak Imin - Akuntansi SIA</p>
<p>Tanggal Cetak: {{ date('d/m/Y H:i') }}</p>
</div>
@foreach($branches as $branch)
@php
$branchSales = $sales->where('branch', $branch->name);
@endphp
@if($branchSales->count() > 0)
<h3>Cabang: {{ $branch->name }}</h3>
<table>
<thead>
<tr>
<th>No</th>
<th>Tanggal</th>
<th>Produk</th>
<th>Jumlah</th>
<th>Total Harga</th>
</tr>
</thead>
<tbody>
@foreach($branchSales as $index => $sale)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ \Carbon\Carbon::parse($sale->date)->format('d/m/Y') }}</td>
<td>{{ $sale->item }}</td>
<td>{{ $sale->quantity }}</td>
<td>Rp {{ number_format($sale->total_price, 0, ',', '.') }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th colspan="4" style="text-align: right;">Total</th>
<th>Rp {{ number_format($branchSales->sum('total_price'), 0, ',', '.') }}</th>
</tr>
</tfoot>
</table>
@endif
@endforeach
<div class="footer">
Halaman 1
</div>
</body>
</html>