"""The text of the Vertex ERP user guide. Each item: (kind, ...).

ch(title, intro)          chapter
sec(title)                section
p(text)                   paragraph (supports <b> and <i>)
where(path)               "Where to find it" menu path
steps([...])              numbered steps
bullets([...])            bullet list
shot(name, caption)       screenshot
entry(title, [(side, account, note)])   accounting entry box
tip(text), note(text), warn(text)
table(headers, rows, widths)
"""

def ch(t, intro=""): return ("ch", t, intro)
def sec(t): return ("sec", t)
def p(t): return ("p", t)
def where(t): return ("where", t)
def steps(xs): return ("steps", xs)
def bullets(xs): return ("bullets", xs)
def shot(n, c): return ("shot", n, c)
def entry(t, lines): return ("entry", t, lines)
def tip(t): return ("tip", t)
def note(t): return ("note", t)
def warn(t): return ("warn", t)
def table(h, rows, w=None): return ("table", h, rows, w)


GUIDE = [
# ------------------------------------------------------------------ 1
ch("Welcome to Vertex ERP",
   "Vertex ERP runs the finance and operations of a company with one or more branches: sales, purchasing, stock, "
   "cash and bank, payroll and the books, in English and Arabic, with every document posted to the ledger as it "
   "happens."),
sec("What Vertex does"),
p("Vertex is a complete double-entry accounting system with the operational modules around it. Every document you "
  "create — an invoice, a vendor bill, a payment, a cheque, a delivery, a payroll — writes its own journal entry, so "
  "the trial balance, profit and loss and balance sheet are always up to date. There is no separate posting run and "
  "no month-end batch to wait for."),
bullets([
    "<b>Multi-branch, multi-currency.</b> Each branch keeps its own books in its own currency (SAR, AED, KWD...). "
    "Reports can show one branch or all branches consolidated, with inter-branch balances eliminated.",
    "<b>Bilingual.</b> Every screen, report and printed document is available in English and Arabic (right to left). "
    "Each user picks their language.",
    "<b>Licensed by module.</b> Your company pays only for the modules it uses. Modules not in your plan appear on the "
    "home screen as \"Available to add\".",
    "<b>Controls built in.</b> Lock dates, approval steps, credit limits, an audit log of every change, and user "
    "access limited by branch and role.",
]),
sec("The modules"),
table(["Module", "What it covers"], [
    ["Accounting (core)", "Chart of accounts with groups, journal entries, invoices and bills, payments, cheques, petty cash, "
                          "multi-currency, cost centres, budgets, inter-branch transfers, month-end and year-end closing, all reports"],
    ["Sales", "Quotations, sales orders, delivery and invoicing from orders"],
    ["Procurement", "Material requests, optional requisitions, RFQs with sealed bids, award approval, purchase orders sent and "
     "acknowledged, goods received notes, three-way match"],
    ["Inventory", "Warehouses, stock on hand, receipts, deliveries, returns, transfers, adjustments, landed costs, average costing"],
    ["Point of Sale", "Cashier sessions, touch selling screen, cash and card, refunds, receipts, automatic posting"],
    ["CRM", "Leads and opportunities pipeline, activities, quotations from leads, win/loss analysis"],
    ["Vendor Management", "Vendor onboarding and approval, documents with expiry dates, evaluations"],
    ["Bank Reconciliation", "Bank statement import, automatic and manual matching, reconciliation report"],
    ["Fixed Assets", "Asset register, depreciation schedules, monthly posting, disposal"],
    ["Prepaid & Accruals", "Prepaid expenses, deferred revenue and accruals released month by month"],
    ["HR & Payroll", "Employees, monthly payroll with GOSI and the WPS bank file, leave, loans, end-of-service benefits, final settlement"],
    ["Projects", "Project manager and team, budgets, committed and actual cost, budget control, progress billing and retention"],
    ["Supplier Portal", "Supplier self-registration and approval, portal accounts; suppliers quote, confirm POs, send invoices, "
     "renew documents and request bank changes"],
], [45, 135]),
note("This guide describes every module. If a menu in this guide is not on your screen, the module is not in your "
     "licence or your user does not have access to it — ask your administrator."),
sec("How this guide is organised"),
p("Chapter 2 is for every user and chapter 3 for the administrator who sets the system up. Chapters 4 to 12 "
  "follow the daily work of each team, and chapters 13 and 14 cover reports and moving from your old system. Each topic shows <b>where to find it</b>, the <b>steps</b>, and — for anything that "
  "touches the books — the <b>accounting entry</b> Vertex posts, so an accountant can see exactly what happens in the "
  "ledger. Appendix A lists every entry in one table."),

# ------------------------------------------------------------------ 2
ch("Getting started", "Signing in, the home screen, finding your way around and the controls you will use every day."),
sec("Signing in"),
p("Open the address your administrator gave you in a web browser (Chrome, Edge, Safari or Firefox) on a computer, "
  "tablet or phone. Enter your user name and password and choose <b>Sign in</b>."),
shot("login", "The sign-in screen"),
tip("Change your password the first time you sign in: open your name at the top right and choose <b>Change password</b>."),
sec("The home screen"),
p("After signing in you see the home screen: one tile for each app you can use, grouped into Operations, Finance and "
  "Administration. Each tile shows what needs attention right now — overdue invoices, bills due this week, cheques due "
  "to clear, documents expiring. A red badge means something is late; an amber badge means something is waiting."),
shot("home", "The home screen with live counts on each app"),
bullets([
    "<b>New invoice</b> and <b>Record payment</b> at the top right are shortcuts to the two things done most often.",
    "Choose a tile to open that app. Its menu appears in the sidebar on the left.",
    "The grid icon at the top left always brings you back to the home screen.",
]),
sec("Searching for any screen"),
p("Type in the search box on the home screen (or press <b>/</b>) to find an app or any menu item by name. "
  "Press <b>Enter</b> to open the first result. Inside an app, the <b>Search menu</b> box at the top of the sidebar "
  "does the same for that app's menu."),
shot("home-search", "Typing \"bill\" finds Vendor Bills, Recurring Bills and more"),
sec("Branches, language and dark mode"),
bullets([
    "<b>Branch switcher</b> (top bar): choose one branch to work in, or <b>All branches (consolidated)</b> to see everything "
    "you have access to. Lists and reports follow this choice; new documents start in the selected branch.",
    "<b>Language</b>: the <b>العربية / English</b> button switches the whole system, including printed documents, between "
    "English and Arabic. Arabic screens read right to left.",
    "<b>Dark mode</b>: the moon icon switches to a dark theme, easier on the eyes in the evening.",
]),
shot("home-ar", "The same home screen in Arabic"),
sec("Working with lists and forms"),
bullets([
    "<b>Lists</b> (invoices, payments, employees...) have tabs and filters at the top: search, date range and status. "
    "Click any row to open it.",
    "<b>Searchable drop-downs.</b> Long lists such as accounts, customers, vendors and products have a search box: type a "
    "few letters of the name or the code — \"ban\" shows Bank Accounts and Bank Charges, \"61\" shows the 61xx accounts. "
    "Use the arrow keys and <b>Enter</b> or <b>Tab</b> to choose, <b>Esc</b> to close, or click to see the whole list.",
    "<b>Lines.</b> On invoices, bills and journal entries, <b>Tab</b> moves from box to box; Tab on the last box of the "
    "last line adds a new line.",
    "<b>Save & Post</b> posts the document to the ledger at once. <b>Save as Draft</b> keeps it to finish later; drafts do "
    "not affect the books.",
    "<b>Attachments.</b> Most documents have an Attachments section at the bottom: add the scanned invoice, the signed "
    "contract or the receipt. Files stay with the document.",
]),
shot("jv-form", "A searchable account box on a journal entry line"),

# ------------------------------------------------------------------ 3
ch("Setting up the company", "For administrators: what to set before the first transaction, in the order to do it."),
sec("Setup checklist"),
table(["#", "Step", "Where"], [
    ["1", "Company details, logo and default accounts", "Settings → Company"],
    ["2", "Branches (one per legal entity / location) and their currency and VAT", "Settings → Branches"],
    ["3", "Chart of accounts (start from the standard grouped chart)", "Accounting → Chart of Accounts"],
    ["4", "Taxes (VAT rates) and journals", "Accounting → Taxes / Journals"],
    ["5", "Currencies and exchange rates", "Accounting → Currencies / Exchange Rates"],
    ["6", "Cost centres (departments, projects, sites) — optional", "Accounting → Cost Centres"],
    ["7", "Users, their role and the branches they may see", "Settings → Users"],
    ["8", "Customers, vendors and products", "Sales / Purchases → Setup"],
    ["9", "Opening balances and open invoices from the old system", "Data Import"],
], [8, 110, 62]),
sec("Company details and logo"),
where("Settings → Company"),
p("Enter the legal name in English and Arabic, CR and VAT numbers, address, phone and email — these print on every "
  "invoice, statement and report. Upload the company <b>logo</b> (PNG or JPG, up to 2 MB; a transparent PNG looks best). "
  "Choose the <b>accent colour</b> used on the screens and printed documents."),
p("The same page holds the <b>default accounts</b> (receivable, payable, inventory, retained earnings, exchange "
  "gain and loss, cheques), the <b>lock date</b> and the <b>financial year start month</b>, credit control rules and "
  "the email (SMTP) settings used to send invoices and statements."),
shot("company", "Company settings with the logo upload"),
warn("The <b>lock date</b> closes the books up to that date: nothing can be posted, changed or cancelled on or before it. "
     "Set it after each month is reviewed."),
sec("Branches"),
where("Settings → Branches"),
p("Each branch has its own code, name, currency, VAT number and default sales and purchase VAT. When you create a "
  "branch Vertex adds its standard journals (sales, purchases, bank, cash, miscellaneous, cheques) and a main "
  "warehouse automatically."),
shot("branches", "Branches with their own currency"),
sec("Chart of accounts"),
where("Accounting → Setup → Chart of Accounts"),
p("The chart is a tree: <b>group accounts</b> (such as 1 Assets › 11 Current Assets › 111 Cash and Bank) hold posting "
  "accounts and show their total. Nothing can be posted to a group. Every account has a <b>type</b> (bank and cash, "
  "receivable, current asset, payable, equity, income, expense...) which decides where it appears in the financial "
  "statements."),
steps([
    "To add an account, choose <b>+ New account</b>, or the <b>+</b> on the group it belongs to.",
    "Enter the code, the English and Arabic names, the type and the parent group.",
    "Tick <b>Inter-branch</b> for current accounts between your own branches, so consolidated reports eliminate them.",
    "If you imported accounts without groups, the banner <b>Group them automatically</b> places them in the standard groups.",
]),
shot("coa", "The chart of accounts as a tree with balances"),
sec("Taxes, currencies and exchange rates"),
p("<b>Taxes</b> (Accounting → Taxes) hold each VAT rate with its account, for sales and for purchases. "
  "<b>Currencies</b> lists the currencies in use; <b>Exchange Rates</b> holds the rate of each currency to the company "
  "currency by date. The rate on or before a document's date is used."),
shot("currencies", "Exchange rates by date"),
sec("Cost centres"),
where("Accounting → Setup → Cost Centres"),
p("A cost centre is a department, project, site or vehicle you want a separate profit and loss for. Choose it on "
  "invoice, bill, journal and petty cash lines (and on employees, assets and prepaid schedules). "
  "Reports → <b>P&L by Cost Centre</b> then shows one column per cost centre. In Company settings you can require a cost "
  "centre on every income and expense line, and choose whether cost centres are used on income and expense lines or on "
  "<b>expense lines only</b> (then revenue is never asked for one)."),
sec("Users and permissions"),
where("Settings → Users"),
table(["Role", "Can do"], [
    ["Administrator", "Everything, including settings, users, licence and data import"],
    ["Accountant", "Create, post and cancel documents; run month-end; see all reports"],
    ["Viewer", "See documents and reports only (auditors, management)"],
], [40, 140]),
p("For each user choose the language, whether they see <b>all branches</b> or only selected ones, and whether they "
  "may <b>approve</b> purchase requisitions and orders above the approval limit."),
shot("users", "Users with their role and branches"),
sec("Licence and modules"),
where("Settings → License & Modules"),
p("This page shows the modules in your licence, the user and branch limits and the expiry date. If the licence expires the "
  "system becomes read-only until it is renewed; no data is lost."),

# ------------------------------------------------------------------ 3b
ch("Approvals", "Who approves what: rules, roles, steps, the approvals inbox and separation of duties."),
sec("How approvals work"),
p("Documents that need approval — material requests, requisitions, purchase orders, RFQ awards, supplier "
  "registrations and vendor bank changes — are sent for approval when they are submitted. The first active "
  "<b>rule</b> that matches the document (type, branch, department, project and amount band) decides the "
  "<b>steps</b>. Each step goes to the members of a <b>role</b> and/or named people; \"Any\" needs the number of "
  "approvals given, \"All\" needs everyone. When the last step approves, the document moves on by itself (a PO is "
  "confirmed, an award creates the PO, a vendor is created...). No matching rule means no approval is needed."),
bullets([
    "<b>Separation of duties</b> — the person who submits never approves their own document. An administrator can "
    "approve in place of the approvers only with a reason, and that override is recorded.",
    "<b>Project manager step</b> — a step can go to the manager of the document's project; it is skipped for "
    "documents without a project.",
    "<b>Out of office</b> — in My Approvals you can delegate your approvals to a colleague for a period.",
    "<b>Reminders</b> — approvers are reminded after the days set on the rule (by the daily job).",
]),
where("Settings → Approval Workflow / Approval Roles"),
shot("wf-rules", "Approval rules by document type"),
shot("wf-rule", "One rule with its steps"),
sec("My Approvals"),
p("The tick icon at the top shows how many documents wait for you. Open one, read it and press <b>Approve</b> or "
  "<b>Reject</b> (a reason is required to reject). The approval panel on every document shows each step, who "
  "approved and when, and the full history."),
shot("wf-inbox", "My Approvals"),
shot("wf-mr", "A material request waiting at the project manager step"),

# ------------------------------------------------------------------ 4
ch("Sales and customers", "From quotation to cash: orders, invoices, credit notes, receipts, cheques, statements and credit control."),
sec("Customers and products"),
where("Sales → Setup → Customers / Products"),
p("A customer needs a name in English (the Arabic name is optional), and ideally the VAT number, CR number, email and address — they "
  "print on the tax invoice. Optional: a different receivable account, a <b>credit limit</b>, a <b>document currency</b> "
  "(for a customer you always invoice in USD, for example) and <b>credit hold</b>."),
p("A product or service has a code, names, sales and purchase price, VAT and the income account. Stock products also "
  "carry a category whose accounts decide where inventory and cost of goods sold are booked."),
shot("customers", "The customer list"),
sec("Quotations and sales orders"),
where("Sales → Quotations & Orders"),
steps([
    "Choose <b>+ New Quotation</b>, pick the customer and add the products, quantities and prices.",
    "Print or email the quotation. When the customer accepts, choose <b>Confirm</b> — it becomes a sales order.",
    "From the order, <b>Create Delivery</b> sends the goods (Inventory) and <b>Create Invoice</b> bills them. Partial "
    "deliveries and invoices are tracked on the order.",
]),
shot("order-view", "A sales order with its deliveries and invoices"),
sec("Customer invoices"),
where("Sales → Customer Invoices"),
steps([
    "Choose <b>+ New</b>. Select the customer, branch, journal, date and due date.",
    "Add lines: product (or just a description), account, quantity, unit price and VAT. Totals update as you type.",
    "Choose <b>Save & Post</b>. The invoice gets its number and is booked.",
    "From the invoice: <b>Print</b>, <b>PDF</b>, <b>Email</b> to the customer, <b>Register Payment</b>, <b>Pay by cheque</b>, "
    "or create a <b>credit note</b>.",
]),
shot("invoice-form", "Entering a customer invoice"),
entry("Posting a customer invoice", [
    ("Dr", "Accounts Receivable (the customer)", "invoice total"),
    ("Cr", "Sales / Service Revenue", "amount before VAT, per line"),
    ("Cr", "Output VAT", "VAT"),
]),
shot("invoice-view", "A posted invoice with payment status"),
p("If the customer is over their credit limit or has overdue invoices, a <b>Credit control</b> warning appears on the "
  "draft; with the strict policy the invoice cannot be posted until it is resolved (see Credit control below)."),
sec("Invoices in a foreign currency"),
p("Choose the <b>Currency</b> on the invoice (for example USD) — the exchange rate is filled from the rates table and "
  "can be changed. Amounts on the invoice are in USD; the ledger is booked in the branch currency at that rate. The "
  "invoice shows both."),
shot("invoice-fx", "A USD invoice booked in SAR"),
entry("When a foreign-currency invoice is paid at a different rate", [
    ("Dr", "Bank", "USD received × rate on the payment day"),
    ("Cr", "Accounts Receivable", "USD × the invoice's own rate"),
    ("Cr / Dr", "Realized Exchange Gain / Loss", "the difference"),
]),
sec("Credit notes"),
p("From a posted invoice choose <b>Credit Note / Return</b>: a draft credit note is created with the same lines; "
  "adjust it and post. If goods come back, Inventory receives them at the cost they left with."),
entry("Posting a credit note", [("Dr", "Sales Revenue and Output VAT", ""), ("Cr", "Accounts Receivable", "")]),
sec("Receiving payments"),
where("Sales → Customer Payments, or Register Payment on the invoice"),
steps([
    "On the invoice choose <b>Register Payment</b>. The amount due is filled in.",
    "Choose the bank or cash journal and the date, and <b>Confirm</b>.",
    "The invoice shows <b>Paid</b> or <b>Partially paid</b>. A payment can also be recorded without an invoice (an advance).",
]),
shot("payment-form", "Registering a payment against an invoice"),
entry("Customer receipt", [("Dr", "Bank / Cash", ""), ("Cr", "Accounts Receivable", "")]),
sec("Cheques and post-dated cheques (PDC)"),
where("Sales → Cheques Received, or Pay by cheque on the invoice"),
p("A cheque from a customer is registered with its number, bank and the <b>date on the cheque</b>. A later date makes "
  "it a post-dated cheque. The invoice shows as paid at once; the money reaches the bank only when the cheque clears."),
steps([
    "On the invoice choose <b>Pay by cheque</b>, enter the cheque number, bank and cheque date, and <b>Register cheque</b>.",
    "When you take it to the bank, open the cheque and <b>Mark as deposited</b> (no entry).",
    "When the bank credits it, choose <b>Cleared by the bank</b>. A post-dated cheque cannot clear before its date.",
    "If it comes back unpaid, choose <b>Bounced</b> and give the reason: the receipt is reversed and the invoice is open again.",
]),
shot("cheques-received", "Cheques received: not cleared, due and post-dated totals"),
entry("Cheque received → cleared", [
    ("Dr", "Cheques Under Collection", "on receipt"), ("Cr", "Accounts Receivable", "on receipt"),
    ("Dr", "Bank", "on clearing"), ("Cr", "Cheques Under Collection", "on clearing"),
]),
sec("Customer statements"),
where("Sales → Customer Statements"),
p("A statement of account lists every invoice, credit note and payment for a period with the running balance and "
  "the ageing of what is open. Download it as PDF or email it — one customer at a time or many at once — as a "
  "statement or a payment reminder."),
shot("statement", "Statement of account with ageing"),
sec("Credit control"),
where("Sales → Credit Control"),
p("This page lists customers over their credit limit, on hold, or with invoices overdue beyond the allowed days. The policy in "
  "Company settings is either <b>warn</b> (a warning on the invoice or order) or <b>block</b> (it cannot be posted). "
  "Put a customer on <b>credit hold</b> to stop new invoices and orders until released."),
shot("credit", "Credit control"),
sec("Recurring invoices"),
where("Sales → Recurring Invoices (or Make recurring on an invoice)"),
p("For rent, subscriptions and maintenance contracts: set the frequency (weekly, monthly, quarterly, yearly), the next date "
  "and whether to post and email automatically. Due documents are listed on the home screen and month-end page."),

sec("Invoice types"),
p("A new customer invoice starts by choosing its type. All are printed in English and Arabic with the right title."),
table(["Type", "Use it for"], [
    ["Tax Invoice", "The normal invoice"],
    ["Simplified Tax Invoice", "Retail customers (no buyer VAT number needed)"],
    ["Advance Payment Tax Invoice", "A down payment invoiced before delivery; VAT is charged now"],
    ["Tax Invoice (Final)", "A tax invoice that deducts earlier advances — printed automatically when it does"],
    ["Proforma Invoice", "A quotation in invoice form; no accounting effect"],
    ["Debit Note", "Increases an invoice already issued (price correction, extra work), with the reason"],
    ["Progress / Retention Release", "Made from a project's milestones (see Projects)"],
], [55, 125]),
shot("inv-types", "Choosing the invoice type"),
entry("Advance payment invoice (30% of 120,000)", [
    ("Dr", "Accounts Receivable", "41,400"), ("Cr", "Advances from Customers (liability)", "36,000"),
    ("Cr", "Output VAT", "5,400")]),
p("On the final invoice use <b>Deduct advance</b>: it adds a line \"Less: advance invoice …\" for the amount before "
  "VAT and reverses the advance's VAT with it. Vertex checks that no more than what is left of each advance is "
  "deducted, and <b>Sales → Customer Advances</b> shows every advance, what was deducted and what is left."),
entry("Final invoice 120,000 less the 36,000 advance", [
    ("Dr", "Accounts Receivable", "96,600 (what the customer still pays)"), ("Dr", "Advances from Customers", "36,000"),
    ("Cr", "Revenue", "120,000"), ("Cr", "Output VAT", "12,600 (18,000 less the 5,400 already charged)")]),
shot("final-print", "A final tax invoice with the advance deducted"),
p("A <b>proforma</b> is issued with its own number (PRO/…) and printed \"This is not a tax invoice\"; it is never "
  "posted. When the customer confirms, <b>Convert to tax invoice</b> creates the draft tax invoice with the same "
  "lines. A <b>debit note</b> is made from a posted invoice with <b>Debit Note</b>: enter the additional amount and "
  "the reason; it posts like an invoice (Dr Accounts Receivable / Cr Revenue / Cr Output VAT) and refers to the "
  "original invoice."),
shot("proforma", "An issued proforma, ready to convert"),

# ------------------------------------------------------------------ 5
ch("Purchasing and vendors", "Requests, quotations with sealed bids, award approval, purchase orders, receiving, "
   "three-way match, vendor bills and payments."),
sec("The purchasing flow"),
table(["Step", "Document", "Who"], [
    ["1", "Material Request — a department or project asks for items", "Any user"],
    ["2", "Approval — project manager first (for project requests), then the department approver", "Approvers"],
    ["3", "Request for Quotation — sent to several vendors; optionally sealed", "Purchasing"],
    ["4", "Award — recommended, then approved; the purchase order is created and confirmed", "Purchasing / approvers"],
    ["5", "Purchase Order — sent to the vendor, who accepts it (on the portal or by email)", "Purchasing"],
    ["6", "Receipt — stock into the warehouse, or a GRN for site deliveries and services", "Store / requester"],
    ["7", "Vendor Bill — checked against the PO and what was received (three-way match)", "Accounts"],
    ["8", "Payment or cheque", "Accounts"],
], [12, 120, 48]),
p("A purchase requisition is optional: an approved material request can go straight to an RFQ or a purchase "
  "order. You can also start with a purchase order (a <b>Direct PO</b>) or simply enter a vendor bill."),
shot("mr-actions", "An approved material request offers: issue from stock, request quotations, buy directly or a requisition"),
sec("Requests for quotation"),
where("Purchases → Requests for Quotation"),
p("An RFQ made from a material request copies its lines. Complete it before sending:"),
bullets([
    "<b>Header</b> — closing date and time (no quotations accepted after it), quotation validity, payment terms, "
    "Incoterms and delivery place, terms & conditions (the standard RFQ terms are filled in).",
    "<b>Lines</b> — item code, description and specification, manufacturer and part / model number, unit, quantity, "
    "required date, and whether alternatives are accepted. Drawings and data sheets are attached on the RFQ page.",
    "<b>Vendors</b> — search by name, or choose a category and <b>Add all approved in category</b>.",
    "<b>Sealed bids</b> — tick it for tenders: prices stay hidden from everyone until the closing time has passed "
    "and someone opens the bids (recorded with their name and time). No vendor ever sees another vendor's price.",
]),
p("<b>Save & email to vendors</b> sends each vendor the RFQ as a PDF (with a link to the supplier portal when they "
  "have an account). Quotations are entered by the buyer from the vendor's offer, or by the vendor on the portal."),
shot("rfq-form", "The RFQ form: header, vendor picker and detailed lines"),
shot("rfq-sealed", "A sealed RFQ before closing: two vendors have quoted, prices hidden"),
sec("Award approval"),
p("After the bids are opened the comparison shows each vendor's prices (lowest per line in green, the lowest "
  "complete quotation highlighted), lead times and validity. <b>Recommend award</b> chooses the vendor — a vendor "
  "other than the lowest needs a written reason — and sends the award for approval under the <b>RFQ Award</b> rules "
  "(demo: Procurement Manager; above 100,000 also the Finance Manager). The person who recommended cannot approve. "
  "When the award is approved the purchase order is created at the quoted prices and confirmed — the award approval "
  "is the PO approval."),
shot("rfq-award", "Bids opened, award waiting for the Procurement Manager"),
sec("Purchase orders"),
p("Each PO shows whether it is a <b>Requisition PO</b> (from a request, requisition or RFQ) or a <b>Direct PO</b>. "
  "Direct POs above the limits in Approval Workflow wait for approval. A confirmed PO is sent with <b>Send to vendor</b> "
  "(email with the PDF and terms) or <b>Mark as Sent</b>, and the vendor's answer is recorded as the "
  "<b>acknowledgement</b>: accepted with their order reference and promised delivery date (which updates the expected "
  "arrival), or rejected with a reason."),
shot("po-sent", "A sent PO accepted by the vendor, with its goods received notes"),
sec("Receiving"),
p("Stock items are received into the warehouse with a <b>Receipt</b> (Inventory). Items delivered to a site and "
  "services are received with a <b>GRN</b> (goods received note) from the PO: <b>Receive (GRN)</b>. A GRN for a "
  "material request can be made only by the requester, the project manager or team, or an administrator. It makes no "
  "accounting entry — the cost is booked by the bill — and prints with signature boxes."),
shot("grn", "A goods received note"),
sec("Three-way match"),
p("When a vendor bill linked to a PO is posted, Vertex compares, line by line, the quantity billed so far with the "
  "quantity received (receipts and GRNs) and the billed price with the PO price. Company settings decide what happens "
  "when they differ: <b>warn</b> (post with a warning), <b>stop the bill</b>, or do not check, with tolerances for "
  "quantity and price (demo: 0% and 2%)."),
sec("Vendor bills"),
where("Purchases → Vendor Bills"),
p("Enter the vendor's invoice number in <b>Reference</b>, the bill date and due date, and the lines. Bills created from "
  "a purchase order bring its lines; any price difference between the receipt and the bill is booked automatically. "
  "Invoices vendors send through the supplier portal arrive in the <b>AP Inbox</b> (see Supplier portal)."),
entry("Posting a vendor bill (expense or service)", [
    ("Dr", "Expense account", "amount before VAT"), ("Dr", "Input VAT", "VAT"), ("Cr", "Accounts Payable (the vendor)", "total"),
]),
entry("Goods: receipt then bill", [
    ("Dr", "Inventory", "on receipt, at the order price"), ("Cr", "Goods Received Not Invoiced", "on receipt"),
    ("Dr", "Goods Received Not Invoiced + Input VAT", "on the bill"), ("Cr", "Accounts Payable", "on the bill"),
]),
shot("bills", "Vendor bills with payment status"),
sec("Paying vendors"),
p("<b>Register Payment</b> on the bill (Dr Accounts Payable / Cr Bank), or <b>Pay by cheque</b> to issue a cheque. An "
  "issued cheque is booked to <b>Post-dated Cheques Issued</b> until the bank pays it; then choose <b>Cleared by the "
  "bank</b> on the cheque (Dr Post-dated Cheques Issued / Cr Bank)."),
sec("Vendor management"),
where("Vendors → Vendor Management"),
p("Keep vendor documents (CR, VAT certificate, bank letter, agreements) with their expiry dates, approve or block "
  "vendors, and score them on quality, delivery and price. Changing a vendor's bank account (IBAN) does not take effect "
  "at once: it goes to finance for approval, and payments keep using the current account until then."),
shot("vendors", "Vendor management"),

# ------------------------------------------------------------------ 5b
ch("Projects", "Customer jobs with a manager, team, budget, committed and actual cost, progress billing and retention."),
sec("Setting up a project"),
where("Projects → Projects → New project"),
p("A project has a code and name, the branch that runs it, the customer, the project manager and the team, dates and "
  "site address, the contract value and the <b>retention %</b> the customer holds back. Every project gets its own "
  "<b>cost centre</b> with the same code, so whatever is posted to it — bills, stock issued on its material "
  "requests, petty cash, journal entries — is the project's cost, and its invoices are its revenue."),
bullets([
    "<b>Budget</b> — one line per cost category on an expense account; a line on a group account (for example "
    "Cost of Revenue) covers every account under it.",
    "<b>Budget control</b> — warn or block when a material request is submitted or a purchase order is confirmed "
    "that would take a budget line over.",
    "<b>Milestones</b> — the progress billing plan; they cannot add up to more than the contract value.",
]),
shot("project-form", "The project form: team, budget lines and milestones"),
sec("The project page"),
p("Shows the contract value, budget used, invoiced, retention held and profit to date, and <b>Budget vs committed vs "
  "actual</b> per budget line: <b>Committed</b> = confirmed purchase orders not yet billed, <b>Actual</b> = costs "
  "posted to the project's cost centre, <b>Remaining</b> = Budget − Committed − Actual. All its requests, orders, "
  "invoices and bills are listed below, and new ones can be raised from the buttons at the top."),
shot("project", "A project with budget, milestones and documents"),
sec("Progress billing and retention"),
p("<b>Create invoice</b> on a milestone makes a draft progress invoice for its amount, with the retention deducted:"),
entry("Progress invoice 297,500 with 10% retention", [
    ("Dr", "Accounts Receivable", "312,375"), ("Dr", "Retention Receivable", "29,750"),
    ("Cr", "Revenue (project cost centre)", "297,500"), ("Cr", "Output VAT", "44,625 (on the full amount)")]),
p("At handover, <b>Release retention</b> invoices the retention held (Dr Accounts Receivable / Cr Retention "
  "Receivable, no VAT). Retention held always equals the Retention Receivable account."),
shot("progress-inv", "A progress tax invoice with the retention deduction"),

# ------------------------------------------------------------------ 5c
ch("Supplier onboarding and portal", "Suppliers register themselves, are approved, and then quote, confirm orders, send "
   "invoices and keep their documents up to date on the supplier portal."),
sec("Supplier registration"),
where("Vendors → Supplier Registrations"),
p("Copy the <b>registration link</b> (or email it) and share it with new suppliers. They fill in the company, contact "
  "and bank details and attach their CR, VAT certificate and bank letter (required) and any other documents. The "
  "IBAN is checked, a Saudi VAT number must have 15 digits, and the same VAT or CR number cannot register twice."),
shot("reg-form", "The public registration form"),
p("Each registration goes through the <b>Supplier Registration</b> approval (demo: procurement review, then a "
  "finance check of the bank details). The review page shows the details and documents, and warns about possible "
  "duplicates or an account name that differs from the company. Reviewers can <b>approve</b>, <b>ask for more "
  "information</b> (the supplier gets a private link, valid 14 days, to correct the form) or <b>reject</b> with a "
  "reason."),
shot("registration", "Reviewing a registration"),
p("On approval the vendor is created (approved, with its documents and bank details) and the supplier receives an "
  "<b>activation link</b> (valid 72 hours, used once) to choose a password. Passwords are never sent by email."),
sec("What suppliers do on the portal"),
table(["Menu", "What the supplier can do"], [
    ["Requests for Quotation", "See the RFQs they are invited to, download the PDF and attachments, submit or update "
     "their quotation until the closing time, or decline. On sealed RFQs they see only their own prices."],
    ["Purchase Orders", "View and download, accept (with their reference and promised date) or reject with a reason"],
    ["Invoices", "Send a tax invoice (PDF) for a PO or without one, and follow it: received, being processed, "
     "approved for payment, paid, or returned with our reason"],
    ["Payments", "Their bills with what is still to pay, and the payments made"],
    ["Documents", "See expiry dates and send renewed documents (they replace the old ones once accepted)"],
    ["Company & bank", "Ask to change the bank account, with a stamped bank letter"],
], [45, 135]),
shot("portal-home", "The supplier portal"),
shot("portal-rfq", "A supplier quoting on a sealed RFQ"),
sec("AP Inbox and bank changes"),
where("Vendors → AP Inbox"),
p("Invoices sent on the portal wait in the AP Inbox. <b>Create draft bill</b> makes the vendor bill — from the PO "
  "lines when the invoice names a PO — with the supplier's PDF attached; or <b>Return to the vendor</b> with a reason."),
shot("ap-view", "An invoice in the AP Inbox"),
p("A new bank account, whether asked for by the supplier or typed by staff, goes through the <b>Bank Details "
  "Change</b> approval (demo: Finance Manager). The page shows the current and new details side by side and the "
  "bank letter. Call the vendor on a number you already have before approving; until then payments use the old account."),
shot("bank-change", "A bank details change waiting for finance approval"),

# ------------------------------------------------------------------ 6
ch("Inventory", "Stock on hand, receipts, deliveries, transfers, adjustments and landed costs, valued at average cost."),
sec("Stock on hand"),
where("Inventory → Stock on Hand"),
p("Shows the quantity and value of every stock product in every warehouse, at average cost. The stock value always equals the "
  "inventory account in the ledger."),
shot("stock", "Stock on hand by warehouse"),
sec("Receipts and deliveries"),
p("Receipts come from purchase orders and deliveries from sales orders (or from invoices entered without an order). "
  "Open the document, check the quantities and choose <b>Validate</b>. Delivering less than ordered creates a "
  "backorder for the rest."),
entry("Delivery to a customer", [("Dr", "Cost of Goods Sold", "at average cost"), ("Cr", "Inventory", "")]),
shot("picking-view", "A validated delivery"),
p("Every receipt, delivery and return prints as a document — <b>Delivery Note</b>, <b>Goods Receipt Note</b>, return "
  "note — with quantities only (no prices) and signature boxes, from the PDF and Print buttons on the transfer."),
sec("Warehouse transfers"),
where("Inventory → Warehouse Transfers"),
p("Move stock between warehouses. Inside one branch the goods move at once at average cost and no entry is needed. "
  "Between branches they travel through <b>Goods in Transit</b> until the receiving branch confirms."),
steps([
    "Choose <b>+ New transfer</b>, the from and to warehouses, the products and quantities, then <b>Save & Send</b>.",
    "For another branch, the receiving branch opens the transfer and chooses <b>Receive goods</b> when they arrive.",
    "If the goods come back, choose <b>Returned to sender</b>.",
]),
entry("Transfer to another branch", [
    ("Dr", "Goods in Transit", "sending branch, on sending"), ("Cr", "Inventory", "sending branch"),
    ("Dr", "Inter-branch current account", "sending branch, on receipt"), ("Cr", "Goods in Transit", "sending branch"),
    ("Dr", "Inventory", "receiving branch"), ("Cr", "Inter-branch current account", "receiving branch"),
]),
shot("wtransfer-view", "A transfer in transit to another branch"),
sec("Adjustments and landed costs"),
p("<b>Adjustments</b>: enter the counted quantity; the difference is booked against Inventory Adjustments. "
  "<b>Landed costs</b>: spread freight, customs and clearing over the goods of one or more receipts (by value or by quantity); the part still in stock goes to Inventory and the part already sold to Cost of Goods Sold."),

# ------------------------------------------------------------------ 7
ch("Point of Sale and CRM", "Selling over the counter and managing the sales pipeline."),
sec("Point of Sale"),
where("Point of Sale"),
p("Open a session on a register with the opening cash, sell from the touch screen (search or tap products, choose the "
  "customer if needed, take cash and/or card), print the receipt, and close the session with the cash counted. On "
  "closing, Vertex posts one entry for the session and one stock movement."),
entry("Closing a POS session", [("Dr", "Cash / Card clearing", ""), ("Cr", "Sales and Output VAT", ""),
                                ("Dr", "Cost of Goods Sold", ""), ("Cr", "Inventory", ""), ("Dr / Cr", "Cash Over / Short", "difference counted")]),
shot("pos", "Point of Sale registers and sessions"),
sec("CRM"),
where("CRM → Pipeline"),
p("Each lead or opportunity moves through the stages New → Qualified → Proposal → Negotiation → Won / Lost. Drag the "
  "cards between columns, plan calls and meetings as activities, and create the quotation from the lead. The CRM report "
  "shows the pipeline value, win rate and reasons for lost deals."),
shot("crm", "The CRM pipeline"),

# ------------------------------------------------------------------ 8
ch("Accounting", "Journal entries, petty cash, inter-branch transfers, budgets, foreign currency and recurring entries."),
sec("Journal entries"),
where("Accounting → Journal Entries"),
steps([
    "Choose <b>+ New Entry</b>, the branch, journal and date, and a narration.",
    "On each line search the account (type part of its name or code), choose the partner or cost centre if needed and "
    "enter the debit <i>or</i> the credit — typing one clears the other.",
    "The difference at the bottom must be zero. <b>Save & Post</b>, or <b>Save as Draft</b> to post later.",
]),
shot("jv-view", "A posted journal entry"),
tip("Print a <b>Journal Voucher</b> with Prepared by / Reviewed by / Approved by boxes from the PDF or Print button on the entry."),
sec("Petty cash"),
where("Accounting → Petty Cash"),
p("Each petty cash fund (office, warehouse, site) has its own cash account and a fixed float. The custodian pays small "
  "expenses and records them on expense vouchers with the receipt numbers and VAT."),
steps([
    "Create the fund once: name, branch, custodian and float. Vertex creates its cash account and journal.",
    "<b>Top up</b> from the bank to the float.",
    "For each spend, add an <b>Expense voucher</b>: expense account, description, receipt number, amount before VAT and VAT.",
    "Count the cash from time to time with <b>Record cash count</b>; any difference goes to Cash Over / Short.",
]),
entry("Petty cash", [("Dr", "Petty Cash", "top-up"), ("Cr", "Bank", "top-up"),
                     ("Dr", "Expense + Input VAT", "voucher"), ("Cr", "Petty Cash", "voucher")]),
shot("petty-fund", "A petty cash fund with vouchers and top-ups"),
sec("Inter-branch transfers"),
where("Accounting → Inter-branch Transfers"),
p("Records money sent from one branch's bank account to another branch's. Each branch books its side against the inter-branch current "
  "account; consolidated reports eliminate the two."),
sec("Foreign-currency revaluation"),
where("Accounting → Currency Revaluation"),
p("At each month end, open invoices and bills in a foreign currency are restated at the month-end rate. The screen "
  "lists each open document with the rate it was booked at, the month-end rate and the difference. <b>Post "
  "revaluation</b> books the difference as unrealized gain or loss and reverses it on the first day of the next month; "
  "the real difference is booked when the document is paid."),
shot("fx", "Open foreign-currency documents and the revaluation"),
sec("Budgets"),
where("Accounting → Budgets"),
p("Enter a budget per branch (and optionally per cost centre) for each income and expense account by month — or start "
  "from last year's actuals plus a percentage. <b>Budget vs Actual</b> shows the month, year to date or full year with "
  "the variance and the % of budget used, in red where unfavourable."),
shot("budget", "Budget vs actual"),
sec("Recurring entries"),
p("For rent accruals, standing charges and similar entries, choose <b>Make recurring</b> on a journal entry, invoice or bill, set "
  "the frequency and next date, and the documents are created when due."),

# ------------------------------------------------------------------ 9
ch("Bank and cash", "Reconciling the bank and managing cheques."),
sec("Bank reconciliation"),
where("Bank → Bank Reconciliation"),
steps([
    "Choose <b>+ New Statement</b>, the bank journal, and import the bank's statement as a CSV file (or type the lines).",
    "<b>Auto-match</b> pairs statement lines with payments of the same amount and date range.",
    "For each remaining line: match it to an existing payment, create the payment for an open invoice, or book it "
    "directly to an account (bank charges, interest).",
    "When every line is matched the statement is reconciled. The Reconciliation Report shows book balance versus bank.",
]),
shot("bank-statement", "Matching bank statement lines"),
sec("Cheques"),
p("Cheques Received and Cheques Issued are in the Bank app as well as in Sales and Purchases. Check the <b>Due</b> tab "
  "every morning: it lists the cheques whose date has come — received cheques ready to deposit, and issued cheques "
  "the bank will pay."),

# ------------------------------------------------------------------ 10
ch("Fixed assets and prepaid", "Depreciation and spreading costs and revenue over months."),
sec("Fixed assets"),
where("Fixed Assets"),
p("Register an asset (or choose <b>Register Asset</b> on a vendor bill) with its category, cost, salvage value, start "
  "date and life. Confirming it creates the depreciation schedule (straight line or declining balance). Each month the "
  "due lines are posted from the asset or from Month-end Closing. Sell or dispose of an asset to book the gain or loss."),
entry("Monthly depreciation", [("Dr", "Depreciation Expense", ""), ("Cr", "Accumulated Depreciation", "")]),
shot("asset-view", "An asset with its depreciation schedule"),
sec("Prepaid expenses, deferred revenue and accruals"),
where("Prepaid & Accruals (or Spread over months on an invoice or bill)"),
table(["Type", "Each month"], [
    ["Prepaid expense (e.g. annual insurance paid in advance)", "Dr Expense / Cr Prepaid Expenses"],
    ["Deferred revenue (e.g. a yearly contract invoiced upfront)", "Dr Deferred Revenue / Cr Revenue"],
    ["Accrual (e.g. electricity used, not yet billed)", "Dr Expense / Cr Accrued Expenses (optionally reversed on the 1st)"],
], [100, 80]),

# ------------------------------------------------------------------ 11
ch("HR & Payroll", "Employees, monthly payroll, GOSI and WPS, leave, loans, end of service and final settlement — under Saudi and UAE labour law."),
sec("Employees"),
where("HR & Payroll → Employees"),
p("Each employee has a number, names, branch, department, job title and cost centre; the labour law (Saudi Arabia or "
  "UAE) and whether they are a national; salary (basic, housing, transport, other allowances); ID / Iqama and passport "
  "with expiry dates; GOSI number; bank and IBAN. The profile shows the leave balance, end-of-service to date, loans and "
  "every payslip."),
shot("employee", "An employee profile"),
sec("Monthly payroll"),
where("HR & Payroll → Payroll"),
steps([
    "Choose the branch and month and <b>Prepare payroll</b>. Salaries come from the employee records; new joiners and "
    "leavers are paid for their days.",
    "Enter overtime hours, additions (bonus, commission), deductions and unpaid days for anyone who needs them, and "
    "<b>Save and recalculate</b>. Approved unpaid leave is deducted automatically; loan instalments are deducted automatically.",
    "<b>Post payroll</b> books the month. Download the <b>Bank salary file (WPS)</b> for the bank and print the payslips "
    "and the payroll register.",
    "When the bank transfers the salaries, <b>Record salary payment</b>.",
]),
shot("payroll-run", "A payroll run with the entry it posts"),
entry("Posting the payroll", [
    ("Dr", "Salaries & Wages", "gross pay, by cost centre"), ("Dr", "GOSI Contributions", "company share"),
    ("Cr", "GOSI Payable", "employee + company share"), ("Cr", "Employee Loans & Advances", "instalments deducted"),
    ("Cr", "Salaries Payable", "net pay"),
    ("Dr / Cr", "End of Service Benefits / Provision", "the month's change in the obligation"),
    ("Dr / Cr", "Vacation Pay / Provision", "the month's change in unused leave"),
]),
sec("GOSI, overtime and the rules applied"),
table(["", "Saudi Arabia", "UAE"], [
    ["Social insurance", "GOSI on basic + housing (capped): Saudi 9.75% employee, 11.75% company; non-Saudi 2% company", "—"],
    ["Annual leave", "21 days a year, 30 after 5 years", "30 days a year"],
    ["Overtime per hour", "hourly wage + 50% of hourly basic", "hourly basic + 25%"],
    ["End of service", "½ month per year for 5 years, 1 month after; on resignation nothing under 2 years, ⅓ for 2–5, ⅔ for 5–10", "21 days' basic per year for 5 years, 30 after; nothing under 1 year"],
], [34, 86, 60]),
p("Rates, the GOSI ceiling, the wage used for end of service and the payroll accounts can be changed in "
  "<b>HR & Payroll → HR Settings</b>."),
shot("payslip", "A payslip"),
sec("Leave and loans"),
p("<b>Leave</b>: record annual, sick, unpaid or other leave and <b>Approve</b> it. Approved annual leave reduces the "
  "balance; approved unpaid leave is deducted in that month's payroll. <b>Loans & Advances</b>: enter the amount, the "
  "monthly instalment and the first month, then <b>Save & Pay out</b> (Dr Employee Loans / Cr Bank). Instalments are "
  "deducted from each payroll until repaid."),
sec("Final settlement"),
where("HR & Payroll → Final Settlements (or Final settlement on the employee)"),
p("Choose the employee, the last working day and the reason (resignation, termination, end of contract). Vertex "
  "calculates the end-of-service benefit for that reason, the value of unused leave and the loan balance to recover. "
  "Posting uses up the provisions already booked and books only the difference; the employee is marked as left. Print "
  "the settlement for signature, then record the payment."),
sec("HR reports"),
p("<b>End of Service & Leave</b> shows each employee's obligation today against what is booked. <b>Expiring "
  "Documents</b> lists Iqamas and passports expiring within the days you choose."),
shot("provisions", "End-of-service and leave obligations"),

# ------------------------------------------------------------------ 12
ch("Month-end and year-end", "Closing the month and the year."),
sec("Month-end closing"),
where("Accounting → Month-end Closing"),
p("This page brings together everything a month end needs: draft entries and invoices still open, deliveries not validated, "
  "invoices not matched to goods, recurring documents due, depreciation and prepaid lines due (post them with one "
  "button), and the year-end closing."),
shot("closing", "The month-end closing page"),
table(["#", "Month-end checklist"], [
    ["1", "Post or delete drafts; validate deliveries and receipts"],
    ["2", "Post depreciation and prepaid / accrual lines due"],
    ["3", "Run the payroll and post it"],
    ["4", "Reconcile each bank account; clear cheques due"],
    ["5", "Revalue open foreign-currency invoices and bills"],
    ["6", "Review the trial balance, P&L and balance sheet; compare with the budget"],
    ["7", "Set the lock date to the month end (Settings → Company)"],
], [10, 170]),
sec("Year-end closing"),
p("After the last month of the financial year is reviewed, the year-end closing moves the year's income and expense "
  "balances to <b>Retained Earnings</b> with a closing entry per branch, and can set the lock date. It can be reopened "
  "(the closing entry is removed) as long as the year is not locked."),
entry("Year-end closing", [("Dr", "Each income account", "its balance"), ("Cr", "Each expense account", "its balance"),
                           ("Cr / Dr", "Retained Earnings", "the year's profit or loss")]),

# ------------------------------------------------------------------ 13
ch("Reports, printing and exports", "Financial statements and analysis, printed with your letterhead."),
sec("The reports"),
table(["Report", "Shows"], [
    ["Profit & Loss", "Income and expenses for a period, per branch and consolidated"],
    ["Balance Sheet", "Assets, liabilities and equity at a date"],
    ["Trial Balance", "Opening, debits, credits and closing of every account"],
    ["General Ledger", "Every line of an account (or all accounts) with the running balance"],
    ["P&L by Cost Centre", "Profit and loss with one column per cost centre"],
    ["Budget vs Actual", "Budget, actual, variance and % used"],
    ["Partner Ledger", "Opening, debit, credit and closing per customer / vendor; click one for every entry with the running balance"],
    ["Aged Receivables / Payables", "What each customer owes / you owe each vendor by age: not due, 1–30, 31–60, 61–90, 90+ days"],
    ["VAT Report", "Output and input VAT by rate, and the net VAT payable, per branch"],
    ["Sales Analysis", "Sales by product, customer, branch or month"],
    ["Stock vs Invoices", "Goods invoiced but not delivered, delivered but not invoiced, and the like"],
], [50, 130]),
sec("Using a report"),
bullets([
    "Tick the <b>branches</b> to include; more than one gives a consolidated report with an eliminations column.",
    "Set the dates. <b>In group currency</b> translates branches in other currencies (balance sheet at the closing rate, "
    "P&L at the average rate).",
    "<b>Levels</b> shows all accounts, groups only, or a number of levels of the chart.",
    "Click an account to open its general ledger, and a line there to open the entry.",
]),
shot("reports-pl", "Profit & Loss, consolidated, with the export buttons"),
sec("PDF, Excel, CSV and Print"),
p("Every report has four buttons: <b>PDF</b> downloads a printable file, <b>Excel</b> a formatted workbook with real "
  "numbers, <b>CSV</b> raw data for other systems, and <b>Print</b> opens the PDF to print. Printed reports carry the "
  "company logo and names in English and Arabic, CR and VAT, the title in both languages, the period, branches and "
  "currency, and at the bottom of every page who printed it, when, and \"Page x of y\". Documents — invoices, "
  "vouchers, payslips, settlements, cheques — add <b>Prepared by / Reviewed by / Approved by</b> signature boxes."),
shot("reports-bs", "Balance Sheet grouped by the chart of accounts"),
shot("reports-aged", "Aged Receivables"),
shot("partner-ledger", "Partner Ledger: customers with their balances"),

# ------------------------------------------------------------------ 13b
ch("Security and backups", "Users, passwords, protection built in, and keeping your data safe."),
sec("Users and passwords"),
bullets([
    "Roles: <b>Admin</b> (everything, including settings), <b>Accountant</b> (enters and posts documents), "
    "<b>Viewer</b> (reads only). Users can be limited to some branches.",
    "Passwords need at least 8 characters with letters and numbers. Five wrong passwords lock the user for 15 minutes.",
    "While someone signs in with a published demo password, a red banner asks them to change it.",
    "Users are signed out after 8 idle hours. Every change is in the <b>Audit Log</b> (Settings).",
]),
sec("Backups"),
where("Settings → Backups"),
p("<b>Back up now</b> makes one file with the whole database and every uploaded document; backups can be downloaded "
  "from the list. On the server, run <b>python manage.py daily</b> every night: it makes the backup, creates the "
  "recurring documents that are due, sends approval reminders and emails suppliers about documents about to expire. "
  "Keep a copy of the backups away from the server."),
shot("backups", "Backups"),

# ------------------------------------------------------------------ 14
ch("Moving from your old system", "Importing master data, opening balances and history."),
where("Data Import"),
p("Data Import brings in the chart of accounts, customers and vendors, products, opening balances, open invoices and "
  "bills, opening stock, fixed assets, and history (journal entries, invoices, payments) from Excel or CSV files. Employees are entered in HR & Payroll. Download the template for each, fill it in (or upload your "
  "own export and map its columns), check the preview — errors are shown line by line — and import."),
shot("import", "Data import"),
table(["Order", "Import", "Notes"], [
    ["1", "Chart of accounts", "Or keep the standard chart and add your accounts"],
    ["2", "Customers, vendors, products", ""],
    ["3", "Opening trial balance", "At the day before go-live; receivables and payables as totals or per partner"],
    ["4", "Open invoices and bills", "So ageing, statements and payments continue"],
    ["5", "Fixed assets", "With cost and accumulated depreciation to date"],
    ["6", "Opening stock", "Quantities and cost per warehouse"],
], [14, 60, 106]),
tip("Import into a test copy first, compare the trial balance with the old system, then import into the live company."),
]

