Kasir/resources/views/exports/ringkasan_pdf.blade.php
2025-09-10 13:32:58 +07:00

200 lines
6.1 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{ $title ?? 'Laporan Ringkasan' }}</title>
<style>
body {
font-family: sans-serif;
font-size: 10px;
margin: 0;
padding: 10px;
}
.header {
text-align: center;
margin-bottom: 20px;
border-bottom: 2px solid #333;
padding-bottom: 10px;
}
.header h2 {
margin: 0 0 10px 0;
font-size: 16px;
color: #333;
}
.filter-info {
background-color: #f8f9fa;
padding: 10px;
border-radius: 5px;
margin-bottom: 15px;
border-left: 4px solid #007bff;
}
.filter-info h3 {
margin: 0 0 8px 0;
font-size: 12px;
color: #333;
}
.filter-item {
margin: 3px 0;
font-size: 10px;
}
.filter-label {
font-weight: bold;
color: #666;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 15px;
font-size: 9px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f8f9fa;
font-weight: bold;
color: #333;
}
.text-right { text-align: right; }
.text-center { text-align: center; }
.total-row td {
background-color: #e9ecef;
font-weight: bold;
color: #333;
}
.rekap-section {
background-color: #e9ecef;
padding: 10px;
margin-bottom: 15px;
border-radius: 5px;
}
.rekap-title {
font-weight: bold;
margin-bottom: 8px;
color: #333;
}
.rekap-item {
display: inline-block;
margin-right: 20px;
font-size: 10px;
}
.rekap-label {
font-weight: bold;
color: #666;
}
.no-data {
text-align: center;
font-style: italic;
color: #666;
}
.periode-section {
margin-bottom: 20px;
}
.periode-header {
background-color: #f8f9fa;
padding: 8px;
border-radius: 5px 5px 0 0;
border: 1px solid #ddd;
border-bottom: none;
font-weight: bold;
color: #333;
font-size: 11px;
}
.page-footer {
position: fixed;
bottom: 10px;
right: 10px;
font-size: 8px;
color: #666;
}
</style>
</head>
<body>
<div class="header">
<h2>{{ $title ?? 'Laporan Ringkasan ' . ucfirst($filter) }}</h2>
</div>
@if(isset($data_filter))
<div class="filter-info">
<h3>Informasi Filter</h3>
<div class="filter-item">
<span class="filter-label">Periode:</span> {{ ucfirst($filter) }}
</div>
@if($data_filter['tanggal_mulai'] && $data_filter['tanggal_selesai'])
<div class="filter-item">
<span class="filter-label">Rentang Tanggal:</span> {{ $data_filter['tanggal_mulai'] }} s/d {{ $data_filter['tanggal_selesai'] }}
</div>
@endif
@if($data_filter['sales_filter'])
<div class="filter-item">
<span class="filter-label">Sales:</span> {{ $data_filter['sales_filter'] }}
</div>
@endif
</div>
@endif
@if(isset($grand_total))
<div class="rekap-section">
<div class="rekap-title">Rekap {{ ucfirst($filter) }}</div>
<div class="rekap-item">
<span class="rekap-label">Total Item Terjual:</span> {{ $grand_total['total_item'] }}
</div>
<div class="rekap-item">
<span class="rekap-label">Total Berat:</span> {{ $grand_total['total_berat'] }}
</div>
<div class="rekap-item">
<span class="rekap-label">Total Pendapatan:</span> {{ $grand_total['total_pendapatan'] }}
</div>
</div>
@endif
@foreach($data as $item)
<div class="periode-section">
<div class="periode-header">
{{ $item['tanggal'] }}
</div>
<table style="margin-bottom: 0;">
<thead>
<tr>
<th style="width: 30%;">Nama Sales</th>
<th style="width: 20%;" class="text-center">Item Terjual</th>
<th style="width: 25%;" class="text-right">Berat Terjual</th>
<th style="width: 25%;" class="text-right">Pendapatan</th>
</tr>
</thead>
<tbody>
@if(count($item['sales']) > 0)
@foreach($item['sales'] as $sales)
<tr>
<td>{{ $sales['nama'] }}</td>
<td class="text-center">{{ $sales['item_terjual'] }}</td>
<td class="text-right">{{ $sales['berat_terjual'] }}</td>
<td class="text-right">{{ $sales['pendapatan'] }}</td>
</tr>
@endforeach
@else
<tr>
<td colspan="4" class="no-data">Tidak ada data transaksi</td>
</tr>
@endif
{{-- Baris Total --}}
<tr class="total-row">
<td class="text-right"><strong>Total Periode Ini</strong></td>
<td class="text-center"><strong>{{ $item['total_item_terjual'] }}</strong></td>
<td class="text-right"><strong>{{ $item['total_berat'] }}</strong></td>
<td class="text-right"><strong>{{ $item['total_pendapatan'] }}</strong></td>
</tr>
</tbody>
</table>
</div>
@endforeach
<div class="page-footer">
Dicetak pada: {{ \Carbon\Carbon::now()->isoFormat('dddd, D MMMM Y - HH:mm') }} WIB
</div>
</body>
</html>