Table a_crdt_note_invoice_link
Diagram AccountsPayable 
Description:
This table receives a new entry when a credit note is applied to an invoice. Since the invoices and credit notes share the same table, we need a way to link the two, and this is the role of this table.
PRIMARY KEY
a_credit_note_document_id_i
integer NOT NULL
Reference to the credit note. a_ap_document
a_invoice_document_id_i
integer NOT NULL
Reference to the invoice. a_ap_document

a_ledger_number_i
integer NOT NULL
Reference to the ledger number.
a_applied_date_d
date
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_crdt_note_invoice_link_fk1: a_credit_note_document_id_i => a_ap_document
a_crdt_note_invoice_link_fk2: a_invoice_document_id_i => a_ap_document
a_crdt_note_invoice_link_fkcr: s_created_by_c => s_user
a_crdt_note_invoice_link_fkmd: s_modified_by_c => s_user