@php if($quotation->quotation_status_approved == 'approved'){ $breadcrumbs = [ 'Quotation List' => url('/quotation_list_approved'), 'Quotation View' => '' ]; }else{ $breadcrumbs = [ 'Quotation List' => url('/quotation_list'), 'Quotation View' => '' ]; } // ดึงไอดีหลักไปใช้งานในระบบ Workflow $id = $quotation->quotation_id; // แกะข้อมูลระบบ Quantity และรายการย่อย $use_qty = $quotation->quotation_use_qty ?? 0; $main_qty = $quotation->quotation_main_qty ?? 0; $sub_services = json_decode($quotation->quotation_sub_services, true) ?? []; $sub_amounts = json_decode($quotation->quotation_sub_amounts, true) ?? []; $sub_qtys = json_decode($quotation->quotation_sub_qtys, true) ?? []; @endphp @extends('layouts.master') @section('title') Quotation View - {{ $quotation->quotation_no }} @endsection @section('style') @endsection @section('content')
{{--

Quotation Details

Back
--}}

Quotation Details

{{-- เพิ่มเงื่อนไขแสดงสถานะ Rejected และรายละเอียดตรงนี้ --}} @if($quotation->quotation_status_approved == 'rejected')
REJECTED
by {{ $who ? $who : 'Unknown User' }} @if(!empty(trim($comment)))
Reason: {{ $comment }}
@endif
@endif @if($quotation->quotation_status_approved == 'approved') @if($quotation->quotation_customer == 'rejected')
CUSTOMER REJECTED
@if(!empty(trim($comment)))
Reason: {{ $comment }}
@endif
@endif @endif
Back
Quotation Date :
{{ date('d M Y', strtotime($quotation->quotation_date)) }}
Expiration Date :
{{ $quotation->quotation_exp_date ? date('d M Y', strtotime($quotation->quotation_exp_date)) : '-' }}
Quotation No :
{{ $quotation->quotation_no }}

Attention :
{{ $quotation->quotation_attention }}
{!! nl2br(e($quotation->quotation_attention_detail)) !!}
Project Name :
{{ $quotation->quotation_project_name }}
Project Duration :
{{ $quotation->quotation_project_duration }}
@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
DescriptionQuantityAmount (THB)
{{ $quotation->quotation_main_description }} {{ $main_qty != 0 ? number_format($main_qty) : '' }} {{ (float)$quotation->quotation_amount != 0 ? number_format((float)$quotation->quotation_amount, 2) : '' }}
{{ $sub }} {{ $current_sub_qty != 0 ? number_format($current_sub_qty) : '' }} @if($current_sub_amount != 0) {{ number_format($current_sub_amount, 2) }} @endif
@if(!empty(trim($quotation->quotation_remark))){{ trim($quotation->quotation_remark) }}@else- No remark specified -@endif
Special Discount @php $total_before_discount = (float)$quotation->quotation_amount; $disc_val = (float)$quotation->quotation_discount_value; $discount = ($quotation->quotation_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($quotation->quotation_upload_file) && $quotation->quotation_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'))
{!! csrf_field() !!}
@if($workflow_approve_who->workflow_approve_who === 'Customer') @endif
{{-- Modal เลือกลายเซ็น กรณีผู้ใช้มีลายเซ็นมากกว่า 1 แบบ --}}
@endif {{-- @if(!$workflow_reject_who->isEmpty() && Auth::user()->hasAnyRole(['Admin', 'Admin-Consult']))
{!! csrf_field() !!}
@endif --}}
@endsection @section('script') @endsection