{{ str_pad('SURAT JALAN', 27) }} {{$name ?? 'N/A'}}
{{ str_pad('', 45) }} {{''}}
{{ str_pad('', 45) }} {{$city ?? ''}}{{$salesInvoice->phone_number?' - '.$salesInvoice->phone_number:''}}
{{ str_pad('', 45) }} {{ \Carbon\Carbon::parse($salesInvoice->document_date)->format('d/m/Y') }}
{{ substr($salesInvoice->sales_invoice_number,7) }}
———————————————————————————————————————————————————————————————————————————————————————
NO NAMA BARANG QTY UNIT
———————————————————————————————————————————————————————————————————————————————————————
@php
$count = 0;
$startingIndex = 0;
for ($i = 0; $i < $pageNumber; $i++) {
$startingIndex += count($pages[$i]['items']);
}
@endphp
@foreach($page['items'] as $index => $detail)
@php
$maxLength = 49; // Max length for item name
$itemName = $detail->item_name.' '.$detail->notes;
$prefix = '| BUTTERFLY |';
// Check if the item name starts with the prefix
if (str_starts_with($itemName, $prefix)) {
// Remove the prefix if it exists
$itemName = substr($itemName, strlen($prefix));
// Optional: Trim any leading/trailing whitespace left after removal
$itemName = trim($itemName);
}
$lines = explode("\n", wordwrap($itemName, $maxLength, "\n", false)); // Word-based wrapping
$qtys+=$detail->qty;
@endphp
@foreach($lines as $lineIndex => $line)
@if($lineIndex == 0)
{{ str_pad($startingIndex + $loop->parent->iteration, 3) }} {{ str_pad($line, 49) }} {{ str_pad(number_format( $detail->qty, 0, ',', '.') , 10, ' ', STR_PAD_BOTH) }} {{ str_pad($salesInvoice->unit_name , 10, ' ', STR_PAD_BOTH) }} {{ str_pad(' ', 9) }}
@else
{{ str_pad('', 3) }} {{ str_pad($line, 49) }} {{ str_pad('', 10) }} {{ str_pad('', 10) }} {{ str_pad(' ', 9) }}
@endif
@php
$count++;
@endphp
@endforeach
@endforeach
@for($i = 0; $i < (11 - $count-1); $i++)
{{ str_pad('', 3) }} {{ str_pad('', 49) }} {{ str_pad('', 10) }} {{ str_pad('', 10) }} {{ str_pad(' ', 9) }}
@endfor
@php
$maxLength = 40;
$exp = ($salesInvoice->ekspedisi && $salesInvoice->ekspedisi != '') ? 'EXP : ' . $salesInvoice->ekspedisi : '';
$expLines = explode("\n", wordwrap($exp, $maxLength, "\n", false));
$maxLength = 35;
$alamat = ($salesInvoice->ekspedisi && $salesInvoice->alamat != '') ?'ALAMAT : ' . $salesInvoice->alamat:'';
$alamatLines = explode("\n", wordwrap($alamat, $maxLength, "\n", false));
@endphp
———————————————————————————————————————————————————————————————————————————————————————
{{str_pad(('Terbilang: '.strtoupper(numberToWords($qtys)).' '.$salesInvoice->unit_name),58,' ',STR_PAD_RIGHT)}} {{str_pad($qtys.' '.$salesInvoice->unit_name,24, ' ', STR_PAD_RIGHT)}}
———————————————————————————————————————————————————————————————————————————————————————
PENERIMA: {{ str_pad('', 10) }} {{ str_pad($expLines[0] , 40, ' ', STR_PAD_RIGHT) }} PENGIRIM:
@if(isset($expLines[1]))
{{ str_pad('', 20) }} {{ str_pad(' '.$expLines[1] , 40, ' ', STR_PAD_RIGHT) }}
@endif
@if(isset($expLines[2]))
{{ str_pad('', 20) }} {{ str_pad(' '.$expLines[2] , 40, ' ', STR_PAD_RIGHT) }}
@endif
{{ str_pad('', 20) }} {{ str_pad($alamatLines[0], 40, ' ', STR_PAD_RIGHT) }}
@if(isset($alamatLines[1]))
{{ str_pad('', 20) }} {{ str_pad(' '.$alamatLines[1], 40, ' ', STR_PAD_RIGHT) }}
@else
@endif
@if(!isset($expLines[1]))
@endif
{{str_pad($names,77,' ',STR_PAD_LEFT)}} {{ ($pageNumber + 1) }} of {{ $totalPages }}
@endforeach