ACCOUNTCODE

General Ledger Account Code table.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
CONTRAACCOUNT bit Default = 0 Is this a contra account code?
DATEADDED datetime Default = getdate() Indicates the date this record was added.
DATECHANGED datetime Default = getdate() Indicates the date this record was last changed.
TS timestamp Timestamp.
TSLONG bigint (Computed) yes CONVERT(bigint, TS) Numeric representation of the timestamp.
CATEGORYCODE tinyint Default = 1 1=Asset, 2=Liability, 3=Net asset, 4=Revenue, 5=Expense
CATEGORY nvarchar(9) (Computed) yes CASE [CATEGORYCODE] WHEN 1 THEN N'Asset' WHEN 2 THEN N'Liability' WHEN 3 THEN N'Net asset' WHEN 4 THEN N'Revenue' WHEN 5 THEN N'Expense' END Provides a translation for the 'CATEGORYCODE' field.
SUBCATEGORYCODE tinyint Default = 0 0=, 1=Gain, 2=Gift, 3=Loss, 4=Transfer
NORMALBALANCECODE int (Computed) (case when CATEGORYCODE in (1,5) then 1 else 2 end) Normal balance code based on the category. 1 - Debit, 2 - Credit.
NORMALBALANCE varchar(6) (Computed) (case when CATEGORYCODE in (1,5) then 'Debit' else 'Credit' end) Normal balance based on the category.
TYPE int (Computed) 1 Maps to the type field in the Accounting Element table.
SUBCATEGORY nvarchar(8) (Computed) yes CASE [SUBCATEGORYCODE] WHEN 0 THEN N'' WHEN 1 THEN N'Gain' WHEN 2 THEN N'Gift' WHEN 3 THEN N'Loss' WHEN 4 THEN N'Transfer' END Provides a translation for the 'SUBCATEGORYCODE' field.

Foreign Keys

Foreign Key Field Type Null Notes Description
ID uniqueidentifier PDACCOUNTSEGMENTVALUE.ID Primary Key.
CASHFLOWCODEID uniqueidentifier yes CASHFLOWCODE.ID Defines the cash flow for an account code.
WORKINGCAPITALCODEID uniqueidentifier yes WORKINGCAPITALCODE.ID Defines the working capital for an account code.
STATUSCODEID uniqueidentifier yes ACCOUNTCODESTATUSCODE.ID Defines the account code status
SITEID uniqueidentifier yes SITE.ID Site using this Account Code.
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.

Indexes

Index Name Fields Unique Primary Clustered
IX_ACCOUNTCODE_DATEADDED DATEADDED yes
IX_ACCOUNTCODE_DATECHANGED DATECHANGED
PK_ACCOUNTCODE ID yes yes

Triggers

Trigger Name Description
TR_ACCOUNTCODE_AUDIT_UPDATE
TR_ACCOUNTCODE_AUDIT_DELETE

Referenced by

Referenced by Field
GLACCOUNTCODEATTACHMENT GLACCOUNTCODEID
GLACCOUNTCODEMEDIALINK GLACCOUNTCODEID
GLACCOUNTCODENOTE GLACCOUNTCODEID