Sales Invoices (SIN)
The sin submodule of acc owns the sales-invoice header, its lines, the type reference data, and the periodic invoice batch that turns a stack of BillableCharge rows into one or more invoices. A SalesInvoiceLine rolls up the matched BillableCharge rows of acc.chg and links to the journal entry that posts it. The submodule depends on acc.doc for the document scaffolding, acc.chg for the matched billable charges, acc.gld for the line ledger account, acc.jrn for the journal entry, acc.vat for the VAT code, acc.pmt for payment allocations, and com.par/com.org/com.fin for the line content.
Concepts
Sales InvoiceThe header of an outbound customer invoice, identified by its document code. Goes through
Draft→Confirmedlifecycle.Sales Invoice LineOne line of the invoice. Carries amounts excl./incl. VAT in foreign and internal currency, the VAT code and percentage, and the journal entry the line was posted as. A line aggregates the
BillableChargerows it covers.Sales Invoice TypeA reference type that names the invoice variant (e.g. "standard", "credit note") and pins the number series and default terms-of-invoice for it.
Sales Invoice BatchA periodic run that consumes pending
BillableChargerows for a billing window and emits one or more sales invoices. Goes throughPending→Completed.
Entities
Sales Invoice Type (SalesInvoiceType)
A reference type for sales-invoice variants.
| Field | Description |
|---|---|
| Business key (up to 4 characters). |
| Human-readable name. |
| Whether invoices of this type are debit invoices or credit notes. |
| Number series used to allocate document codes. |
| Default terms of invoice. |
Sales Invoice (SalesInvoice)
The invoice header.
| Field | Description |
|---|---|
| Business key — the document code (final). |
| Human-readable description (final). |
| The invoice type (final). |
| Invoice currency and conversion rate (final). |
| Invoice date (final). |
| Owning department (final). |
| The customer (final). |
| The postal/invoice address (final). |
| Terms applied (final). |
| The batch this invoice was emitted in (final). |
| Derived from |
| Whether all lines have been settled. Default |
| Lifecycle flag. |
| Derived status ( |
| Derived due date. |
| Sum of line amounts (excl. VAT) in foreign / internal currency. |
| Sum of line VAT amounts. |
| Cumulative paid amount. |
| Outstanding amount. |
| The lines and the payment-allocation rows for this invoice. |
A validation rule enforces that the customer’s company equals the department’s company.
Sales Invoice Line (SalesInvoiceLine)
One line of a sales invoice.
| Field | Description |
|---|---|
| Owning invoice (composite business key with |
| Line number. |
| The product item (final). |
| Line description (final). |
| VAT code and percentage (final). |
| Amount excluding VAT (final). |
| VAT amount (final). |
| Amount including VAT (final). |
| The journal entry that posts the line (operational). |
| The ledger account the line posts to (operational). |
| The billable charges the line covers. |
| Sum of the matched charge amounts. |
Sales Invoice Batch (SalesInvoiceBatch)
A periodic run that turns pending BillableCharge rows into invoices.
| Field | Description |
|---|---|
| Business key (final). |
| Owning department (final). |
| Owning company derived from the department (operational, internal). |
| Free-form description (set while pending). |
| Date the batch is run. |
| Window of charge dates picked up. |
| Daily / weekly / monthly grouping. |
| Invoice type used for emitted invoices. |
| Lifecycle flag. |
| Derived status — see Batch Statuses below. |
| Number of charges picked up by the run. |
| Number of invoices emitted. |
| The emitted invoices. |
Batch Statuses (SalesInvoiceBatchStatus)
| Code | Name | Meaning |
|---|---|---|
| Pending | Configured but not yet run. |
| Completed | Run; |
| Undone | Reverted (charges put back to Pending). |
Functionality
Confirm / unconfirm of a sales invoice
The confirm and confirmUndo write actions on SalesInvoice flip the invoice between Draft and Confirmed. Confirming triggers downstream posting (the matching journal entry is created via acc.jrn); unconfirming reverses that.
Run a sales-invoice batch
The createSalesInvoices write action on SalesInvoiceBatch consumes the BillableCharge rows pending for the configured (department, billing period, invoice frequency) and emits one or more sales invoices. Each emitted invoice points back at this batch through salesInvoiceBatch. The batch’s status moves from Pending to Completed. The action handlers for both flows (SalesInvoiceActionWriter, SalesInvoiceBatchActionWriter) are the framework dispatch targets.
Public API
ACC_SIN_QueryApi and ACC_SIN_CommandApi
This submodule does not provide query- or command-API classes. Other modules read invoices, lines, and batches through the standard generated readers and trigger confirm/unconfirm or batch run through the entity action handlers.
ViewModel actions
| Action | User-visible effect |
|---|---|
| Locks a draft invoice and posts the matching journal entry. |
| Reverts a confirmed invoice back to draft and rolls back the journal entry. |
| Picks up pending billable charges in the batch’s window and emits sales invoices for them. |