Files
accounting_dev_v2/application/views/inventory_professional/document_pdf.php
T
2026-09-11 16:03:00 +07:00

86 lines
4.4 KiB
PHP

<?php
$formatQty = static function ($value) {
$number = (float) $value;
$decimals = abs($number - round($number)) < 0.0001 ? 0 : 4;
return number_format($number, $decimals, ',', '.');
};
$companyLabel = trim(($document->company_code ? $document->company_code.' - ' : '').($document->company_name ?: 'Perusahaan'));
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
body{font-family:DejaVu Sans,sans-serif;font-size:10px;color:#263044}
h1{font-size:18px;margin:2px 0 0}.company{font-size:11px;font-weight:700}.subtitle{color:#657086}
p{margin:3px 0}.head{border-bottom:2px solid #ee7800;padding-bottom:12px;margin-bottom:14px}
.meta{width:100%;margin-bottom:14px}.meta td{width:33%;vertical-align:top;padding:4px}
.label{font-size:8px;color:#6e7888;text-transform:uppercase}.value{font-weight:bold;margin-top:2px}
table.lines{width:100%;border-collapse:collapse}.lines th{background:#edf2f8;text-align:left;font-size:8px}
.lines th,.lines td{border:1px solid #dfe5ed;padding:6px;vertical-align:top}.right{text-align:right}
.attachments{margin-top:12px;padding:8px;border:1px solid #dfe5ed}.attachments ul{margin:5px 0 0;padding-left:18px}
.sign{margin-top:35px;width:100%;text-align:center}.sign td{width:25%;height:70px;vertical-align:top}
.foot{position:fixed;bottom:0;font-size:8px;color:#788292}
</style>
</head>
<body>
<div class="head">
<div class="company"><?=html_escape($companyLabel)?></div>
<h1>Dokumen Mutasi Persediaan</h1>
<p class="subtitle"><?=html_escape($document->document_no)?> &middot; <?=html_escape(strtoupper(str_replace('_', ' ', $document->document_type)))?></p>
</div>
<table class="meta">
<tr>
<td><div class="label">Tanggal</div><div class="value"><?=date('d/m/Y', strtotime($document->document_date))?></div></td>
<td><div class="label">Gudang Asal</div><div class="value"><?=html_escape($document->from_warehouse ?: '-')?></div></td>
<td><div class="label">Gudang Tujuan</div><div class="value"><?=html_escape($document->to_warehouse ?: '-')?></div></td>
</tr>
<tr>
<td><div class="label">Status</div><div class="value"><?=html_escape(strtoupper($document->status))?></div></td>
<td><div class="label">Dokumen Sumber</div><div class="value"><?=html_escape(($document->source_type ?: '-').' #'.($document->source_id ?: '-'))?></div></td>
<td><div class="label">Alasan</div><div class="value"><?=html_escape($document->reason ?: '-')?></div></td>
</tr>
</table>
<table class="lines">
<thead>
<tr><th>No</th><th>Barang</th><th>Barcode / Serial</th><th>Batch</th><th class="right">Qty</th><th class="right">Biaya Satuan</th><th>Catatan</th></tr>
</thead>
<tbody>
<?php foreach ($document->lines as $line): ?>
<tr>
<td><?=$line->line_no?></td>
<td><b><?=html_escape($line->kode_detail)?></b><br><?=html_escape($line->nama_barang)?></td>
<td><?=html_escape($line->barcode ?: '-')?><?php if ($line->serial_number): ?><br>SN <?=html_escape($line->serial_number)?><?php endif ?></td>
<td><?=html_escape($line->batch_no ?: '-')?></td>
<td class="right"><?=$formatQty($document->document_type === 'opname' ? $line->counted_qty : $line->qty)?> <?=html_escape($line->unit ?: '')?></td>
<td class="right">Rp <?=number_format((float) $line->unit_cost, 2, ',', '.')?></td>
<td><?=html_escape($line->reason ?: '-')?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<div class="attachments">
<div class="label">Lampiran Pendukung</div>
<?php if ($document->attachments): ?>
<ul><?php foreach ($document->attachments as $attachment): ?><li><?=html_escape($attachment->original_name)?></li><?php endforeach ?></ul>
<?php else: ?>
<p>Tidak ada lampiran.</p>
<?php endif ?>
</div>
<table class="sign">
<tr>
<td>Dibuat oleh<br><br><br><b><?=html_escape($document->creator_name ?: '-')?></b></td>
<td>Diajukan oleh<br><br><br><b><?=html_escape($document->submitter_name ?: '-')?></b></td>
<td>Disetujui oleh<br><br><br><b><?=html_escape($document->approver_name ?: '-')?></b></td>
<td>Diposting oleh<br><br><br><b><?=html_escape($document->poster_name ?: '-')?></b></td>
</tr>
</table>
<div class="foot">Dicetak <?=date('d/m/Y H:i')?> &middot; Dokumen elektronik dapat diverifikasi melalui riwayat status aplikasi.</div>
</body>
</html>