diff --git a/models/reporting/xero/schema.yaml b/models/reporting/xero/schema.yaml index 7eb3491..bccdeaf 100644 --- a/models/reporting/xero/schema.yaml +++ b/models/reporting/xero/schema.yaml @@ -850,3 +850,267 @@ models: - name: purchases_tracking_categories data_type: jsonb description: "" + - name: xero__credit_notes + description: | + Credit notes that we have raised within our accounting books. + + A credit note is a document representing a refund or decrease in invoiced + amount to a customer. For clarity, if we make an invoice charging someone + 100$, and we realise afterward that we should have charged him just 75$, + we will solve the situation by creating a credit note for them with 25$. + + Credit notes can be associated to a specific invoice for a customer, or + can be standalone documents. + + The data structure of credit notes it's pretty much identical to that of + invoices, with the way money is owed being the only difference. + + You can read more here: https://developer.xero.com/documentation/api/accounting/creditnotes + + columns: + - name: id_credit_note + data_type: character varying + description: Xero's unique identifier for the credit note. + + - name: id_contact + data_type: text + description: | + The ID of the contact related to this credit note. + + You can use this to join with the contacts table. + + - name: reference + data_type: character varying + description: | + The Superhog-set reference for the credit note. + + - name: credit_note_number + data_type: character varying + description: "" + + - name: credit_note_issued_at_utc + data_type: timestamp with time zone + description: Date on which the credit note was issued. + + - name: credit_note_issued_date_utc + data_type: date + description: The date were the invoice should be paid the latest. + + - name: credit_note_type + data_type: character varying + description: | + Indicates whether the credit note is an Accounts Receivable Credit + Note (ACCRECCREDIT) or an Accounts Payable Credit Note + (ACCPAYCREDIT). + + Most documents in our company will be ACCRECCREDIT, related to our + own customers. + + - name: credit_note_currency_iso_4217 + data_type: character varying + description: | + + The ISO 4217 code for the currency which this credit note 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 credited, in the currency the note is + denominated in. + + - name: total_amount_in_gbp + data_type: numeric + description: The total amount to be credited, converted to GBP. + + - name: subtotal_local_curr + data_type: numeric + description: | + The total amount to be credited minus taxes, in the currency the + note is denominated in. + + - name: subtotal_in_gbp + data_type: numeric + description: The total amount to be credited minus taxes, in GBP. + + - name: total_tax_local_curr + data_type: numeric + description: | + The total tax, in the currency the credit note is denominated in. + + - name: total_tax_in_gbp + data_type: numeric + description: The total tax, in GBP. + + - name: remaining_credit_local_curr + data_type: numeric + description: "" + + - name: remaining_credit_in_gbp + data_type: numeric + description: "" + + - name: applied_amount + data_type: numeric + description: "" + + - name: credit_note_status + data_type: character varying + description: | + The status of the credit note. + + Can be one of: PAID, VOIDED, DRAFT, DELETED, AUTHORISED, SUBMITTED. + + - name: credit_note_due_date + data_type: timestamp with time zone + description: "" + + - name: date_string + data_type: timestamp with time zone + description: "" + + - name: due_date_string + data_type: timestamp with time zone + description: "" + + - name: allocations + data_type: jsonb + description: "" + + - name: has_been_sent_to_contact + data_type: boolean + description: "" + + - name: has_attachments + data_type: boolean + description: "" + + - name: updated_at_utc + data_type: timestamp with time zone + description: "" + + - name: id_branding_theme + data_type: character varying + description: "" + + - name: was_fully_paid_on_date_utc + data_type: timestamp with time zone + 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: updated_date_utc + data_type: date + description: "" + + - name: dwh_extracted_at_utc + data_type: timestamp with time zone + description: "" + - name: xero__credit_note_line_items + description: | + Credit note line items. Every record corresponds to a Line Item in Xero. + + A Line Item is a combination of a specific service or item being credited, + together with its quantity, price, total amount and taxes. + + You can read more here: https://developer.xero.com/documentation/api/accounting/invoices + + columns: + - name: id_credit_note + data_type: character varying + description: Xero's unique identifier for the credit note. + + - name: id_line_item + data_type: text + description: Xero's unique identifier for the line item. + + - name: id_item + data_type: text + description: Xero's unique identifier for the item of this line. + + - name: item_code + data_type: text + description: A text based code that describes the Item. + + - name: quantity + data_type: numeric + description: How much of the item is credited in this credit note. + + - name: unit_amount + data_type: numeric + description: The price of each unit of the item. + + - name: line_amount_local_curr + data_type: numeric + description: | + The total value to be charged for this line, in local currency. + + - name: line_amount_in_gbp + data_type: numeric + description: The total value to be charged for this line, in GBP. + + - name: line_amount_wo_taxes_local_curr + data_type: numeric + description: | + The total value to be charged for this line, minus taxes, in local + currency. + + In some cases, this will be the same value as the line amount. This + depends on whether there is any tax in the credit note, and whether + the credit note amounts are tax inclusive or tax exclusive. You can + find this out in the details of the credit note this line item belongs + to. + + - name: line_amount_wo_taxes_in_gbp + data_type: numeric + description: | + The total value to be charged for this line, minus taxes, in GBP. + + In some cases, this will be the same value as the line amount. This + depends on whether there is any tax in the credit note, and whether + the credit note amounts are tax inclusive or tax exclusive. You can + find this out in the details of the credit note this line item belongs + to. + + - name: tax_amount_local_curr + data_type: numeric + description: The total value of taxes for this line, in local currency. + + - name: tax_amount_in_gbp + data_type: numeric + description: The total value of taxes for this line, in GBP. + + - name: tax_type + data_type: text + description: "" + + - name: credit note_currency_iso_4217 + data_type: character varying + description: | + The currency in which this line item amounts are defined. + + Line items don't really have a currency definition of its own, this + field is populated for your convenience when working with this data. + The credit note currency is defined at the credit note level, and the + values you see in this field should always be the same as the currency + of the credit note this line item belongs to. + + - name: line_description + data_type: text + description: A text description of the line item.