SIIT Consulting Center
Sirindhorn International Institute of Technology
Thammasat University - Rangsit Campus
99 Moo 18, Km. 41, Khlong Luang,
Pathum Thani 12120, Thailand
QUOTATION
Invoice Date: {{ date('d F Y', strtotime($invoice->invoice_date)) }}
Expiration Date: {{ $invoice->invoice_exp_date ? date('d F Y', strtotime($invoice->invoice_exp_date)) : '-' }}
Invoice No.: {{ $invoice->invoice_no }}
{{ $invoice->invoice_attention }}
{!! nl2br(e($invoice->invoice_attention_detail)) !!}
{{ $invoice->invoice_project_name }}
{!! nl2br(e($invoice->invoice_project_duration)) !!}
@php $use_qty = $invoice->invoice_use_qty ?? 0; $main_qty = $invoice->invoice_main_qty ?? 0; $sub_services = json_decode($invoice->invoice_sub_services, true) ?? []; $sub_amounts = json_decode($invoice->invoice_sub_amounts, true) ?? []; $sub_qtys = json_decode($invoice->invoice_sub_qtys, true) ?? []; $main_amount = (float)$invoice->invoice_amount; $sub_amount_total = 0; // ดึงยอดสุทธิจากราคาของช่องบริการหลักเพียวๆ ไม่บวกรวมราคาบริการย่อยตามสเปก $total_before_discount = $main_amount; $disc_val = (float)$invoice->invoice_discount_value; $discount = ($invoice->invoice_discount_type == 'percent') ? ($total_before_discount * $disc_val / 100) : $disc_val; $net_total = $total_before_discount - $discount; if (!function_exists('numberToWord')) { function numberToWord($num) { $ones = array( 0 => "", 1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five", 6 => "six", 7 => "seven", 8 => "eight", 9 => "nine", 10 => "ten", 11 => "eleven", 12 => "twelve", 13 => "thirteen", 14 => "fourteen", 15 => "fifteen", 16 => "sixteen", 17 => "seventeen", 18 => "eighteen", 19 => "nineteen" ); $tens = array( 0 => "", 2 => "twenty", 3 => "thirty", 4 => "forty", 5 => "fifty", 6 => "sixty", 7 => "seventy", 8 => "eighty", 9 => "ninety" ); $hundreds = array("", "thousand", "million", "billion"); $num = number_format($num, 2, ".", ","); $num_arr = explode(".", $num); $wholenum = $num_arr[0]; $decnum = (int)$num_arr[1]; $whole_arr = array_reverse(explode(",", $wholenum)); krsort($whole_arr); $rettxt = ""; foreach($whole_arr as $key => $i) { $i = (int)$i; if($i == 0) continue; $temp = ""; if($i < 20) { $temp = $ones[$i]; } elseif($i < 100) { $temp = $tens[substr($i,0,1)]; if(substr($i,1,1) != "0") $temp .= "-".$ones[substr($i,1,1)]; } else { $temp = $ones[substr($i,0,1)]." hundred"; $rem = (int)substr($i,1); if($rem > 0 && $rem < 20) { $temp .= " and ".$ones[$rem]; } elseif($rem >= 20) { $temp .= " and ".$tens[substr($i,1,1)]; if(substr($i,2,1) != "0") $temp .= "-".$ones[substr($i,2,1)]; } } $rettxt .= $temp . " " . $hundreds[$key] . " "; } $res = trim($rettxt) . " baht"; if($decnum > 0) { $res .= " and " . $decnum . "/100"; } else { $res .= " only"; } return $res; } } @endphp @if($use_qty == 1) @endif @if($use_qty == 1) @endif @if(!empty($sub_services)) @foreach($sub_services as $index => $sub) @php $current_sub_amount = isset($sub_amounts[$index]) ? (float)$sub_amounts[$index] : 0; $current_sub_qty = isset($sub_qtys[$index]) ? (float)$sub_qtys[$index] : 0; @endphp @if($use_qty == 1) @endif @endforeach @endif @if($use_qty == 1) @endif @if($discount > 0) @if($use_qty == 1) @endif @endif
DescriptionQuantityAmount THB
{{ $invoice->invoice_main_description }}
{{ $main_qty != 0 ? number_format($main_qty) : '' }} {{ $main_amount != 0 ? number_format($main_amount, 2) : '' }}
{{ $sub }}
{{ $current_sub_qty != 0 ? number_format($current_sub_qty) : '' }} @if($current_sub_amount != 0) {{ number_format($current_sub_amount, 2) }} @endif
Special Discount {{ $invoice->invoice_discount_type == 'percent' ? $invoice->invoice_discount_value.'%' : '' }}
({{ number_format($discount, 2) }})
(Amount in words)
{{ \Illuminate\Support\Str::title(numberToWord($net_total)) }}
{{ number_format($net_total, 2) }}
@php $bank = $bank ?? (!empty($invoice->invoice_bank) ? \Illuminate\Support\Facades\DB::table('bank')->where('bank_id', $invoice->invoice_bank)->first() : null); @endphp @if(!empty($bank))
Payment to:
Bank name : {{ $bank->bank_name }}
Branch : {{ $bank->bank_branch }}
Account Name : {{ $bank->bank_account_name }}
Account No. : {{ $bank->bank_account_no }}
@endif @php $flow_pdf_id = $workflow_approve->pluck('workflow_approve_id_flow_pdf')->first(); $flow_wf_id = $workflow_approve->pluck('workflow_approve_id_flow')->first(); $flowHtml = app('App\Http\Controllers\PDF_wfController')->pdf_wf($flow_wf_id, $flow_pdf_id, $id); @endphp