fct_invoice


Description

Invoice fact table. Each row represents one invoice position, enriched with contract and company data. Includes all invoice types: regular invoice runs, MySports receipts, voids, and imported invoices.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
invoice_id int8 19 null

Primary key of this table. Unique identifier of the invoice position (position-level grain, not invoice-level).

invoice_entity_id int8 19 null

Technical identifier of the invoice this position belongs to

invoice_number varchar 255 null

Human-readable invoice reference number shown on the invoice document. Null for VOID invoices which have no external reference.

invoice_created_date timestamptz 35 null

Timestamp when the invoice record was created in the system

invoice_date date 13 null

Date on which the invoice was formally issued. Null for MySports receipts and some imported invoices.

invoice_status varchar 255 null

Current lifecycle status of the invoice. For MySports receipts, status is set to ‘PAID’ since they represent completed online payments. VOID invoices retain their source status (typically ‘DRAFT’). May be null for some imported invoices.

invoice_type_discriminator varchar 255 null

Technical subtype of the invoice, distinguishing automated invoice runs, manual debt claims, voids, MySports receipts, and imported invoices

invoice_type varchar 255 null

Document classification of the invoice. Set for debt-claim invoice runs (INVOICE, REFUND) and MySports receipts (PAYMENT_RECEIPT). Null for void and some imported invoices.

invoice_gross_amount numeric 19,2 null

Total gross amount of the invoice across all positions including tax. Null for some void and imported invoices.

currency_id varchar 255 null

Currency in which the invoice amounts are denominated. Null for some void and imported invoices.

payment_deadline_days int4 10 null

Number of days from the invoice date by which payment is due. Typically 0 for standard invoices (immediate payment), 30 for manual debt claims. Null for MySports receipts and some imported invoices.

external_qr_link varchar 65535 null

External URL encoded as a QR code on the invoice for electronic invoicing flows. Null when electronic invoicing is not applicable.

customer_id int8 19 null
dim_customer.customer_id fct_invoice_customer_id_fkey R

Identifier of the customer who was invoiced. Null for company-only invoices where no individual customer is associated.

company_id int8 19 null
dim_company.company_id Implied Constraint R

Identifier of the company associated with this invoice. Null for individual/non-corporate invoices.

organization_unit_id int8 19 null
dim_organization_unit.organization_unit_id Implied Constraint R

Identifier of the studio or organization unit that issued the invoice

reference_invoice_id int8 19 null

Identifier of the original invoice that this invoice voids or credits. Only set for VOID and COMPANY_VOID invoice types; null otherwise.

position_name varchar 65535 null

Display name of the line item as shown on the invoice

position_type varchar 255 null

Technical subtype of the invoice position, distinguishing invoice run positions, MySports receipts, and imported positions

position_status varchar 255 null

Lifecycle status of the invoice position. Only set for debt-claim position types; null for MySports and imported positions.

position_subline varchar 65535 null

Secondary description or sub-label shown beneath the main position name on the invoice. Null when no sub-label was specified.

position_gross_amount numeric 19,2 null

Gross amount of this invoice position including tax (net_amount + tax_amount)

position_net_amount numeric 19,2 null

Net amount of this invoice position excluding tax

position_tax_amount numeric 19,2 null

Tax amount applied to this invoice position

position_tax_percentage numeric 19,2 null

Tax rate applied to this invoice position, expressed as a percentage

position_order int4 10 null

Display order of this position within the invoice

contract_id int8 19 null
fct_contract.contract_id Implied Constraint R

Identifier of the contract linked to this invoice position. Null when the position has no associated booking entry or the booking entry has no contract (e.g. MySports positions, payment-type booking entries).

service_period_start_date date 13 null

Start date of the service period this invoice position covers. Null when the position has no associated booking entry.

service_period_end_date date 13 null

End date of the service period this invoice position covers. Null when the position has no associated booking entry.

product_id varchar 255 null

Surrogate key linking to the product dimension via sale_position. Only populated for invoice positions that have an associated sale with a product variant or dynamic item. Null for membership charges and positions without linked sales.

rate_id int8 19 null
dim_rate.rate_id Implied Constraint R

Identifier of the rate plan linked to the contract. Null when contract_id is null.

last_updated timestamptz 35 null

System column. UTC Timestamp at which entry was calculated (lags shortly behind source system).

Relationships