Dentolize · Accounting Module Walkthrough
On this pageCore accounting termsReportsPayroll & HRSetup / platformPermission keysData model notes

Glossary

Core accounting terms

TermMeaning in this module
AccountA 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 EntryA 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).
PostingThe 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 RoleA 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 PeriodOne calendar month, trackable as Open, Soft Closed, or Hard Closed. Soft close can be reopened; hard close is final.
Trial BalanceA 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 LedgerThe complete set of posted accounts and their activity; browsable account-by-account.
Account LedgerA single account's full transaction history with a running balance — the "bank statement" view of one account.
Responsibility CenterAn optional tag (department, location, branch, program) attachable to a journal line, independent of the account it hits. Has a kindCOST, 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 MappingA 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 RuleA 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.
ReversalPosting 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 entryA 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 currencyA 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

TermMeaning
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 SheetAssets, Liabilities, and Equity at a point in time; must satisfy Assets = Liabilities + Equity.
Cash Flow StatementCash movement over a period, split into Operating, Investing, and Financing activity.
Statement of Changes in EquityOpening 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 AccountOne 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 ReconciliationA per-treasury, user-initiated comparison of the GL's cash balance against an external bank statement, with manually entered statement lines.
ZakatAn 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.
ZATCASaudi 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

TermMeaning
Salary ProfileOne 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 RunOne month's payroll for a company, moving through Draft → Pending Review → Confirmed → Processed. Contains one line per included employee.
Commission PolicyPer-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 PayoutA 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 ScheduleAn 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 KindThe 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.

Setup / platform

TermMeaning
Feature FlagA 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.
CategoryA 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 SettingPer-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 SettingsCompany-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.

PermissionGrants
VIEW_GLView the general ledger, journal entries, account ledger, audit log.
VIEW_REPORTSView accounting reports (trial balance, financial statements, receivables/payables, etc.) without ledger/posting access.
POST_JOURNALPost manual journals, payment vouchers, expense claims, debit notes, bank reconciliations, recurring journals.
APPROVE_JOURNALApprove or reject journal entries and expense claims.
REVERSE_JOURNALReverse a posted manual journal entry.
MANAGE_COAManage the chart of accounts, account mapping, tax codes, responsibility centers, responsibility-center mappings, allocation rules, automations, tax return generation/filing.
MANAGE_FX_RATESManage exchange rates (and, web-only, currencies).
MANAGE_FIXED_ASSETSManage fixed assets and run depreciation (also grantable via CLOSE_PERIOD for the depreciation action specifically).
CLOSE_PERIODClose/reopen fiscal periods, close a fiscal year.
VIEW_SALARY_HUB / MANAGE_SALARY_HUBView / manage Salary Hub (salary profiles, payroll settings, commission policies).
PROCESS_PAYROLLStart, confirm, process, and cancel payroll runs.
VIEW_OWN_SALARYAccess "My Income" (always scoped to the logged-in user only).
MANAGE_HRManage leave types, holidays, and work schedules.
APPROVE_LEAVEApprove/reject leave requests (and book leave on behalf of others, auto-approved).
REQUEST_LEAVESubmit 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.