29 lines
1.9 KiB
PHP
29 lines
1.9 KiB
PHP
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
body{font-family:DejaVu Sans,sans-serif;font-size:9px;color:#202635}
|
|
h2{margin:0 0 4px}.meta{color:#667085;margin-bottom:14px}
|
|
.summary{width:100%;border-collapse:collapse}.summary th,.summary td{border:1px solid #d7dce5;padding:5px}
|
|
.summary th{background:#f1f4f8;text-align:left}.num{text-align:right}.footer{margin-top:20px;color:#667085}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h2><?=html_escape($company->name??'Perusahaan')?> — Dokumen Budget</h2>
|
|
<div class="meta"><?=html_escape($budget->budget_no)?> · <?=html_escape($budget->name)?> · Tahun Fiskal <?=$budget->fiscal_year?> · Versi <?=$budget->version_no?> · Status <?=strtoupper(html_escape($budget->status))?></div>
|
|
<?php
|
|
$months=array('Jan','Feb','Mar','Apr','Mei','Jun','Jul','Agu','Sep','Okt','Nov','Des');
|
|
$rows=array();
|
|
foreach($lines as$l){
|
|
$key=(int)$l->account_id;
|
|
if(!isset($rows[$key]))$rows[$key]=array('name'=>$l->kode_akun.' - '.$l->nama_akun,'amounts'=>array_fill(1,12,0));
|
|
$rows[$key]['amounts'][(int)substr($l->period,5,2)]+=(float)$l->amount;
|
|
}
|
|
?>
|
|
<table class="summary"><thead><tr><th>Akun</th><?php foreach($months as$m):?><th class="num"><?=$m?></th><?php endforeach?><th class="num">Total</th></tr></thead><tbody>
|
|
<?php $grand=0;foreach($rows as$r):$total=array_sum($r['amounts']);$grand+=$total;?><tr><td><?=html_escape($r['name'])?></td><?php foreach($r['amounts']as$a):?><td class="num"><?=number_format($a,2,',','.')?></td><?php endforeach?><td class="num"><strong><?=number_format($total,2,',','.')?></strong></td></tr><?php endforeach?>
|
|
<tr><th colspan="13">TOTAL BUDGET TAHUNAN</th><th class="num"><?=number_format($grand,2,',','.')?></th></tr></tbody></table>
|
|
<div class="footer">Dicetak <?=date('d-m-Y H:i')?>. Budget aktif tidak dapat diubah langsung; perubahan wajib melalui dokumen revisi.</div>
|
|
</body></html>
|