OLIVIA                                   NOTA NETTO
  Kepada Yth.
  {{ str_pad($customerOrigin->customer_name ?? 'N/A', 35) }}No. Invoice : {{ $salesInvoice->sales_invoice_number }}
  {{ str_pad($customerOrigin->city ?? 'N/A', 35) }}Tanggal     : {{ \Carbon\Carbon::parse($salesInvoice->document_date)->format('d M Y') }}

 ---------------------------------------------------------------------------------------
 |NO.|NAMA BARANG                        | COLY|         QTY|      HARGA |       JUMLAH|
 ---------------------------------------------------------------------------------------
@php
    $count = 0;
@endphp
@foreach($salesInvoice->details as $index => $detail)
@php
      $maxLength = 35; // Max length for item name
      $itemName = $detail->items->item_name;
      $lines = explode("\n", wordwrap($itemName, $maxLength, "\n", false)); // Word-based wrapping
@endphp
@foreach($lines as $lineIndex => $line)
@if($lineIndex == 0)
 |{{ str_pad($loop->parent->iteration . '.', 3) }}|{{ str_pad($line, 35) }}|{{ str_pad(number_format($detail->qty, 0), 5, ' ', STR_PAD_LEFT) }}|{{ str_pad(number_format($detail->base_qty * $detail->qty, 2, ',', '.') . ' ' . $detail->baseUnit->unit_name, 12, ' ', STR_PAD_LEFT) }}|{{ str_pad($detail->items->additional_tax? number_format($detail->price + ($detail->price*$tax->tax_base*$tax->tariff/100), 0,',','.'):number_format($detail->price, 0,',','.'), 12, ' ', STR_PAD_LEFT) }}|{{ str_pad($detail->items->additional_tax? number_format(($detail->price*$detail->qty*$detail->base_qty) + ($detail->price*$detail->qty*$detail->base_qty*$tax->tax_base*$tax->tariff/100), 0,',','.'):number_format($detail->nominal, 0,',','.'), 13, ' ', STR_PAD_LEFT) }}|
@else
 |{{ str_pad('', 3) }}|{{ str_pad($line, 35) }}|{{ str_pad('', 5) }}|{{ str_pad('', 12) }}|{{ str_pad('', 12) }}|{{ str_pad('', 13) }}|
@endif
@php
    $count++;
@endphp
@endforeach
@endforeach
@if(14 - $count-1>0)
 |---|-----------------------------------|-----|------------|------------|-------------|
@endif
@for($i = 0; $i < (14 - $count-1); $i++)
 |{{ str_pad('', 3) }}|{{ str_pad('', 35) }}|{{ str_pad('', 5) }}|{{ str_pad('', 12) }}|{{ str_pad('', 12) }}|{{ str_pad('', 13) }}|
@endfor
 ---------------------------------------------------------------------------------------
@php
      $maxLength = 35; // Max length for Terbilang
      $terbilang = "Terbilang: " . $totalHuruf;
      $terbilangLines = explode("\n", wordwrap($terbilang, $maxLength, "\n", false));
      // Ensure at least 3 lines for Terbilang, padding with empty strings if needed
      while (count($terbilangLines) < 3) {
          $terbilangLines[] = '';
      }
@endphp
  {{ str_pad($terbilangLines[0], 35) }}                    Sub Total    : {{ str_pad(number_format($salesInvoice->subtotal+$salesInvoice->add_tax+$totalDiscount+ ($totalDiscount*$tax->tax_base*$tax->tariff/100), 0,',','.'), 15, ' ', STR_PAD_LEFT) }}
  {{ str_pad($terbilangLines[1], 35) }}                    Discount     : {{ str_pad(number_format(($totalDiscount)+ ($totalDiscount*$tax->tax_base*$tax->tariff/100), 0, ',', '.'), 15, ' ', STR_PAD_LEFT) }}
@if(isset($terbilangLines[3]))
@foreach(array_slice($terbilangLines, 3) as $extraLine)
  {{ str_pad($extraLine, 35) }}
@endforeach
@endif
  {{ str_pad('', 35) }}                    Total Invoice: {{ str_pad(number_format($salesInvoice->total, 0, ',', '.'), 15, ' ', STR_PAD_LEFT) }}


Kembali