fct_invoice


Description

Invoice fact table. Each row represents one invoice position, enriched with contract and company data. Covers regular invoice runs, MySports receipts, 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 some imported invoices.

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. * DRAFT: Invoice is a draft — not yet finalized; can be deleted but not yet sent. * CREATED: Invoice finalized but not yet sent to recipient. * SENT: Invoice has been sent to recipient. * CANCELLED: Invoice has been cancelled. * PAID: Invoice has been fully paid. Set for standard invoices upon successful bank transfer processing. * PARTIALLY_PAID: Invoice has received partial payment. Set for standard invoices when a bank transfer partially covers the outstanding amount.

invoice_type_discriminator varchar 255 null

Technical subtype of the invoice, distinguishing automated invoice runs, manual debt claims, MySports receipts, and imported invoices. * INVOICE_RUN: Standard automated invoice run issued to customer. * COMPANY: Automated invoice run issued to company (B2B). * MANUAL_DEBT_CLAIM: Manually created debt claim invoice. * DIRECT: Direct debt claim invoice with no payment deadline. * MYSPORTS: MySports online payment receipt. * MYSPORTS_ACCOUNT_BALANCE: MySports account balance receipt. * MYSPORTS_CONSUMPTION_CREDIT: MySports consumption credit receipt. * IMPORTED: Externally imported historical invoice.

invoice_type varchar 255 null

Document classification of the invoice. * INVOICE: Standard outgoing invoice (debit document). Set for invoice runs and manual debt claims. * REFUND: Credit note / refund invoice. Exclusively on MySports account balance reversal receipts that carry a reference_invoice_id. * PAYMENT_RECEIPT: Payment receipt document. Set for MySports receipts (MYSPORTS and MYSPORTS_ACCOUNT_BALANCE types).

invoice_gross_amount numeric 19,2 null

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

currency_id varchar 255 null
dim_currency.currency_id fct_invoice_currency_id_fkey R

Currency in which the invoice amounts are denominated. Null for some 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 fct_invoice_company_id_fkey 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 fct_invoice_organization_unit_id_fkey 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 reverses or refunds. Only set when invoice_type = ‘REFUND’ (i.e. on MySports account balance reversal receipts). NULL for all other invoice types.

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. * INVOICE_RUN: Position from automated invoice run. * MANUAL_DEBT_CLAIM: Position from manual debt claim. * DIRECT: Position from direct debt claim. * MYSPORTS: Position for MySports sales. * MYSPORTS_ACCOUNT_BALANCE: Position for account balance receipt. * MYSPORTS_CONSUMPTION_CREDIT: Position for consumption credit. * IMPORTED: Position from imported invoice.

position_status varchar 255 null

Lifecycle status of the invoice position. NULL only for MYSPORTS_ACCOUNT_BALANCE positions. MYSPORTS positions carry status ACTIVE. * DRAFT: Position is a draft — not yet finalized. * ACTIVE: Position is active (default state). Applies to INVOICE_RUN, MYSPORTS, and MANUAL_DEBT_CLAIM positions. * DISCONNECTED: Position has been disconnected from its booking entry. * CANCELLED: Position has been cancelled.

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
dim_product.product_id fct_invoice_product_id_fkey R

Links this invoice position to the product that was sold. Only populated for positions associated with a product sale (physical goods, vouchers, or services purchased individually). Null for membership charges and positions without a linked product.

rate_id int8 19 null
dim_rate.rate_id fct_invoice_rate_id_fkey 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