0) { try { $sale = fetch_sale($id); } catch (Throwable $e) { $dbError = $e->getMessage(); } } $paymentSummary = $sale ? sale_payment_summary($sale) : ['paid_amount' => 0, 'due_amount' => 0, 'payment_status' => 'paid']; // Company Info for Invoice $companyName = current_lang() === 'ar' ? get_setting('company_name_ar', 'حلوى الريامي') : get_setting('company_name_en', 'Al Riyami Sweets'); $companyAddress = get_setting('company_address', ''); $companyVat = get_setting('company_vat_number', '300123456789012'); $companyEmail = 'info@flatlogic.com'; $companyPhone = phone_display(get_setting('company_phone', '')); require __DIR__ . '/includes/header.php'; ?>
= h(tr('قد تكون الفاتورة خارج صلاحية هذا الحساب أو لم تعد موجودة.', 'The sale may be outside this account scope or no longer exists.')) ?>
= h(tr('العودة إلى المبيعات', 'Back to sales')) ?>= h($companyAddress) ?>
= h(tr('الرقم الضريبي:', 'VAT NO:')) ?> = h($companyVat) ?>
= h($companyPhone) ?> | = h($companyEmail) ?>
= h(tr('الفرع:', 'Branch:')) ?> = h(branch_label((string) $sale['branch_code'])) ?>
= h(tr('بواسطة:', 'Served By:')) ?> = h((string) $sale['cashier_name']) ?>
| # | = h(tr('وصف الصنف', 'Item Description')) ?> | = h(tr('الكمية', 'Qty')) ?> | = h(tr('سعر الوحدة', 'Unit Price')) ?> | = h(tr('الإجمالي', 'Line Total')) ?> |
|---|---|---|---|---|
| = $i++ ?> |
= h(current_lang() === 'ar' ? ($item['name_ar'] ?? $item['sku']) : ($item['name_en'] ?? $item['sku'])) ?>
= h(tr('رمز الصنف:', 'SKU:')) ?> = h($item['sku']) ?>
|
= h((string) ($item['qty'] ?? 0)) ?> | = h(number_format((float) ($item['price'] ?? 0), 3)) ?> | = h(number_format((float) ($item['line_total'] ?? 0), 3)) ?> |
= nl2br(h((string) $sale['notes'])) ?>
| = h(tr('المجموع الفرعي', 'Subtotal')) ?> | = h(number_format((float) $sale['subtotal'], 3)) ?> |
| = h(tr('ضريبة القيمة المضافة (مضافة)', 'VAT (Added)')) ?> | = number_format((float)($sale['vat_amount'] ?? 0), 3) ?> |
| = h(tr('الإجمالي', 'Total')) ?> | = h(number_format((float) $sale['total_amount'], 3)) ?> = h(tr('ر.ع', 'OMR')) ?> |
| = h(tr('المدفوع', 'Paid')) ?> | = h(number_format((float) $paymentSummary['paid_amount'], 3)) ?> = h(tr('ر.ع', 'OMR')) ?> |
| = h(tr('المتبقي', 'Due')) ?> | = h(number_format((float) $paymentSummary['due_amount'], 3)) ?> = h(tr('ر.ع', 'OMR')) ?> |