create print opname and mutations
This commit is contained in:
@@ -527,4 +527,25 @@ class MutationsController extends Controller
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function print($id)
|
||||
{
|
||||
try {
|
||||
$mutation = Mutation::with([
|
||||
'fromDealer',
|
||||
'toDealer',
|
||||
'requestedBy.role',
|
||||
'approvedBy.role',
|
||||
'receivedBy.role',
|
||||
'rejectedBy.role',
|
||||
'cancelledBy.role',
|
||||
'mutationDetails.product.category'
|
||||
])->findOrFail($id);
|
||||
|
||||
return view('warehouse_management.mutations.print', compact('mutation'));
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error printing mutation: ' . $e->getMessage());
|
||||
return back()->with('error', 'Gagal membuka halaman print mutasi.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,8 @@ class OpnamesController extends Controller
|
||||
->addColumn('action', function ($row) use ($menu) {
|
||||
$btn = '<div class="d-flex">';
|
||||
|
||||
$btn .= '<a href="'.route('opnames.show', $row->id).'" class="btn btn-primary btn-sm">Detail</a>';
|
||||
$btn .= '<a href="'.route('opnames.show', $row->id).'" class="btn btn-primary btn-sm" style="margin-right: 8px;">Detail</a>';
|
||||
$btn .= '<a href="'.route('opnames.print', $row->id).'" class="btn btn-success btn-sm" target="_blank">Print</a>';
|
||||
|
||||
$btn .= '</div>';
|
||||
|
||||
@@ -477,5 +478,18 @@ class OpnamesController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function print($id)
|
||||
{
|
||||
try {
|
||||
$opname = Opname::with(['details.product.category', 'user', 'dealer'])
|
||||
->findOrFail($id);
|
||||
|
||||
return view('warehouse_management.opnames.print', compact('opname'));
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error printing opname: ' . $e->getMessage());
|
||||
return back()->with('error', 'Gagal membuka halaman print opname.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
Detail
|
||||
</a>
|
||||
|
||||
<!-- Print Button -->
|
||||
<a href="{{ route('mutations.print', $row->id) }}"
|
||||
class="btn btn-sm btn-success mr-2"
|
||||
target="_blank">
|
||||
Print
|
||||
</a>
|
||||
|
||||
@if($row->status->value === 'sent')
|
||||
<!-- Receive Button (untuk dealer tujuan) -->
|
||||
@if(auth()->user()->dealer_id == $row->to_dealer_id)
|
||||
|
||||
546
resources/views/warehouse_management/mutations/print.blade.php
Normal file
546
resources/views/warehouse_management/mutations/print.blade.php
Normal file
@@ -0,0 +1,546 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Print Mutasi - {{ $mutation->mutation_number }}</title>
|
||||
<style>
|
||||
@media print {
|
||||
@page {
|
||||
margin: 0.5in;
|
||||
size: A4;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-print-color-adjust: exact;
|
||||
color-adjust: exact;
|
||||
}
|
||||
|
||||
.no-print {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
color: #333;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* Header Section */
|
||||
.header {
|
||||
border-bottom: 3px solid #2c5282;
|
||||
padding-bottom: 20px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.company-info {
|
||||
text-align: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.company-name {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.company-tagline {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.document-title {
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
/* Info Section */
|
||||
.info-section {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.info-box {
|
||||
flex: 1;
|
||||
min-width: 250px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.info-box:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.info-title {
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px dotted #e2e8f0;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-weight: 600;
|
||||
color: #4a5568;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #2d3748;
|
||||
width: 55%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Status Badge */
|
||||
.status-badge {
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.status-sent {
|
||||
background-color: #bee3f8;
|
||||
color: #2c5282;
|
||||
}
|
||||
|
||||
.status-received {
|
||||
background-color: #fef5e7;
|
||||
color: #744210;
|
||||
}
|
||||
|
||||
.status-approved {
|
||||
background-color: #c6f6d5;
|
||||
color: #22543d;
|
||||
}
|
||||
|
||||
.status-rejected {
|
||||
background-color: #fed7d7;
|
||||
color: #742a2a;
|
||||
}
|
||||
|
||||
.status-cancelled {
|
||||
background-color: #e2e8f0;
|
||||
color: #4a5568;
|
||||
}
|
||||
|
||||
/* Table Styles */
|
||||
.table-container {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.table-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 15px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #e2e8f0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.data-table th {
|
||||
background-color: #2c5282;
|
||||
color: white;
|
||||
padding: 12px 8px;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.data-table td {
|
||||
padding: 10px 8px;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.data-table tbody tr:nth-child(even) {
|
||||
background-color: #f7fafc;
|
||||
}
|
||||
|
||||
/* Numeric columns */
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Quantity highlighting */
|
||||
.quantity-full {
|
||||
color: #22543d;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.quantity-partial {
|
||||
color: #744210;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.quantity-none {
|
||||
color: #742a2a;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Summary Section */
|
||||
.summary-section {
|
||||
background-color: #f7fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.summary-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.summary-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
background: white;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.stat-number {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
text-transform: uppercase;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
/* Notes Section */
|
||||
.notes-section {
|
||||
background-color: #f7fafc;
|
||||
border-left: 4px solid #2c5282;
|
||||
padding: 15px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.notes-title {
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.notes-content {
|
||||
color: #4a5568;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.footer {
|
||||
margin-top: 50px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.print-info {
|
||||
text-align: center;
|
||||
color: #666;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* Print button */
|
||||
.print-button {
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
background-color: #2c5282;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.print-button:hover {
|
||||
background-color: #2a4365;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<button class="print-button no-print" onclick="window.print()">Print</button>
|
||||
|
||||
<div class="container">
|
||||
<!-- Header -->
|
||||
<div class="header">
|
||||
<div class="company-info">
|
||||
<div class="company-name">PT. CINTA KASIH BERSAMA</div>
|
||||
<div class="company-tagline">Warehouse Management System</div>
|
||||
</div>
|
||||
<div class="document-title">Dokumen Mutasi Stock</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Section -->
|
||||
<div class="info-section">
|
||||
<div class="info-box">
|
||||
<div class="info-title">Informasi Mutasi</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">No. Mutasi:</span>
|
||||
<span class="info-value">{{ $mutation->mutation_number }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Tanggal Dibuat:</span>
|
||||
<span class="info-value">{{ \Carbon\Carbon::parse($mutation->created_at)->format('d F Y H:i') }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Status:</span>
|
||||
<span class="info-value">
|
||||
@php
|
||||
$status = $mutation->status instanceof \App\Enums\MutationStatus ? $mutation->status : \App\Enums\MutationStatus::from($mutation->status);
|
||||
@endphp
|
||||
<span class="status-badge status-{{ strtolower($status->name) }}">{{ $status->label() }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Dibuat oleh:</span>
|
||||
<span class="info-value">{{ $mutation->requestedBy->name ?? '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<div class="info-title">Informasi Dealer</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Dari Dealer:</span>
|
||||
<span class="info-value">{{ $mutation->fromDealer->name ?? '-' }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Ke Dealer:</span>
|
||||
<span class="info-value">{{ $mutation->toDealer->name ?? '-' }}</span>
|
||||
</div>
|
||||
@if($mutation->receivedBy)
|
||||
<div class="info-item">
|
||||
<span class="info-label">Diterima oleh:</span>
|
||||
<span class="info-value">{{ $mutation->receivedBy->name ?? '-' }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@if($mutation->received_at)
|
||||
<div class="info-item">
|
||||
<span class="info-label">Tanggal Terima:</span>
|
||||
<span class="info-value">{{ \Carbon\Carbon::parse($mutation->received_at)->format('d F Y H:i') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($mutation->shipping_notes)
|
||||
<div class="notes-section">
|
||||
<div class="notes-title">Catatan Pengiriman</div>
|
||||
<div class="notes-content">{{ $mutation->shipping_notes }}</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($mutation->reception_notes)
|
||||
<div class="notes-section">
|
||||
<div class="notes-title">Catatan Penerimaan</div>
|
||||
<div class="notes-content">{{ $mutation->reception_notes }}</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($mutation->approval_notes)
|
||||
<div class="notes-section">
|
||||
<div class="notes-title">Catatan Persetujuan</div>
|
||||
<div class="notes-content">{{ $mutation->approval_notes }}</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($mutation->rejection_reason)
|
||||
<div class="notes-section" style="border-left-color: #742a2a; background-color: #fed7d7;">
|
||||
<div class="notes-title" style="color: #742a2a;">Alasan Penolakan</div>
|
||||
<div class="notes-content" style="color: #742a2a;">{{ $mutation->rejection_reason }}</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Table Section -->
|
||||
<div class="table-container">
|
||||
<div class="table-title">Detail Produk Mutasi</div>
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 5%;">No.</th>
|
||||
<th style="width: 15%;">Kode Produk</th>
|
||||
<th style="width: 35%;">Nama Produk</th>
|
||||
<th style="width: 15%;">Kategori</th>
|
||||
<th style="width: 10%;" class="text-center">Qty Diminta</th>
|
||||
@if($mutation->status->value !== 'sent')
|
||||
<th style="width: 10%;" class="text-center">Qty Diterima</th>
|
||||
<th style="width: 10%;">Catatan</th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$totalRequested = 0;
|
||||
$totalApproved = 0;
|
||||
$fullItems = 0;
|
||||
$partialItems = 0;
|
||||
$rejectedItems = 0;
|
||||
@endphp
|
||||
|
||||
@foreach($mutation->mutationDetails as $index => $detail)
|
||||
@php
|
||||
$totalRequested += $detail->quantity_requested;
|
||||
$totalApproved += $detail->quantity_approved ?? 0;
|
||||
|
||||
if ($detail->quantity_approved) {
|
||||
if ($detail->quantity_approved == $detail->quantity_requested) {
|
||||
$fullItems++;
|
||||
} elseif ($detail->quantity_approved > 0) {
|
||||
$partialItems++;
|
||||
} else {
|
||||
$rejectedItems++;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td class="text-center">{{ $index + 1 }}</td>
|
||||
<td>{{ $detail->product->code ?? '-' }}</td>
|
||||
<td>{{ $detail->product->name ?? '-' }}</td>
|
||||
<td>{{ $detail->product->category->name ?? '-' }}</td>
|
||||
<td class="text-center">{{ number_format($detail->quantity_requested, 2) }}</td>
|
||||
@if($mutation->status->value !== 'sent')
|
||||
<td class="text-center
|
||||
@if($detail->quantity_approved == $detail->quantity_requested) quantity-full
|
||||
@elseif($detail->quantity_approved > 0) quantity-partial
|
||||
@else quantity-none
|
||||
@endif">
|
||||
{{ $detail->quantity_approved ? number_format($detail->quantity_approved, 2) : '0.00' }}
|
||||
@if($detail->quantity_approved && $detail->quantity_approved < $detail->quantity_requested)
|
||||
<br><small class="text-muted">(Kurang {{ number_format($detail->quantity_requested - $detail->quantity_approved, 2) }})</small>
|
||||
@endif
|
||||
</td>
|
||||
<td style="font-size: 10px;">{{ $detail->notes ?: '-' }}</td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr style="background-color: #2c5282; color: white; font-weight: bold;">
|
||||
<td colspan="4" class="text-center">TOTAL</td>
|
||||
<td class="text-center">{{ number_format($totalRequested, 2) }}</td>
|
||||
@if($mutation->status->value !== 'sent')
|
||||
<td class="text-center">{{ number_format($totalApproved, 2) }}</td>
|
||||
<td>-</td>
|
||||
@endif
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Summary Section -->
|
||||
<div class="summary-section">
|
||||
<div class="summary-title">Ringkasan Mutasi</div>
|
||||
<div class="summary-stats">
|
||||
<div class="stat-item">
|
||||
<div class="stat-number">{{ count($mutation->mutationDetails) }}</div>
|
||||
<div class="stat-label">Total Item</div>
|
||||
</div>
|
||||
@if($mutation->status->value !== 'sent')
|
||||
<div class="stat-item">
|
||||
<div class="stat-number" style="color: #22543d;">{{ $fullItems }}</div>
|
||||
<div class="stat-label">Lengkap</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-number" style="color: #744210;">{{ $partialItems }}</div>
|
||||
<div class="stat-label">Sebagian</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-number" style="color: #742a2a;">{{ $rejectedItems }}</div>
|
||||
<div class="stat-label">Ditolak</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="stat-item">
|
||||
<div class="stat-number">{{ number_format($totalRequested, 2) }}</div>
|
||||
<div class="stat-label">Total Diminta</div>
|
||||
</div>
|
||||
@if($mutation->status->value !== 'sent')
|
||||
<div class="stat-item">
|
||||
<div class="stat-number">{{ number_format($totalApproved, 2) }}</div>
|
||||
<div class="stat-label">Total Diterima</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<div class="print-info">
|
||||
Dicetak pada: {{ now()->format('d F Y H:i:s') }} |
|
||||
Sistem Manajemen Gudang PT. Cinta Kasih Bersama
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Print on Ctrl+P
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.ctrlKey && e.key === 'p') {
|
||||
e.preventDefault();
|
||||
window.print();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
438
resources/views/warehouse_management/opnames/print.blade.php
Normal file
438
resources/views/warehouse_management/opnames/print.blade.php
Normal file
@@ -0,0 +1,438 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Print Opname - {{ $opname->id }}</title>
|
||||
<style>
|
||||
@media print {
|
||||
@page {
|
||||
margin: 0.5in;
|
||||
size: A4;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-print-color-adjust: exact;
|
||||
color-adjust: exact;
|
||||
}
|
||||
|
||||
.no-print {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
color: #333;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* Header Section */
|
||||
.header {
|
||||
border-bottom: 3px solid #2c5282;
|
||||
padding-bottom: 20px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.company-info {
|
||||
text-align: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.company-name {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.company-tagline {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.document-title {
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
/* Info Section */
|
||||
.info-section {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.info-box {
|
||||
flex: 1;
|
||||
min-width: 250px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.info-box:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.info-title {
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px dotted #e2e8f0;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-weight: 600;
|
||||
color: #4a5568;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #2d3748;
|
||||
width: 55%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Status Badge */
|
||||
.status-badge {
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.status-approved {
|
||||
background-color: #c6f6d5;
|
||||
color: #22543d;
|
||||
}
|
||||
|
||||
/* Table Styles */
|
||||
.table-container {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.table-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 15px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #e2e8f0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.data-table th {
|
||||
background-color: #2c5282;
|
||||
color: white;
|
||||
padding: 12px 8px;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.data-table td {
|
||||
padding: 10px 8px;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.data-table tbody tr:nth-child(even) {
|
||||
background-color: #f7fafc;
|
||||
}
|
||||
|
||||
/* Numeric columns */
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Difference highlighting */
|
||||
.difference-positive {
|
||||
color: #22543d;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.difference-negative {
|
||||
color: #742a2a;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.difference-zero {
|
||||
color: #4a5568;
|
||||
}
|
||||
|
||||
/* Summary Section */
|
||||
.summary-section {
|
||||
background-color: #f7fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.summary-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.summary-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
background: white;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.stat-number {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #2c5282;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
text-transform: uppercase;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.footer {
|
||||
margin-top: 50px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.print-info {
|
||||
text-align: center;
|
||||
color: #666;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* Print button */
|
||||
.print-button {
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
background-color: #2c5282;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.print-button:hover {
|
||||
background-color: #2a4365;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<button class="print-button no-print" onclick="window.print()">Print</button>
|
||||
|
||||
<div class="container">
|
||||
<!-- Header -->
|
||||
<div class="header">
|
||||
<div class="company-info">
|
||||
<div class="company-name">PT. CINTA KASIH BERSAMA</div>
|
||||
<div class="company-tagline">Warehouse Management System</div>
|
||||
</div>
|
||||
<div class="document-title">Laporan Stock Opname</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Section -->
|
||||
<div class="info-section">
|
||||
<div class="info-box">
|
||||
<div class="info-title">Informasi Opname</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Tanggal Opname:</span>
|
||||
<span class="info-value">{{ \Carbon\Carbon::parse($opname->opname_date)->format('d F Y') }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Status:</span>
|
||||
<span class="info-value">
|
||||
@php
|
||||
$status = $opname->status instanceof \App\Enums\OpnameStatus ? $opname->status : \App\Enums\OpnameStatus::from($opname->status);
|
||||
@endphp
|
||||
<span class="status-badge status-approved">{{ $status->label() }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Dibuat:</span>
|
||||
<span class="info-value">{{ \Carbon\Carbon::parse($opname->created_at)->format('d F Y H:i') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<div class="info-title">Informasi Dealer & User</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Dealer:</span>
|
||||
<span class="info-value">{{ $opname->dealer->name ?? '-' }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">User:</span>
|
||||
<span class="info-value">{{ $opname->user->name ?? '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table Section -->
|
||||
<div class="table-container">
|
||||
<div class="table-title">Detail Stock Opname</div>
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 5%;">No.</th>
|
||||
<th style="width: 15%;">Kode Produk</th>
|
||||
<th style="width: 35%;">Nama Produk</th>
|
||||
<th style="width: 15%;">Kategori</th>
|
||||
<th style="width: 10%;" class="text-center">Stok Sistem</th>
|
||||
<th style="width: 10%;" class="text-center">Stok Fisik</th>
|
||||
<th style="width: 10%;" class="text-center">Selisih</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$totalSystemStock = 0;
|
||||
$totalPhysicalStock = 0;
|
||||
$totalDifference = 0;
|
||||
$positiveCount = 0;
|
||||
$negativeCount = 0;
|
||||
$zeroCount = 0;
|
||||
@endphp
|
||||
|
||||
@foreach($opname->details as $index => $detail)
|
||||
@php
|
||||
$difference = $detail->difference;
|
||||
$totalSystemStock += $detail->system_stock;
|
||||
$totalPhysicalStock += $detail->physical_stock;
|
||||
$totalDifference += $difference;
|
||||
|
||||
if ($difference > 0) $positiveCount++;
|
||||
elseif ($difference < 0) $negativeCount++;
|
||||
else $zeroCount++;
|
||||
@endphp
|
||||
<tr>
|
||||
<td class="text-center">{{ $index + 1 }}</td>
|
||||
<td>{{ $detail->product->code ?? '-' }}</td>
|
||||
<td>{{ $detail->product->name ?? '-' }}</td>
|
||||
<td>{{ $detail->product->category->name ?? '-' }}</td>
|
||||
<td class="text-center">{{ number_format($detail->system_stock, 2) }}</td>
|
||||
<td class="text-center">{{ number_format($detail->physical_stock, 2) }}</td>
|
||||
<td class="text-center
|
||||
@if($difference > 0) difference-positive
|
||||
@elseif($difference < 0) difference-negative
|
||||
@else difference-zero
|
||||
@endif">
|
||||
{{ $difference > 0 ? '+' : '' }}{{ number_format($difference, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr style="background-color: #2c5282; color: white; font-weight: bold;">
|
||||
<td colspan="4" class="text-center">TOTAL</td>
|
||||
<td class="text-center">{{ number_format($totalSystemStock, 2) }}</td>
|
||||
<td class="text-center">{{ number_format($totalPhysicalStock, 2) }}</td>
|
||||
<td class="text-center">{{ $totalDifference > 0 ? '+' : '' }}{{ number_format($totalDifference, 2) }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Summary Section -->
|
||||
<div class="summary-section">
|
||||
<div class="summary-title">Ringkasan Stock Opname</div>
|
||||
<div class="summary-stats">
|
||||
<div class="stat-item">
|
||||
<div class="stat-number">{{ count($opname->details) }}</div>
|
||||
<div class="stat-label">Total Produk</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-number" style="color: #22543d;">{{ $positiveCount }}</div>
|
||||
<div class="stat-label">Surplus</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-number" style="color: #742a2a;">{{ $negativeCount }}</div>
|
||||
<div class="stat-label">Minus</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-number" style="color: #4a5568;">{{ $zeroCount }}</div>
|
||||
<div class="stat-label">Sesuai</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<div class="print-info">
|
||||
Dicetak pada: {{ now()->format('d F Y H:i:s') }} |
|
||||
Sistem Manajemen Gudang PT. Cinta Kasih Bersama
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Print on Ctrl+P
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.ctrlKey && e.key === 'p') {
|
||||
e.preventDefault();
|
||||
window.print();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -240,6 +240,7 @@ Route::group(['middleware' => 'auth'], function() {
|
||||
Route::get('create','create')->name('opnames.create');
|
||||
Route::post('/','store')->name('opnames.store');
|
||||
Route::get('{opnames}','show')->name('opnames.show');
|
||||
Route::get('{opnames}/print','print')->name('opnames.print');
|
||||
Route::post('get-stock-data', 'getStockData')->name('opnames.get-stock-data');
|
||||
});
|
||||
|
||||
@@ -253,6 +254,7 @@ Route::group(['middleware' => 'auth'], function() {
|
||||
Route::get('{mutation}', 'show')->name('show');
|
||||
Route::get('{mutation}/edit', 'edit')->name('edit');
|
||||
Route::get('{mutation}/details', 'getDetails')->name('details');
|
||||
Route::get('{mutation}/print', 'print')->name('print');
|
||||
Route::post('{mutation}/receive', 'receive')->name('receive');
|
||||
Route::post('{mutation}/approve', 'approve')->name('approve');
|
||||
Route::post('{mutation}/reject', 'reject')->name('reject');
|
||||
|
||||
Reference in New Issue
Block a user