Skip to main content

Account Receivables - The Money Trail

Account Receivables (AR) is where Billerang tracks who owes you money, who paid, and how it all adds up in your books. If billing is the factory that produces invoices, AR is the warehouse that tracks every dollar until it's collected.

This guide explains the 7 key concepts that make AR work, using a real-world story: Sarah's SaaS company billing her customers.


The Cast of Characters

Before diving in, here's what you're about to meet:

ConceptOne-linerReal-world analogy
Accounting CodeA labeled bucket for moneyThe "Revenue" or "Cash" jar on your shelf
JournalA logbook of transactionsYour company's checkbook register
OCC TemplateA recipe for recording transactionsA rubber stamp that says "apply this pattern"
Account OperationAn actual financial eventA specific invoice sent or payment received
Journal EntryThe double-entry bookkeeping lineThe actual pen stroke in the ledger
MatchingLinking payments to invoicesCrossing off an invoice when the check clears
Accounting SchemeCustom accounting rules (scripted)A smart accountant who handles edge cases

1. Accounting Codes - Your Chart of Accounts

An Accounting Code represents a single account in your general ledger (GL). Think of it as a labeled bucket where money flows in or out.

Real-World Example

Sarah's SaaS company has these accounting codes:

CodeNameTypeWhat goes here
4110Accounts ReceivableASSETMoney customers owe us
7000SaaS RevenueREVENUEMoney we earned
7010Professional ServicesREVENUEConsulting revenue
2110Sales Tax CollectedLIABILITYTax we collected for the government
1000Bank AccountASSETActual cash in the bank
6500Bad Debt ExpenseEXPENSEInvoices we gave up collecting

Key Properties

  • Code: The GL account number (e.g., 4110)
  • Description: Human-readable name
  • Chart Type: ASSET, LIABILITY, EQUITY, REVENUE, or EXPENSE
  • View Type: BALANCE_SHEET or INCOME_STATEMENT
  • Parent Code: For hierarchical reporting (e.g., 4110 under 4000 - Current Assets)

Why It Matters

Every financial transaction in Billerang ultimately lands in one or more Accounting Codes. They're the foundation of your financial reports.


2. Journals - The Logbooks

A Journal is a chronological logbook that groups related transactions. Instead of dumping everything into one giant log, you organize by type.

Real-World Example

Sarah uses three journals:

Journal CodeNameWhat it tracks
SALESSales JournalAll invoice-related entries
CASHCash ReceiptsAll incoming payments
MISCMiscellaneousAdjustments, write-offs, manual entries

Why Separate Journals?

Imagine your accountant needs to audit all payments received in March. With journals, they open the CASH journal and see only payment entries. Without journals, they'd wade through thousands of mixed entries.

Key Properties

  • Code: Journal identifier (e.g., SALES)
  • Description: What this journal tracks

Journals are simple master data. Their power comes from organizing the Account Operations and Journal Entries that reference them.


3. OCC Templates - The Recipes

OCC stands for Other Credits and Charges. An OCC Template is a recipe that tells Billerang: "When this type of financial event happens, here's exactly how to record it in the books."

The Rubber Stamp Analogy

Think of an OCC Template as a rubber stamp. When Sarah's billing system creates an invoice, it grabs the "Invoice" stamp and applies it. That stamp says:

"Debit Accounts Receivable (4110), Credit Sales Revenue (7000), use the SALES journal."

Real-World Example

Sarah's company has these OCC Templates:

Template CodeCategoryPrimary AccountContra AccountJournalPurpose
INV_STANDARDDEBIT4110 (AR)7000 (Revenue)SALESStandard invoices
INV_NEGATIVECREDIT4110 (AR)7000 (Revenue)SALESCredit notes
PAY_CHECKCREDIT4110 (AR)1000 (Bank)CASHCheck payments
PAY_WIRECREDIT4110 (AR)1000 (Bank)CASHWire transfers
ADJ_WRITEOFFCREDIT4110 (AR)6500 (Bad Debt)MISCWrite-offs
DUNNING_FEEDEBIT4110 (AR)7500 (Late Fees)MISCLate payment charges

The Three Accounting Codes

Each OCC Template can specify up to three GL accounts:

  1. Primary Accounting Code (accountingCode): The main account affected. For invoices, this is typically AR (4110).
  2. Contra Accounting Code (contraAccountingCode): The offset account for double-entry. For invoices, this is Revenue (7000).
  3. Contra Accounting Code 2 (contraAccountingCode2): Optional second offset for taxes, commissions, etc.

How Double-Entry Works

Every OCC Template has a Category (DEBIT or CREDIT) that determines the direction:

Invoice Template (DEBIT category):

DEBIT  4110 Accounts Receivable    $1,000  (primary code)
CREDIT 7000 Sales Revenue $1,000 (contra code)

Translation: "Customer owes us $1,000, and we earned $1,000 in revenue."

Payment Template (CREDIT category):

DEBIT  1000 Bank Account            $1,000  (contra code)
CREDIT 4110 Accounts Receivable $1,000 (primary code)

Translation: "$1,000 arrived in the bank, and the customer no longer owes it."

Key Properties

  • Code: Template identifier
  • Category: DEBIT (increases AR) or CREDIT (decreases AR)
  • Accounting Code: Primary GL account
  • Contra Accounting Code: Offset GL account
  • Contra Accounting Code 2: Secondary offset (taxes/commissions)
  • Journal: Which logbook to write in
  • Manual Creation Enabled: Can users create AOs manually with this template?

4. Account Operations - The Actual Events

An Account Operation (AO) is the actual financial event. If the OCC Template is the recipe, the Account Operation is the dish you cooked.

Types of Account Operations

Billerang uses single-table inheritance with a discriminator to distinguish types:

TypeDiscriminatorWhat it representsExample
RecordedInvoiceIAn invoice posted to ARSarah sends a $500 invoice to Acme Corp
PaymentPMoney receivedAcme Corp pays $500 by wire transfer
OtherCreditAndChargeOCCManual adjustmentsSarah adds a $25 late fee to Acme's account
RefundRMoney returnedSarah refunds $100 for a service issue

The Lifecycle of an Account Operation

Created (POSTED)
|
|-- Accounting period valid? --YES--> Journal Entries generated
| NO--> Status = REJECTED (CLOSED_PERIOD)
|
|-- Matching process runs
| |
| |-- Fully matched --> matchingStatus = L (Matched)
| |-- Partially matched --> matchingStatus = P
| |-- No match --> matchingStatus = O (Open)
| |-- Disputed --> matchingStatus = I (Litigation)
|
|-- Export to ERP/GL system --> Status = EXPORTED

Real-World Scenario: Acme Corp's Month

Let's follow Acme Corp through a month:

Day 1 - Invoice sent:

Account Operation #1001 (type=I, RecordedInvoice)
Customer Account: ACME_CORP
Amount: $5,000
Status: POSTED
Matching Status: O (Open - nobody paid yet)
Unmatching Amount: $5,000

Day 15 - Partial payment received:

Account Operation #1002 (type=P, Payment)
Customer Account: ACME_CORP
Amount: $3,000
Reference: "Wire transfer #TRF-2024-0315"
Status: POSTED
Matching Status: O (Open - not yet linked to invoice)

Day 15 - Matching runs (automatic or manual):

After matching #1001 and #1002:

AO #1001 (Invoice): matchingAmount=$3,000, unMatchingAmount=$2,000, matchingStatus=P
AO #1002 (Payment): matchingAmount=$3,000, unMatchingAmount=$0, matchingStatus=L

Day 25 - Late fee added:

Account Operation #1003 (type=OCC)
Customer Account: ACME_CORP
OCC Template: DUNNING_FEE
Amount: $50
Status: POSTED
Matching Status: O (Open)

