@php use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Auth; $seller = config('einvoice.seller', []); $sellerAddress = $seller['address'] ?? []; $taxRate = (float) (config('einvoice.tax.rate') ?? 0); $grossAmount = (float) ($request->amount ?? 0); $netAmount = $taxRate > 0 ? round($grossAmount / (1 + $taxRate), 2) : $grossAmount; $taxAmount = round($grossAmount - $netAmount, 2); $grandTotal = $grossAmount; $showTaxBreakdown = (bool) ($showTaxBreakdown ?? false); $viewMode = $viewMode ?? 'admin'; $isBackoffice = Auth::user()?->isBackofficeUser() ?? false; $canEmailCustomer = $isBackoffice; $customerType = strtolower((string) ($request->customer_type ?? 'individual')); $isCompany = $customerType === 'company'; $pdfRouteParams = ['invoice' => $request->id]; if ($viewMode === 'customer') { $pdfRouteParams['view'] = 'customer'; } $payStatus = $request->invoice_status ?? 'unpaid'; $isPaid = $payStatus === 'paid'; $isApproved = $isPaid && !empty($request->payment_approved_at); $isSubmitted = !empty($request->lhdn_uuid); $period = $request->invoice_cycle_month ? \Carbon\Carbon::parse($request->invoice_cycle_month)->format('m/Y') : '-'; @endphp @push('styles') @endpush
@if(session('success')) @endif @if($errors->any()) @endif {{-- HEADER --}}
{{ config('app.name', 'SUBS') }}
INVOICE
{{ $seller['name'] ?? config('app.name', 'SUBS') }} ({{ $seller['registration_number'] ?? '-' }})
{{ $sellerAddress['line1'] ?? '' }}
@if(!empty($sellerAddress['line2'])) {{ $sellerAddress['line2'] }}
@endif {{ $sellerAddress['postcode'] ?? '' }} {{ $sellerAddress['city'] ?? '' }}, {{ $sellerAddress['state'] ?? '' }}
Tel: {{ $seller['contact_number'] ?? '-' }}   Email: {{ $seller['email'] ?? '-' }}
@if($isBackoffice) @if($viewMode === 'customer') Admin View @else Customer View @endif @endif Download PDF View PDF @if($canEmailCustomer)
@csrf
@endif
{{-- PAID STAMP --}} @if($isApproved && !$isSubmitted)
PAID
@if($request->receipt_no)
Receipt No: {{ $request->receipt_no }}
@endif
Payment Date: {{ optional($request->payment_date)->format('d/m/Y') ?? '-' }}

@endif {{-- UNPAID STAMP --}} @if($payStatus === 'unpaid')
UNPAID
Invoice Date: {{ optional($request->txn_date)->format('d/m/Y') ?? '-' }}
Due Date: {{ optional($request->due_date)->format('d/m/Y') ?? '-' }}

@endif {{-- DETAILS SECTION --}}
{{-- CUSTOMER --}}
CUSTOMER
Customer ID : {{ $request->customer_id ?? $request->ic_passport ?? '-' }}
Customer : {{ $request->name ?? '-' }}
@if(!empty($request->email))
{{ $request->email }}
@endif
Contact : {{ $request->phone ?? '-' }}
{{-- DETAILS --}}
DETAILS
Invoice No : {{ $request->invoice_no ?? '-' }}
Invoice Date : {{ optional($request->txn_date)->format('d/m/Y') ?? '-' }}
@if(!$isPaid && $request->due_date)
Due Date : {{ optional($request->due_date)->format('d/m/Y') ?? '-' }}
@endif @if($isSubmitted)
Unique Identifier No : {{ $request->lhdn_uuid ?? '-' }}
E-Invoice UUID : {{ $request->lhdn_uuid ?? '-' }}
@else
Unique Identifier No :
E-Invoice UUID :
@endif
{{-- QR BOX --}} @if($isSubmitted)
LHDN QR
@if(!empty($qrDataUri)) LHDN QR @endif @if(!empty($shareUrl)) @endif
@endif

{{-- ITEMS TABLE --}}
No Car Plate Site Period Description Amount
1 {{ $request->car_plate ?? '-' }} {{ $request->site->name ?? '-' }} {{ $period }} Parking Subscription - {{ $request->site->name ?? '-' }} RM {{ number_format($grossAmount, 2) }}
{{-- SUMMARY --}}
@if($taxRate > 0) @endif
Subtotal RM {{ number_format($netAmount, 2) }}
Add Service Tax ({{ number_format($taxRate * 100, 0) }}%) RM {{ number_format($taxAmount, 2) }}
Total RM {{ number_format($grandTotal, 2) }}
{{-- SERVICE TAX SUMMARY --}} @if($taxRate > 0)
Service Tax Summary Amount(RM) Tax(RM)
* {{ number_format($taxRate * 100, 2) }}% {{ number_format($netAmount, 2) }} {{ number_format($taxAmount, 2) }}
** Nil 0.00 -
@endif
No authorised signatures required as this is a computer generated invoice
{{ $seller['name'] ?? config('app.name', 'SUBS') }}
{{-- PDF MODAL --}}