Description:
The invoices table holds billing documents generated for users, aggregating rental costs, discounts, taxes, and related metadata. It links to users, branches, payments, and cost centers to support comprehensive financial tracking and integration with accounting systems. These are customer billing artifacts (often aggregated charges, penalties, subscriptions) and are not tied to individual rentals.
🔑 Primary Key
id
| Field Name | Data Type | Description |
|---|---|---|
dtype |
NUMBER | Single-table inheritance discriminator: 0 => RentalInvoice (deprecated), 1 => SpecialInvoice (deprecated), 2 => LineItemInvoice (current). |
id |
NUMBER | Primary key of the invoice. |
invoice_date |
TIMESTAMP_TZ | Date the invoice was generated. |
invoice_id |
TEXT | Public-facing invoice identifier (formatted string shown to the customer). |
payment_id |
NUMBER | Linked payment ID if this invoice was paid. |
state |
NUMBER | Invoice state: 0 => OPEN (open for new rentals), 1 => CLOSED (not accepting new rentals), 2 => BILLED (bill created and sent to customer), 3 => PAID (successfully charged), 4 => EXCEPTION_OPENING, 5 => EXCEPTION_BILLING, 6 => EXCEPTION_SEPA, 7 => EXCEPTION_PAYING, 8 => IGNORE (empty invoice, can be ignored), 9 => DISPUTED, 10 => IN_PAYMENT, 11 => PUSH_WAITING_FOR_USER (waiting for user to finish push payment), 12 => PUSH_CANCELLED_BY_USER, 13 => PUSH_BANK_REFUSED (no retries), 14 => PUSH_ERROR_INITIALISING, 15 => REFUND_IN_PROGRESS, 16 => REFUNDED, 17 => EXCEPTION_REFUND, 18 => THREE_DS_WAITING_FOR_USER (waiting for user to finish 3DS verification), 19 => THREE_DS_FAILED, 20 => COLLECTION (handed over to a collection agency), 21 => PAID_EXTERNALLY (paid externally and manually set), 22 => REFUNDED_EXTERNALLY (refunded externally and manually set), 23 => UNKNOWN, 24 => BILLED_EXTERNAL_COLLECTION (collection handled externally, e.g. wire transfer), 25 => CANCELLED_BY_REFUND, 26 => REFUNDED_BY_CANCELLATION (refunded without money transfer due to cancellation before payment), 27 => DISPUTE_LOST, 28 => NOTIFIED, 29 => EXCEPTION_NOTIFICATION, 30 => LOST. |
state_name |
TEXT | String label for state. |
properties |
VARIANT | Flexible JSON field for custom invoice-related metadata. Sample value: { "legacyId": 2038, "paymentReference": "2038" }. |
open_until |
TIMESTAMP_TZ | Time until which the invoice remains open for new rentals (present only for legacy dtype 0). |
due_date |
TIMESTAMP_TZ | Final due date for payment. |
title |
TEXT | Title or summary shown on the invoice. |
description |
TEXT | Optional description (e.g. “Monthly invoice for April 2025”). |
branch_id |
NUMBER | Branch associated with the invoice. |
guser_id |
NUMBER | Customer ID related to the invoice. |
package_id |
NUMBER | Package, if the invoice resulted from a subscription or bundle. |
cost_center_id |
NUMBER | Associated cost center (used for B2B accounting). |
refunded_invoice_id |
NUMBER | Points to the original invoice if this is a refund. |
price_of_rentals_net |
NUMBER | Net price total for all rentals included in this invoice. |
rebate_net |
NUMBER | Total rebate/discount applied, net. |
sub_total_net |
NUMBER | Intermediate net total. |
payment_rebate_net |
NUMBER | Rebate applied due to payment method, net. |
price_of_rentals_gross |
NUMBER | Gross price total for all rentals included in this invoice. |
rebate_gross |
NUMBER | Total rebate/discount applied, gross. |
sub_total_gross |
NUMBER | Intermediate gross total. |
payment_rebate_gross |
NUMBER | Rebate applied due to payment method, gross. |
net_price |
NUMBER | Final net price. |
contained_tax |
NUMBER | Total tax amount contained in the invoice. |
gross_price |
NUMBER | Final gross price. |
created_at |
TIMESTAMP_TZ | Timestamp when the invoice was created. |
updated_at |
TIMESTAMP_TZ | Last updated timestamp. |
created_by |
NUMBER | User or system ID that created the record. |
updated_by |
NUMBER | User or system ID that last modified the invoice. |
_snowflake_inserted_at |
TIMESTAMP_NTZ | System timestamp when the record was inserted into Snowflake. |
_snowflake_updated_at |
TIMESTAMP_NTZ | System timestamp when the record was last updated in Snowflake. |
_snowflake_deleted |
BOOLEAN | True if the record was deleted in the source. |