@php $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; $customerType = strtolower((string) ($request->customer_type ?? 'individual')); $isCompany = $customerType === 'company'; $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') : '-'; ?>