Invoice Date :
{{ date('d M Y', strtotime($invoice->invoice_date)) }}
Expiration Date :
{{ $invoice->invoice_exp_date ? date('d M Y', strtotime($invoice->invoice_exp_date)) : '-' }}
Invoice No :
{{ $invoice->invoice_no }}
Attention :
{{ $invoice->invoice_attention }}
{!! nl2br(e($invoice->invoice_attention_detail)) !!}
Project Name :
{{ $invoice->invoice_project_name }}
Project Duration :
{{ $invoice->invoice_project_duration }}
| Description |
@if($use_qty == 1)
Quantity |
@endif
Amount (THB) |
|
{{ $invoice->invoice_main_description }}
|
@if($use_qty == 1)
{{ $main_qty != 0 ? number_format($main_qty) : '' }}
|
@endif
{{ (float)$invoice->invoice_amount != 0 ? number_format((float)$invoice->invoice_amount, 2) : '' }}
|
@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
|
{{ $sub }}
|
@if($use_qty == 1)
{{ $current_sub_qty != 0 ? number_format($current_sub_qty) : '' }}
|
@endif
@if($current_sub_amount != 0)
{{ number_format($current_sub_amount, 2) }}
@endif
|
@endforeach
@endif
@php
$bank = $bank ?? (!empty($invoice->invoice_bank) ? \Illuminate\Support\Facades\DB::table('bank')->where('bank_id', $invoice->invoice_bank)->first() : null);
@endphp
Special Discount
@php
$total_before_discount = (float)$invoice->invoice_amount;
$disc_val = (float)$invoice->invoice_discount_value;
$discount = ($invoice->invoice_discount_type == 'percent')
? ($total_before_discount * $disc_val / 100)
: $disc_val;
@endphp
({{ number_format($discount, 2) }})
NET TOTAL :
{{ number_format($total_before_discount - $discount, 2) }}
PDF
@if(!empty($invoice->invoice_upload_file) && $invoice->invoice_upload_file != 'rejected')
Attachment
@endif
@php
$all_workflow_approve = DB::table('workflow_approve')
->where('workflow_approve_item', $id)
->get();
$workflow_approve_who = $all_workflow_approve->where('workflow_approve_status', 'pending')->first();
$workflow_reject_who = $all_workflow_approve->where('workflow_approve_status', 'rejected');
$user_meta = DB::table('user_meta')->where('user_userid', Auth::user()->id)->first();
$my_roles = $user_meta ? explode('///', $user_meta->user_role) : [];
// ดึงลายเซ็นทั้งหมดของผู้ใช้คนนี้ เผื่อมีมากกว่า 1 แบบ
$my_signatures = DB::table('signature')
->where('signature_who', Auth::user()->id)
->get();
$signature = $my_signatures->first(); // ใช้เช็คว่ามีลายเซ็นหรือยัง (คงพฤติกรรมเดิมไว้)
@endphp
@if($workflow_approve_who && (in_array($workflow_approve_who->workflow_approve_who_id, $my_roles) || $workflow_approve_who->workflow_approve_who === 'Customer'))
@endif
{{-- @if(!$workflow_reject_who->isEmpty() && Auth::user()->hasAnyRole(['Admin', 'Admin-Consult']))
@endif --}}