reporting models
This commit is contained in:
parent
d0b8d4a8df
commit
f8fcf7f2b5
4 changed files with 101 additions and 4 deletions
|
|
@ -5,11 +5,12 @@ select
|
||||||
j.id_line_item,
|
j.id_line_item,
|
||||||
j.id_item,
|
j.id_item,
|
||||||
j.item_code,
|
j.item_code,
|
||||||
j.quantity,
|
j.quantity::numeric,
|
||||||
j.unit_amount,
|
j.unit_amount::numeric,
|
||||||
j.line_amount,
|
j.line_amount::numeric,
|
||||||
j.tax_amount,
|
j.tax_amount::numeric,
|
||||||
j.tax_type,
|
j.tax_type,
|
||||||
|
i.invoice_currency_iso_4217,
|
||||||
j.line_description
|
j.line_description
|
||||||
from int_xero__invoices i
|
from int_xero__invoices i
|
||||||
cross join
|
cross join
|
||||||
|
|
|
||||||
44
models/reporting/xero/xero__contacts.sql
Normal file
44
models/reporting/xero/xero__contacts.sql
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
with int_xero__contacts as (select * from {{ ref("int_xero__contacts") }})
|
||||||
|
select
|
||||||
|
id_contact as id_contact,
|
||||||
|
account_number as account_number,
|
||||||
|
id_deal as id_deal,
|
||||||
|
contact_name as contact_name,
|
||||||
|
is_customer as is_customer,
|
||||||
|
is_supplier as is_supplier,
|
||||||
|
tax_number as tax_number,
|
||||||
|
contact_first_name as contact_first_name,
|
||||||
|
contact_last_name as contact_last_name,
|
||||||
|
phones as phones,
|
||||||
|
website as website,
|
||||||
|
balances as balances,
|
||||||
|
discount as discount,
|
||||||
|
addresses as addresses,
|
||||||
|
attachments as attachments,
|
||||||
|
email_addresses as email_addresses,
|
||||||
|
payment_terms as payment_terms,
|
||||||
|
batch_payments as batch_payments,
|
||||||
|
branding_theme as branding_theme,
|
||||||
|
contact_groups as contact_groups,
|
||||||
|
contact_number as contact_number,
|
||||||
|
contact_status as contact_status,
|
||||||
|
skyper_user_name as skyper_user_name,
|
||||||
|
contact_persons as contact_persons,
|
||||||
|
has_attachments as has_attachments,
|
||||||
|
updated_at_utc as updated_at_utc,
|
||||||
|
updated_date_utc as updated_date_utc,
|
||||||
|
xero_network_key as xero_network_key,
|
||||||
|
default_currency_iso_4217 as default_currency_iso_4217,
|
||||||
|
validation_errors as validation_errors,
|
||||||
|
bank_account_details as bank_account_details,
|
||||||
|
has_validation_errors as has_validation_errors,
|
||||||
|
tracking_category_name as tracking_category_name,
|
||||||
|
account_payable_tax_type as account_payable_tax_type,
|
||||||
|
tracking_category_option as tracking_category_option,
|
||||||
|
sales_default_account_code as sales_default_account_code,
|
||||||
|
sales_tracking_categories as sales_tracking_categories,
|
||||||
|
account_receivable_tax_type as account_receivable_tax_type,
|
||||||
|
purchases_default_account_code as purchases_default_account_code,
|
||||||
|
purchases_tracking_categories as purchases_tracking_categories,
|
||||||
|
dwh_extracted_at_utc as dwh_extracted_at_utc
|
||||||
|
from int_xero__contacts
|
||||||
18
models/reporting/xero/xero__invoice_line_items.sql
Normal file
18
models/reporting/xero/xero__invoice_line_items.sql
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
with
|
||||||
|
int_xero__invoice_line_items as (
|
||||||
|
select * from {{ ref("int_xero__invoice_line_items") }}
|
||||||
|
)
|
||||||
|
|
||||||
|
select
|
||||||
|
id_invoice as id_invoice,
|
||||||
|
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 as line_amount,
|
||||||
|
tax_amount as tax_amount,
|
||||||
|
tax_type as tax_type,
|
||||||
|
invoice_currency_iso_4217 as invoice_currency_iso_4217,
|
||||||
|
line_description as line_description
|
||||||
|
from int_xero__invoice_line_items li
|
||||||
34
models/reporting/xero/xero__invoices.sql
Normal file
34
models/reporting/xero/xero__invoices.sql
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
with int_xero__invoices as (select * from {{ ref("int_xero__invoices") }})
|
||||||
|
|
||||||
|
select
|
||||||
|
id_invoice as id_invoice,
|
||||||
|
id_contact as id_contact,
|
||||||
|
reference as reference,
|
||||||
|
invoice_number as invoice_number,
|
||||||
|
invoice_issued_date_utc as invoice_issued_date_utc,
|
||||||
|
invoice_due_date_utc as invoice_due_date_utc,
|
||||||
|
was_fully_paid_on_date_utc as was_fully_paid_on_date_utc,
|
||||||
|
invoice_type as invoice_type,
|
||||||
|
invoice_currency_iso_4217 as invoice_currency_iso_4217,
|
||||||
|
exchange_rate_to_gbp as exchange_rate_to_gbp,
|
||||||
|
total_amount_local_curr as total_amount_local_curr,
|
||||||
|
total_amount_wo_tax_local_curr as total_amount_wo_tax_local_curr,
|
||||||
|
total_tax_local_curr as total_tax_local_curr,
|
||||||
|
total_due_local_curr as total_due_local_curr,
|
||||||
|
total_paid_local_curr as total_paid_local_curr,
|
||||||
|
invoice_status as invoice_status,
|
||||||
|
has_errors as has_errors,
|
||||||
|
is_discounted as is_discounted,
|
||||||
|
date_string as date_string,
|
||||||
|
due_date_string as due_date_string,
|
||||||
|
has_been_sent_to_contact as has_been_sent_to_contact,
|
||||||
|
total_discount as total_discount,
|
||||||
|
total_credited_local_curr as total_credited_local_curr,
|
||||||
|
has_attachments as has_attachments,
|
||||||
|
updated_at_utc as updated_at_utc,
|
||||||
|
updated_date_utc as updated_date_utc,
|
||||||
|
line_amount_tax_inclusiveness as line_amount_tax_inclusiveness,
|
||||||
|
payment_planned_date_utc as payment_planned_date_utc,
|
||||||
|
payment_expected_date_utc as payment_expected_date_utc,
|
||||||
|
dwh_extracted_at_utc as dwh_extracted_at_utc
|
||||||
|
from int_xero__invoices
|
||||||
Loading…
Add table
Add a link
Reference in a new issue