From 9d4b1043748320cfc569fa7285bc2d6d90b3f24c Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 13 May 2024 15:17:46 +0200 Subject: [PATCH] int invoice model --- .../intermediate/xero/int_xero__invoices.sql | 42 +++++++++++++++++++ models/staging/xero/stg_xero__invoices.sql | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 models/intermediate/xero/int_xero__invoices.sql diff --git a/models/intermediate/xero/int_xero__invoices.sql b/models/intermediate/xero/int_xero__invoices.sql new file mode 100644 index 0000000..499f821 --- /dev/null +++ b/models/intermediate/xero/int_xero__invoices.sql @@ -0,0 +1,42 @@ +with stg_xero__invoices as (select * from {{ ref("stg_xero__invoices") }}) + +select + id_invoice, + contact ->> 'ContactId' as id_contact, + reference, + invoice_number, + invoice_issued_date_utc, + invoice_due_date_utc, + was_fully_paid_on_date_utc, + invoice_type, + invoice_currency_iso_4217, + exchange_rate_to_gbp, + total_amount_local_curr, + total_amount_wo_tax_local_curr, + total_tax_local_curr, + total_due_local_curr, + total_paid_local_curr, + invoice_status, + full_contact_details as full_contact_details, + payments, + has_errors, + line_items, + credit_notes, + prepayments, + overpayments, + is_discounted, + date_string, + due_date_string, + has_been_sent_to_contact, + total_discount, + total_credited_local_curr, + has_attachments, + updated_at_utc, + updated_date_utc, + id_branding_theme, + invoice_url, + line_amount_tax_inclusiveness, + payment_planned_date_utc, + payment_expected_date_utc, + dwh_extracted_at_utc +from stg_xero__invoices diff --git a/models/staging/xero/stg_xero__invoices.sql b/models/staging/xero/stg_xero__invoices.sql index 4125e6d..a53db68 100644 --- a/models/staging/xero/stg_xero__invoices.sql +++ b/models/staging/xero/stg_xero__invoices.sql @@ -17,7 +17,7 @@ with {{ adapter.quote("AmountDue") }} as total_due_local_curr, {{ adapter.quote("AmountPaid") }} as total_paid_local_curr, {{ adapter.quote("Status") }} as invoice_status, - {{ adapter.quote("Contact") }} as contact, + {{ adapter.quote("Contact") }} as full_contact_details, {{ adapter.quote("Payments") }} as payments, {{ adapter.quote("HasErrors") }} as has_errors, {{ adapter.quote("LineItems") }} as line_items,