Billable Charges (CHG)

The chg submodule of acc owns the billable-charge stream — individual sales-line-shaped charges that have been recorded in the system but not yet rolled up into a sales invoice. Charges flow in from any source document (sales order, work order, ad-hoc) and stay Pending until the next invoice batch picks them up. Per-period interest accrual on outstanding charges is captured as BillableChargeInterest. The submodule depends on acc.bas for the financial period and interest contract, on acc.doc for source-document references, on acc.sin for the sales-invoice link once a charge is invoiced, on acc.cst for cost-unit allocation, on acc.vat for the VAT code, and on com.par / com.org / com.fin / com.log / cat.itm for the line content (customer, address, terms, units, item).

Concepts

Billable Charge

A line-shaped charge that has been booked but not yet invoiced. Carries everything a sales-invoice line needs: customer, address, item, quantity (internal and external UoM), price, currency, VAT code, terms, and cost-unit allocation. The status moves from Pending to Invoiced (when picked up by an invoice batch) or Cancelled.

Billable Charge Interest

A per-period accrual of interest on a charge while it is outstanding. Captures the begin balance, the period interest, and the end balance under the interest rate effective in that period.

Source Document Line

The document line that originated the charge — captured both as a DocumentLine reference and as an opaque DocumentId so the charge survives if the source line is removed.

Entities

CHG entities

Billable Charge (BillableCharge)

A line-shaped charge that has been booked but not yet invoiced.

FieldDescription

transactionId

Business key — a generated transaction id.

documentOrigin

The kind of source document the charge came from.

department

Owning department (final field).

sourceDocumentLine

The originating document line.

sourceDocumentId

Opaque id of the source document (final).

chargeDate

Date of the charge.

customer

The customer being charged.

invoiceAddress

Optional invoice (postal) address.

termsOfInvoice / termsOfPayment / invoiceType

Terms applied when the charge is invoiced.

currency / currencyRate

Charge currency and conversion rate.

item

The product item.

description

Line description shown on the invoice.

referenceExt / referenceInt

Optional external/internal references.

chargeQuantityInt

Quantity in the internal (item) UoM.

chargeQuantityExt

Quantity in the external (invoiced) UoM.

chargeQuantityExtUom

The external UoM.

priceExt

Unit price in the external UoM.

priceUom

The price UoM (price / priceUom).

chargeAmountExt / chargeAmountInt

Amount in transaction currency and internal currency.

vatCode

VAT code applied to the charge.

inventoryUnit

Optional inventory cost-unit.

projectUnit

Optional project cost-unit.

invoiceLineText

Optional free-form text appended to the invoice line.

salesInvoiceLine

Set when the charge is invoiced — the resulting sales-invoice line.

salesInvoiceBatch

Set when invoiced — the batch the line was emitted in.

interestContract

Optional interest contract that drives accruals.

interestCalculationType

Simple or compound interest. Default S (Simple).

interestInt

Optional cumulative interest amount in the internal currency.

biBillableChargeStatus

Derived status — see Billable Charge Statuses below. Default P.

A validation rule enforces that any salesInvoiceLine set on the charge agrees with the charge on VAT code, currency, customer, invoice address, and terms.

Billable Charge Statuses (BillableChargeStatus)

CodeNameMeaning

P

Pending

Booked but not yet invoiced.

I

Invoiced

Picked up by an invoice batch and emitted as a sales-invoice line.

X

Cancelled

Cancelled before invoicing.

Billable Charge Interest (BillableChargeInterest)

A per-period accrual of interest on a charge while it is outstanding.

FieldDescription

billableCharge

Owning charge.

periodYear / periodNumber

The financial period (composite business key).

rate

Interest rate in effect during the period.

firstDate / lastDate

Inclusive period boundaries.

description

Optional description.

balanceBegin

Balance at the start of the period.

cumulativeInterest

Cumulative interest at the end of the period.

periodInterest

Interest accrued in this period.

periodAmount

Net change in the balance during the period.

balanceEnd

Balance at the end of the period.

Functionality

Pending-charge lookup

BillableChargeReaderService exposes the catalogue of charges still waiting for invoice: every pending charge, every pending charge for a given customer, and every pending charge dated in a given window. These are the seams an invoice-batch run consumes when picking up work.

Charge writing

BillableChargeWriterService is the seam used when other modules (sales delivery, work-order completion, manual charge entry) need to materialize a BillableCharge. The full create/cancel API is currently commented out — see Public API below — so callers cannot mint or cancel charges from outside the package without re-enabling those methods.

Public API

ACC_CHG_QueryApi

Read-side facade.

MethodDescription

findPendingCharges()

Every charge currently in Pending status.

findPendingChargesByCustomer(Customer)

Every pending charge for a customer.

ACC_CHG_CommandApi

Write-side facade. Currently a thin wrapper that holds a reference to BillableChargeWriterService; the documented createBillableCharge and cancelBillableCharge methods are commented out and not exposed at this time. Callers needing to create or cancel charges should re-enable those methods rather than reaching past the API.

ViewModel actions

The submodule defines a view model for BillableCharge but does not declare any custom UI actions.