@php function formatNumber($number) { // Check if the number has a decimal part if (floor($number) == $number) { // If it's a whole number, format without decimals return number_format($number, 0); } else { // If it has a decimal part, format with 2 decimal places return number_format($number, 2); } } @endphp
Yulia Mega Hasta                                                                           Faktur Penjualan
Tanggal : {{ \Carbon\Carbon::parse($salesInvoices->document_date)->format('d-m-Y') }} No. DO : {{ $doNumber }} Pelanggan : {{ $salesInvoices->customer->customer_name }}
Nomor Dokumen : {{ $salesInvoices->sales_invoice_number }} Tanggal DO : {{ \Carbon\Carbon::parse($doDate)->format('d-m-Y') }} Alamat : {{ $salesInvoices->customer->address }}
@php $totalQty = 0;$subtotal = 0; @endphp @foreach($salesInvoices->details as $detail) @php $totalQty += $detail->qty; $subtotal += ($detail->markup_nominal??0) == 0 ? ($detail->nominal_base??$detail->nominal) : $detail->markup_nominal; @endphp @endforeach
Item Satuan Qty Harga Diskon Subtotal
{{ $detail->alias_id ? $alias->where("id",$detail->alias_id)->first()->alias : $detail->item->item_name ?? '-' }} {{ $detail->unit }} {{ formatNumber($detail->qty, 2) }} {{ formatNumber(($detail->markup_price??0) == 0 ? ($detail->price_base??$detail->price) : $detail->markup_price, 2) }} {{ formatNumber($detail->disc_nominal, 2) }} {{ formatNumber(($detail->markup_nominal??0) == 0 ? ($detail->nominal_base??$detail->nominal) : $detail->markup_nominal, 2) }}
Total Qty {{ formatNumber($totalQty,2) }} Subtotal (Rp) {{ formatNumber($subtotal, 2) }}
@if($salesInvoices->add_tax == 0) PPN (0%) @else PPN ({{ formatNumber($salesOrder->tax_tariff, 2) }}%) @endif {{ formatNumber($salesInvoices->add_tax, 2) }}
Grand Total (Rp) {{ formatNumber($salesInvoices->total_base??$salesInvoices->total, 2) }}
Terbilang: {{ $totalHuruf }}
Diketahui,
   
   
{{ $salesInvoices->ttd->employee->employee_name ?? '' }}
{{ $salesInvoices->ttd->position->position_name ?? '' }}
Sidoarjo, {{ \Carbon\Carbon::parse($salesInvoices->document_date)->format('d-m-Y') }}
Dicetak oleh : {{ $username }} , Cetakan ke : {{ ($salesInvoices->print_number ?? 0) + 1 }}