APPENDIX_ENTRIES = [
    ("Customer invoice", "Accounts Receivable", "Revenue + Output VAT"),
    ("Advance payment invoice", "Accounts Receivable", "Advances from Customers + Output VAT"),
    ("Final invoice — advance deducted", "Accounts Receivable + Advances from Customers", "Revenue + Output VAT (net)"),
    ("Debit note", "Accounts Receivable", "Revenue + Output VAT"),
    ("Progress invoice with retention", "Accounts Receivable + Retention Receivable", "Revenue + Output VAT"),
    ("Retention release", "Accounts Receivable", "Retention Receivable"),
    ("Customer credit note", "Revenue + Output VAT", "Accounts Receivable"),
    ("Customer receipt", "Bank / Cash", "Accounts Receivable"),
    ("Cheque received", "Cheques Under Collection", "Accounts Receivable"),
    ("Cheque received — cleared", "Bank", "Cheques Under Collection"),
    ("Cheque received — bounced", "Accounts Receivable", "Cheques Under Collection"),
    ("Vendor bill (expense)", "Expense + Input VAT", "Accounts Payable"),
    ("Goods receipt", "Inventory", "Goods Received Not Invoiced"),
    ("Vendor bill for goods received", "GRNI + Input VAT", "Accounts Payable"),
    ("Vendor payment", "Accounts Payable", "Bank / Cash"),
    ("Cheque issued", "Accounts Payable", "Post-dated Cheques Issued"),
    ("Cheque issued — cleared", "Post-dated Cheques Issued", "Bank"),
    ("Delivery to a customer", "Cost of Goods Sold", "Inventory"),
    ("Customer return of goods", "Inventory", "Cost of Goods Sold"),
    ("Stock adjustment (gain)", "Inventory", "Inventory Adjustments"),
    ("Transfer between branches — sent", "Goods in Transit", "Inventory"),
    ("Transfer — received (sender)", "Inter-branch Current Account", "Goods in Transit"),
    ("Transfer — received (receiver)", "Inventory", "Inter-branch Current Account"),
    ("Petty cash top-up", "Petty Cash", "Bank"),
    ("Petty cash voucher", "Expense + Input VAT", "Petty Cash"),
    ("Depreciation", "Depreciation Expense", "Accumulated Depreciation"),
    ("Prepaid released", "Expense", "Prepaid Expenses"),
    ("Deferred revenue released", "Deferred Revenue", "Revenue"),
    ("Accrual", "Expense", "Accrued Expenses"),
    ("Payroll", "Salaries & Wages + GOSI Contributions", "GOSI Payable + Loans + Salaries Payable"),
    ("End-of-service provision", "End of Service Benefits", "End of Service Provision"),
    ("Vacation provision", "Vacation Pay", "Vacation Pay Provision"),
    ("Salary payment", "Salaries Payable", "Bank"),
    ("Employee loan paid out", "Employee Loans & Advances", "Bank"),
    ("Foreign-currency payment, rate up (customer)", "Bank", "Receivable + Realized Exchange Gain"),
    ("Month-end revaluation (receivable up)", "Accounts Receivable", "Unrealized Exchange Gain"),
    ("Year-end closing (profit)", "Income accounts", "Expense accounts + Retained Earnings"),
]

