Skip to main content

Financial Entries

An Entry is the core entity in Moonlight. It records a financial operation: the movement of money between parties.

Active development

The entry model below reflects the current build. Moonlight is in active development, so a few fields are still being stabilised and a couple of statuses (notably CANCELLED) are present in the schema but not yet used by any workflow. Where this matters, the page calls it out explicitly.

Entry Structure

Each entry contains:

FieldDescription
entryTypeINCOME or EXPENSE
entryStatusCurrent lifecycle status
amountCentsAmount in cents (e.g., 50000 = $500.00)
baseCurrencyCurrency code (USD, EUR, etc.)
fromParty / toPartyParties involved in the operation
entryDateDate of the financial operation
referenceExternal reference number (invoice #, etc.)
isCompleteWhether all required proofs are present
isReconciledWhether the entry has been verified by the accountant
reconciledAtTimestamp when entry was marked as reconciled
reconciledByUser ID of the person who reconciled the entry
relatedEntryIdLink to related entry (refund, reimbursement)
externalIdStable id from the source system (e.g. neary:purchase:100); see External References
externalSourceName of the source system (e.g. neary)
fxSettlementCurrencyCurrency the entry is settled into (e.g. KHR for Cambodia)
fxRateConversion rate baseCurrency → fxSettlementCurrency
fxSettlementAmountCentsamountCents × fxRate, stored to avoid recomputation drift
fxRateDateDate of the FX rate snapshot
fxRateSourceSource of the rate (e.g. NBC for the National Bank of Cambodia)

The FX columns are populated whenever the ingest payload carries an fx block; they let accountants reconcile entries against statements issued in the local settlement currency without losing the original USD amount.

Entry Notes

Accountants and users can attach notes to entries for tracking purposes (e.g., "verified against bank statement", "pending clarification from vendor"). Notes are stored in a separate entry_note table with author and timestamp information.

Entry Statuses

StatusDescription
PENDINGNewly created, not yet sent to an external system
UNDER_REVIEWPushed to an external accounting system, awaiting approval
COMPLETEDApproved and finalized
REJECTEDRejected by reviewer or external accounting system
VOIDEDPermanently annulled — via void action (duplicate, error, cancellation) or as a result of a refund
note

CANCELLED status exists in the enum but is not currently used in workflows. Entries are voided instead of cancelled.

Entry Types

INCOME

Money flowing into the organization. Examples: customer payments, sales revenue.

EXPENSE

Money flowing out of the organization. Examples: vendor payments, salaries, operational costs.

Entry Relations

Entries can be linked to each other via relatedEntryId and relationType:

Relation TypeDescription
REFUNDThis entry is a refund for the related entry
REIMBURSEMENTThis entry reimburses an employee for the related expense
CORRECTIONThis entry corrects the related entry

Entry Items

Each entry can have line items (EntryItem) representing specific components:

Item TypeDescription
PRODUCTPhysical goods
SERVICEServices rendered
TAXTax charges
DISCOUNTDiscounts applied
  • Documents — attach invoices, receipts, and payment proofs to entries
  • Completeness — automatic verification that entries have all required documents
  • Parties — the from/to participants in every entry
  • Accounting Review — the accountant review workflow before sync
  • Entries API — REST endpoints for managing entries