Table a_ap_document |
Description: Either an invoice or a credit note in the Accounts Payable system. |
PRIMARY KEY | ||
a_ap_document_id_i
integer default: 0 NOT NULL | Unique key for this record | |
UNIQUE KEY | ||
a_ledger_number_i
integer NOT NULL | Reference to the ledger for this invoice. | a_ledger, a_account |
a_ap_number_i
integer NOT NULL | A unique key (together with the ledger number) to identify this document. | |
p_partner_key_n
bigint NOT NULL | Reference to the supplier that sent this invoice. | a_ap_supplier |
a_credit_note_flag_l
boolean default: '0' NOT NULL | A flag to indicate if this document is an invoice or a credit note. | |
a_document_code_c
varchar (30) | The code given on the document itself (be it invoice or credit note). This will have to be unique for each supplier. | |
a_reference_c
varchar (100) | Some kind of other reference needed. | |
a_date_issued_d
date default: CURRENT_DATE NOT NULL | The date when this document was issued. | |
a_date_entered_d
date default: CURRENT_DATE NOT NULL | The date when this document was entered into the system. | |
a_credit_terms_i
integer default: 0 | Credit terms allowed for this invoice. | |
a_total_amount_n
numeric (24, 10) default: 0 NOT NULL | The total amount of money that this document is worth. | |
a_currency_code_c
varchar (16) NOT NULL | the currency of the document | |
a_exchange_rate_to_base_n
numeric (24, 10) | The exchange rate to the base currency at the time that the document was issued. | |
a_discount_percentage_n
numeric (24, 10) | The percentage discount you get for early payment of this document in the case that it is an invoice. | |
a_discount_days_i
integer | The number of days that the discount is valid for (0 for none). | |
a_ap_account_c
varchar (16) | Reference to the AP Account to debit/credit when posting/paying the document. | a_account |
a_last_detail_number_i
integer default: 0 NOT NULL | The number of the last item for this document. This is used simply to quickly get the next number if items are added. | |
a_document_status_c
varchar (16) | The current status of the invoice. The value can (for now) be one of: OPEN, APPROVED, POSTED, PARTPAID, or PAID. | |
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_ap_document_fk1: a_ledger_number_i => a_ledger a_ap_document_fk2: p_partner_key_n => a_ap_supplier a_ap_document_fk3: a_ledger_number_i;a_ap_account_c => a_account a_ap_document_fkcr: s_created_by_c => s_user a_ap_document_fkmd: s_modified_by_c => s_user | ||
REFERENCED BY a_crdt_note_invoice_link, a_crdt_note_invoice_link, a_ap_document_detail, a_ap_document_payment, a_ep_document_payment | ||