Update besar apk finance
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
$company=$pdf_company;$groups=array();
|
||||
foreach($lines as$l){
|
||||
$detail=trim((string)($l->keterangan?:$l->specification));
|
||||
$key=$l->service_date.'|'.$l->items_id.'|'.$l->harga.'|'.$l->tax_rate.'|'.$detail;
|
||||
$label=trim(($l->item_code?$l->item_code.' - ':'').$l->nama_item);
|
||||
if(!isset($groups[$key]))$groups[$key]=array('date'=>$l->service_date,'item'=>$label,'detail'=>$detail,'qty'=>0,'unit'=>$l->unit,'price'=>$l->harga,'discount'=>0,'tax'=>0,'total'=>0);
|
||||
$groups[$key]['qty']+=(float)$l->qty;$groups[$key]['discount']+=(float)$l->discount_amount;$groups[$key]['tax']+=(float)$l->tax_amount;$groups[$key]['total']+=(float)$l->subtotal;
|
||||
}
|
||||
function ipMoney($v){return number_format((float)$v,2,',','.');}
|
||||
function ipQty($v){return floor($v)==$v?number_format($v,0,',','.'):number_format($v,4,',','.');}
|
||||
?>
|
||||
<!doctype html><html><head><meta charset="utf-8"><style>
|
||||
@page{margin:28px 34px}body{font-family:DejaVu Sans,sans-serif;font-size:10px;color:#20242c}h1{font-size:20px;margin:0}.muted{color:#667085}.head{width:100%;margin-bottom:18px}.head td{vertical-align:top}.right{text-align:right}table.grid{width:100%;border-collapse:collapse}table.grid th{background:#eef2f6;text-align:left;font-size:8px;letter-spacing:.04em}table.grid th,table.grid td{border:1px solid #d8dee8;padding:7px}.num{text-align:right}.summary{margin:14px 0 0 auto;width:44%}.summary td{padding:4px}.page{page-break-before:always}.sign{margin-top:40px;width:100%;text-align:center}.sign td{width:33%;height:80px;vertical-align:top}.repeat{display:table-header-group}
|
||||
</style></head><body>
|
||||
<table class="head"><tr><td><h1><?=html_escape($company->name??'Perusahaan')?></h1><div class="muted"><?=html_escape($company->address??'')?></div></td><td class="right"><h1>INVOICE</h1><b><?=html_escape($invoice->no_invoice)?></b><br><?=html_escape($invoice->tanggal)?></td></tr></table>
|
||||
<table width="100%"><tr><td><b>Kepada</b><br><?=html_escape($invoice->customer_name)?><br><?=nl2br(html_escape($invoice->customer_address?:'-'))?></td><td class="right"><b>Periode</b><br><?=html_escape(($invoice->period_start?:$invoice->tanggal).' s.d. '.($invoice->period_end?:$invoice->tanggal))?><br><b>Jatuh tempo:</b> <?=html_escape($invoice->jatuh_tempo)?><br><b>Pengakuan:</b> <?=$invoice->recognition_policy==='accrual'?'Akrual':'Setelah pembayaran'?></td></tr></table><br>
|
||||
<table class="grid"><thead><tr><th>TANGGAL</th><th>BARANG / JASA & KETERANGAN</th><th>QTY</th><th class="num">HARGA</th><th class="num">DISKON</th><th class="num">PAJAK</th><th class="num">SUBTOTAL</th></tr></thead><tbody><?php foreach($groups as$g):?><tr><td><?=html_escape($g['date'])?></td><td><b><?=html_escape($g['item'])?></b><br><span class="muted"><?=html_escape($g['detail']?:'-')?></span></td><td><?=ipQty($g['qty']).' '.html_escape($g['unit'])?></td><td class="num"><?=ipMoney($g['price'])?></td><td class="num"><?=ipMoney($g['discount'])?></td><td class="num"><?=ipMoney($g['tax'])?></td><td class="num"><b><?=ipMoney($g['total'])?></b></td></tr><?php endforeach?></tbody></table>
|
||||
<table class="summary"><tr><td>Subtotal bersih</td><td class="num"><?=ipMoney($invoice->subtotal_before_tax)?></td></tr><tr><td>Diskon</td><td class="num"><?=ipMoney($invoice->discount_total)?></td></tr><tr><td>Pajak</td><td class="num"><?=ipMoney($invoice->tax_total)?></td></tr><tr><td><b>Total</b></td><td class="num"><b>Rp <?=ipMoney($invoice->total)?></b></td></tr><tr><td>Sudah dibayar</td><td class="num"><?=ipMoney($invoice->total_bayar)?></td></tr><tr><td><b>Sisa piutang</b></td><td class="num"><b><?=ipMoney($invoice->sisa_piutang)?></b></td></tr></table>
|
||||
<p><b>Surat Jalan:</b> <?=html_escape(implode(', ',array_map(function($d){return$d->delivery_no;},$deliveries))?:'-')?><br><b>Catatan:</b> <?=html_escape($invoice->keterangan?:'-')?></p>
|
||||
<table class="sign"><tr><td>Dibuat oleh<br><br><br><b><?=html_escape($invoice->creator_name?:'-')?></b></td><td>Disetujui<br><br><br><b><?=html_escape($invoice->approver_name?:'-')?></b></td><td>Diterima Customer</td></tr></table>
|
||||
<div class="page"><h2>Lampiran Detail Barcode / Serial Number</h2><p class="muted">Lampiran invoice <?=html_escape($invoice->no_invoice)?> · <?=count($barcodes)?> baris barcode</p><table class="grid"><thead class="repeat"><tr><th>TANGGAL</th><th>SURAT JALAN</th><th>BARANG</th><th>BARCODE / SERIAL</th><th>QTY</th><th>GUDANG</th><th>STATUS</th></tr></thead><tbody><?php foreach($barcodes as$b):?><tr><td><?=html_escape($b->service_date)?></td><td><?=html_escape($b->delivery_no?:'-')?></td><td><?=html_escape(trim(($b->item_code?$b->item_code.' - ':'').$b->nama_barang))?></td><td><b><?=html_escape($b->barcode)?></b><br><?=html_escape($b->serial_number?:'-')?></td><td><?=ipQty($b->qty)?></td><td><?=html_escape($b->warehouse_name?:'-')?></td><td><?=in_array($invoice->workflow_status,array('posted','approved'),true)?'Terkirim':'Dialokasikan'?></td></tr><?php endforeach?><?php if(!$barcodes):?><tr><td colspan="7" style="text-align:center">Invoice ini tidak berisi barang gudang sehingga tidak memiliki detail barcode atau Surat Jalan.</td></tr><?php endif?></tbody></table></div>
|
||||
</body></html>
|
||||
Reference in New Issue
Block a user