diff --git a/models/reporting/xero/schema.yaml b/models/reporting/xero/schema.yaml new file mode 100644 index 0000000..f0f278b --- /dev/null +++ b/models/reporting/xero/schema.yaml @@ -0,0 +1,176 @@ +version: 2 + +models: + - name: xero__invoices + description: | + Invoice data from Xero. Each record corresponds to one specific invoiced. + + + columns: + - name: id_invoice + data_type: character varying + description: Xero's unique identifier for the invoice. + + - name: id_contact + data_type: text + description: | + The ID of the contact related to this invoice. + + The customer if it's an Accounts Receivables one, the supplier if it's an Accounts Payables one. + + You can use this to join with the contacts table. + + - name: reference + data_type: character varying + description: | + The Superhog-set reference for the invoices. Only relevant for + records of invoice type (ACCREC). + + - name: invoice_number + data_type: character varying + description: "" + + - name: invoice_issued_date_utc + data_type: timestamp with time zone + description: Date on which the invoice was issued. + + - name: invoice_due_date_utc + data_type: timestamp with time zone + description: The date were the invoice should be paid the latest. + + - name: was_fully_paid_on_date_utc + data_type: timestamp with time zone + description: | + The date on which the invoice was fully paid. If the invoice is still + not fully paid, it returns null. + + - name: invoice_type + data_type: character varying + description: | + This field indicates whether the invoice is from Superhog towards a customer + (value is "ACCREC") or from a supplier towards Superhog (value is "ACCPAY"). + + - name: invoice_currency_iso_4217 + data_type: character varying + description: The ISO 4217 code for the currency which this invoice uses as unit of account. + + - name: exchange_rate_to_gbp + data_type: numeric + description: | + The implied exchange rate between the invoice currency and GBP. + + This is the XXX to GBP rate. So the number represented in this field is the units of currency GBP + that 1 unit of XXX buys you. + + For example, if the invoice is 135 ZAR, and this rate is 0.0167, the invoice value in GBP is 2.25 + (135ZAR * 0.0167GBP/ZAR = 2.25GBP). + + - name: total_amount_local_curr + data_type: numeric + description: The total amount to be paid, in the currency the invoice is denominated in. + + - name: total_amount_in_gbp + data_type: numeric + description: The total amount to be paid, converted to GBP. + + - name: total_amount_wo_tax_local_curr + data_type: numeric + description: The total amount to be paid minus taxes, in the currency the invoice is denominated in. + + - name: total_amount_wo_tax_in_gbp + data_type: numeric + description: The total amount to be paid minus taxes, converted to GBP. + + - name: total_tax_local_curr + data_type: numeric + description: The total tax, in the currency the invoice is denominated in. + + - name: total_tax_in_gbp + data_type: numeric + description: The total tax, converted to GBP. + + - name: total_due_local_curr + data_type: numeric + description: The total amount outstanding right now, in the currency the invoice is denominated in. + + - name: total_due_in_gbp + data_type: numeric + description: The total amount outstanding right now, converted to GBP. + + - name: total_paid_local_curr + data_type: numeric + description: The total amount that has already been paid, in the currency the invoice is denominated in. + + - name: total_paid_in_gbp + data_type: numeric + description: The total amount that has already been paid, in GBP. + + - name: invoice_status + data_type: character varying + description: | + The status of the invoice. + + Can be one of: PAID, VOIDED, DRAFT, DELETED, AUTHORISED, SUBMITTED. + + You can read more here: https://developer.xero.com/documentation/api/accounting/types#invoices + + - name: has_errors + data_type: boolean + description: "" + + - name: is_discounted + data_type: boolean + description: "" + + - name: date_string + data_type: timestamp with time zone + description: "" + + - name: due_date_string + data_type: timestamp with time zone + description: "" + + - name: has_been_sent_to_contact + data_type: boolean + description: "" + + - name: total_discount + data_type: numeric + description: "" + + - name: total_credited_local_curr + data_type: numeric + description: + Total amount credited by related credit notes, over-payments and + pre-payments. + + - name: has_attachments + data_type: boolean + description: Flag indicating if the invoice has an attachment. + + - name: updated_at_utc + data_type: timestamp with time zone + description: "" + + - name: updated_date_utc + data_type: date + description: "" + + - name: line_amount_tax_inclusiveness + data_type: character varying + description: | + Indicates whether the amounts included in line items are tax + inclusive (Inclusive), tax exclusive (Exclusive) or simply, + there are no taxes on the invoice (NoTax). + + - name: payment_planned_date_utc + data_type: timestamp with time zone + description: "" + + - name: payment_expected_date_utc + data_type: timestamp with time zone + description: "" + + - name: dwh_extracted_at_utc + data_type: timestamp with time zone + description: "" \ No newline at end of file diff --git a/models/staging/xero/schema.yml b/models/staging/xero/schema.yml index 398af13..7a89a51 100644 --- a/models/staging/xero/schema.yml +++ b/models/staging/xero/schema.yml @@ -313,7 +313,7 @@ models: - name: has_attachments data_type: boolean - description: Flag indicating if the invoice has an attahcment. + description: Flag indicating if the invoice has an attachment. - name: updated_at_utc data_type: timestamp with time zone