Host Resolution model for report

This commit is contained in:
Joaquin 2025-04-29 11:42:15 +02:00
parent ca5be5c3cf
commit 16bf7f1d6c
4 changed files with 191 additions and 8 deletions

View file

@ -26,7 +26,7 @@ models:
- name: reference
data_type: character varying
description: |
The Superhog-set reference for the invoices. Only relevant for
The Truvi-set reference for the invoices. Only relevant for
records of invoice type (ACCREC).
- name: invoice_number
@ -61,8 +61,8 @@ models:
- name: invoice_type
data_type: character varying
description: |
This field indicates whether the invoice is from Superhog towards a customer
(value is "ACCREC") or from a supplier towards Superhog (value is "ACCPAY").
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
@ -299,7 +299,7 @@ models:
- name: account_number
data_type: character varying
description: A Superhog set identifier. For customers, this is Hubspot's Deal Id.
description: A Truvi set identifier. For customers, this is Hubspot's Deal Id.
- name: id_deal
data_type: text
@ -316,11 +316,11 @@ models:
- name: is_customer
data_type: boolean
description: Flag that shows if the contact is a Superhog customer.
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 Superhog supplier.
description: Flag that shows if the contact is a Truvi supplier.
- name: tax_number
data_type: character varying
@ -496,7 +496,7 @@ models:
- name: reference
data_type: character varying
description: |
The Superhog-set reference for the credit note.
The Truvi-set reference for the credit note.
- name: credit_note_number
data_type: character varying
@ -1580,3 +1580,144 @@ models:
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: ""

View file

@ -0,0 +1,35 @@
with
int_xero__host_resolutions_payments as (
select * from {{ ref("int_xero__host_resolutions_payments") }}
),
xero__contacts as (select * from {{ ref("xero__contacts") }})
select
hrp.id_line_item,
hrp.document_class,
hrp.id_account,
hrp.account_code,
hrp.account_name,
hrp.line_description,
hrp.transaction_date_utc,
hrp.quantity,
hrp.unit_amount,
hrp.line_amount_local_curr,
hrp.line_amount_in_gbp,
hrp.line_amount_wo_taxes_local_curr,
hrp.line_amount_wo_taxes_in_gbp,
hrp.tax_amount_local_curr,
hrp.tax_amount_in_gbp,
hrp.transaction_currency_iso_4217,
hrp.id_contact,
hrp.id_deal,
c.account_number,
c.contact_name,
c.is_customer,
c.is_supplier,
c.contact_first_name,
c.contact_last_name,
c.email_addresses,
c.contact_number,
c.contact_status
from int_xero__host_resolutions_payments hrp
left join xero__contacts c on c.id_contact = hrp.id_contact