commit wip
This commit is contained in:
parent
f768be9ea5
commit
2746977671
1 changed files with 7 additions and 9 deletions
|
|
@ -1,11 +1,5 @@
|
|||
with
|
||||
int_xero__invoice_line_items as (
|
||||
select * from {{ ref("int_xero__invoice_line_items") }}
|
||||
),
|
||||
int_xero__invoices as (select * from {{ ref("int_xero__invoices") }}),
|
||||
int_xero__credit_note_line_items as (
|
||||
select * from {{ ref("int_xero__credit_note_line_items") }}
|
||||
),
|
||||
int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }}),
|
||||
int_xero__contacts as (select * from {{ ref("int_xero__contacts") }}),
|
||||
stg_seed__accounting_aggregations as (
|
||||
|
|
@ -28,7 +22,9 @@ with
|
|||
where cn.credit_note_status = 'AUTHORISED' and c.id_deal is not null
|
||||
)
|
||||
select
|
||||
id_contact,
|
||||
id_deal,
|
||||
contact_name,
|
||||
sum(total_due_in_gbp) as total_outstanding_in_gbp,
|
||||
case
|
||||
when sum(total_due_in_gbp) < 0
|
||||
|
|
@ -37,4 +33,6 @@ with
|
|||
then 'Outstanding Invoices'
|
||||
end as outstanding_type
|
||||
from amount_due_deals
|
||||
group by id_deal
|
||||
group by id_contact,
|
||||
id_deal,
|
||||
contact_name
|
||||
Loading…
Add table
Add a link
Reference in a new issue