Day 30 - Final payment:

Account Operation #1004 (type=P, Payment)
Customer Account: ACME_CORP
Amount: $2,050 (remaining $2,000 + $50 late fee)

After matching: All AOs are now fully matched (status L). The customer's balance is zero.

Key Fields

FieldWhat it means
amountTotal amount in functional currency
matchingAmountHow much has been matched against other AOs
unMatchingAmountHow much is still open (amount - matchingAmount)
matchingStatusO=Open, L=Matched, P=Partial, I=Litigation, C=Closed
statusPOSTED, REJECTED, EXPORTED, CLOSED
dueDateWhen payment is expected
transactionDateWhen the event actually happened
customerAccountWhich customer this belongs to

5. Journal Entries - The Bookkeeping Lines

A Journal Entry is the actual line written in the accounting ledger. When an Account Operation is created, Billerang automatically generates Journal Entries based on the OCC Template's accounting rules.

The Double-Entry Magic

For every Account Operation, Billerang creates at least two Journal Entries (debits must equal credits):

When Sarah's $5,000 invoice to Acme is posted:

#DirectionAccountAmountJournalDescription
1DEBIT4110 - Accounts Receivable$5,000SALESAcme owes us
2CREDIT7000 - SaaS Revenue$4,500SALESRevenue earned
3CREDIT2110 - Sales Tax$500SALESTax collected

When Acme's $5,000 payment arrives:

#DirectionAccountAmountJournalDescription
1DEBIT1000 - Bank Account$5,000CASHCash received
2CREDIT4110 - Accounts Receivable$5,000CASHAcme no longer owes

Key Properties

  • Direction: DEBIT or CREDIT
  • Account: The GL account (Accounting Code)
  • Amount: The entry amount
  • Journal Code: Which journal this belongs to
  • Account Operation: The AO that triggered this entry
  • Supporting Document: The invoice or payment reference
  • Matching Code: Links to the reconciliation (filled when matched)
  • Analytic Codes: Cost center/department codes for management reporting

When Are They Generated?

Journal Entries are created automatically:

  1. Invoice validation - createFromInvoice() generates AR + Revenue + Tax entries
  2. Payment recording - createFromPayment() generates Bank + AR reversal entries
  3. OCC creation - createFromAccountOperation() generates primary + contra entries

They are NOT generated if:

  • The accounting period for the operation date is closed (AO gets rejected)
  • The AO status is not POSTED

6. Matching - Connecting the Dots

Matching is the process of linking payments to the invoices they pay. In accounting terms, this is called reconciliation or lettrage (French accounting term used in the code as status L).

How It Works: A Play in Three Acts

Act 1: The Setup

AO #1001 (Invoice)  - Amount: $1,000 - Open ($1,000 unmatched)
AO #1002 (Payment) - Amount: $1,000 - Open ($1,000 unmatched)

Act 2: The Match

When a user (or the system automatically) matches these two:

  1. A MatchingCode is created (e.g., MC-2024-001)
  2. Two MatchingAmount records link each AO to the MatchingCode
  3. Both AOs update their matchingAmount and unMatchingAmount

Act 3: The Result

MatchingCode MC-2024-001:
Total Debits: $1,000
Total Credits: $1,000

AO #1001 (Invoice): matchingStatus=L, matchingAmount=$1,000, unMatchingAmount=$0
AO #1002 (Payment): matchingStatus=L, matchingAmount=$1,000, unMatchingAmount=$0
Invoice: paymentStatus = PAID

Partial Matching

What if Acme only pays $600 of a $1,000 invoice?

After partial matching:
AO #1001 (Invoice): matchingStatus=P, matchingAmount=$600, unMatchingAmount=$400
AO #1002 (Payment): matchingStatus=L, matchingAmount=$600, unMatchingAmount=$0
Invoice: paymentStatus = PPAID (Partially Paid)