SHORTCUTS = [
    ("/", "Search apps and menus (home screen) or the sidebar menu (inside an app)"),
    ("Ctrl + K (Cmd + K on a Mac)", "Search apps and menus from the home screen"),
    ("Type in a drop-down", "Filter accounts, customers, products by name or code"),
    ("↑ ↓, Enter, Tab", "Move in a drop-down list and choose"),
    ("Esc", "Close a drop-down list or clear the search"),
    ("Tab on the last box of the last line", "Add a new line (invoices, bills, journal entries, petty cash)"),
]

FAQ = [
    ("I cannot see a menu described in this guide.",
     "The module is not in your licence, or your user role or branches do not include it. Ask your administrator."),
    ("I posted a document with a mistake.",
     "For an invoice or bill without payments: Reset to Draft, correct it and post again. Otherwise issue a credit note or a reversing entry. Nothing can be changed on or before the lock date."),
    ("Why can I not post to an account?",
     "It is a group account (it only holds other accounts). Choose one of the accounts under it."),
    ("The invoice says the customer is over the credit limit.",
     "Collect overdue invoices, raise the limit (customer record) or ask an administrator to release the hold."),
    ("A post-dated cheque will not clear.",
     "A cheque cannot clear before the date written on it. Clear it on or after that date."),
    ("Where does the payroll GOSI go?",
     "The company share is an expense (GOSI Contributions); both shares sit in GOSI Payable until you pay GOSI."),
    ("How do I print in Arabic?",
     "Switch the language with the العربية button at the top, then print or download the PDF. Titles, labels and layout follow the language; the company details always show in both languages."),
]
