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 Invoice

The header of an outbound customer invoice, identified by its document code. Goes through DraftConfirmed lifecycle.

Sales Invoice Line

One 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 BillableCharge rows it covers.

Sales Invoice Type

A 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 Batch

A periodic run that consumes pending BillableCharge rows for a billing window and emits one or more sales invoices. Goes through PendingCompleted.

Entities

SIN entities

Sales Invoice Type (SalesInvoiceType)

A reference type for sales-invoice variants.

FieldDescription

code

Business key (up to 4 characters).

description

Human-readable name.

invoiceBaseType

Whether invoices of this type are debit invoices or credit notes.

numberSeries

Number series used to allocate document codes.

termsOfInvoice

Default terms of invoice.

Sales Invoice (SalesInvoice)

The invoice header.

FieldDescription

documentCode

Business key — the document code (final).

description

Human-readable description (final).

invoiceType

The invoice type (final).

currency / currencyRate

Invoice currency and conversion rate (final).

documentDate

Invoice date (final).

department

Owning department (final).

customer

The customer (final).

invoiceAddress

The postal/invoice address (final).

termsOfPayment / termsOfInvoice

Terms applied (final).

salesInvoiceBatch

The batch this invoice was emitted in (final).

invoiceBaseType

Derived from invoiceType (operational, internal).

matched

Whether all lines have been settled. Default false.

confirmed

Lifecycle flag.

biInvoiceStatus

Derived status (DR Draft / CF Confirmed).

biDueDate

Derived due date.

biInvoiceAmountExt / biInvoiceAmountInt

Sum of line amounts (excl. VAT) in foreign / internal currency.

biInvoiceVatAmountExt / biInvoiceVatAmountInt

Sum of line VAT amounts.

biPaidAmountInclVatExt / biPaidAmountInclVatInt

Cumulative paid amount.

biToPayAmountInclVatExt / biToPayAmountInclVatInt

Outstanding amount.

invoiceLines / paymentAllocations

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.

FieldDescription

salesInvoice

Owning invoice (composite business key with documentLineNumber).

documentLineNumber

Line number.

item

The product item (final).

description

Line description (final).

vatCode / vatPercentage

VAT code and percentage (final).

invoiceAmountExclVatExt / invoiceAmountExclVatInt

Amount excluding VAT (final).

invoiceVatAmountExt / invoiceVatAmountInt

VAT amount (final).

invoiceAmountInclVatExt / invoiceAmountInclVatInt

Amount including VAT (final).

journalEntry

The journal entry that posts the line (operational).

ledgerAccount

The ledger account the line posts to (operational).

billableCharges

The billable charges the line covers.

biTotalChargeAmountExt / biTotalChargeAmountInt

Sum of the matched charge amounts.

Sales Invoice Batch (SalesInvoiceBatch)

A periodic run that turns pending BillableCharge rows into invoices.

FieldDescription

documentCode

Business key (final).

department

Owning department (final).

company

Owning company derived from the department (operational, internal).

description

Free-form description (set while pending).

batchDate

Date the batch is run.

billingPeriodStart / billingPeriodEnd

Window of charge dates picked up.

invoiceFrequency

Daily / weekly / monthly grouping.

invoiceType

Invoice type used for emitted invoices.

completed

Lifecycle flag.

biSalesInvoiceBatchStatus

Derived status — see Batch Statuses below.

biChargeCount

Number of charges picked up by the run.

biInvoiceCount

Number of invoices emitted.

salesInvoices

The emitted invoices.

Batch Statuses (SalesInvoiceBatchStatus)

CodeNameMeaning

P

Pending

Configured but not yet run.

C

Completed

Run; salesInvoices populated.

U

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

ActionUser-visible effect

confirm (on Sales Invoice)

Locks a draft invoice and posts the matching journal entry.

confirmUndo (on Sales Invoice)

Reverts a confirmed invoice back to draft and rolls back the journal entry.

createSalesInvoices (on Sales Invoice Batch)

Picks up pending billable charges in the batch’s window and emits sales invoices for them.