The remaining $400 stays open until another payment comes in.

Matching Status Reference

CodeLabelMeaning
OOpenNot matched to anything yet
LMatched (Lettree)Fully reconciled
PPartialPartially matched, balance remaining
CClosedAdministratively closed
ILitigationUnder dispute, matching blocked
RRejectedMatching was rejected

Unmatching

Made a mistake? Billerang supports unmatching too. This creates an UnMatchingCode record and reverses all the matching amounts, putting the AOs back to their previous state.


7. Accounting Scheme - The Custom Rules Engine

An Accounting Scheme is an optional extensibility mechanism for when the standard OCC Template rules aren't enough. It contains a script (Groovy or JavaScript) that can dynamically determine accounting codes, journals, or other posting rules.

When Do You Need It?

Most companies never need Accounting Schemes. They're for edge cases like:

  • Different GL codes based on customer country
  • Dynamic tax code selection based on product + region
  • Revenue recognition rules that depend on contract type
  • Multi-entity accounting where the posting target depends on the seller

How It Works

  1. Create an Accounting Scheme with a ScriptInstance
  2. Link it to an OCC Template
  3. When the OCC Template is used, the script runs and can override:
    • Which accounting codes to use
    • Which journal to post to
    • How amounts are split

Think of it as: "The OCC Template is the standard recipe, and the Accounting Scheme is the chef who can improvise when needed."


Putting It All Together: The Complete Flow

Here's the full journey of a $10,000 invoice for Acme Corp:

1. BILLING CYCLE RUNS
Billerang generates Invoice #INV-2024-001 for Acme Corp ($10,000)

2. INVOICE VALIDATION
System selects OCC Template "INV_STANDARD" based on invoice type

3. ACCOUNT OPERATION CREATED
RecordedInvoice AO #5001 created:
- Amount: $10,000
- Customer: ACME_CORP
- Status: POSTED
- Matching Status: O (Open)

4. JOURNAL ENTRIES GENERATED
JE #1: DEBIT 4110 AR $10,000 (SALES journal)
JE #2: CREDIT 7000 Revenue $9,000 (SALES journal)
JE #3: CREDIT 2110 Sales Tax $1,000 (SALES journal)

5. ACME PAYS $10,000 (15 days later)
Payment AO #5002 created:
- Amount: $10,000
- Reference: "Wire TRF-123"
- Status: POSTED

6. PAYMENT JOURNAL ENTRIES
JE #4: DEBIT 1000 Bank $10,000 (CASH journal)
JE #5: CREDIT 4110 AR $10,000 (CASH journal)

7. MATCHING
MatchingCode MC-001 links AO #5001 and AO #5002
Both marked as MATCHED (L)
Invoice paymentStatus: PAID

8. ACCOUNTING EXPORT
All Journal Entries exported to ERP
AOs marked as EXPORTED

The Balance Sheet Impact

After this complete cycle:

  • AR (4110): +$10,000 (invoice) - $10,000 (payment) = $0 (settled)
  • Revenue (7000): +$9,000
  • Tax (2110): +$1,000
  • Bank (1000): +$10,000

Everything balances. That's the beauty of double-entry bookkeeping.


Quick Reference: Where to Find Things in Billerang

WhatWhere in the UI
View/create Account OperationsSidebar > Account Receivables > Account Operations
Configure OCC TemplatesSetup > Billing section > OCC Templates
View matching detailsAccount Operation detail page > Matching Amounts card

Glossary

TermDefinition
ARAccounts Receivable - money owed to you by customers
GLGeneral Ledger - the master accounting record
OCCOther Credits and Charges - manual adjustments
Matching / LettrageLinking payments to invoices
Contra AccountThe offset account in double-entry bookkeeping
Functional CurrencyYour company's reporting currency
Transactional CurrencyThe currency the customer actually paid in
Accounting PeriodA time window (usually monthly) that can be open or closed for posting