added credit note reporting models
This commit is contained in:
parent
791cbd47e8
commit
fb89652159
2 changed files with 59 additions and 0 deletions
22
models/reporting/xero/xero__credit_note_line_items.sql
Normal file
22
models/reporting/xero/xero__credit_note_line_items.sql
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
with
|
||||||
|
int_xero__credit_note_line_items as (
|
||||||
|
select * from {{ ref("int_xero__credit_note_line_items") }}
|
||||||
|
)
|
||||||
|
|
||||||
|
select
|
||||||
|
id_credit_note as id_credit_note,
|
||||||
|
id_line_item as id_line_item,
|
||||||
|
id_item as id_item,
|
||||||
|
item_code as item_code,
|
||||||
|
quantity as quantity,
|
||||||
|
unit_amount as unit_amount,
|
||||||
|
line_amount_local_curr as line_amount_local_curr,
|
||||||
|
line_amount_in_gbp as line_amount_in_gbp,
|
||||||
|
line_amount_wo_taxes_local_curr as line_amount_wo_taxes_local_curr,
|
||||||
|
line_amount_wo_taxes_in_gbp as line_amount_wo_taxes_in_gbp,
|
||||||
|
tax_amount_local_curr as tax_amount_local_curr,
|
||||||
|
tax_amount_in_gbp as tax_amount_in_gbp,
|
||||||
|
tax_type as tax_type,
|
||||||
|
credit_note_currency_iso_4217 as credit_note_currency_iso_4217,
|
||||||
|
line_description as line_description
|
||||||
|
from int_xero__credit_note_line_items li
|
||||||
37
models/reporting/xero/xero__credit_notes.sql
Normal file
37
models/reporting/xero/xero__credit_notes.sql
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
with int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }})
|
||||||
|
|
||||||
|
select
|
||||||
|
id_credit_note as id_credit_note,
|
||||||
|
id_contact as id_contact,
|
||||||
|
reference as reference,
|
||||||
|
credit_note_number as credit_note_number,
|
||||||
|
credit_note_issued_at_utc as credit_note_issued_at_utc,
|
||||||
|
credit_note_issued_date_utc as credit_note_issued_date_utc,
|
||||||
|
credit_note_type as credit_note_type,
|
||||||
|
credit_note_currency_iso_4217 as credit_note_currency_iso_4217,
|
||||||
|
exchange_rate_to_gbp as exchange_rate_to_gbp,
|
||||||
|
total_amount_local_curr as total_amount_local_curr,
|
||||||
|
total_amount_in_gbp as total_amount_in_gbp,
|
||||||
|
subtotal_local_curr as subtotal_local_curr,
|
||||||
|
subtotal_in_gbp as subtotal_in_gbp,
|
||||||
|
total_tax_local_curr as total_tax_local_curr,
|
||||||
|
total_tax_in_gbp as total_tax_in_gbp,
|
||||||
|
remaining_credit_local_curr as remaining_credit_local_curr,
|
||||||
|
remaining_credit_in_gbp as remaining_credit_in_gbp,
|
||||||
|
applied_amount as applied_amount,
|
||||||
|
credit_note_status as credit_note_status,
|
||||||
|
full_contact_details as full_contact_details,
|
||||||
|
credit_note_due_date as credit_note_due_date,
|
||||||
|
line_items as line_items,
|
||||||
|
date_string as date_string,
|
||||||
|
due_date_string as due_date_string,
|
||||||
|
allocations as allocations,
|
||||||
|
has_been_sent_to_contact as has_been_sent_to_contact,
|
||||||
|
has_attachments as has_attachments,
|
||||||
|
updated_at_utc as updated_at_utc,
|
||||||
|
id_branding_theme as id_branding_theme,
|
||||||
|
was_fully_paid_on_date_utc as was_fully_paid_on_date_utc,
|
||||||
|
line_amount_tax_inclusiveness as line_amount_tax_inclusiveness,
|
||||||
|
updated_date_utc as updated_date_utc,
|
||||||
|
dwh_extracted_at_utc as dwh_extracted_at_utc
|
||||||
|
from int_xero__credit_notes
|
||||||
Loading…
Add table
Add a link
Reference in a new issue