staging model for credit notes
This commit is contained in:
parent
79521d723d
commit
2faa47e7cb
2 changed files with 41 additions and 0 deletions
|
|
@ -15,3 +15,7 @@ sources:
|
||||||
identifier: invoices
|
identifier: invoices
|
||||||
description: |
|
description: |
|
||||||
Invoices that we have raised within our accounting books.
|
Invoices that we have raised within our accounting books.
|
||||||
|
- name: credit_notes
|
||||||
|
identifier: credit_notes
|
||||||
|
description: |
|
||||||
|
Credit notes that have been created within our accounting books.
|
||||||
|
|
|
||||||
37
models/staging/xero/stg_xero__credit_notes.sql
Normal file
37
models/staging/xero/stg_xero__credit_notes.sql
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
with
|
||||||
|
raw_credit_notes as (select * from {{ source("xero", "credit_notes") }}),
|
||||||
|
stg_xero__credit_notes as (
|
||||||
|
select
|
||||||
|
{{ adapter.quote("CreditNoteID") }} as id_credit_note,
|
||||||
|
{{ adapter.quote("Reference") }} as reference,
|
||||||
|
{{ adapter.quote("CreditNoteNumber") }} as credit_note_number,
|
||||||
|
{{ adapter.quote("Date") }} as credit_note_issued_at_utc,
|
||||||
|
cast({{ adapter.quote("Date") }} as date) as credit_note_issued_date_utc,
|
||||||
|
{{ adapter.quote("Type") }} as credit_note_type,
|
||||||
|
{{ adapter.quote("CurrencyCode") }} as invoice_currency_iso_4217,
|
||||||
|
1 / {{ adapter.quote("CurrencyRate") }} as exchange_rate_to_gbp,
|
||||||
|
{{ adapter.quote("Total") }} as total_amount_local_curr,
|
||||||
|
{{ adapter.quote("SubTotal") }} as subtotal_local_curr,
|
||||||
|
{{ adapter.quote("TotalTax") }} as total_tax_local_curr,
|
||||||
|
{{ adapter.quote("RemainingCredit") }} as remaining_credit_local_curr,
|
||||||
|
{{ adapter.quote("AppliedAmount") }} as applied_amount,
|
||||||
|
{{ adapter.quote("Status") }} as credit_note_status,
|
||||||
|
{{ adapter.quote("Contact") }} as full_contact_details,
|
||||||
|
{{ adapter.quote("DueDate") }} as credit_note_due_date,
|
||||||
|
{{ adapter.quote("LineItems") }} as line_items,
|
||||||
|
{{ adapter.quote("DateString") }} as date_string,
|
||||||
|
{{ adapter.quote("DueDateString") }} as due_date_string,
|
||||||
|
{{ adapter.quote("Allocations") }} as allocations,
|
||||||
|
{{ adapter.quote("SentToContact") }} as has_been_sent_to_contact,
|
||||||
|
{{ adapter.quote("HasAttachments") }} as has_attachments,
|
||||||
|
{{ adapter.quote("UpdatedDateUTC") }} as updated_at_utc,
|
||||||
|
{{ adapter.quote("BrandingThemeID") }} as id_branding_theme,
|
||||||
|
{{ adapter.quote("FullyPaidOnDate") }} as was_fully_paid_on_date_utc,
|
||||||
|
{{ adapter.quote("LineAmountTypes") }} as line_amount_tax_inclusiveness,
|
||||||
|
cast({{ adapter.quote("UpdatedDateUTC") }} as date) as updated_date_utc,
|
||||||
|
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||||
|
|
||||||
|
from raw_credit_notes
|
||||||
|
)
|
||||||
|
select *
|
||||||
|
from stg_xero__credit_notes
|
||||||
Loading…
Add table
Add a link
Reference in a new issue