Document control numbers (DCN)
A document control number is a numeric reference generated for each invoice and printed on it, built so that when the customer pays, the bank passes the number back and the receipt matches itself to the invoice. In Switzerland it is the ESR / QR reference, in the Nordic countries the KID, OCR or viite number, in SEPA the ISO 11649 creditor reference. SQL-Ledger generates it from a pattern you set on the bank account, prints it, and uses it to match incoming payments.
- A numeric, check-digited reference generated for every sales invoice, POS sale and AR transaction from a pattern you define per bank account.
- Encodes your bank member number, the customer number, the invoice number and, if you want, the amount — padded to fixed widths.
- Swiss ESR and QR-bill references (recursive modulo 10) and weighted modulo-10/11 references (KID, OCR, viite, Luhn) supported.
- Printed on the invoice, on remittance vouchers positioned to pre-printed slips, and shown on AR reports and statements.
- Keyed from the vendor’s slip on purchases, and carried on the cheque, advice or payment file.
- Payment import matches receipts to invoices by DCN first, then by amount, from CSV or a Swiss .v11 bank file.
- Attachments (reference documents) are a separate feature on the same screens.
What it is for
- An invoice number is text; a DCN is a fixed-length string of digits with a check digit, so it survives a bank’s payment system unchanged and can be verified for typing errors.
- It encodes what you decide: usually your bank customer number, the invoice number and sometimes the amount, each padded to a fixed width.
- On the sales side it is generated when you post and printed on the invoice or its payment slip. On the purchase side you key the vendor’s DCN from their invoice so it goes out with your payment.
- When the bank statement or payment file comes back, Import › Payments matches each receipt to the open invoice by DCN and posts it — no re-keying, no guessing which invoice a round amount belongs to.
Where it is required
The name changes by country; the mechanism is the same.
- Switzerland — the 27-digit ESR/BESR reference on the orange payment slip, and since 2022 the QR reference on the QR-bill, both using the recursive modulo-10 check digit SQL-Ledger implements. Business customers expect it; without it your receipts arrive as unreferenced credits.
- Norway (KID), Sweden (OCR), Finland (viitenumero), Denmark (FI-kort reference) — structured references with modulo-10 or modulo-11 check digits that banks validate at the point of payment.
- SEPA countries — the ISO 11649 structured creditor reference (
RF+ two check digits + your reference) is optional but is what automated reconciliation keys on in Germany, Austria, the Netherlands and Belgium. - UK, US, Canada, Australia — not a banking convention; the invoice number is quoted in the payment memo. You can still use a DCN internally, for example to match a payment file from a card processor or a marketplace.
Setting the pattern up
- Open System › Bank Accounts. Every account in the chart that is flagged as a payment account is listed; click the one your customers pay into.
- Fill in the bank, IBAN and BIC (printed on the invoice and used by payment files), your Member No. (the customer or participant number the bank gave you) and, for Swiss accounts, the Clearing No..
- In DCN enter the pattern. Each piece is
<%field width%>, padded with leading zeros to that width; the check digit is a command at the end. For a Swiss-style 27-digit reference:<%membernumber 9%><%customernumber 6%><%invnumber 11%><%modulo10%>. - Fields available:
membernumber,customernumber,invnumber,integer_amountanddecimal(the invoice total split at the point), plus any other numeric field on the invoice. Letters and dashes in a value are replaced by a running digit, soSI-4006becomes1234006and the reference stays numeric. - Check digits:
<%modulo10%>is the recursive modulo-10 used by Swiss ESR and QR references;<%modulo11_21_right%>-style commands give weighted modulo-10/11 (Luhn, KID, OCR) with the weight pair and the direction spelled out. - RVC is a second pattern of the same kind for the code line of a remittance voucher, where the bank wants the amount and account encoded as well. Leave it empty unless your bank specifies it.
- Save. From now on every sales invoice, POS sale and AR transaction posted to this account gets its DCN computed and stored with it.
Patterns by country
The pattern is set per bank account, not per country; the country only fixes the length, what goes in, and the check-digit rule. These are working patterns for the common schemes, with the number each produces for customer C-1006, invoice SI-4006 (letters and dashes fall away as described above) and bank member number 010001628.
| Scheme | Length & rule | DCN pattern on the bank account | Result |
|---|---|---|---|
| Switzerland — ESR / BESR (orange slip) | 27 digits; recursive modulo 10 | <%membernumber 9%><%customernumber 6%><%invnumber 11%><%modulo10%> | 010001628001006000000040064 |
| Switzerland — QR-bill, QR reference | 27 digits; same modulo 10 (the QR-IBAN carries the participant, so the reference is usually just your own numbering) | <%membernumber 6%><%invnumber 20%><%modulo10%> | 123456000000000000000040062 |
| Norway — KID (MOD10) | up to 25 digits; Luhn (weights 2,1 from the right) | <%customernumber 6%><%invnumber 8%><%modulo10_21_right%> | 001006000040069 |
| Sweden — OCR-nummer | 2–25 digits; Luhn; some banks also want a length digit before the check digit | <%invnumber 10%><%modulo10_21_right%> | 00000040063 |
| Denmark — FI-kort 71 / 75 | 15 digits; Luhn | <%invnumber 14%><%modulo10_21_right%> | 000000000040063 |
| Any country — amount-bearing reference | invoice + amount, so the bank can validate the sum; used with pre-printed slips | <%invnumber 10%><%integer_amount 8%><%decimal 2%><%modulo10%> | 000000400600001962650 for 1,962.65 |
| Finland — viitenumero | 4–20 digits; weights 7, 3, 1 repeating from the right, check = 10 − (sum mod 10) | Not producible by the pattern engine (it alternates two weights); ask us — a three-weight command is a small addition to format_dcn. | |
| Norway — KID (MOD11) | weights 2–7 cycling from the right, check = 11 − remainder | Same: the engine’s modulo-11 is a two-weight remainder, not the banking MOD11. Use the MOD10 variant your bank offers, or ask us. | |
| SEPA — ISO 11649 creditor reference (RF) | RF + 2 check digits (modulo 97 over the reference) + up to 21 characters | Not producible by the pattern engine (modulo 97 with letters). We add it as a custom function where a customer needs it. | |
Check the result against a number your bank accepts before you print a run: banks differ on padding and on whether the customer number is part of the reference.
On the sales side
- Post the invoice. The DCN is worked out from the pattern on the bank account selected as the payment account, saved on the invoice, and shown read-only on the screen from then on. Reposting recomputes it; the number never has to be typed.
- Print it with
<%dcn%>in the invoice template, or use Batch › Print › Remittance Vouchers to print the payment slip itself, positioned to your bank’s pre-printed forms;<%rvc%>prints the code line. - The DCN is a column on the AR reports (tick DCN in the column picker) and on statements, so a customer query can be answered from the number they quote.
On the purchase side
- On a vendor invoice or AP transaction, type the reference from the vendor’s payment slip into the DCN field before posting.
- When you pay, the DCN goes out with the payment — on the cheque or remittance advice, and in the payment file if you export one for the bank — so the vendor’s system matches your payment the way yours matches theirs.
- Vendor invoices imported from CSV can carry the DCN in a column of the same name.
Matching the payments that come back
- Ask the bank for the payment file. Swiss banks and PostFinance supply the ESR record file (
.v11); others supply CSV or a statement export you save as CSV with at leastdatepaid, debit, credit, dcn. - Open Import › Payments, choose the bank account and currency, the file, and .v11 or csv. Press Continue.
- Each row is matched to an open invoice: first by DCN, and only if there is no DCN by amount. AR and AP are both searched, so a refund from a vendor lands on the right side. The preview shows the invoice, customer and amount per row; rows that matched nothing have no tick box.
- Press Import Payments. The receipts post against their invoices with the source and memo from the file, and the bank account is ready to reconcile.
Reference documents
Not to be confused with the DCN: attachments live in the Reference Documents band on the same screens.
- Type a description, choose the file, and it is uploaded when the record is saved; tick the box to mark it confidential.
- Reference Documents › List Documents finds any attachment and shows what it is attached to; Image Files holds the pictures used on part records and in the storefront.
Every dataset on our hosting has this, from day one.
Create your free account or ask us about migrating