Table: dbo.Pending_AP_Payment_Application
This table holds pending applications. A pending application is the pairing of one existing payable and one existing payment, or one existing payable and one pending payment. It can be used to create a real (no longer pending) application of payment to payable.
Columns
NameTypeConstraintsDescription
pending_ap_payment_application_KEYint (4)NOT NULLPrimary Key for this table.
vendor_KEYint (4)NOT NULLThe vendor linked to the payment and the payable.
payable_transaction_KEYint (4)A foreign key to an existing payable transaction. If this is null then the record is incomplete, but this is an allowed state to save off work in progress. This key will appear in several records for the same client and vendor if one payable is paired with several payments.
payment__gl_transaction_KEYint (4)A foreign key to an existing payment transaction, and this key will be reused if several payables are linked with one existing payment. To put it another way, several table records for the same client and vendor could have repeats of this key.
pending_ap_payment_KEYint (4)A foreign key to a pending payment, and this key will be reused if several payables are linked to the same pending payment. To put it another way, several table records for the same client and vendor could have repeats of this key.
application_selection_group_numberint (4)Used when we are linking an existing payment with a payable. This key will be reused if several payables are linked with one existing payment, or several existing payments are linked with one payable. To put it another way, several table records for the same client and vendor could have repeats of this key. Null when not using an existing payment.
payment_selection_group_numberint (4)Used when we are linking a pending payment with a payable. One pending payment can be linked to one or more existing payables with a payment group number. To put it another way, several table records for the same client and vendor could have repeats of this key. Null when not using a pending payment.
paid_amountdecimal (9, 2)NOT NULLThe amount of this pending application, that is, the amount by which a payment and a payable will be reduced en route to reducing the payable down to an amount remaining to be paid of zero dollars and zero cents.
discount_taken_amountdecimal (9, 2)NOT NULLIf a discount is to be taken with this application, it will reduce the amount remaining to be paid of the payable by this amount.
Primary key
NameColumnsDescription
PK_Pending_AP_Payment_Applicationpending_ap_payment_application_KEY
Foreign keys
NameColumnsReferenced tableDescription
FK_Pending_AP_Payment_Application__Payable_Transaction__payable_transaction_KEYpayable_transaction_KEYPayable_Transaction (payable_transaction_KEY)
FK_Pending_AP_Payment_Application__Pending_AP_Payment__pending_ap_payment_KEYpending_ap_payment_KEYPending_AP_Payment (pending_ap_payment_KEY)
FK_Pending_AP_Payment_Application__Vendor__vendor_KEYvendor_KEYVendor (vendor_KEY)
FK_Pending_AP_Payment_Application__GL_Transaction__payment__gl_transaction_KEYpayment__gl_transaction_KEYGL_Transaction (gl_transaction_KEY)

Schema diagram