join credit notes
This commit is contained in:
parent
0b05f8cb62
commit
7fb5bc90d8
1 changed files with 17 additions and 16 deletions
|
|
@ -32,22 +32,23 @@ union all
|
|||
|
||||
select
|
||||
|
||||
id_credit_note,
|
||||
id_line_item,
|
||||
id_item,
|
||||
cnli.id_credit_note,
|
||||
cnli.id_line_item,
|
||||
cnli.id_item,
|
||||
'credit note' as document_type,
|
||||
item_code,
|
||||
quantity,
|
||||
unit_amount,
|
||||
cnli.item_code,
|
||||
cnli.quantity,
|
||||
cnli.unit_amount,
|
||||
-- We multiply all credit amounts by -1 so aggregations with
|
||||
-- invoicing side work the way you would expect them to
|
||||
line_amount_local_curr * -1,
|
||||
line_amount_in_gbp * -1,
|
||||
line_amount_wo_taxes_local_curr * -1,
|
||||
line_amount_wo_taxes_in_gbp * -1,
|
||||
tax_amount_local_curr * -1,
|
||||
tax_amount_in_gbp * -1,
|
||||
tax_type,
|
||||
credit_note_currency_iso_4217,
|
||||
line_description
|
||||
from int_xero__credit_note_line_items
|
||||
cnli.line_amount_local_curr * -1,
|
||||
cnli.line_amount_in_gbp * -1,
|
||||
cnli.line_amount_wo_taxes_local_curr * -1,
|
||||
cnli.line_amount_wo_taxes_in_gbp * -1,
|
||||
cnli.tax_amount_local_curr * -1,
|
||||
cnli.tax_amount_in_gbp * -1,
|
||||
cnli.tax_type,
|
||||
cnli.credit_note_currency_iso_4217,
|
||||
cnli.line_description
|
||||
from int_xero__credit_note_line_items cnli
|
||||
left join int_xero__credit_notes cn on cn.id_credit_note = cnli.id_credit_note
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue