On this page
Core accounting termsReportsPayroll & HRSetup / platformPermission keysData model notes
Glossary
Core accounting terms
| Term | Meaning in this module |
|---|
| Account | A single line in the chart of accounts (e.g. "Cash," "Patients Receivable," "VAT Payable"). Has a type (Asset/Liability/Equity/Revenue/Expense, plus three contra-types), an optional parent (for hierarchy), and can be marked postable or not (header/grouping accounts aren't postable). |
| Journal Entry | A set of debit/credit lines that must sum to zero. The atomic unit of the ledger — everything that affects the books is a journal entry, whether posted by a person (manual) or by the system (automated). |
| Posting | The act of turning some event (an invoice, a payment, a depreciation run) into a balanced journal entry and recording it against the ledger. |
| Account Mapping / Posting Role | A named "slot" (e.g. AR_PATIENT, VAT_PAYABLE, COGS) that an automated posting targets. A clinic can point each role at a specific account or leave it on the system default — see Setup & Foundations. There are 30 roles across 11 groups. |
| Fiscal Period | One calendar month, trackable as Open, Soft Closed, or Hard Closed. Soft close can be reopened; hard close is final. |
| Trial Balance | A report listing every account's net balance, on its natural debit or credit side, for a period — the standard "does everything add up" check. |
| General Ledger | The complete set of posted accounts and their activity; browsable account-by-account. |
| Account Ledger | A single account's full transaction history with a running balance — the "bank statement" view of one account. |
| Responsibility Center | An optional tag (department, location, branch, program) attachable to a journal line, independent of the account it hits. Has a kind — COST, REVENUE, PROFIT, or INVESTMENT (default COST) — used to run a P&L per center and, for non-cost kinds, to receive allocated overhead from a cost-kind center. This model was renamed from "Cost Center" earlier in this PR's development; the field is responsibilityCenterId everywhere in the schema. |
| Responsibility Center Mapping | A rule that auto-assigns a responsibility center to postings based on a dimension — procedure group, doctor, or branch — resolved at posting time and denormalized onto the journal line. Shown in the UI as "Revenue Mappings." Multiple rules can match the same posting; Automations & Controls sets which dimension wins (mappingPrecedence). |
| Allocation Rule | A step-down overhead allocation: spreads a COST-kind responsibility center's pooled costs onto one or more PROFIT/INVESTMENT-kind target centers, by a driver (manual weight, chair-minutes, or procedure count). Running the rule for a period (an "Allocation Run") posts a real, reversible journal entry that nets to zero. |
| Reversal | Posting a new, opposite-signed journal entry to cancel out a mistaken one. The original entry is never deleted or edited — the ledger is append-only. |
| Adjustment entry | A journal entry flagged isAdjustment: true, which allows it to post into a soft-closed fiscal period (e.g. a correcting entry or a reversal). |
| Functional currency | A company's home/reporting currency. Multi-currency journal lines carry both their original (transaction) amount and the equivalent in functional currency; the debit=credit check happens in functional currency. |
Reports
| Term | Meaning |
|---|
| Income Statement (P&L) | Revenue minus expenses over a period, following a Revenue → Cost of Revenue → Gross Profit → Operating Expenses → EBITDA → Net Profit waterfall. |
| Balance Sheet | Assets, Liabilities, and Equity at a point in time; must satisfy Assets = Liabilities + Equity. |
| Cash Flow Statement | Cash movement over a period, split into Operating, Investing, and Financing activity. |
| Statement of Changes in Equity | Opening equity, owner contributions, net income, and other movements, reconciled to closing equity. |
| Aging (AR/AP Aging) | Outstanding balances bucketed by how overdue they are (default buckets: 30/60/90/120 days). |
| Statement of Account | One party's (patient, insurer, supplier, or lab) full transaction history with the clinic — opening balance, activity, closing balance. |
| Reconciliation (company-wide) | An automatic, always-live check comparing the GL's balance for cash/AR/inventory/AP/doctor-payable against the actual operational tables, to catch posting drift. Distinct from Bank Reconciliation (see below). |
| Bank Reconciliation | A per-treasury, user-initiated comparison of the GL's cash balance against an external bank statement, with manually entered statement lines. |
| Zakat | An Islamic wealth tax; the Tax overview computes an estimated Zakat base and amount due, explicitly flagged as a planning figure, not a filing-ready number. |
| ZATCA | Saudi Arabia's Zakat, Tax and Customs Authority — the e-invoicing compliance authority. This module's "ZATCA" tab is a reconciliation check against the clinic's existing, separate e-invoicing system, not a filing integration. |
Payroll & HR
| Term | Meaning |
|---|
| Salary Profile | One employee's compensation configuration: base salary, pay method, and (for hourly/attendance-tracked staff) contracted hours, overtime multiplier, lateness grace period, and leave entitlement settings. |
| Payroll Run | One month's payroll for a company, moving through Draft → Pending Review → Confirmed → Processed. Contains one line per included employee. |
| Commission Policy | Per-company/branch/doctor configuration of how a doctor's commission is calculated: on production (work completed) or on payment (money collected), with optional deductions. Most-specific policy wins. |
| Doctor Payout | A payment to a doctor that settles their outstanding commission first, then any remaining base-salary amount — distinct from a payroll run, though a payroll run triggers the same payout mechanism internally. |
| Work Schedule | An employee's expected working days/hours — either inherited from their branch, offset from it, or fully custom — used to compute worked-vs-scheduled hours and overtime in payroll. |
| Leave Kind | The category of leave: Annual, Sick, Unpaid, Permission, Mission, or Other. Permission/Mission are typically "hourly" (measured in hours within a day) rather than day-based. |
| Accrual (leave) | Optionally, leave entitlement can build up incrementally over the year (monthly or weekly) rather than being granted all at once on day one. |
| Term | Meaning |
|---|
| Feature Flag | A remote, rule-evaluated switch (not a hardcoded toggle) that controls whether a company sees the accounting module. Can target specific companies by country, tier, beta status, etc. |
| Category | A generic tagging model (this PR) that replaced several separate hard-coded lists (expense types, income types, appointment types, salary-adjustment types) with one flexible system that can also carry an accounting classification. |
| Posting Automation Setting | Per-event-type (invoice, payment, expense, depreciation, etc.) control over whether that event auto-posts, and whether it lands as a finished (Posted) entry or a Draft needing review. |
| Accounting Settings | Company-wide accounting behavior controls: segregation-of-duties enforcement, period-lock enforcement, whether manual journals require a responsibility center (requireResponsibilityCenterOnManual), a fallback responsibility center, whether revenue mapping is enabled and its dimension precedence, GL drift alerting, aging buckets, audit retention period. |
| Pending Posting (outbox) | A durable queue of operational events waiting to post to the ledger, used so a transient posting failure doesn't block the operational action (a payment, an invoice) that triggered it. Retried automatically. |
Permission keys
These are the permission strings a clinic's permission group can grant, assignable in Settings → Groups, and checked both to show/hide menu items and (independently, and authoritatively) on the server for every query and mutation.
| Permission | Grants |
|---|
VIEW_GL | View the general ledger, journal entries, account ledger, audit log. |
VIEW_REPORTS | View accounting reports (trial balance, financial statements, receivables/payables, etc.) without ledger/posting access. |
POST_JOURNAL | Post manual journals, payment vouchers, expense claims, debit notes, bank reconciliations, recurring journals. |
APPROVE_JOURNAL | Approve or reject journal entries and expense claims. |
REVERSE_JOURNAL | Reverse a posted manual journal entry. |
MANAGE_COA | Manage the chart of accounts, account mapping, tax codes, responsibility centers, responsibility-center mappings, allocation rules, automations, tax return generation/filing. |
MANAGE_FX_RATES | Manage exchange rates (and, web-only, currencies). |
MANAGE_FIXED_ASSETS | Manage fixed assets and run depreciation (also grantable via CLOSE_PERIOD for the depreciation action specifically). |
CLOSE_PERIOD | Close/reopen fiscal periods, close a fiscal year. |
VIEW_SALARY_HUB / MANAGE_SALARY_HUB | View / manage Salary Hub (salary profiles, payroll settings, commission policies). |
PROCESS_PAYROLL | Start, confirm, process, and cancel payroll runs. |
VIEW_OWN_SALARY | Access "My Income" (always scoped to the logged-in user only). |
MANAGE_HR | Manage leave types, holidays, and work schedules. |
APPROVE_LEAVE | Approve/reject leave requests (and book leave on behalf of others, auto-approved). |
REQUEST_LEAVE | Submit a leave request for oneself. |
Data model notes
The accounting module deliberately deviates from this codebase's usual "one resolver file per action" convention. Instead of files like resolvers/mutations/actions/accounting/addAccount.js, the business logic is consolidated into a small number of larger files (packages/server/src/resolvers/mutations/ledgerMutations.js, queries/ledgerQueries.js, and others), with the real accounting logic (posting, reports, close, depreciation) factored into a dedicated packages/server/src/accounting/ package. This is intentional for this module, not a convention violation to flag in review.