Table: dbo.AR_Payment
Table which holds all the necessary information for each payment in Accounts Receivable.
Columns
Name | Type | Constraints | Description
gl_transaction_KEY | int (4) | NOT NULL | Each Accounts Receivable payment is based on a GL transaction.
ar_payment_type_KEY | int (4) | NOT NULL | Specifies what type of payment this row is.
customer_KEY | int (4) | NOT NULL | The customer that is associated with this payment.
customer_name | nvarchar (100) | NOT NULL | The name of the customer associated with this payment. This field serves as a historical snapshot containing the customer name from when the transaction was created. If the name of the customer is changed in the customer table after the transaction is created, it is important to retain the original name the transaction was created under.
reference_number | nvarchar (32) | NOT NULL | The number to be associated with this payment.
transaction_date | smalldatetime (4) | NOT NULL | The date to be associated with this payment.
amount | decimal (9, 2) | NOT NULL | The numerical cash value of this payment
undeposited_payment__gl_account_KEY | int (4) | NOT NULL | The GL account to be associated with undeposited payments.
unearned_revenue__gl_account_KEY | int (4) | NOT NULL | The GL account to be associated with unearned revenue.
transaction_status_KEY | int (4) | NOT NULL | Specifies the state the payment is currently in.
ar_deposit__bank_transaction_KEY | int (4) |  | When an AR Payment is tied to a bank transaction of type AR deposit, this key shall be the key of that AR deposit. For AR Payments that are not yet tied to an AR deposit, this key shall be null.
reference_number_sortable | varchar (80) | NOT NULL | An easily sortable version of the reference number. This is automatically generated when the reference number is added.
created_date | datetime (8, 3) | NOT NULL | The date on which the AR transaction was created. Similar to Bank_Transaction_Event.event_date, we want the actual time in form of DATETIME instead of DATE and the local time value needs to be assigned rather than using UTC time. For the purposes of historical data, we get midnight (T00:00 Local time) as an artifact of the data conversion process, but new data should include the time-of-day.

Primary key
Name | Columns | Description
PK_AR_Payment$gl_transaction_KEY | gl_transaction_KEY |

Foreign keys
Name | Columns | Referenced table | Description
FK_AR_Payment__AR_Payment_Type__ar_payment_type_KEY | ar_payment_type_KEY | AR_Payment_Type (ar_payment_type_KEY) |
FK_AR_Payment__Bank_Transaction__ar_deposit__bank_transaction_KEY | ar_deposit__bank_transaction_KEY | Bank_Transaction (bank_transaction_KEY) |
FK_AR_Payment__Customer__customer_KEY | customer_KEY | Customer (customer_KEY) |
FK_AR_Payment__GL_Account__undeposited_payment__gl_account_KEY | undeposited_payment__gl_account_KEY | GL_Account (gl_account_KEY) |
FK_AR_Payment__GL_Account__unearned_revenue__gl_account_KEY | unearned_revenue__gl_account_KEY | GL_Account (gl_account_KEY) |
FK_AR_Payment__GL_Transaction__gl_transaction_KEY | gl_transaction_KEY | GL_Transaction (gl_transaction_KEY) |
FK_AR_Payment__Transaction_Status__transaction_status_KEY | transaction_status_KEY | Transaction_Status (transaction_status_KEY) |