Table a_ar_invoice |
Description: the invoice (which is also an offer at a certain stage) |
PRIMARY KEY | ||
a_ledger_number_i
integer default: 0 NOT NULL | This is used as a key field in most of the accounting system files | a_tax_table |
a_key_i
integer NOT NULL | Key to uniquely identify invoice | |
a_status_c
varchar (32) NOT NULL | an invoice can have these states: OFFER, CHARGED, PARTIALLYPAID, PAID | |
p_partner_key_n
bigint | This is the partner who has to pay the bill; can be null for cash payments; could also be another field | p_partner |
a_date_effective_d
date | this is the date when the invoice was charged | |
a_offer_i
integer | refers to the offer that was created for this invoice; it is basically an archived copy of the invoice, and the invoice might actually be different from the offer (e.g. hospitality: different number of people, etc.); table ph_booking always refers to the invoice, and the invoice refers to the offer; there is no requirement for an offer to exist, it can be null | |
a_taxing_c
varchar (20) default: 'DEFAULT' NOT NULL | this defines whether no tax is applied to this invoice (NONE), or if a SPECIAL tax is applied, or if the DEFAULT tax defined for each article; this should work around issues of selling to businesses or customers abroad | |
a_special_tax_type_code_c
varchar (16) | if a_taxing_c has the value SPECIAL, then this tax applies (defined by tax type code, tax rate code, and date valid from | a_tax_table |
a_special_tax_rate_code_c
varchar (16) | this describes whether it is e.g. the standard, reduced or zero rate of VAT | a_tax_table |
a_special_tax_valid_from_d
date | this describes when this particular percentage rate has become valid by law | a_tax_table |
a_total_amount_n
numeric (24, 10) | The total amount of money that this invoice is worth; this includes all discounts, even the early payment discount; if the early payment discount does not apply anymore at the time of payment, this total amount needs to be updated | |
a_currency_code_c
varchar (16) NOT NULL | the currency of the total amount | a_currency |
s_date_created_d
date default: CURRENT_DATE | The date the record was created. | |
s_created_by_c
varchar (20) | User ID of who created this record. | s_user |
s_date_modified_d
date | The date the record was modified. | |
s_modified_by_c
varchar (20) | User ID of who last modified this record. | s_user |
s_modification_id_t
timestamp default: CURRENT_TIMESTAMP | This identifies the current version of the record. | |
FOREIGN KEY a_ar_invoice_fk1: p_partner_key_n => p_partner a_ar_invoice_fk2: a_ledger_number_i;a_special_tax_type_code_c;a_special_tax_rate_code_c;a_special_tax_valid_from_d => a_tax_table a_ar_invoice_fk3: a_currency_code_c => a_currency a_ar_invoice_fkcr: s_created_by_c => s_user a_ar_invoice_fkmd: s_modified_by_c => s_user | ||
REFERENCED BY a_ar_invoice_detail, a_ar_invoice_discount, ph_booking | ||