version: 2 models: - name: xero__invoices description: | Invoices that we have raised within our accounting books. This includes both our invoices towards customers and invoices provided by our suppliers. You can read more here: https://developer.xero.com/documentation/api/accounting/invoices columns: - name: id_invoice data_type: character varying description: Xero's unique identifier for the invoice. - name: id_contact data_type: text description: | The ID of the contact related to this invoice. The customer if it's an Accounts Receivables one, the supplier if it's an Accounts Payables one. You can use this to join with the contacts table. - name: reference data_type: character varying description: | The Truvi-set reference for the invoices. Only relevant for records of invoice type (ACCREC). - name: invoice_number data_type: character varying description: "" - name: is_invoice_posted_in_hyperline data_type: boolean description: | Indicates whether the invoice has been posted in Hyperline. An invoice is considered posted in Hyperline if it follows this logic: - The invoice type equals to ACCREC and the document number follows the naming convention 20XX-Y, where 20XX is the posting year and Y is an autoincremental number. data_tests: - not_null - name: invoice_issued_date_utc data_type: timestamp with time zone description: Date on which the invoice was issued. - name: invoice_due_date_utc data_type: timestamp with time zone description: The date were the invoice should be paid the latest. - name: was_fully_paid_on_date_utc data_type: timestamp with time zone description: | The date on which the invoice was fully paid. If the invoice is still not fully paid, it returns null. - name: invoice_type data_type: character varying description: | This field indicates whether the invoice is from Truvi towards a customer (value is "ACCREC") or from a supplier towards Truvi (value is "ACCPAY"). - name: invoice_currency_iso_4217 data_type: character varying description: The ISO 4217 code for the currency which this invoice uses as unit of account. - name: exchange_rate_to_gbp data_type: numeric description: | The implied exchange rate between the invoice currency and GBP. This is the XXX to GBP rate. So the number represented in this field is the units of currency GBP that 1 unit of XXX buys you. For example, if the invoice is 135 ZAR, and this rate is 0.0167, the invoice value in GBP is 2.25 (135ZAR * 0.0167GBP/ZAR = 2.25GBP). - name: total_amount_local_curr data_type: numeric description: The total amount to be paid, in the currency the invoice is denominated in. - name: total_amount_in_gbp data_type: numeric description: The total amount to be paid, converted to GBP. - name: total_amount_wo_tax_local_curr data_type: numeric description: The total amount to be paid minus taxes, in the currency the invoice is denominated in. - name: total_amount_wo_tax_in_gbp data_type: numeric description: The total amount to be paid minus taxes, converted to GBP. - name: total_tax_local_curr data_type: numeric description: The total tax, in the currency the invoice is denominated in. - name: total_tax_in_gbp data_type: numeric description: The total tax, converted to GBP. - name: total_due_local_curr data_type: numeric description: The total amount outstanding right now, in the currency the invoice is denominated in. - name: total_due_in_gbp data_type: numeric description: The total amount outstanding right now, converted to GBP. - name: total_paid_local_curr data_type: numeric description: The total amount that has already been paid, in the currency the invoice is denominated in. - name: total_paid_in_gbp data_type: numeric description: The total amount that has already been paid, in GBP. - name: invoice_status data_type: character varying description: | The status of the invoice. Can be one of: PAID, VOIDED, DRAFT, DELETED, AUTHORISED, SUBMITTED. You can read more here: https://developer.xero.com/documentation/api/accounting/types#invoices - name: has_errors data_type: boolean description: "" - name: is_discounted data_type: boolean description: "" - name: date_string data_type: timestamp with time zone description: "" - name: due_date_string data_type: timestamp with time zone description: "" - name: has_been_sent_to_contact data_type: boolean description: "" - name: total_discount data_type: numeric description: "" - name: total_credited_local_curr data_type: numeric description: Total amount credited by related credit notes, over-payments and pre-payments. - name: has_attachments data_type: boolean description: Flag indicating if the invoice has an attachment. - name: updated_at_utc data_type: timestamp with time zone description: "" - name: updated_date_utc data_type: date description: "" - name: line_amount_tax_inclusiveness data_type: character varying description: | Indicates whether the amounts included in line items are tax inclusive (Inclusive), tax exclusive (Exclusive) or simply, there are no taxes on the invoice (NoTax). - name: payment_planned_date_utc data_type: timestamp with time zone description: "" - name: payment_expected_date_utc data_type: timestamp with time zone description: "" - name: dwh_extracted_at_utc data_type: timestamp with time zone description: "" - name: xero__invoice_line_items description: | Invoice line items. Every record corresponds to a Line Item in Xero. A Line Item is a combination of a specific service or item being sold, together with its quantity, price, total amount and taxes. You can read more here: https://developer.xero.com/documentation/api/accounting/invoices columns: - name: id_invoice data_type: character varying description: Xero's unique identifier for the invoice. - name: id_line_item data_type: text description: Xero's unique identifier for the line item. - name: id_item data_type: text description: Xero's unique identifier for the item of this line. - name: item_code data_type: text description: A text based code that describes the Item. - name: account_code data_type: text description: Accounting code for the related account. - name: account_name data_type: text description: Name for the related account. - name: quantity data_type: numeric description: How much of the item is sold in its invoice. - name: unit_amount data_type: numeric description: The price of each unit of the item. - name: line_amount_local_curr data_type: numeric description: | The total value to be charged for this line, in local currency. - name: line_amount_in_gbp data_type: numeric description: The total value to be charged for this line, in GBP. - name: line_amount_wo_taxes_local_curr data_type: numeric description: | The total value to be charged for this line, minus taxes, in local currency. In some cases, this will be the same value as the line amount. This depends on whether there is any tax in the invoice, and whether the invoice amounts are tax inclusive or tax exclusive. You can find this out in the details of the invoice this line item belongs to. - name: line_amount_wo_taxes_in_gbp data_type: numeric description: | The total value to be charged for this line, minus taxes, in GBP. In some cases, this will be the same value as the line amount. This depends on whether there is any tax in the invoice, and whether the invoice amounts are tax inclusive or tax exclusive. You can find this out in the details of the invoice this line item belongs to. - name: tax_amount_local_curr data_type: numeric description: The total value of taxes for this line, in local currency. - name: tax_amount_in_gbp data_type: numeric description: The total value of taxes for this line, in GBP. - name: tax_type data_type: text description: "" - name: invoice_currency_iso_4217 data_type: character varying description: | The currency in which this line item amounts are defined. Line items don't really have a currency definition of its own, this field is populated for your convenience when working with this data. The invoice currency is defined at the invoice level, and the values you see in this field should always be the same as the currency of the invoice this line item belongs to. - name: line_description data_type: text description: A text description of the line item. - name: xero__contacts description: | Xero contacts identify other parties we transact with: customers, suppliers, employees, etc. The most interesting contacts are our customers. columns: - name: id_contact data_type: character varying description: Xero's unique identifier for the contact. data_tests: - not_null - unique - name: account_number data_type: character varying description: A Truvi set identifier. For customers, this is Hubspot's Deal Id. - name: id_deal data_type: text description: | For those account numbers that look like a Deal Id, we extract them into this field. Other contacs will have a blank. You can use this to find specific deal ids or even as a proxy bool to keep or remove deal id customers. data_tests: - unique - name: contact_name data_type: character varying description: The name for the customer. - name: is_customer data_type: boolean description: Flag that shows if the contact is a Truvi customer. - name: is_supplier data_type: boolean description: Flag that shows if the contact is a Truvi supplier. - name: tax_number data_type: character varying description: Tax number for this contact. - name: contact_first_name data_type: character varying description: "" - name: contact_last_name data_type: character varying description: "" - name: phones data_type: jsonb description: "" - name: website data_type: character varying description: "" - name: balances data_type: jsonb description: "" - name: discount data_type: numeric description: "" - name: addresses data_type: jsonb description: "" - name: attachments data_type: jsonb description: "" - name: email_addresses data_type: character varying description: "" - name: payment_terms data_type: jsonb description: "" - name: batch_payments data_type: jsonb description: "" - name: branding_theme data_type: jsonb description: "" - name: contact_groups data_type: jsonb description: "" - name: contact_number data_type: character varying description: "" - name: contact_status data_type: character varying description: "" - name: skyper_user_name data_type: character varying description: "" - name: contact_persons data_type: jsonb description: "" - name: has_attachments data_type: boolean description: "" - name: updated_at_utc data_type: timestamp with time zone description: "" - name: updated_date_utc data_type: date description: "" - name: xero_network_key data_type: character varying description: "" - name: default_currency_iso_4217 data_type: character varying description: | The default currency used to interact with this contact. For customers, this is the currency we will usually use to invoice. - name: validation_errors data_type: jsonb description: "" - name: bank_account_details data_type: character varying description: "" - name: has_validation_errors data_type: boolean description: "" - name: tracking_category_name data_type: character varying description: "" - name: account_payable_tax_type data_type: character varying description: "" - name: tracking_category_option data_type: character varying description: "" - name: sales_default_account_code data_type: character varying description: "" - name: sales_tracking_categories data_type: jsonb description: "" - name: account_receivable_tax_type data_type: character varying description: "" - name: purchases_default_account_code data_type: character varying description: "" - name: purchases_tracking_categories data_type: jsonb description: "" - name: dwh_extracted_at_utc data_type: timestamp with time zone description: "" - name: xero__credit_notes description: | Credit notes that we have raised within our accounting books. A credit note is a document representing a refund or decrease in invoiced amount to a customer. For clarity, if we make an invoice charging someone 100$, and we realise afterward that we should have charged him just 75$, we will solve the situation by creating a credit note for them with 25$. Credit notes can be associated to a specific invoice for a customer, or can be standalone documents. The data structure of credit notes it's pretty much identical to that of invoices, with the way money is owed being the only difference. You can read more here: https://developer.xero.com/documentation/api/accounting/creditnotes columns: - name: id_credit_note data_type: character varying description: Xero's unique identifier for the credit note. - name: id_contact data_type: text description: | The ID of the contact related to this credit note. You can use this to join with the contacts table. - name: reference data_type: character varying description: | The Truvi-set reference for the credit note. - name: credit_note_number data_type: character varying description: "" - name: is_credit_note_posted_in_hyperline data_type: boolean description: | Indicates whether the credit note has been posted in Hyperline. A credit note is considered posted in Hyperline if it follows this logic: - The credit note type equals to ACCRECCREDIT and the document number follows the naming convention CN-20XX-Y, where CN refers to Credit Note, 20XX is the posting year and Y is an autoincremental number. data_tests: - not_null - name: credit_note_issued_at_utc data_type: timestamp with time zone description: Date on which the credit note was issued. - name: credit_note_issued_date_utc data_type: date description: The date were the invoice should be paid the latest. - name: credit_note_type data_type: character varying description: | Indicates whether the credit note is an Accounts Receivable Credit Note (ACCRECCREDIT) or an Accounts Payable Credit Note (ACCPAYCREDIT). Most documents in our company will be ACCRECCREDIT, related to our own customers. - name: credit_note_currency_iso_4217 data_type: character varying description: | The ISO 4217 code for the currency which this credit note uses as unit of account. - name: exchange_rate_to_gbp data_type: numeric description: | The implied exchange rate between the invoice currency and GBP. This is the XXX to GBP rate. So the number represented in this field is the units of currency GBP that 1 unit of XXX buys you. For example, if the invoice is 135 ZAR, and this rate is 0.0167, the invoice value in GBP is 2.25 (135ZAR * 0.0167GBP/ZAR = 2.25GBP). - name: total_amount_local_curr data_type: numeric description: | The total amount to be credited, in the currency the note is denominated in. - name: total_amount_in_gbp data_type: numeric description: The total amount to be credited, converted to GBP. - name: subtotal_local_curr data_type: numeric description: | The total amount to be credited minus taxes, in the currency the note is denominated in. - name: subtotal_in_gbp data_type: numeric description: The total amount to be credited minus taxes, in GBP. - name: total_tax_local_curr data_type: numeric description: | The total tax, in the currency the credit note is denominated in. - name: total_tax_in_gbp data_type: numeric description: The total tax, in GBP. - name: remaining_credit_local_curr data_type: numeric description: "" - name: remaining_credit_in_gbp data_type: numeric description: "" - name: applied_amount data_type: numeric description: "" - name: credit_note_status data_type: character varying description: | The status of the credit note. Can be one of: PAID, VOIDED, DRAFT, DELETED, AUTHORISED, SUBMITTED. - name: credit_note_due_date data_type: timestamp with time zone description: "" - name: date_string data_type: timestamp with time zone description: "" - name: due_date_string data_type: timestamp with time zone description: "" - name: allocations data_type: jsonb description: "" - name: has_been_sent_to_contact data_type: boolean description: "" - name: has_attachments data_type: boolean description: "" - name: updated_at_utc data_type: timestamp with time zone description: "" - name: id_branding_theme data_type: character varying description: "" - name: was_fully_paid_on_date_utc data_type: timestamp with time zone description: "" - name: line_amount_tax_inclusiveness data_type: character varying description: | Indicates whether the amounts included in line items are tax inclusive (Inclusive), tax exclusive (Exclusive) or simply, there are no taxes on the invoice (NoTax). - name: updated_date_utc data_type: date description: "" - name: dwh_extracted_at_utc data_type: timestamp with time zone description: "" - name: xero__credit_note_line_items description: | Credit note line items. Every record corresponds to a Line Item in Xero. A Line Item is a combination of a specific service or item being credited, together with its quantity, price, total amount and taxes. You can read more here: https://developer.xero.com/documentation/api/accounting/invoices columns: - name: id_credit_note data_type: character varying description: Xero's unique identifier for the credit note. - name: credit_note_issued_at_utc data_type: timestamp with time zone description: Date on which the credit note was issued. - name: credit_note_status data_type: character varying description: | The status of the credit note. Can be one of: PAID, VOIDED, DRAFT, DELETED, AUTHORISED, SUBMITTED. data_tests: - not_null - accepted_values: values: - PAID - VOIDED - DRAFT - DELETED - AUTHORISED - SUBMITTED - name: id_contact data_type: text description: | Xero's unique id for the contact related to this transaction. - name: id_line_item data_type: text description: Xero's unique identifier for the line item. - name: id_item data_type: text description: Xero's unique identifier for the item of this line. - name: item_code data_type: text description: A text based code that describes the Item. - name: account_code data_type: text description: Accounting code for the related account. - name: account_name data_type: text description: Name for the related account. - name: quantity data_type: numeric description: How much of the item is credited in this credit note. - name: unit_amount data_type: numeric description: The price of each unit of the item. - name: line_amount_local_curr data_type: numeric description: | The total value to be charged for this line, in local currency. - name: line_amount_in_gbp data_type: numeric description: The total value to be charged for this line, in GBP. - name: line_amount_wo_taxes_local_curr data_type: numeric description: | The total value to be charged for this line, minus taxes, in local currency. In some cases, this will be the same value as the line amount. This depends on whether there is any tax in the credit note, and whether the credit note amounts are tax inclusive or tax exclusive. You can find this out in the details of the credit note this line item belongs to. - name: line_amount_wo_taxes_in_gbp data_type: numeric description: | The total value to be charged for this line, minus taxes, in GBP. In some cases, this will be the same value as the line amount. This depends on whether there is any tax in the credit note, and whether the credit note amounts are tax inclusive or tax exclusive. You can find this out in the details of the credit note this line item belongs to. - name: tax_amount_local_curr data_type: numeric description: The total value of taxes for this line, in local currency. - name: tax_amount_in_gbp data_type: numeric description: The total value of taxes for this line, in GBP. - name: tax_type data_type: text description: "" - name: credit_note_currency_iso_4217 data_type: character varying description: | The currency in which this line item amounts are defined. Line items don't really have a currency definition of its own, this field is populated for your convenience when working with this data. The credit note currency is defined at the credit note level, and the values you see in this field should always be the same as the currency of the credit note this line item belongs to. - name: line_description data_type: text description: A text description of the line item. - name: xero__net_fees description: | A summary aggregation table showing the total raw and net fees by month and year. Information comes from both Invoices and Credit notes. Only documents in statuses ('PAID', 'AUTHORISED') are kept. Net fees get computed by subtracting credited amounts from invoiced amounts. columns: - name: issued_year_month data_type: date description: The issuing year and month of the aggregated documents. - name: fee_category data_type: text description: | A fee category, one of out of booking_fees, listing_fees, verification_fees, waiver fees. - name: fees_invoiced_in_gbp data_type: numeric description: The total sum of invoiced fees. - name: fees_credited_in_gbp data_type: numeric description: The total sum of credited fees. - name: net_fees_in_gbp data_type: numeric description: | Net fees are calculated by subtracting credited fees from invoiced fees. It might be the case that net fees are negative in some month, if it happens to be that we have given back to customers more than we have invoiced them. - name: xero__net_fees_by_deal description: | A summary aggregation table showing the total raw and net fees by month and year, dedicated for deal attribution. Information comes from both Invoices and Credit notes. Only documents in statuses ('PAID', 'AUTHORISED') are kept. Net fees get computed by subtracting credited amounts from invoiced amounts. columns: - name: issued_year_month data_type: date description: The issuing year and month of the aggregated documents. - name: id_deal data_type: text description: | A fee category per deal. - name: fees_invoiced_in_gbp data_type: numeric description: The total sum of invoiced fees. - name: fees_credited_in_gbp data_type: numeric description: The total sum of credited fees. - name: net_fees_in_gbp data_type: numeric description: | Net fees are calculated by subtracting credited fees from invoiced fees. It might be the case that net fees are negative in some month, if it happens to be that we have given back to customers more than we have invoiced them. - name: xero__bank_transactions description: | Bank transactions that have happened in any of our bank accounts. You can read more here: https://developer.xero.com/documentation/api/accounting/banktransactions columns: - name: id_bank_transaction data_type: character varying description: Xero's unique identifier for the transaction. data_tests: - not_null - unique - name: id_prepayment data_type: character varying description: | Xero generated identifier for a Prepayment (unique within organisations). This will be returned on BankTransactions with a Type of SPEND-PREPAYMENT or RECEIVE-PREPAYMENT. - name: id_overpayment data_type: character varying description: Xero generated identifier for an Overpayment (unique within organisations). This will be returned on BankTransactions with a Type of SPEND-OVERPAYMENT or RECEIVE-OVERPAYMENT. - name: id_contact data_type: text description: | Xero's unique id for the contact related to this transaction. - name: id_bank_account data_type: text description: | Xero's unique id for the bank account related to this transaction. - name: reference data_type: character varying description: | Reference for the transaction. Only supported for SPEND and RECEIVE transactions. - name: transaction_type data_type: character varying description: | What kind of transaction is this record. Can be one of: RECEIVE, RECEIVE-OVERPAYMENT, RECEIVE-PREPAYMENT, SPEND, SPEND-OVERPAYMENT, SPEND-PREPAYMENT, RECEIVE-TRANSFER, SPEND-TRANSFER The type will affect the sign of all amounts. Amounts we send are negative, amounts we receive are positive. You can read more here: https://developer.xero.com/documentation/api/accounting/types#bank-transactions data_tests: - not_null - accepted_values: values: - RECEIVE - RECEIVE-OVERPAYMENT - RECEIVE-PREPAYMENT - SPEND - SPEND-OVERPAYMENT - SPEND-PREPAYMENT - RECEIVE-TRANSFER - SPEND-TRANSFER - name: transaction_sign data_type: numeric description: | The sign for the transactions. Spending transactions show as -1, receiving transactions show as 1. This helps in converting the transaction amounts in the right sign, since Xero brings all amounts as positive by default. data_tests: - not_null - accepted_values: values: - 1 - -1 - name: transaction_status data_type: character varying description: | The status of this transaction. Can be one of: AUTHORISED, DELETED. You can read more here: https://developer.xero.com/documentation/api/accounting/types#bank-transaction-status-codes data_tests: - not_null - accepted_values: values: - AUTHORISED - DELETED - name: transaction_at_utc data_type: timestamp with time zone description: When did the transaction happen. - name: transaction_date_utc data_type: date description: The date on which the transaction happened. - name: date_string data_type: timestamp with time zone description: When did the transaction happened, as a string. - name: total_amount_local_curr data_type: numeric description: | Total of bank transaction tax inclusive, in the currency the transaction is denominated in. data_tests: - not_null - name: total_amount_in_gbp data_type: numeric description: | Total of bank transaction tax inclusive, presented in GBP. - name: total_amount_wo_tax_local_curr data_type: numeric description: | Total of bank transaction excluding taxes, in the currency the transaction is denominated in. - name: total_amount_wo_tax_in_gbp data_type: numeric description: | Total of bank transaction excluding taxes, presented in GBP. - name: total_tax_local_curr data_type: numeric description: | Total tax on bank transaction, in the currency the transaction is denominated in. - name: total_tax_in_gbp data_type: numeric description: | Total tax on bank transaction, presented in GBP. - name: transaction_currency_iso_4217 data_type: character varying description: The ISO 4217 code for the currency of the transaction. data_tests: - not_null - length_between: min_length: 3 max_length: 3 - name: exchange_rate_to_gbp data_type: numeric description: | ATTENTION! unlike in many other Xero entities, here this field is not completed by Xero always. It has been complemented with the general rates data used in the DWH. Xero's rates are preferent, so DWH rates will only be used where Xero didn't provide a rate. The implied exchange rate between the transaction currency and GBP. This is the XXX to GBP rate. So the number represented in this field is the units of currency GBP that 1 unit of XXX buys you. For example, if the transaction is 135 ZAR, and this rate is 0.0167, the transaction value in GBP is 2.25 (135ZAR * 0.0167GBP/ZAR = 2.25GBP). data_tests: - not_negative - name: line_amount_tax_inclusiveness data_type: character varying description: | Indicates whether the amounts included in line items are tax inclusive (Inclusive), tax exclusive (Exclusive) or simply, there are no taxes on the invoice (NoTax). data_tests: - accepted_values: values: - Inclusive - Exclusive - NoTax - name: is_reconciled data_type: boolean description: A flag indicating if the transaction has been reconciled. data_tests: - not_null - name: has_attachments data_type: boolean description: "" - name: url data_type: character varying description: "" - name: external_link_provider_name data_type: character varying description: "" - name: updated_at_utc data_type: timestamp with time zone description: "" - name: updated_date_utc data_type: date description: "" - name: dwh_extracted_at_utc data_type: timestamp with time zone description: "" - name: xero__bank_transaction_line_items description: | Line item level data for our Bank Transactions. You can read more here: https://developer.xero.com/documentation/api/accounting/banktransactions columns: - name: id_bank_transaction data_type: character varying description: Xero's unique identifier for the transaction. data_tests: - not_null - name: id_line_item data_type: text description: Xero's unique identifier for the line item. data_tests: - not_null - unique - name: line_description data_type: text description: A text description of the line item. - name: id_account data_type: text description: Xero's unique identifier for the related Account. - name: account_code data_type: text description: Accounting code for the related account. - name: account_name data_type: character varying description: Name for the related account. - name: item_code data_type: text description: Item code if an item has been specified. - name: quantity data_type: numeric description: How much of the item is transferred in this transaction. - name: unit_amount data_type: numeric description: The quantity-to-money conversion rate for this item. - name: line_amount_local_curr data_type: numeric description: | The total value transferred in this line, in the transaction currency. - name: line_amount_in_gbp data_type: numeric description: | The total value transferred in this line, presented in GBP. - name: line_amount_wo_taxes_local_curr data_type: numeric description: | The total value transferred in this line, minus taxes, in the transaction currency. In some cases, this will be the same value as the line amount. This depends on whether there is any tax in the invoice, and whether the invoice amounts are tax inclusive or tax exclusive. You can find this out in the details of the transaction this line item belongs to. - name: line_amount_wo_taxes_in_gbp data_type: numeric description: | The total value transferred in this line, minus taxes, presented in GBP. In some cases, this will be the same value as the line amount. This depends on whether there is any tax in the invoice, and whether the invoice amounts are tax inclusive or tax exclusive. You can find this out in the details of the transaction this line item belongs to. - name: tax_amount_local_curr data_type: numeric description: | The total value of taxes for this line, in the transaction currency. - name: tax_amount_in_gbp data_type: numeric description: | The total value of taxes for this line, presented in GBP. - name: tax_type data_type: text description: "" - name: transaction_currency_iso_4217 data_type: character varying description: | The currency in which this line item amounts are defined. Line items don't really have a currency definition of its own, this field is populated for your convenience when working with this data. The transaction currency is defined at the Bank Transaction level, and the values you see in this field should always be the same as the currency of the Bank Transaction this line item belongs to. - name: xero__bank_transaction_denom_mart description: | This model is a denormalized mart, which only exists for presentation purposes in a PBI report. The data is the same that lives in `xero__bank_transaction_line_items`, `xero__bank_transactions` and `xero__contacts`. The granularity is at line item level, so be careful when doing aggregations. Most aggregations on data on the transaction or contact level will be wrong due to duplicates. columns: - name: id_line_item data_type: text description: Xero's unique identifier for the line item. data_tests: - not_null - unique - name: xero__sales_denom_mart description: | This table is a denormalized mix of all invoices and credit notes data. It is built by creating a snowflake schema for the invoicing area and another one for the crediting area. In both cases, the cardinality is *:1 between line items and documents, and *:1 between documents and contacts. Then, the invoice and credit note side get unioned to be stored in a single structure. The only transformation that happens differently across both is that credit note amounts get their sign reversed (* -1) so that aggregations happen naturally (credit amounts subtract from invoice amounts). The final granularity of the table is on the line item level. Invoice and credit note records can be told apart through the document_class field. The word _document_ in the context of this table encompasses both invoices and credit notes. The source of amounts is identifiable by their prefix. `line_` amount fields come from the line items data, while `header_` fields come from the document level data. Aggregating line fields can be done without worries. Document level data can't be summed or averaged since it's duplicated per line item, so be careful with it. Most fields are not documented here: you can find more details in upstream models. columns: - name: id_line_item data_type: text description: "" data_tests: - not_null - unique - name: id_item data_type: text description: "" - name: document_class data_type: text description: | Indicates whether the record belongs in an invoice or a credit note. data_tests: - not_null - accepted_values: values: - "invoice" - "credit note" - name: item_code data_type: text description: "" - name: account_code data_type: text description: Accounting code for the related account. - name: account_name data_type: text description: Name for the related account. - name: quantity data_type: numeric description: "" - name: unit_amount data_type: numeric description: "" - name: line_amount_local_curr data_type: numeric description: "" - name: line_amount_in_gbp data_type: numeric description: "" - name: line_amount_wo_taxes_local_curr data_type: numeric description: "" - name: line_amount_wo_taxes_in_gbp data_type: numeric description: "" - name: tax_amount_local_curr data_type: numeric description: "" - name: tax_amount_in_gbp data_type: numeric description: "" - name: tax_type data_type: text description: "" - name: document_currency_iso_4217 data_type: character varying description: "" data_tests: - not_null - length_between: min_length: 3 max_length: 3 - name: line_description data_type: text description: "" - name: id_document data_type: character varying description: "" data_tests: - not_null - name: is_document_posted_in_hyperline data_type: boolean description: | Indicates whether the document has been posted in Hyperline. A document is considered posted in Hyperline if it follows this logic: - For invoices, if the invoice type equals to ACCREC and the document number follows the naming convention 20XX-Y, where 20XX is the posting year and Y is an autoincremental number. - For credit notes, if the credit note type equal to ACCRECCREDIT and the document number follows the naming convention CN-20XX-Y, where CN refers to Credit Note, 20XX is the posting year and Y is an autoincremental number. data_tests: - not_null - name: reference data_type: character varying description: "" - name: document_number data_type: character varying description: "" - name: document_issued_at_utc data_type: timestamp with time zone description: "" - name: document_issued_date_utc data_type: date description: "" - name: document_is_effective_at_end_of_month_utc data_type: date description: | The last day of the month when the document is effective. This is used to align the document with the correct invoicing cycle period. For documents posted in Hyperline, this represents the last day of the previous month to the issuing date. For documents not posted in Hyperline, this is the last day of the month when the document was issued. - name: document_type data_type: character varying description: "" data_tests: - not_null - accepted_values: values: - "ACCREC" - "ACCPAY" - "ACCRECCREDIT" - "ACCPAYCREDIT" - name: document_currency_iso_4217 data_type: character varying description: "" - name: exchange_rate_to_gbp data_type: numeric description: "" data_tests: - not_null - not_negative - name: document_status data_type: character varying description: "" data_tests: - not_null - accepted_values: values: - PAID - VOIDED - DRAFT - DELETED - AUTHORISED - SUBMITTED - name: line_amount_tax_inclusiveness data_type: character varying description: "" data_tests: - accepted_values: values: - Inclusive - Exclusive - NoTax - name: header_total_amount_local_curr data_type: numeric description: "" - name: header_total_amount_in_gbp data_type: numeric description: "" - name: header_total_amount_wo_tax_local_curr data_type: numeric description: "" - name: header_total_amount_wo_tax_in_gbp data_type: numeric description: "" - name: header_total_tax_local_curr data_type: numeric description: "" - name: header_total_tax_in_gbp data_type: numeric description: "" - name: header_total_due_local_curr data_type: numeric description: "" - name: header_total_due_in_gbp data_type: numeric description: "" - name: id_contact data_type: character varying description: "" - name: id_deal data_type: text description: "" - name: contact_name data_type: character varying description: "" - name: accounting_root_aggregation data_type: character varying description: | The root aggregation per account code. This is the main aggregation that is used to retrieve low-level data. - name: accounting_kpis_aggregation data_type: character varying description: | The default macro-aggregation for Invoiced KPIs. - name: accounting_financial_l1_aggregation data_type: character varying description: | The Level 1 aggregation for Financial reporting. - name: accounting_financial_l2_aggregation data_type: character varying description: | The Level 2 aggregation for Financial reporting. - name: accounting_financial_l3_aggregation data_type: character varying description: | The Level 3 aggregation for Financial reporting. - name: account_code_name data_type: character varying description: | The code and name of the account separated by a "-". - name: xero__sales_monthly_trends description: | This model provides monthly aggregated sales and credit note data with fiscal year alignment and period-over-period comparisons. The model is built by aggregating the `int_xero__sales_denom_mart` model at the monthly level, computing sales amounts without taxes in GBP, and incorporating key financial aggregations. Additionally, it calculates prior period trends: - Previous month sales - Previous year (same month) sales - Year-to-date (YTD) sales for the current fiscal year - YTD sales for the previous fiscal year The fiscal year is determined based on an April-March cycle, where a fiscal year is labeled by the year in which it ends (e.g., FY 2025 represents April 2024 – March 2025). data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - document_issued_month_utc - document_status - document_type - id_deal - accounting_financial_l3_aggregation columns: - name: document_issued_month_utc data_type: date description: "The first day of the month when the document was issued, truncated to the month level." data_tests: - not_null - name: fiscal_year data_type: integer description: | "The fiscal year in which the document's issued month falls. The fiscal year runs from April to March and is labeled by the year in which it ends (e.g., FY 2025 represents April 2024 – March 2025)." data_tests: - not_null - name: previous_fiscal_year data_type: integer description: "The fiscal year prior to the current one, based on the April-March cycle." data_tests: - not_null - name: document_status data_type: text description: "The status of the document (e.g., PAID, VOIDED, AUTHORISED, etc.)." data_tests: - not_null - name: document_type data_type: text description: "The type of document, indicating whether it is an invoice or credit note." data_tests: - not_null - name: id_deal data_type: text description: "The deal associated with the transaction, if applicable. Defaults to 'UNSET' if not provided." data_tests: - not_null - name: contact_name data_type: text description: "The name of the contact associated with the deal." - name: id_deal_contact_name data_type: text description: "A concatenation of the deal ID and contact name." data_tests: - not_null - name: accounting_financial_l1_aggregation data_type: text description: "The Level 1 aggregation for Financial reporting." - name: accounting_financial_l2_aggregation data_type: text description: "The Level 2 aggregation for Financial reporting." - name: accounting_financial_l3_aggregation data_type: text description: "The Level 3 aggregation for Financial reporting." - name: amount_wo_taxes_in_gbp data_type: numeric description: "Total sales amount without taxes, converted to GBP, aggregated at the monthly level." - name: previous_month_amount_wo_taxes_in_gbp data_type: numeric description: "The sales amount without taxes (GBP) for the previous month within the same category." - name: previous_year_amount_wo_taxes_in_gbp data_type: numeric description: "The sales amount without taxes (GBP) for the same month in the previous year within the same category." - name: ytd_amount_wo_taxes_in_gbp data_type: numeric description: | "Year-to-date (YTD) total of sales amount without taxes (GBP) from the start of the current fiscal year up to the current month." - name: previous_year_ytd_amount_wo_taxes_in_gbp data_type: numeric description: | "Year-to-date (YTD) total of sales amount without taxes (GBP) from the start of the previous fiscal year up to the same month." - name: xero__host_resolutions_payments description: | This model provides a view of transactions related to resolutions, including details such as transaction date, associated account, and transaction amount. Previously, all resolution-related transaction data was stored in the `int_xero__bank_transactions` model. However, some resolution transactions have been, and will continue to be, credited through the standard invoicing process — these are stored in the `int_xero__sales_denom_mart` model. This model is built by joining the `int_xero__bank_transactions` and `int_xero__sales_denom_mart` models to provide a unified view of resolution transactions. columns: - name: id_line_item data_type: text description: "Unique identifier of the line item associated with the transaction." data_tests: - not_null - unique - name: id_account data_type: text description: "Unique identifier of the account associated with the transaction." data_tests: - not_null - name: account_code data_type: text description: "The code of the account associated with the transaction." data_tests: - not_null - name: account_name data_type: text description: "The name of the account associated with the transaction." data_tests: - not_null - name: line_description data_type: text description: "Description of the transaction line item." - name: document_class data_type: text description: "Indicates whether the record belongs in an a credit note or a bank transaction." data_tests: - not_null - accepted_values: values: - "credit note" - "bank transaction" - name: transaction_date_utc data_type: date description: "The date of the transaction in UTC." - name: quantity data_type: numeric description: "The quantity of transactions." - name: unit_amount data_type: numeric description: "The unit amount of the transaction." - name: line_amount_local_curr data_type: numeric description: "The transaction amount in the local currency." - name: line_amount_in_gbp data_type: numeric description: "The transaction amount in GBP." - name: line_amount_wo_taxes_local_curr data_type: numeric description: "The transaction amount without taxes in the local currency." - name: line_amount_wo_taxes_in_gbp data_type: numeric description: "The transaction amount without taxes in GBP." - name: tax_amount_local_curr data_type: numeric description: "The tax amount in the local currency." - name: tax_amount_in_gbp data_type: numeric description: "The tax amount in GBP." - name: transaction_currency_iso_4217 data_type: character varying description: "The currency of the transaction, represented in ISO 4217 format." - name: id_contact data_type: text description: "Unique identifier of the contact associated with the transaction." date_tests: - not_null - name: id_deal data_type: text description: | "Unique identifier of an account associated with the transaction. Can be null" - name: account_number data_type: character varying description: A Truvi set identifier. For customers, this is Hubspot's Deal Id. - name: contact_name data_type: character varying description: The name for the customer. - name: is_customer data_type: boolean description: Flag that shows if the contact is a Truvi customer. - name: is_supplier data_type: boolean description: Flag that shows if the contact is a Truvi supplier. - name: contact_first_name data_type: character varying description: "" - name: contact_last_name data_type: character varying description: "" - name: email_addresses data_type: character varying description: "" - name: contact_number data_type: character varying description: "" - name: contact_status data_type: character varying description: "" - name: xero__deals_due_amounts description: | This model provides a view on outstanding amounts related to deals, specifically focusing on the amounts owed by Truvi or to Truvi. This includes all AUTHORISED invoices and credit notes. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - id_contact - currency - dbt_utils.unique_combination_of_columns: combination_of_columns: - id_deal - currency columns: - name: id_contact data_type: character varying description: | Unique identifier of a contact. data_tests: - not_null - name: id_deal data_type: character varying description: | Identifier of the account. data_tests: - not_null - name: contact_name data_type: character varying description: "Name of the contact associated with the deal." - name: currency data_type: character varying description: "The currency of the transaction, represented in ISO 4217 format." data_tests: - not_null - name: total_due_invoice_amount_local_curr data_type: numeric description: | Total outstanding amount in the local currency, which is the sum of all AUTHORISED invoices for the deal. - name: total_due_invoice_amount_in_gbp data_type: numeric description: | Total outstanding amount in GBP, which is the sum of all AUTHORISED invoices for the deal, converted to GBP. - name: total_due_credit_note_amount_local_curr data_type: numeric description: | Total outstanding amount in the local currency, which is the sum of all AUTHORISED credit notes for the deal. - name: total_due_credit_note_amount_in_gbp data_type: numeric description: | Total outstanding amount in GBP, which is the sum of all AUTHORISED credit notes for the deal, converted to GBP. - name: total_due_amount_local_curr data_type: numeric description: | Total outstanding amount in the local currency, which is the sum of all AUTHORISED invoices and credit notes for the deal. - name: total_due_amount_in_gbp data_type: numeric description: | Total outstanding amount in GBP, which is the sum of all AUTHORISED invoices and credit notes for the deal, converted to GBP. - name: outstanding_type data_type: character varying description: | Field indicating whether Truvi ows more money to the deal account ('Outstanding Resolutions') or the deal account owes more money to Truvi ('Outstanding Invoices'). data_tests: - accepted_values: values: - "Outstanding Resolutions" - "Outstanding Invoices"