Purchase Invoices (PIN)

The pin submodule of acc owns the purchase invoice header (PurchaseInvoice), its lines, and the type reference data. Each PurchaseInvoiceLine rolls up the matched PurchaseLiability rows of acc.lia into a single line and links to the journal entry that posts it. The submodule depends on acc.doc for the document scaffolding, acc.lia for the matched liabilities, acc.gld for the line ledger account, acc.jrn for the journal entry, acc.vat for the VAT code, acc.pmt for payment allocations, acc.bas for terms and currency rate, and com.par/com.org/com.fin/com.log/cat.itm for the line content.

Concepts

Purchase Invoice

The header of an inbound supplier invoice, identified by its document code. Goes through DraftConfirmed lifecycle; once confirmed, no edits except payment allocation.

Purchase 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 PurchaseLiability rows it covers.

Purchase 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.

Invoice Base Type

Whether the invoice header is a debit invoice or a credit note.

Entities

PIN entities

Purchase Invoice Type (PurchaseInvoiceType)

A reference type for purchase 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 — see Invoice Base Types below.

numberSeries

Number series used to allocate document codes.

termsOfInvoice

Default terms of invoice.

Invoice Base Types (InvoiceBaseType)

CodeNameMeaning

D

Debit Invoice

Standard invoice (we owe the supplier).

C

Credit Note

Credit note (the supplier owes us).

Purchase Invoice (PurchaseInvoice)

The invoice header.

FieldDescription

documentCode

Business key — the document code.

description

Human-readable description.

invoiceType

The invoice type (drives number series and terms defaults).

currency / currencyRate

Invoice currency and conversion rate.

documentDate

Invoice date.

department

Owning department.

supplier

The supplier.

termsOfPayment / termsOfInvoice

Terms applied to the invoice.

invoiceBaseType

Derived from invoiceType (operational, internal).

matched

Whether all lines have been matched to liabilities. Default false.

confirmed

Lifecycle flag.

biInvoiceStatus

Derived status — see Invoice Statuses below.

biDueDate

Derived due date.

biInvoiceAmountExt / biInvoiceAmountInt

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

biInvoiceVatAmountExt / biInvoiceVatAmountInt

Sum of line VAT amounts.

biPaidAmountInclVatExt / biPaidAmountInclVatInt

Cumulative paid amount (incl. VAT).

biToPayAmountInclVatExt / biToPayAmountInclVatInt

Outstanding amount.

invoiceLines / paymentAllocations

The contained lines and the payment-allocation rows that match this invoice.

A validation rule enforces that the supplier’s company equals the department’s company.

Invoice Statuses (InvoiceStatus)

CodeNameMeaning

DR

Draft

Editable; not yet confirmed.

CF

Confirmed

Locked; payable.

Purchase Invoice Line (PurchaseInvoiceLine)

One line of a purchase invoice.

FieldDescription

purchaseInvoice

Owning invoice (composite business key with documentLineNumber).

documentLineNumber

Line number.

item

The product item (final).

description

Line description (final).

vatCode

VAT code (final).

vatPercentage

Optional VAT percentage applied (final).

invoiceAmountExclVatExt / invoiceAmountExclVatInt

Amount excluding VAT in foreign / internal currency (final).

invoiceVatAmountExt / invoiceVatAmountInt

VAT amount in foreign / internal currency (final).

invoiceAmountInclVatExt / invoiceAmountInclVatInt

Amount including VAT in foreign / internal currency (final).

journalEntry

The journal entry that posts the line (operational).

ledgerAccount

The ledger account the line posts to (operational).

purchaseLiabilities

The liabilities the line covers.

biTotalLiabilityAmountExt / biTotalLiabilityAmountInt

Sum of the matched liability amounts; differences are tracked as variances on the liability rows.

Functionality

Confirm / unconfirm

The confirm and confirmUndo write actions on PurchaseInvoice flip the invoice between Draft and Confirmed. PurchaseInvoiceActionWriter is the action handler dispatched by the framework. Confirming triggers downstream posting (the matching journal entry is created via acc.jrn); unconfirming reverses that.

Public API

ACC_PIN_QueryApi and ACC_PIN_CommandApi

This submodule does not provide query- or command-API classes. Other modules read invoices through the standard generated readers and trigger confirm/unconfirm through the entity action handler (PurchaseInvoiceActionWriter).

ViewModel actions

ActionUser-visible effect

confirm (on Purchase Invoice)

Locks a draft invoice and posts the matching journal entry.

confirmUndo (on Purchase Invoice)

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