Print / PDF
Printable document data endpoints for sales documents. Returns enriched JSON for client-side PDF rendering with full company, customer, item, and localization details.
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET | /api/sales/quotations/{id}/print | Print quotation |
GET | /api/sales/orders/{id}/print | Print sales order |
GET | /api/sales/invoices/{id}/print | Print sales invoice |
GET | /api/sales/delivery-notes/{id}/print | Print delivery note |
GET | /api/sales/returns/{id}/print | Print sales return |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
lang | string | Language: ar or en (default: en) |
When lang=ar, product names, company names, and notes return Arabic variants (name_ar, notes_ar, etc.) with English fallback.
Response Structure
All print endpoints return the same enriched structure:
json
{
"data": {
"document_type": "SalesInvoice",
"document_number": "INV-000001",
"date": "2026-02-15",
"due_date": "2026-03-15",
"status": "posted",
"company": {
"name": "Moon ERP Co.",
"name_en": "Moon ERP Co.",
"name_ar": "شركة مون إي آر بي",
"address": "...",
"phone": "...",
"email": "...",
"tax_number": "...",
"commercial_register": "...",
"logo": "..."
},
"branch": {
"name": "Main Branch",
"address": "...",
"phone": "..."
},
"customer": {
"name": "Customer Inc.",
"address": "...",
"phone": "...",
"email": "...",
"tax_number": "..."
},
"salesperson": "Ahmed Hassan",
"items": [
{
"line_number": 1,
"product_name": "Product A",
"description": "",
"sku": "PRD-001",
"quantity": 10,
"unit_name": "Piece",
"unit_price": 50.000,
"discount_percent": 0,
"discount_amount": 0,
"tax_rate_name": "VAT 15%",
"tax_amount": 75.000,
"line_total": 500.000
}
],
"subtotal": 500.000,
"discount_amount": 0,
"tax_amount": 75.000,
"total": 575.000,
"amount_paid": 300.000,
"balance_due": 275.000,
"amount_in_words_en": "Five Hundred Seventy-Five Kuwaiti Dinars",
"amount_in_words_ar": "خمسمائة وخمسة وسبعون ديناراً كويتياً",
"notes": "Thank you for your business",
"payment_terms": "Net 30",
"lang": "en",
"print_date": "2026-02-24",
"printed_by": "Admin User"
}
}Usage Example
bash
# Print invoice in Arabic
curl -s -X GET "$API/sales/invoices/1/print?lang=ar" \
-H "Authorization: Bearer $TOKEN"dart
final res = await http.get(
Uri.parse('$api/sales/invoices/1/print?lang=ar'),
headers: {'Authorization': 'Bearer $token'},
);
final data = jsonDecode(res.body)['data'];
// Use data to render PDF client-sideAmount in Words
The amount_in_words_en and amount_in_words_ar fields are generated by the NumberToWordsService from the Accounting module, converting the total amount to text with the company's currency name.
Permissions
Each print endpoint uses the corresponding document's view permission:
| Endpoint | Permission |
|---|---|
| Quotation print | sales.quotations.view |
| Order print | sales.orders.view |
| Invoice print | sales.invoices.view |
| Delivery note print | sales.delivery_notes.view |
| Return print | sales.returns.view |
Company Isolation
Print endpoints filter by company_id from the authenticated user. Attempting to print a document belonging to another company returns 404.