Merged PR 2118: Bank Transactions Line Items to Reporting schema
Simply bring the int model into reporting as is. Related work items: #17551
This commit is contained in:
commit
6446dfdb9e
2 changed files with 127 additions and 0 deletions
|
|
@ -983,3 +983,107 @@ models:
|
||||||
- name: dwh_extracted_at_utc
|
- name: dwh_extracted_at_utc
|
||||||
data_type: timestamp with time zone
|
data_type: timestamp with time zone
|
||||||
description: ""
|
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.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_line_item
|
||||||
|
data_type: text
|
||||||
|
description: Xero's unique identifier for the line item.
|
||||||
|
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.
|
||||||
|
|
|
||||||
23
models/reporting/xero/xero__bank_transaction_line_items.sql
Normal file
23
models/reporting/xero/xero__bank_transaction_line_items.sql
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
with
|
||||||
|
int_xero__bank_transaction_line_items as (
|
||||||
|
select * from {{ ref("int_xero__bank_transaction_line_items") }}
|
||||||
|
)
|
||||||
|
select
|
||||||
|
btli.id_bank_transaction as id_bank_transaction,
|
||||||
|
btli.id_line_item as id_line_item,
|
||||||
|
btli.line_description as line_description,
|
||||||
|
btli.id_account as id_account,
|
||||||
|
btli.account_code as account_code,
|
||||||
|
btli.account_name as account_name,
|
||||||
|
btli.item_code as item_code,
|
||||||
|
btli.quantity as quantity,
|
||||||
|
btli.unit_amount as unit_amount,
|
||||||
|
btli.line_amount_local_curr as line_amount_local_curr,
|
||||||
|
btli.line_amount_in_gbp as line_amount_in_gbp,
|
||||||
|
btli.line_amount_wo_taxes_local_curr as line_amount_wo_taxes_local_curr,
|
||||||
|
btli.line_amount_wo_taxes_in_gbp as line_amount_wo_taxes_in_gbp,
|
||||||
|
btli.tax_amount_local_curr as tax_amount_local_curr,
|
||||||
|
btli.tax_amount_in_gbp as tax_amount_in_gbp,
|
||||||
|
btli.tax_type as tax_type,
|
||||||
|
btli.transaction_currency_iso_4217 as transaction_currency_iso_4217
|
||||||
|
from int_xero__bank_transaction_line_items btli
|
||||||
Loading…
Add table
Add a link
Reference in a new issue