42 lines
1 KiB
SQL
42 lines
1 KiB
SQL
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
|