MYOB Exo Business Creditors
List of entities
Entity details
Entity: CONTACTS
CommentThis table contains information about Contacts.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique identifier for the Contact record.
SALUTATIONNoVARCHAR(4)NoThe Contact's preferred salutation, e.g. Mr, Mrs.
FIRSTNAMENoVARCHAR(30)NoThe Contact's first name.
LASTNAMENoVARCHAR(30)NoThe Contact's last/family name.
TITLENoVARCHAR(30)NoThe Contact's job title.
MOBILENoVARCHAR(30)NoThe Contact's mobile phone number.
DIRECTPHONENoVARCHAR(30)NoThe Contact's direct telephone number.
DIRECTFAXNoVARCHAR(30)NoThe Contact's fax number.
HOMEPHONENoVARCHAR(30)NoThe Contact's home phone number.
EMAILNoVARCHAR(60)NoThe Contact's email address.
NOTESNoVARCHAR(4096)NoAll notes entered for the Contact on the Notes tab.
ADDRESS1NoVARCHAR(30)NoPostal address line 1.
ADDRESS2NoVARCHAR(30)NoPostal address line 2.
ADDRESS3NoVARCHAR(30)NoPostal address line 3.
ADDRESS4NoVARCHAR(30)NoPostal address line 4.
ADDRESS5NoVARCHAR(30)NoPostal address line 5. This line is only available on the Contacts window if the Additional Postal Address Row profile setting is enabled.
POST_CODENoVARCHAR(12)NoThe Contact's post code.
DELADDR1NoVARCHAR(30)NoDelivery address line 1.
DELADDR2NoVARCHAR(30)NoDelivery address line 2.
DELADDR3NoVARCHAR(30)NoDelivery address line 3.
DELADDR4NoVARCHAR(30)NoDelivery address line 4.
DELADDR5NoVARCHAR(30)NoDelivery address line 5.
DELADDR6NoVARCHAR(30)NoDelivery address line 6.
ISACTIVENoCHAR(1)NoWhether the Contact is active (Y) or inactive (N).
ADVERTSOURCENoINTEGERNoThe Contact's Advertising Source - corresponds to the SEQNO of the type in the ADVERT_TYPES table.
SALESNONoINTEGERNoThe STAFFNO of staff member who is set as the Sales person for the Contact.
FULLNAMENoASNoThe Contact's full name, formed by joining the FIRSTNAME and LASTNAME fields.
COMPANY_ACCNONoINTEGERNoIf the Contact is associated with a company (Debtor, Creditor or Non Account) the company's ID number is recorded here.
COMPANY_ACCTYPENoINTEGERNoIf the Contact is associated with a company (Debtor, Creditor or Non Account) the type of company account is recorded here:
1 = Debtor account
2 = Creditor account
3 = Non Account
MSN_IDNoVARCHAR(45)NoThe Contact's MSN ID number.
YAHOO_IDNoVARCHAR(45)NoThe Contact's Yahoo! ID number.
SKYPE_IDNoVARCHAR(45)NoThe Contact's Skype ID number.
LAST_UPDATEDNoDATETIMENoThe date and time when the Contact record was last updated.
SUB1NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 1 is ticked on the Marketing tab.
SUB2NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 2 is ticked on the Marketing tab.
SUB3NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 3 is ticked on the Marketing tab.
SUB4NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 4 is ticked on the Marketing tab.
SUB5NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 5 is ticked on the Marketing tab.
SUB6NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 6 is ticked on the Marketing tab.
SUB7NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 7 is ticked on the Marketing tab.
SUB8NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 8 is ticked on the Marketing tab.
SUB9NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 9 is ticked on the Marketing tab.
SUB10NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 10 is ticked on the Marketing tab.
SUB11NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 11 is ticked on the Marketing tab.
SUB12NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 12 is ticked on the Marketing tab.
SUB13NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 13 is ticked on the Marketing tab.
SUB14NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 14 is ticked on the Marketing tab.
SUB15NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 15 is ticked on the Marketing tab.
SUB16NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 16 is ticked on the Marketing tab.
SUB17NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 17 is ticked on the Marketing tab.
SUB18NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 18 is ticked on the Marketing tab.
SUB19NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 19 is ticked on the Marketing tab.
SUB20NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 20 is ticked on the Marketing tab.
SUB21NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 21 is ticked on the Marketing tab.
SUB22NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 22 is ticked on the Marketing tab.
SUB23NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 23 is ticked on the Marketing tab.
SUB24NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 24 is ticked on the Marketing tab.
SUB25NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 25 is ticked on the Marketing tab.
SUB26NoCHAR(1)NoThis field is set to 'Y' if Marketing Class number 26 is ticked on the Marketing tab.
SYNC_CONTACTSNoCHAR(1)YesThis field is set to 'Y' if the Contact is set to sync with Microsoft Outlook.
LINKEDINNoVARCHAR(20)NoThe Contact's LinkedIn account ID.
TWITTERNoVARCHAR(500)NoThe Contact's Twitter username.
FACEBOOKNoVARCHAR(500)NoThe Contact's Facebook username or ID number.
OPTOUT_EMARKETINGNoCHAR(1)NoThis field is set to 'Y' if the Contact's Opt-Out eMarketing flag is ticked. Contacts who have opted out of eMarketing will not be included in campaign waves for campaigns whose Campaign Type is set to "Marketing" (EXO Business CRM).
CAMPAIGN_WAVE_SEQNONoINTEGERNoIf the Contact is included in a campaign wave (EXO Business CRM), the wave's ID number is stored here.
LATITUDENoFLOAT(53)NoThe Contact's latitude.
LONGITUDENoFLOAT(53)NoThe Contact's longitude.
GEOCODE_STATUSNoINTEGERNoResult of the geocode lookup. Will be one of:
Null or -1 - lookup not yet attempted
0 - lookup successful
>0 - lookup failed

Relationships:
NameRelationship typeParentChildCardinality
ADVERT_TYPES_CONTACTSNon IdentifyingADVERT_TYPESCONTACTSZero Or More
CAMPAIGN_WAVE_CONTACTSNon IdentifyingCAMPAIGN_WAVECONTACTSZero Or More
CONTACTS_CAMPAIGN_WAVE_AUDITNon IdentifyingCONTACTSCAMPAIGN_WAVE_AUDITZero Or More
CONTACTS_CONTACT_LIST_ITEMNon IdentifyingCONTACTSCONTACT_LIST_ITEMZero Or More
CONTACTS_CR_CONTACTSNon IdentifyingCONTACTSCR_CONTACTSZero Or More
CONTACTS_CR_CONT_HISTNon IdentifyingCONTACTSCR_CONT_HISTZero Or More
CONTACTS_CR_TRANSNon IdentifyingCONTACTSCR_TRANSZero Or More
CONTACTS_DR_CONTACTSNon IdentifyingCONTACTSDR_CONTACTSZero Or More
CONTACTS_TASKSNon IdentifyingCONTACTSTASKSZero Or More
STAFF_CONTACTSNon IdentifyingSTAFFCONTACTSZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (SYNC_CONTACTS)
Not NullColumn ConstraintNOT NULL (SEQNO)
ADVERT_TYPES_CONTACTSForeign KeyTable ConstraintFOREIGN KEY (ADVERTSOURCE) REFERENCES ADVERT_TYPES(SEQNO)
CAMPAIGN_WAVE_CONTACTSForeign KeyTable ConstraintFOREIGN KEY (CAMPAIGN_WAVE_SEQNO) REFERENCES CAMPAIGN_WAVE(SEQNO)
DF__CONTACTS__ADVERT__08C105B8DefaultColumn ConstraintADVERTSOURCE DEFAULT 0
DF__CONTACTS__CAMPAI__5AE5F7C6DefaultColumn ConstraintCAMPAIGN_WAVE_SEQNO DEFAULT -1
DF__CONTACTS__ISACTI__74BA0D0BDefaultColumn ConstraintISACTIVE DEFAULT Y
DF__CONTACTS__LAST_U__6C3AA0FADefaultColumn ConstraintLAST_UPDATED DEFAULT getdate()
DF__CONTACTS__OPTOUT__5250B1C5DefaultColumn ConstraintOPTOUT_EMARKETING DEFAULT N
DF__CONTACTS__SALESN__09B529F1DefaultColumn ConstraintSALESNO DEFAULT 0
DF__CONTACTS__SUB10__348057BCDefaultColumn ConstraintSUB10 DEFAULT N
DF__CONTACTS__SUB11__3668A02EDefaultColumn ConstraintSUB11 DEFAULT N
DF__CONTACTS__SUB12__3850E8A0DefaultColumn ConstraintSUB12 DEFAULT N
DF__CONTACTS__SUB13__3A393112DefaultColumn ConstraintSUB13 DEFAULT N
DF__CONTACTS__SUB14__3C217984DefaultColumn ConstraintSUB14 DEFAULT N
DF__CONTACTS__SUB15__3E09C1F6DefaultColumn ConstraintSUB15 DEFAULT N
DF__CONTACTS__SUB16__3FF20A68DefaultColumn ConstraintSUB16 DEFAULT N
DF__CONTACTS__SUB17__41DA52DADefaultColumn ConstraintSUB17 DEFAULT N
DF__CONTACTS__SUB18__43C29B4CDefaultColumn ConstraintSUB18 DEFAULT N
DF__CONTACTS__SUB19__45AAE3BEDefaultColumn ConstraintSUB19 DEFAULT N
DF__CONTACTS__SUB1__2355CBBADefaultColumn ConstraintSUB1 DEFAULT N
DF__CONTACTS__SUB20__47932C30DefaultColumn ConstraintSUB20 DEFAULT N
DF__CONTACTS__SUB21__497B74A2DefaultColumn ConstraintSUB21 DEFAULT N
DF__CONTACTS__SUB22__4B63BD14DefaultColumn ConstraintSUB22 DEFAULT N
DF__CONTACTS__SUB23__4D4C0586DefaultColumn ConstraintSUB23 DEFAULT N
DF__CONTACTS__SUB24__4F344DF8DefaultColumn ConstraintSUB24 DEFAULT N
DF__CONTACTS__SUB25__511C966ADefaultColumn ConstraintSUB25 DEFAULT N
DF__CONTACTS__SUB26__5304DEDCDefaultColumn ConstraintSUB26 DEFAULT N
DF__CONTACTS__SUB2__253E142CDefaultColumn ConstraintSUB2 DEFAULT N
DF__CONTACTS__SUB3__27265C9EDefaultColumn ConstraintSUB3 DEFAULT N
DF__CONTACTS__SUB4__290EA510DefaultColumn ConstraintSUB4 DEFAULT N
DF__CONTACTS__SUB5__2AF6ED82DefaultColumn ConstraintSUB5 DEFAULT N
DF__CONTACTS__SUB6__2CDF35F4DefaultColumn ConstraintSUB6 DEFAULT N
DF__CONTACTS__SUB7__2EC77E66DefaultColumn ConstraintSUB7 DEFAULT N
DF__CONTACTS__SUB8__30AFC6D8DefaultColumn ConstraintSUB8 DEFAULT N
DF__CONTACTS__SUB9__32980F4ADefaultColumn ConstraintSUB9 DEFAULT N
DF__CONTACTS__SYNC_C__657894D2DefaultColumn ConstraintSYNC_CONTACTS DEFAULT Y
PK__CONTACTS__73C5E8D2Primary KeyTable ConstraintPRIMARY KEY (SEQNO)
STAFF_CONTACTSForeign KeyTable ConstraintFOREIGN KEY (SALESNO) REFERENCES STAFF(STAFFNO)



Entity: CR_ACCGROUP2S
CommentThis table stores the Secondary Groups for Creditors (a grouping on top of the primary grouping - see CR_ACCGROUPS).
Primary key columnsACCGROUP

Attributes:
Column namePrimary keyData typeNot NULLComment
ACCGROUPYesINTEGERYesA unique ID for the Secondary Creditor Group.
GROUPNAMENoVARCHAR(30)NoThe name of the group.
REPORTCODENoVARCHAR(15)NoA report code for the group.

Relationships:
NameRelationship typeParentChildCardinality
CR_ACCGROUP2S_CR_ACCSNon IdentifyingCR_ACCGROUP2SCR_ACCSZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (ACCGROUP)
PK__CR_ACCGROUP2S__395884C4Primary KeyTable ConstraintPRIMARY KEY (ACCGROUP)



Entity: CR_ACCGROUPS
CommentThis table stores the Primary Groups for Creditors (the finer level of grouping - compare CR_ACCGROUP2S).
Primary key columnsACCGROUP

Attributes:
Column namePrimary keyData typeNot NULLComment
ACCGROUPYesINTEGERYesA unique ID for the Primary Creditor Group.
GROUPNAMENoVARCHAR(30)NoThe name of the group.
REPORTCODENoVARCHAR(15)NoA report code for the group.

Relationships:
NameRelationship typeParentChildCardinality
CR_ACCGROUPS_CR_ACCSNon IdentifyingCR_ACCGROUPSCR_ACCSZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (ACCGROUP)
PK__CR_ACCGROUPS__3A6CA48EPrimary KeyTable ConstraintPRIMARY KEY (ACCGROUP)



Entity: CR_ACCS
CommentThis table contains information about Creditor accounts.
Primary key columnsACCNO

Attributes:
Column namePrimary keyData typeNot NULLComment
ACCNOYesINTEGERYesThe unique ID number for the Creditor account.
NAMENoVARCHAR(60)NoThe Creditor's name.
ADDRESS1NoVARCHAR(30)NoPostal address line 1.
ADDRESS2NoVARCHAR(30)NoPostal address line 2.
ADDRESS3NoVARCHAR(30)NoPostal address line 3.
ADDRESS4NoVARCHAR(30)NoPostal address line 4.
ADDRESS5NoVARCHAR(30)NoPostal address line 5. This line is only available on the Creditor Account Details screen if the Additional Postal Address Row profile setting is enabled.
PHONENoVARCHAR(30)NoThe Creditor's phone number.
FAXNoVARCHAR(30)NoThe Creditor's fax number.
EMAILNoVARCHAR(60)NoThe Creditor's email address.
CREDLIMITNoFLOAT(53)NoThe credit limit for the Creditor account.
ACCGROUPNoINTEGERNoThe Creditor's Primary Group.
LASTMONTHNoFLOAT(53)NoTurnover for the last month.
LASTYEARNoFLOAT(53)NoTurnover for the last year
AGEDBAL0NoFLOAT(53)NoAged Balance for the current month.
AGEDBAL1NoFLOAT(53)NoAged Balance for the previous month.
AGEDBAL2NoFLOAT(53)NoAged Balance for two months back.
AGEDBAL3NoFLOAT(53)NoAged Balance for three months back.
BALANCENoASNoThe total of all aged balances.
CREDITSTATUSNoINTEGERNoCredit terms for the Creditor.
OPENITEMNoCHAR(1)NoThis field contains 'Y' if this is not a balance brought forward account.
DELADDR1NoVARCHAR(30)NoDelivery address line 1.
DELADDR2NoVARCHAR(30)NoDelivery address line 2.
DELADDR3NoVARCHAR(30)NoDelivery address line 3.
DELADDR4NoVARCHAR(30)NoDelivery address line 4.
DELADDR5NoVARCHAR(30)NoDelivery address line 5.
DELADDR6NoVARCHAR(30)NoDelivery address line 6.
SALESNONoINTEGERNoID number of the staff member assigned to the Creditor account.
DISCOUNTLEVELNoINTEGERNoThe Creditor's discount level - this is only populated via EXO APIs.
INVOICETYPENoINTEGERNoThis field only applies to Australian databases where M-Powered Invoices are enabled. If set to 1, search results on the Transactions tab of the Creditor Account Details window will only include accounts with the M-Powered invoice type.
AUTOFREIGHTNoFLOAT(53)NoNot used.
NOTESNoVARCHAR(4096)NoAll notes entered for the Creditor on the Notes tab.
MONTHVALNoFLOAT(53)NoTurnover for the current month.
YEARVALNoFLOAT(53)NoTurnover for the current year.
ALPHACODENoVARCHAR(15)NoA non-unique alphanumeric ID code for the Creditor. Can be used for sorting accounts alphabetically, e.g. give "The Warehouse" the code "WARE" to sort under W instead of T. Sometimes used as an alternate account reference.
TAXSTATUSNoINTEGERNoThe Override GST rate for the Creditor.
HEAD_ACCNONoINTEGERYesThe ACCNO of the Creditor's head office account. If no head office, this is set to -1.
CURRENCYNONoINTEGERYesThe ID number of the currency used by the Creditor account.
ALERTNoVARCHAR(60)NoPop-up alert text to display when dealing with the Creditor.
ISACTIVENoCHAR(1)NoWhether the account is active (Y) or inactive (N).
BANK_ACCOUNTNoVARCHAR(40)NoThe Creditor's bank account number, used for Direct Credit payments.
DEFAULT_CODENoVARCHAR(15)NoThe default GL code on a Creditors Invoice (when in GL mode).
BANK_ACC_NAMENoVARCHAR(40)NoThe Creditor's bank account name, used for Direct Credit payments.
LAST_UPDATEDNoDATETIMENoTime and date stamp when the Creditor's account details were last updated.
LEADTIMENoINTEGERNoThe Primary Lead Time defined for the Creditor, i.e. the number of days between placing an order and its arrival.
TAXREGNoVARCHAR(30)NoGST/ABN number of the Creditor.
POST_CODENoVARCHAR(12)NoThe Creditor's postal code.
N_CR_DISCNoFLOAT(53)NoThe stock line discount for the account on invoice. This is only applicable if manual entry of discounts is allowed on Creditors Invoices (controlled by the profile setting 'Allow manual entry of discounts on creditor invoice and purchase order lines').
GLCONTROLACCNoINTEGERNoNot currently used.
GLCONTROLSUBACCNoINTEGERNoNot currently used.
BRANCHNONoINTEGERNoBranch number - only used by specific sites.
PRIOR_AGEDBAL0NoFLOAT(53)NoPrior Aged Balance for the current month.
PRIOR_AGEDBAL1NoFLOAT(53)NoPrior Aged Balance for the previous month.
PRIOR_AGEDBAL2NoFLOAT(53)NoPrior Aged Balance for two months ago.
PRIOR_AGEDBAL3NoFLOAT(53)NoPrior Aged Balance for three months ago.
PROMPT_PAY_DISCNoFLOAT(53)NoThe prompt payment discount percentage for the Creditor.
BSBNONoVARCHAR(40)NoThe Creditor's Bank State Branch number (Australian databases only).
AUTO_AUTH_AMTNoFLOAT(53)NoThe amount that can be automatically authorised by the trigger AUTHORISE_TRANS on the CR_TRANS table.
PAY_TYPENoINTEGERNoThe default payment method.
PRIOR_BALANCENoASNoThe sum of all Prior Aged Balances.
ACCGROUP2NoINTEGERNoThe Creditor's Secondary Group.
LEADTIME2NoINTEGERNoThe Secondary Lead Time defined for the Creditor (the alternate lead delivery time in days).
N_LAND_COST_PROVNNoFLOAT(53)NoThis value is used to calculate the Fixed cost for any Inwards Goods for the account.
PP_TOPAYNoCHAR(1)NoThe pay status from the Creditors Payment Processor.
STOPCREDITNoCHAR(1)NoIf 'Y', the Creditor is on Stop Credit, and no further transactions will take place.
DEF_INVMODENoINTEGERYesThe Default Invoice Mode for the Creditor. Will be one of:
0 = GL
1 = STOCK
PRIVATE_ACCNoCHAR(1)YesIf 'Y', the Creditor account is classed as private. It can only be accessed by users who have the profile setting "Allow access to private creditor accounts" (ALLOW_ACCESS_TO_PRIVATE_CR_ACC) enabled.
WEBSITENoVARCHAR(30)NoURL of the Creditor's website.
AVE_DAYS_TO_PAYNoINTEGERYesAverage Creditor days, calculated by the Stored Procedure DR_CR_ALLOCATION_AVE_DAYS_SP every time you access the Analysis tab.
STATEMENT_TEXTNoVARCHAR(256)NoThis field is used for M-Powered Payments (AU only). Its value is copied to the REF3 field on CR_TRANS for M-Powered transactions.
REMITTANCE_METHODNoVARCHAR(20)NoHow remittance advice should be sent to the Creditor. Will be one of:
None
E-Mail
Print
Both
SEND_PAYMENT_REMITTANCENoCHAR(1)YesIf this field contains 'Y', remittance advice will be sent to this Creditor whenever payments are made to them via the MYOB M-Powered Payments system.
STATEMENT_CONTACT_SEQNONoINTEGERNoThe ID number of the Contact who is assigned as the Creditor's Remittance Contact.
LINKEDINNoVARCHAR(20)NoThe Creditor's LinkedIn account ID.
TWITTERNoVARCHAR(500)NoThe Creditor's Twitter username.
FACEBOOKNoVARCHAR(500)NoThe Creditor's Facebook account ID or username.
TRACK_CITPNoCHAR(1)YesAustralian companies only. This field is set to 'Y' if payments to the Creditor should be tracked for reporting to the ATO on the "Taxable payments annual report".
LATITUDENoFLOAT(53)NoThe Creditor's latitude.
LONGITUDENoFLOAT(53)NoThe Creditor's longitude.
GEOCODE_STATUSNoINTEGERNoResult of the geocode lookup. Will be one of:
Null or -1 - lookup not yet attempted
0 - lookup successful
>0 - lookup failed
EXTERNAL_IDNoVARCHAR(50)NoAn ID used for external systems.
IGNOREABNCHECKNoCHAR(1)YesIndicates whether or not the ABN validation check on the creditor's name should be ignored.
TAX_LOCALITYNoVARCHAR(27)NoSuburb, Town or Locality used for online tax submissions, e.g. TPAR.

Relationships:
NameRelationship typeParentChildCardinality
CR_ACCGROUP2S_CR_ACCSNon IdentifyingCR_ACCGROUP2SCR_ACCSZero Or More
CR_ACCGROUPS_CR_ACCSNon IdentifyingCR_ACCGROUPSCR_ACCSZero Or More
CR_ACCS_CR_CONTACTSNon IdentifyingCR_ACCSCR_CONTACTSZero Or More
CR_ACCS_CR_CONT_HISTNon IdentifyingCR_ACCSCR_CONT_HISTZero Or More
CR_ACCS_CR_INVLINESNon IdentifyingCR_ACCSCR_INVLINESZero Or More
CR_ACCS_CR_LISTSNon IdentifyingCR_ACCSCR_LISTSZero Or More
CR_ACCS_CR_TRANSNon IdentifyingCR_ACCSCR_TRANSZero Or More
CR_ACCS_INWARDS_GOODSNon IdentifyingCR_ACCSINWARDS_GOODSZero Or More
CR_ACCS_INWARDS_GOODS_COSTSNon IdentifyingCR_ACCSINWARDS_GOODS_COSTSZero Or More
CR_ACCS_JOBCOST_LINESNon IdentifyingCR_ACCSJOBCOST_LINESZero Or More
CR_ACCS_PURCHORD_HDRNon IdentifyingCR_ACCSPURCHORD_HDRZero Or More
CR_ACCS_STOCK_ITEMSNon IdentifyingCR_ACCSSTOCK_ITEMSZero Or More
STAFF_CR_ACCSNon IdentifyingSTAFFCR_ACCSZero Or More

Indexes:
NameIndex columnsIndex type
CR_ACCS_NAMENAME ASC
CR_ACCS_TAXSTATUSTAXSTATUS
CR_ACCS_TAXSTATUSTAXSTATUS ASC

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (IGNOREABNCHECK)
Not NullColumn ConstraintNOT NULL (ACCNO)
Not NullColumn ConstraintNOT NULL (TRACK_CITP)
Not NullColumn ConstraintNOT NULL (SEND_PAYMENT_REMITTANCE)
Not NullColumn ConstraintNOT NULL (AVE_DAYS_TO_PAY)
Not NullColumn ConstraintNOT NULL (PRIVATE_ACC)
Not NullColumn ConstraintNOT NULL (DEF_INVMODE)
Not NullColumn ConstraintNOT NULL (CURRENCYNO)
Not NullColumn ConstraintNOT NULL (HEAD_ACCNO)
CR_ACCGROUP2S_CR_ACCSForeign KeyTable ConstraintFOREIGN KEY (ACCGROUP2) REFERENCES CR_ACCGROUP2S(ACCGROUP)
CR_ACCGROUPS_CR_ACCSForeign KeyTable ConstraintFOREIGN KEY (ACCGROUP) REFERENCES CR_ACCGROUPS(ACCGROUP)
DF_CR_ACCS_CURRENCYNODefaultColumn ConstraintCURRENCYNO DEFAULT 0
DF_CR_ACCS_HEAD_ACCNODefaultColumn ConstraintHEAD_ACCNO DEFAULT -1
DF_CR_ACCS_PAY_TYPEDefaultColumn ConstraintPAY_TYPE DEFAULT 0
DF__CR_ACCS__ACCGROU__3F3159ABDefaultColumn ConstraintACCGROUP DEFAULT 0
DF__CR_ACCS__ACCGROU__4D9F7493DefaultColumn ConstraintACCGROUP2 DEFAULT 0
DF__CR_ACCS__AGEDBAL__420DC656DefaultColumn ConstraintAGEDBAL0 DEFAULT 0
DF__CR_ACCS__AGEDBAL__4301EA8FDefaultColumn ConstraintAGEDBAL1 DEFAULT 0
DF__CR_ACCS__AGEDBAL__43F60EC8DefaultColumn ConstraintAGEDBAL2 DEFAULT 0
DF__CR_ACCS__AGEDBAL__44EA3301DefaultColumn ConstraintAGEDBAL3 DEFAULT 0
DF__CR_ACCS__AUTOFRE__4B973090DefaultColumn ConstraintAUTOFREIGHT DEFAULT 0
DF__CR_ACCS__AVE_DAY__2C8A3039DefaultColumn ConstraintAVE_DAYS_TO_PAY DEFAULT -1
DF__CR_ACCS__BRANCHN__3B60C8C7DefaultColumn ConstraintBRANCHNO DEFAULT 0
DF__CR_ACCS__CREDITS__46D27B73DefaultColumn ConstraintCREDITSTATUS DEFAULT 0
DF__CR_ACCS__CREDLIM__3E3D3572DefaultColumn ConstraintCREDLIMIT DEFAULT 0
DF__CR_ACCS__DEF_INV__6E4219A6DefaultColumn ConstraintDEF_INVMODE DEFAULT 0
DF__CR_ACCS__DISCOUN__49AEE81EDefaultColumn ConstraintDISCOUNTLEVEL DEFAULT 0
DF__CR_ACCS__GEOCODE__4556A95ADefaultColumn ConstraintGEOCODE_STATUS DEFAULT NULL
DF__CR_ACCS__GLCONTR__39788055DefaultColumn ConstraintGLCONTROLACC DEFAULT 0
DF__CR_ACCS__GLCONTR__3A6CA48EDefaultColumn ConstraintGLCONTROLSUBACC DEFAULT 0
DF__CR_ACCS__INVOICE__4AA30C57DefaultColumn ConstraintINVOICETYPE DEFAULT 0
DF__CR_ACCS__ISACTIV__269AB60BDefaultColumn ConstraintISACTIVE DEFAULT Y
DF__CR_ACCS__LASTMON__40257DE4DefaultColumn ConstraintLASTMONTH DEFAULT 0
DF__CR_ACCS__LASTYEA__4119A21DDefaultColumn ConstraintLASTYEAR DEFAULT 0
DF__CR_ACCS__LEADTIM__0BB1B5A5DefaultColumn ConstraintLEADTIME DEFAULT 0
DF__CR_ACCS__LEADTIM__6B2FD77ADefaultColumn ConstraintLEADTIME2 DEFAULT 0
DF__CR_ACCS__MONTHVA__4C8B54C9DefaultColumn ConstraintMONTHVAL DEFAULT 0
DF__CR_ACCS__N_CR_DI__1FCDBCEBDefaultColumn ConstraintN_CR_DISC DEFAULT 0
DF__CR_ACCS__N_LAND___6F00685EDefaultColumn ConstraintN_LAND_COST_PROVN DEFAULT 0
DF__CR_ACCS__OPENITE__47C69FACDefaultColumn ConstraintOPENITEM DEFAULT Y
DF__CR_ACCS__PP_TOPA__2BEA4664DefaultColumn ConstraintPP_TOPAY DEFAULT N
DF__CR_ACCS__PRIOR_A__00FF1D08DefaultColumn ConstraintPRIOR_AGEDBAL0 DEFAULT 0
DF__CR_ACCS__PRIOR_A__01F34141DefaultColumn ConstraintPRIOR_AGEDBAL1 DEFAULT 0
DF__CR_ACCS__PRIOR_A__02E7657ADefaultColumn ConstraintPRIOR_AGEDBAL2 DEFAULT 0
DF__CR_ACCS__PRIOR_A__03DB89B3DefaultColumn ConstraintPRIOR_AGEDBAL3 DEFAULT 0
DF__CR_ACCS__PRIVATE__109731AADefaultColumn ConstraintPRIVATE_ACC DEFAULT N
DF__CR_ACCS__SALESNO__48BAC3E5DefaultColumn ConstraintSALESNO DEFAULT 0
DF__CR_ACCS__SEND_PA__7CA612EDDefaultColumn ConstraintSEND_PAYMENT_REMITTANCE DEFAULT N
DF__CR_ACCS__STATEME__60E8E9DFDefaultColumn ConstraintSTATEMENT_CONTACT_SEQNO DEFAULT -1
DF__CR_ACCS__STOPCRE__2D9D84ACDefaultColumn ConstraintSTOPCREDIT DEFAULT N
DF__CR_ACCS__TAXSTAT__1CFC3D38DefaultColumn ConstraintTAXSTATUS DEFAULT 0
DF__CR_ACCS__TRACK_C__6FEC01A4DefaultColumn ConstraintTRACK_CITP DEFAULT N
DF__CR_ACCS__YEARVAL__4D7F7902DefaultColumn ConstraintYEARVAL DEFAULT 0
PK__CR_ACCS__3C54ED00Primary KeyTable ConstraintPRIMARY KEY (ACCNO)
STAFF_CR_ACCSForeign KeyTable ConstraintFOREIGN KEY (SALESNO) REFERENCES STAFF(STAFFNO)



Entity: CR_ALLOCATIONS
CommentThis table stores details of Creditor allocations.
Primary key columnsSEQNO, ALLOCNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique ID number for the allocation.
ALLOCNOYesINTEGERYesA unique ID number for the allocation set.
TRANS_SEQNONoINTEGERNoThis field is a link back to the original transaction line in CR_TRANS table (CR_TRANS.SEQNO).
AMOUNTNoFLOAT(53)NoThe amount allocated.
CURRENCYNoINTEGERNoThe ID number of the currency in which the transaction took place.
TAKENUPNoCHAR(1)NoThis field is a flag that specify whether or not the allocation has been a part of realised gain/losses.
ALLOCTIMENoDATETIMENoThe date and time of the allocation.
PERIOD_SEQNONoINTEGERYesThe period in which the allocation took place.
AGE_STAMPNoINTEGERNoThis is a historical field that has been superseded by the AGE calculated field.
AGENoASNoThe allocation's age. This is calculated based on PERIOD_SEQNO.
EXCHRATENoFLOAT(53)YesThe exchange rate used for conversion at the time of the allocation.

Relationships:
NameRelationship typeParentChildCardinality
CR_TRANS_CR_ALLOCATIONSNon IdentifyingCR_TRANSCR_ALLOCATIONSZero Or More
CURRENCIES_CR_ALLOCATIONSNon IdentifyingCURRENCIESCR_ALLOCATIONSZero Or More
PERIOD_STATUS_CR_ALLOCATIONSNon IdentifyingPERIOD_STATUSCR_ALLOCATIONSZero Or More

Indexes:
NameIndex columnsIndex type
CR_ALLOCATIONS_PERIOD_SEQNO_INDEXPERIOD_SEQNO ASC
CR_ALLOCATIONS_TRANS_SEQNO_INDEXTRANS_SEQNO ASC

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (EXCHRATE)
Not NullColumn ConstraintNOT NULL (SEQNO)
Not NullColumn ConstraintNOT NULL (ALLOCNO)
Not NullColumn ConstraintNOT NULL (PERIOD_SEQNO)
CR_TRANS_CR_ALLOCATIONSForeign KeyTable ConstraintFOREIGN KEY (TRANS_SEQNO) REFERENCES CR_TRANS(SEQNO)
CURRENCIES_CR_ALLOCATIONSForeign KeyTable ConstraintFOREIGN KEY (CURRENCY) REFERENCES CURRENCIES(CURRENCYNO)
DF__CR_ALLOCA__AGE_S__46E920BADefaultColumn ConstraintAGE_STAMP DEFAULT -1
DF__CR_ALLOCA__ALLOC__041093DDDefaultColumn ConstraintALLOCTIME DEFAULT getdate()
DF__CR_ALLOCA__AMOUN__61BB7BD9DefaultColumn ConstraintAMOUNT DEFAULT 0
DF__CR_ALLOCA__CURRE__62AFA012DefaultColumn ConstraintCURRENCY DEFAULT 0
DF__CR_ALLOCA__EXCHR__7ED93F79DefaultColumn ConstraintEXCHRATE DEFAULT 1
DF__CR_ALLOCA__PERIO__45F4FC81DefaultColumn ConstraintPERIOD_SEQNO DEFAULT 0
DF__CR_ALLOCA__TAKEN__63A3C44BDefaultColumn ConstraintTAKENUP DEFAULT N
PERIOD_STATUS_CR_ALLOCATIONSForeign KeyTable ConstraintFOREIGN KEY (PERIOD_SEQNO) REFERENCES PERIOD_STATUS(SEQNO)
PK__CR_ALLOCATIONS__60C757A0Primary KeyTable ConstraintPRIMARY KEY (SEQNO, ALLOCNO)

Triggers:
Trigger nameCode
update_craccbal_onallocCREATE TRIGGER [dbo].[update_craccbal_onalloc] on [dbo].[CR_ALLOCATIONS]
FOR INSERT
AS
declare @accno integer,
@age integer,
@trans_seqno integer,
@amount float,
@exchrate float
begin

  SET NOCOUNT ON
select @trans_seqno=trans_seqno, @amount=amount from inserted

select @accno=accno, @age=age, @exchrate=exchrate from cr_trans where seqno=@trans_seqno

IF (@age=0) begin
        UPDATE cr_accs
        SET agedbal0=agedbal0-@amount
        WHERE ACCNO=@ACCNO
end
ELSE IF (@age=1) begin
        UPDATE cr_accs
        SET agedbal1=agedbal1-@amount
        WHERE ACCNO=@ACCNO
end
ELSE IF (@age=2) begin
        UPDATE cr_accs
        SET agedbal2=agedbal2-@amount
        WHERE ACCNO=@ACCNO
end
ELSE BEGIN UPDATE cr_accs
        SET agedbal3=agedbal3-@amount
        WHERE ACCNO=@ACCNO
END
 UPDATE [dbo].[CR_ALLOCATIONS]
 SET EXCHRATE=@exchrate
 WHERE TRANS_SEQNO=@trans_seqno
  SET NOCOUNT OFF
end
UPDATE_CRACCBAL_ONUNALLOCCREATE TRIGGER [dbo].[UPDATE_CRACCBAL_ONUNALLOC] on [dbo].[CR_ALLOCATIONS]
FOR DELETE
AS
declare @accno integer,
@age integer,
@trans_seqno integer,
@amount float
begin

  SET NOCOUNT ON
select @trans_seqno=trans_seqno, @amount=amount from deleted

select @accno=accno, @age=age from CR_trans where seqno=@trans_seqno

IF (@age=0) begin
        UPDATE CR_ACCS
        SET agedbal0=agedbal0+@amount
        WHERE ACCNO=@ACCNO
end
ELSE IF (@age=1) begin
        UPDATE CR_ACCS
        SET agedbal1=agedbal1+@amount
        WHERE ACCNO=@ACCNO
end
ELSE IF (@age=2) begin
        UPDATE CR_ACCS
        SET agedbal2=agedbal2+@amount
        WHERE ACCNO=@ACCNO
end
ELSE BEGIN UPDATE CR_ACCS
        SET agedbal3=agedbal3+@amount
        WHERE ACCNO=@ACCNO
END

UPDATE CR_TRANS
SET ALLOCATEDBAL=ALLOCATEDBAL-@amount, ALLOCATED=0
WHERE SEQNO=@TRANS_SEQNO

  SET NOCOUNT OFF
end
UPDATE_CRACC_PRIORBAL_ONALLOCCREATE TRIGGER [dbo].[UPDATE_CRACC_PRIORBAL_ONALLOC] ON [dbo].[CR_ALLOCATIONS]
FOR INSERT AS
  DECLARE @ACCNO INTEGER,
  @TRANS_AGE INTEGER,
  @ALLOC_AGE INTEGER,
  @TRANS_SEQNO INTEGER,
  @TRANS_AMOUNT FLOAT,
  @AMOUNT FLOAT
BEGIN

  SET NOCOUNT ON

  SELECT @TRANS_SEQNO=TRANS_SEQNO, @AMOUNT=AMOUNT, @ALLOC_AGE=AGE FROM INSERTED

  SELECT @ACCNO=ACCNO, @TRANS_AMOUNT=AMOUNT, @TRANS_AGE=AGE FROM CR_TRANS WHERE SEQNO=@TRANS_SEQNO

  IF (@ALLOC_AGE>0)
  BEGIN
    IF (@TRANS_AGE=1)
    BEGIN
      UPDATE CR_ACCS SET PRIOR_AGEDBAL0=PRIOR_AGEDBAL0-@AMOUNT WHERE ACCNO=@ACCNO
    END
    ELSE
    IF (@TRANS_AGE=2)
    BEGIN
      UPDATE CR_ACCS SET PRIOR_AGEDBAL1=PRIOR_AGEDBAL1-@AMOUNT WHERE ACCNO=@ACCNO
    END
    ELSE
    IF (@TRANS_AGE=3)
    BEGIN
     UPDATE CR_ACCS SET PRIOR_AGEDBAL2=PRIOR_AGEDBAL2-@AMOUNT WHERE ACCNO=@ACCNO
    END
    ELSE
    BEGIN
      UPDATE CR_ACCS SET PRIOR_AGEDBAL3=PRIOR_AGEDBAL3-@AMOUNT WHERE ACCNO=@ACCNO
    END

    IF (@ALLOC_AGE > 0)
    BEGIN
     IF @ALLOC_AGE >= 1
     BEGIN
      IF (@TRANS_AGE>=2)
      BEGIN
        UPDATE CR_TRANS
SET ALLOCAGE=@ALLOC_AGE, PREV_PERIOD_OPEN=@TRANS_AMOUNT-ISNULL((SELECT SUM(AMOUNT) FROM [dbo].[CR_ALLOCATIONS]
WHERE TRANS_SEQNO=@TRANS_SEQNO AND AGE>=2), 0), PREV_PERIOD_CLOSE=@TRANS_AMOUNT-ISNULL((SELECT SUM(AMOUNT)
FROM [dbo].[CR_ALLOCATIONS] WHERE TRANS_SEQNO=@TRANS_SEQNO AND AGE>=1), 0) WHERE SEQNO=@TRANS_SEQNO
      END

      IF (@TRANS_AGE=1)
      BEGIN
        UPDATE CR_TRANS
SET ALLOCAGE=@ALLOC_AGE, PREV_PERIOD_OPEN=0, PREV_PERIOD_CLOSE=@TRANS_AMOUNT-ISNULL((SELECT SUM(AMOUNT)
FROM [dbo].[CR_ALLOCATIONS] WHERE TRANS_SEQNO=@TRANS_SEQNO AND AGE>=1), 0) WHERE SEQNO=@TRANS_SEQNO
      END
     END

     IF (@TRANS_AMOUNT-ISNULL((SELECT SUM(AMOUNT) FROM [dbo].[CR_ALLOCATIONS] WHERE TRANS_SEQNO=@TRANS_SEQNO AND AGE>=1), 0))=0
       BEGIN
         UPDATE CR_TRANS SET ALLOCATED=2 WHERE SEQNO=@TRANS_SEQNO
       END
    END
  END
  SET NOCOUNT OFF
END
UPDATE_CRACC_PRIORBAL_ONUNALLOCCREATE TRIGGER [dbo].[UPDATE_CRACC_PRIORBAL_ONUNALLOC] ON [dbo].[CR_ALLOCATIONS]
FOR DELETE AS
  DECLARE @ACCNO INTEGER,
  @TRANS_AGE INTEGER,
  @ALLOC_AGE INTEGER,
  @TRANS_SEQNO INTEGER,
  @TRANS_AMOUNT FLOAT,
  @AMOUNT FLOAT
BEGIN

  SET NOCOUNT ON

  SELECT @TRANS_SEQNO=TRANS_SEQNO, @AMOUNT=AMOUNT, @ALLOC_AGE=AGE FROM DELETED

  SELECT @ACCNO=ACCNO, @TRANS_AMOUNT=AMOUNT, @TRANS_AGE=AGE FROM CR_TRANS WHERE SEQNO=@TRANS_SEQNO

  IF (@ALLOC_AGE>0)
  BEGIN
    IF (@TRANS_AGE=1)
    BEGIN
      UPDATE CR_ACCS SET PRIOR_AGEDBAL0=PRIOR_AGEDBAL0+@AMOUNT WHERE ACCNO=@ACCNO
    END
    ELSE
    IF (@TRANS_AGE=2)
    BEGIN
      UPDATE CR_ACCS SET PRIOR_AGEDBAL1=PRIOR_AGEDBAL1+@AMOUNT WHERE ACCNO=@ACCNO
    END
    ELSE
    IF (@TRANS_AGE=3)
    BEGIN
     UPDATE CR_ACCS SET PRIOR_AGEDBAL2=PRIOR_AGEDBAL2+@AMOUNT WHERE ACCNO=@ACCNO
    END
    ELSE
    BEGIN
      UPDATE CR_ACCS SET PRIOR_AGEDBAL3=PRIOR_AGEDBAL3+@AMOUNT WHERE ACCNO=@ACCNO
    END

    IF (@ALLOC_AGE > 0)
    BEGIN
     IF @ALLOC_AGE >= 1
     BEGIN
      IF (@TRANS_AGE>=2)
      BEGIN
        UPDATE CR_TRANS
SET ALLOCAGE=@ALLOC_AGE, PREV_PERIOD_OPEN=@TRANS_AMOUNT+ISNULL((SELECT SUM(AMOUNT) FROM [dbo].[CR_ALLOCATIONS]
WHERE TRANS_SEQNO=@TRANS_SEQNO AND AGE>=2), 0), PREV_PERIOD_CLOSE=@TRANS_AMOUNT+ISNULL((SELECT SUM(AMOUNT)
FROM [dbo].[CR_ALLOCATIONS] WHERE TRANS_SEQNO=@TRANS_SEQNO AND AGE>=1), 0) WHERE SEQNO=@TRANS_SEQNO
      END

      IF (@TRANS_AGE=1)
      BEGIN
        UPDATE CR_TRANS
SET ALLOCAGE=@ALLOC_AGE, PREV_PERIOD_OPEN=0, PREV_PERIOD_CLOSE=@TRANS_AMOUNT+ISNULL((SELECT SUM(AMOUNT)
FROM [dbo].[CR_ALLOCATIONS] WHERE TRANS_SEQNO=@TRANS_SEQNO AND AGE>=1), 0) WHERE SEQNO=@TRANS_SEQNO
      END
     END

     UPDATE CR_TRANS SET ALLOCATED=0 WHERE SEQNO=@TRANS_SEQNO
    END
  END
  SET NOCOUNT OFF
END


Entity: CR_CONTACTS
CommentThis table contains details of Contact records that are associated with Creditor accounts. Contact details are taken from the relevant entry in the CONTACTS table.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique identifier for the Creditor Contact. The identifier for the Contact record is specified by the CONTACT_SEQNO field.
ACCNONoINTEGERNoThe account number of the Creditor account that the Contact is associated with.
DEFCONTACTNoCHAR(1)NoThis field is set to 'Y' if the Contact is set as the default Contact for the Creditor account.
SALUTATIONNoVARCHAR(4)NoTaken from the associated record in the CONTACTS table.
FIRSTNAMENoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
LASTNAMENoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
TITLENoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
MOBILENoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
DIRECTPHONENoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
DIRECTFAXNoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
EMAILNoVARCHAR(60)NoTaken from the associated record in the CONTACTS table.
HOMEPHONENoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
NOTESNoVARCHAR(4096)NoTaken from the associated record in the CONTACTS table.
ADDRESS1NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
ADDRESS2NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
ADDRESS3NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
DELADDR1NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
DELADDR2NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
DELADDR3NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
DELADDR4NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
ISACTIVENoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB1NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB2NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB3NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB4NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
ADVERTSOURCENoINTEGERNoTaken from the associated record in the CONTACTS table.
POST_CODENoVARCHAR(12)NoTaken from the associated record in the CONTACTS table.
SUB5NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB6NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB7NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB8NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB9NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB10NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB11NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB12NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB13NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB14NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB15NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB16NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB17NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB18NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB19NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB20NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
ADDRESS4NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
DELADDR5NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
DELADDR6NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.
CONTACT_SEQNONoINTEGERNoThe ID number of the Contact record in the CONTACTS table.
SUB21NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB22NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB23NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB24NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB25NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
SUB26NoCHAR(1)NoTaken from the associated record in the CONTACTS table.
DEFACCOUNTNoCHAR(1)YesThis field is set to 'Y' if the Creditor account is the default company for the Contact, i.e. if it is the company specified in the Company field on the Details tab of the Contacts window.
ADDRESS5NoVARCHAR(30)NoTaken from the associated record in the CONTACTS table.

Relationships:
NameRelationship typeParentChildCardinality
CONTACTS_CR_CONTACTSNon IdentifyingCONTACTSCR_CONTACTSZero Or More
CR_ACCS_CR_CONTACTSNon IdentifyingCR_ACCSCR_CONTACTSZero Or More

Indexes:
NameIndex columnsIndex type
CRCONTACT_SEQNO_IDXCONTACT_SEQNO ASC
CR_DEFCONTACT_INDEXACCNO ASC, DEFCONTACT ASC

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (DEFACCOUNT)
Not NullColumn ConstraintNOT NULL (SEQNO)
CONTACTS_CR_CONTACTSForeign KeyTable ConstraintFOREIGN KEY (CONTACT_SEQNO) REFERENCES CONTACTS(SEQNO)
CR_ACCS_CR_CONTACTSForeign KeyTable ConstraintFOREIGN KEY (ACCNO) REFERENCES CR_ACCS(ACCNO)
DF__CR_CONTACT__SUB1__08C03A61DefaultColumn ConstraintSUB1 DEFAULT N
DF__CR_CONTACT__SUB2__09B45E9ADefaultColumn ConstraintSUB2 DEFAULT N
DF__CR_CONTACT__SUB3__0AA882D3DefaultColumn ConstraintSUB3 DEFAULT N
DF__CR_CONTACT__SUB4__0B9CA70CDefaultColumn ConstraintSUB4 DEFAULT N
DF__CR_CONTACT__SUB5__226010D3DefaultColumn ConstraintSUB5 DEFAULT N
DF__CR_CONTACT__SUB6__2354350CDefaultColumn ConstraintSUB6 DEFAULT N
DF__CR_CONTACT__SUB7__24485945DefaultColumn ConstraintSUB7 DEFAULT N
DF__CR_CONTACT__SUB8__253C7D7EDefaultColumn ConstraintSUB8 DEFAULT N
DF__CR_CONTACT__SUB9__2630A1B7DefaultColumn ConstraintSUB9 DEFAULT N
DF__CR_CONTAC__ADVER__0C90CB45DefaultColumn ConstraintADVERTSOURCE DEFAULT 0
DF__CR_CONTAC__CONTA__70E97C27DefaultColumn ConstraintCONTACT_SEQNO DEFAULT 0
DF__CR_CONTAC__DEFAC__42F89445DefaultColumn ConstraintDEFACCOUNT DEFAULT N
DF__CR_CONTAC__DEFCO__1C0818FFDefaultColumn ConstraintDEFCONTACT DEFAULT N
DF__CR_CONTAC__ISACT__07CC1628DefaultColumn ConstraintISACTIVE DEFAULT Y
DF__CR_CONTAC__SUB10__2724C5F0DefaultColumn ConstraintSUB10 DEFAULT N
DF__CR_CONTAC__SUB11__2818EA29DefaultColumn ConstraintSUB11 DEFAULT N
DF__CR_CONTAC__SUB12__290D0E62DefaultColumn ConstraintSUB12 DEFAULT N
DF__CR_CONTAC__SUB13__2A01329BDefaultColumn ConstraintSUB13 DEFAULT N
DF__CR_CONTAC__SUB14__2AF556D4DefaultColumn ConstraintSUB14 DEFAULT N
DF__CR_CONTAC__SUB15__2BE97B0DDefaultColumn ConstraintSUB15 DEFAULT N
DF__CR_CONTAC__SUB16__2CDD9F46DefaultColumn ConstraintSUB16 DEFAULT N
DF__CR_CONTAC__SUB17__2DD1C37FDefaultColumn ConstraintSUB17 DEFAULT N
DF__CR_CONTAC__SUB18__2EC5E7B8DefaultColumn ConstraintSUB18 DEFAULT N
DF__CR_CONTAC__SUB19__2FBA0BF1DefaultColumn ConstraintSUB19 DEFAULT N
DF__CR_CONTAC__SUB20__30AE302ADefaultColumn ConstraintSUB20 DEFAULT N
DF__CR_CONTAC__SUB21__5A261260DefaultColumn ConstraintSUB21 DEFAULT Y
DF__CR_CONTAC__SUB22__5B1A3699DefaultColumn ConstraintSUB22 DEFAULT Y
DF__CR_CONTAC__SUB23__5C0E5AD2DefaultColumn ConstraintSUB23 DEFAULT Y
DF__CR_CONTAC__SUB24__5D027F0BDefaultColumn ConstraintSUB24 DEFAULT Y
DF__CR_CONTAC__SUB25__5DF6A344DefaultColumn ConstraintSUB25 DEFAULT Y
DF__CR_CONTAC__SUB26__5EEAC77DDefaultColumn ConstraintSUB26 DEFAULT Y
PK__CR_CONTAC__SEQNO__1B13F4C6Primary KeyTable ConstraintPRIMARY KEY (SEQNO)

Triggers:
Trigger nameCode
UPDATE_CR_DEFCONTACTCREATE TRIGGER [dbo].[UPDATE_CR_DEFCONTACT] ON [dbo].[CR_CONTACTS] FOR UPDATE AS
DECLARE
  @NEW_DEFCONTACT CHAR,
  @SEQNO INTEGER,
  @ACCNO INTEGER
BEGIN
  SET NOCOUNT ON
  SELECT @NEW_DEFCONTACT=DEFCONTACT, @SEQNO=SEQNO, @ACCNO=ACCNO FROM INSERTED
  IF (@NEW_DEFCONTACT = 'Y')
    EXECUTE UPDATE_DEFAULT_CONTACT 0, @SEQNO, @ACCNO
  SET NOCOUNT OFF
END
UPDATE_CR_DEFCONTACT2CREATE TRIGGER [dbo].[UPDATE_CR_DEFCONTACT2] ON [dbo].[CR_CONTACTS] FOR INSERT AS
DECLARE
  @NEW_DEFCONTACT CHAR,
  @SEQNO INTEGER,
  @ACCNO INTEGER
BEGIN
  SET NOCOUNT ON
  SELECT @NEW_DEFCONTACT=DEFCONTACT, @SEQNO=SEQNO, @ACCNO=ACCNO FROM INSERTED
  IF (@NEW_DEFCONTACT = 'Y')
    EXECUTE UPDATE_DEFAULT_CONTACT 0, @SEQNO, @ACCNO
  SET NOCOUNT OFF
END


Entity: CR_CONT_HIST
CommentThis table contains information about the History Notes attached to Creditor accounts.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique identifier for the record.
CONTACT_SEQNONoINTEGERNoThe ID number of the associated Contact record.
POSTTIMENoDATETIMENoThe actual date and time that the record was posted.
TRANSDATENoDATETIMENoThe transaction date against the History Note.
COMTYPENoINTEGERNoThis field is used by the Serviceable Units add-on module - it is not set from the Creditor UI.
SALESNONoINTEGERNoThe ID of the staff member selected on the History Note.
NOTENoVARCHAR(4096)NoThe main body of the History Note.
SUBJECTNoVARCHAR(80)NoThe subject line of the History Note.
ACCNONoINTEGERNoThe ID number of the Creditor account that the History Note is attached to.
ACTIONSTATUSNoINTEGERNoThis field is used by the Serviceable Units add-on module - it is not set from the Creditors UI.
ACTIONDUEDATENoDATETIMENoThis field is used by the Serviceable Units add-on module - it is not set from the Creditors UI.
JOBNONoINTEGERYesThis is a legacy field that is no longer used.
EVENT_SEQNONoINTEGERNoIf the History Note was created as a result of event logging, this field contains the ID number of the reason event from the REASONS table.
OUTLOOK_LINKNoVARCHAR(40)NoIf the History Note was emailed, this field contains a link to the email in MS Outlook.

Relationships:
NameRelationship typeParentChildCardinality
CONTACTS_CR_CONT_HISTNon IdentifyingCONTACTSCR_CONT_HISTZero Or More
CR_ACCS_CR_CONT_HISTNon IdentifyingCR_ACCSCR_CONT_HISTZero Or More
STAFF_CR_CONT_HISTNon IdentifyingSTAFFCR_CONT_HISTZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (JOBNO)
Not NullColumn ConstraintNOT NULL (SEQNO)
CONTACTS_CR_CONT_HISTForeign KeyTable ConstraintFOREIGN KEY (CONTACT_SEQNO) REFERENCES CONTACTS(SEQNO)
CR_ACCS_CR_CONT_HISTForeign KeyTable ConstraintFOREIGN KEY (ACCNO) REFERENCES CR_ACCS(ACCNO)
DF__CR_CONT_H__ACCNO__3296789CDefaultColumn ConstraintACCNO DEFAULT -1
DF__CR_CONT_H__ACTIO__5911273FDefaultColumn ConstraintACTIONSTATUS DEFAULT 0
DF__CR_CONT_H__ACTIO__5A054B78DefaultColumn ConstraintACTIONDUEDATE DEFAULT getdate()
DF__CR_CONT_H__COMTY__1249A49BDefaultColumn ConstraintCOMTYPE DEFAULT 0
DF__CR_CONT_H__EVENT__29D7E0C0DefaultColumn ConstraintEVENT_SEQNO DEFAULT -1
DF__CR_CONT_H__JOBNO__0A5E6A10DefaultColumn ConstraintJOBNO DEFAULT 0
DF__CR_CONT_H__POSTT__10615C29DefaultColumn ConstraintPOSTTIME DEFAULT getdate()
DF__CR_CONT_H__SALES__133DC8D4DefaultColumn ConstraintSALESNO DEFAULT 0
DF__CR_CONT_H__TRANS__11558062DefaultColumn ConstraintTRANSDATE DEFAULT getdate()
PK__CR_CONT_H__SEQNO__0F6D37F0Primary KeyTable ConstraintPRIMARY KEY (SEQNO)
STAFF_CR_CONT_HISTForeign KeyTable ConstraintFOREIGN KEY (SALESNO) REFERENCES STAFF(STAFFNO)



Entity: CR_INVLINES
CommentThis table contains line information for all Creditor transactions.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique transaction line ID.
ACCNONoINTEGERNoThe account number of the Creditor that the transaction belongs to.
INVNONoVARCHAR(20)NoThe invoice number.
HDR_SEQNONoINTEGERNoThe SEQNO of the record in the CR_TRANS table that this record related to.
STOCKCODENoVARCHAR(23)NoCode of the Stock item on this line.
DESCRIPTIONNoVARCHAR(40)NoDescription of the Stock item on this line.
QUANTITYNoFLOAT(53)NoThe quantity for this line.
UNITPRICENoFLOAT(53)NoThe unit price of the Stock item on this line.
DISCOUNTNoFLOAT(53)NoThe percentage discount for the Stock item on this line.
DISCOUNTAMTNoFLOAT(53)NoThe discount amount on a stock line.
DISCOUNTPCTNoFLOAT(53)NoThe discount percentage on a stock line.
ANALYSISNoINTEGERNoGL code for the Stock line. Can be overridden. The visibility of this column onscreen is controlled by the profile "Enable display and override of GL code from stock item".
LOCATIONNoINTEGERNoThe location that the Stock item will be moved out of. Generally, lines inherit the location from the invoice header.
UNITPRICE_INCTAXNoFLOAT(53)NoThe unit price of the Stock item on this line, inclusive of tax.
UPDATE_STOCKNoCHAR(1)NoIf this field is set to 'Y', stock movements are created via the trigger CR_INVLINES_POST. The field is then set to 'T'.
JOBCODENoVARCHAR(15)NoIf the line originates from a job, the job's code is recorded in this field.
CURRENCYNONoINTEGERNoThe ID number of the currency used on the line.
EXCHRATENoFLOAT(53)NoThe exchange rate for the line at the time of the transaction.
TAXRATENoFLOAT(53)NoThe percentage tax rate on the line at the time of the transaction.
CODETYPENoCHAR(1)NoThe type of code on the line. Will be one of:
G - GL code
S - Stock code
TAXRATE_NONoINTEGERNoThe ID number of the tax rate used by the transaction.
LINETOTAL_TAXNoFLOAT(53)NoThe tax total for the line.
LINETAX_OVERRIDDENNoCHAR(1)NoContains 'Y' if the tax on the line has been manually modified.
LINE_SOURCENoINTEGERNoThe source SEQNO of the line, if it originated from a Sales Order or job.
LINETOTALNoASNoA computed field containing the total value for the line, excluding tax.
LINETOTAL_INCTAXNoASNoA computed field containing the total value for the line, including tax.
JOBNONoINTEGERNoIf the line originates from a job, the job's ID number is recorded in this field.
COST_TYPENoINTEGERNoThis field only applies if EXO Job Costing is installed. It identifies the Cost Type that the transaction belongs to.
COST_GROUPNoINTEGERNoThis field only applies if EXO Job Costing is installed. It identifies the Cost Group that the transaction belongs to.
BRANCHNONoINTEGERNoThe branch number. Lines generally inherit the branch specified on the invoice header.
GLACCNONoINTEGERNoGL account number.
GLSUBACCNoINTEGERNoSL sub-account number.
BATCHCODENoVARCHAR(20)NoThe batch code on the line. The "Enable stock batch codes" Company-level profile setting must be enabled to be able to use batch codes.
CRINVLINEIDNoINTEGERNoA unique ID for the invoice line, which should be used to link to other tables. Every time an invoice is edited, the lines are essentially removed and reinserted again, which changes the SEQNO. However, the CRINVLINEID field retains its value. Hence, any relationships built on this field are still valid in such a scenario.
IGRLINESEQNONoINTEGERNoID number of the Inwards Goods receipt line (if the source of the line is from Inwards Goods).
LINETYPENoINTEGERNoThis field indicates the type of line. Will be one of:
0 = Normal stock line
1 = BOM header line
2 = BOM component line
4 = Narrative line
5 = GL code
KITSEQNONoINTEGERNoA Bill of Materials SEQNO used to group BOM lines together.
KITCODENoVARCHAR(23)NoThe Bill of Materials code, if the line is part of a BOM.
LINKED_STOCKCODENoVARCHAR(23)NoThe physical stock unit.
LINKED_QTYNoFLOAT(53)NoThe physical stock unit quantity.
BOMTYPENoCHAR(1)NoThe type of Bill of Materials that the line relates to:
N = Normal stock item
B = Build
K = Kit
L = Lookup
SHOWLINENoCHAR(1)NoThis field applies to Bills of Materials, and is used by Clarity to determine if the line can be printed.
LINKEDSTATUSNoCHAR(1)NoWill be one of:
S = Stocked
L = Lookup
N = Not applicable
BOMPRICINGNoCHAR(1)NoHow Bills of Materials are priced. Will be one of:
C = Pricing by Component
T = Pricing by total
NARRATIVE_SEQNONoINTEGERNoThe SEQNO for the narrative on this line.
INTERCO_COMPANYNONoINTEGERNoThis field only applies if EXO InterCompany is used. It contains the Company ID number.
INTERCO_BATCH_DESCNoVARCHAR(80)NoThis field only applies if EXO InterCompany is used. It contains the batch description.
INTERCO_DR_BRANCHNONoINTEGERNoThis field only applies if EXO InterCompany is used. It contains the Debtor branch number.
INTERCO_DR_ACCNONoINTEGERNoThis field only applies if EXO InterCompany is used. It contains the Debtor GL account number.
INTERCO_DR_SUBACCNONoINTEGERNoThis field only applies if EXO InterCompany is used. It contains the Debtor GL sub-account number.
INTERCO_CR_BRANCHNONoINTEGERNoThis field only applies if EXO InterCompany is used. It contains the Creditor branch number.
INTERCO_CR_ACCNONoINTEGERNoThis field only applies if EXO InterCompany is used. It contains the Creditor GL account number.
INTERCO_CR_SUBACCNONoINTEGERNoThis field only applies if EXO InterCompany is used. It contains the Creditor GL sub-account number.

Relationships:
NameRelationship typeParentChildCardinality
CR_ACCS_CR_INVLINESNon IdentifyingCR_ACCSCR_INVLINESZero Or More
CR_INVLINES_CR_INVLINES_SERIALSNon IdentifyingCR_INVLINESCR_INVLINES_SERIALSZero Or More
CR_TRANS_CR_INVLINESNon IdentifyingCR_TRANSCR_INVLINESZero Or More
CURRENCIES_CR_INVLINESNon IdentifyingCURRENCIESCR_INVLINESZero Or More
NARRATIVES_CR_INVLINESNon IdentifyingNARRATIVESCR_INVLINESZero Or More
STOCK_ITEMS_CR_INVLINESNon IdentifyingSTOCK_ITEMSCR_INVLINESZero Or More
TAX_RATES_CR_INVLINESNon IdentifyingTAX_RATESCR_INVLINESZero Or More

Indexes:
NameIndex columnsIndex type
CR_INVLINES_ANALYSISANALYSIS ASC
CR_INVLINES_CODETYPECODETYPE ASC
CR_INVLINES_HDRSEQHDR_SEQNO ASC
SK_JC6JOBNO ASC

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (SEQNO)
CR_ACCS_CR_INVLINESForeign KeyTable ConstraintFOREIGN KEY (ACCNO) REFERENCES CR_ACCS(ACCNO)
CR_TRANS_CR_INVLINESForeign KeyTable ConstraintFOREIGN KEY (HDR_SEQNO) REFERENCES CR_TRANS(SEQNO)
CURRENCIES_CR_INVLINESForeign KeyTable ConstraintFOREIGN KEY (CURRENCYNO) REFERENCES CURRENCIES(CURRENCYNO)
DF_CR_INVLINES_UNITPRICE_INCTAXDefaultColumn ConstraintUNITPRICE_INCTAX DEFAULT 0
DF__CR_INVLIN__ACCNO__505BE5ADDefaultColumn ConstraintACCNO DEFAULT 0
DF__CR_INVLIN__ANALY__57FD0775DefaultColumn ConstraintANALYSIS DEFAULT 0
DF__CR_INVLIN__BOMPR__5091BB2EDefaultColumn ConstraintBOMPRICING DEFAULT N
DF__CR_INVLIN__BOMTY__4DB54E83DefaultColumn ConstraintBOMTYPE DEFAULT N
DF__CR_INVLIN__BRANC__2A4B4B5EDefaultColumn ConstraintBRANCHNO DEFAULT 0
DF__CR_INVLIN__COST___286302ECDefaultColumn ConstraintCOST_TYPE DEFAULT 0
DF__CR_INVLIN__COST___29572725DefaultColumn ConstraintCOST_GROUP DEFAULT 0
DF__CR_INVLIN__CRINV__10D65D75DefaultColumn ConstraintCRINVLINEID DEFAULT 0
DF__CR_INVLIN__CURRE__386F4D83DefaultColumn ConstraintCURRENCYNO DEFAULT 0
DF__CR_INVLIN__DISCO__25869641DefaultColumn ConstraintDISCOUNTAMT DEFAULT 0
DF__CR_INVLIN__DISCO__267ABA7ADefaultColumn ConstraintDISCOUNTPCT DEFAULT 0
DF__CR_INVLIN__DISCO__5708E33CDefaultColumn ConstraintDISCOUNT DEFAULT 0
DF__CR_INVLIN__EXCHR__396371BCDefaultColumn ConstraintEXCHRATE DEFAULT 1
DF__CR_INVLIN__GLACC__2B3F6F97DefaultColumn ConstraintGLACCNO DEFAULT 0
DF__CR_INVLIN__GLSUB__2C3393D0DefaultColumn ConstraintGLSUBACC DEFAULT 0
DF__CR_INVLIN__HDR_S__52442E1FDefaultColumn ConstraintHDR_SEQNO DEFAULT 0
DF__CR_INVLIN__IGRLI__2A2C1B24DefaultColumn ConstraintIGRLINESEQNO DEFAULT 0
DF__CR_INVLIN__INTER__32182106DefaultColumn ConstraintINTERCO_COMPANYNO DEFAULT 0
DF__CR_INVLIN__INTER__330C453FDefaultColumn ConstraintINTERCO_DR_BRANCHNO DEFAULT 0
DF__CR_INVLIN__INTER__34006978DefaultColumn ConstraintINTERCO_DR_ACCNO DEFAULT 0
DF__CR_INVLIN__INTER__34F48DB1DefaultColumn ConstraintINTERCO_DR_SUBACCNO DEFAULT 0
DF__CR_INVLIN__INTER__35E8B1EADefaultColumn ConstraintINTERCO_CR_BRANCHNO DEFAULT 0
DF__CR_INVLIN__INTER__36DCD623DefaultColumn ConstraintINTERCO_CR_ACCNO DEFAULT 0
DF__CR_INVLIN__INTER__37D0FA5CDefaultColumn ConstraintINTERCO_CR_SUBACCNO DEFAULT 0
DF__CR_INVLIN__JOBNO__276EDEB3DefaultColumn ConstraintJOBNO DEFAULT 0
DF__CR_INVLIN__KITSE__0FB81C0ADefaultColumn ConstraintKITSEQNO DEFAULT -1
DF__CR_INVLIN__LINET__0EC3F7D1DefaultColumn ConstraintLINETYPE DEFAULT -1
DF__CR_INVLIN__LINET__1CDC41A7DefaultColumn ConstraintLINETOTAL_TAX DEFAULT 0
DF__CR_INVLIN__LINKE__10AC4043DefaultColumn ConstraintLINKED_QTY DEFAULT 0
DF__CR_INVLIN__LINKE__4F9D96F5DefaultColumn ConstraintLINKEDSTATUS DEFAULT N
DF__CR_INVLIN__LOCAT__58F12BAEDefaultColumn ConstraintLOCATION DEFAULT 1
DF__CR_INVLIN__QUANT__55209ACADefaultColumn ConstraintQUANTITY DEFAULT 0
DF__CR_INVLIN__SHOWL__4EA972BCDefaultColumn ConstraintSHOWLINE DEFAULT Y
DF__CR_INVLIN__UNITP__5614BF03DefaultColumn ConstraintUNITPRICE DEFAULT 0
DF__CR_INVLIN__UPDAT__027D5126DefaultColumn ConstraintUPDATE_STOCK DEFAULT N
NARRATIVES_CR_INVLINESForeign KeyTable ConstraintFOREIGN KEY (NARRATIVE_SEQNO) REFERENCES NARRATIVES(SEQNO)
PK__CR_INVLINES__4F67C174Primary KeyTable ConstraintPRIMARY KEY (SEQNO)
STOCK_ITEMS_CR_INVLINESForeign KeyTable ConstraintFOREIGN KEY (STOCKCODE) REFERENCES STOCK_ITEMS(STOCKCODE)
TAX_RATES_CR_INVLINESForeign KeyTable ConstraintFOREIGN KEY (TAXRATE_NO) REFERENCES TAX_RATES(SEQNO)

Triggers:
Trigger nameCode
CRINVLINESIDCREATE TRIGGER [dbo].[CRINVLINESID] ON [dbo].[CR_INVLINES] FOR INSERT AS
BEGIN
  SET NOCOUNT ON
  UPDATE [dbo].[CR_INVLINES] SET CRINVLINEID = INSERTED.SEQNO
  FROM [dbo].[CR_INVLINES]
  INNER JOIN INSERTED ON ([dbo].[CR_INVLINES].SEQNO = INSERTED.SEQNO)
  WHERE INSERTED.CRINVLINEID IS NULL OR INSERTED.CRINVLINEID = 0
  SET NOCOUNT OFF
END
CR_INVLINES_POSTCREATE TRIGGER [dbo].[CR_INVLINES_POST]
ON [dbo].[CR_INVLINES]
FOR INSERT
AS
BEGIN
/* Exonet created trigger from DBUpdate */
  SET NOCOUNT ON
  DECLARE @ASTOCKTRANSCODE VARCHAR(23),
  @AREF2 VARCHAR(30), @ATRANSTYPE INT, @AGLPOSTED CHAR(1), @APOSTTOGL CHAR(1), @APOSTLOOKUPTOGL CHAR(1),
  @ISBOMLINKED CHAR(1), @AQUANTITY FLOAT,
  @AUNITPRICE FLOAT, @ASUPPLIERPRICE FLOAT, @AUNITCOST FLOAT,
  @UNITPRICE FLOAT, @UNITCOST FLOAT, @HIDDEN_COST FLOAT,
  @HIDDEN_SELL FLOAT, @QUANTITY FLOAT, @KITCODE VARCHAR(23), @KITSEQNO INT,
  @STOCKCODE VARCHAR(23), @JOBNO INT, @LINKED_STOCKCODE VARCHAR(23),
  @SEQNO INT, @HDR_SEQNO INT, @BATCHCODE VARCHAR(20), @INVNO VARCHAR(20), @ACCNO INT, @LOCATION INT,
  @LINKEDSTATUS CHAR(1), @DISCOUNT FLOAT, @EXCHRATE FLOAT, @BOMTYPE CHAR(1),
  @LINETYPE INT, @UPDATE_STOCK CHAR(1), @SESSION_ID INT
, @AGE INT
 , @PERIOD_SEQNO INT
IF ISNULL((SELECT TOP 1 SESSION_ID FROM CR_TRANS C JOIN INSERTED I ON C.SEQNO = I.HDR_SEQNO), -1) = -1
  BEGIN
  EXECUTE GEN_ID 'CR_TRANS', 'SESSION_ID', 'Y', @ID=@SESSION_ID OUTPUT
  UPDATE C
  SET SESSION_ID = @SESSION_ID
  FROM CR_TRANS C
  JOIN INSERTED I ON C.SEQNO = I.HDR_SEQNO
  END
ELSE
  BEGIN
  SELECT @SESSION_ID = (SELECT TOP 1 SESSION_ID FROM CR_TRANS C JOIN INSERTED I ON C.SEQNO = I.HDR_SEQNO)
  END
  SET @AGE = 0
SELECT @PERIOD_SEQNO = SEQNO FROM PERIOD_STATUS WHERE LEDGER='S' AND AGE = @AGE
  DECLARE INSERTED_INVCURSOR CURSOR LOCAL FOR
    SELECT UNITPRICE, QUANTITY, KITCODE, KITSEQNO, STOCKCODE,
    JOBNO, LINKED_STOCKCODE, SEQNO, HDR_SEQNO, BATCHCODE, INVNO, ACCNO, LOCATION, LINKEDSTATUS,
    DISCOUNT, EXCHRATE, BOMTYPE, LINETYPE, UPDATE_STOCK
    FROM INSERTED
  OPEN INSERTED_INVCURSOR
  FETCH NEXT FROM INSERTED_INVCURSOR
  INTO @UNITPRICE, @QUANTITY, @KITCODE, @KITSEQNO, @STOCKCODE,
    @JOBNO, @LINKED_STOCKCODE, @SEQNO, @HDR_SEQNO, @BATCHCODE, @INVNO, @ACCNO, @LOCATION, @LINKEDSTATUS,
    @DISCOUNT, @EXCHRATE, @BOMTYPE, @LINETYPE, @UPDATE_STOCK
  WHILE @@FETCH_STATUS = 0
  BEGIN
    SET @AUNITPRICE = @UNITPRICE * (1 - @DISCOUNT / 100)
    SET @ASUPPLIERPRICE = @AUNITPRICE
    IF (@STOCKCODE IS NOT NULL) AND (@STOCKCODE<>'')
    BEGIN
    IF (@UPDATE_STOCK = 'Y')
      BEGIN
        SET @ISBOMLINKED = 'N'
        IF (@BOMTYPE = 'L')
          SET @ISBOMLINKED = 'Y'
        SET @ATRANSTYPE = 1
        SET @AGLPOSTED = 'N'
        SET @APOSTTOGL = 'Y'
        SET @APOSTLOOKUPTOGL = 'N'
        SET @AREF2 = 'CR_INVOICE'
        SET @AQUANTITY = @QUANTITY
        /* FIND STOCKCODE TO POST TO STOCKTRANS */
        SET @ASTOCKTRANSCODE = @LINKED_STOCKCODE
        IF (((@ASTOCKTRANSCODE <> '') AND (@LINETYPE = 0)) OR (@ISBOMLINKED = 'Y'))
          SET @ASTOCKTRANSCODE = @STOCKCODE
        IF (@ASTOCKTRANSCODE = '')
          SET @ASTOCKTRANSCODE = @STOCKCODE
        /* FIND LOCAL CURRENCY DISCOUNTED UNIT PRICE EXCL TAX TO USE FOR STOCK_TRANS */
        IF (@EXCHRATE <> 0)
          SET @AUNITPRICE = @AUNITPRICE / @EXCHRATE
        INSERT INTO STOCK_TRANS
        (TRANSTYPE, STOCKCODE, ACCNO, REF1, REF2, QUANTITY, UNITPRICE, LOCATION, FROM_LEDGER, FROM_HDR, BATCHCODE,
        JOBNO, LINE_SEQNO, PLU, KITCODE, KITSEQNO, POST_TO_GL, UNITCOST, GLPOSTED, POST_LOOKUP_TO_GL, SESSION_ID
         , PERIOD_SEQNO
        ) VALUES (@ATRANSTYPE, @ASTOCKTRANSCODE, @ACCNO, @INVNO, @AREF2, @AQUANTITY,
        @AUNITPRICE, @LOCATION, 'c', @HDR_SEQNO, @BATCHCODE, @JOBNO, @SEQNO,
        @STOCKCODE, @KITCODE, @KITSEQNO, @APOSTTOGL, @AUNITPRICE, @AGLPOSTED, @APOSTLOOKUPTOGL, @SESSION_ID
       , @PERIOD_SEQNO
)
        /* SET UPDATE_STOCK FIELD ON CR_INVLINE TO MARK LINE AS TRIGGERED */
        UPDATE [dbo].[CR_INVLINES]
        SET UPDATE_STOCK='T'
        WHERE SEQNO = @SEQNO
      END
      /* UPDATE STOCK TABLE AND SET SUPPLIER COST */
      UPDATE STOCK_ITEMS
      SET SUPPLIERCOST = @ASUPPLIERPRICE
      WHERE (STOCKCODE=@STOCKCODE) AND (SUPPLIERNO=@ACCNO)
       /* UPDATE SUPPLIER_STOCK_ITEMS TABLE AND SET LATESTCOST */
      UPDATE SUPPLIER_STOCK_ITEMS
      SET LATESTCOST = @ASUPPLIERPRICE
      WHERE (STOCKCODE=@STOCKCODE)AND (ACCNO=@ACCNO)
    END
    FETCH NEXT FROM INSERTED_INVCURSOR
    INTO @UNITPRICE, @QUANTITY, @KITCODE, @KITSEQNO, @STOCKCODE,
      @JOBNO, @LINKED_STOCKCODE, @SEQNO, @HDR_SEQNO, @BATCHCODE, @INVNO, @ACCNO, @LOCATION, @LINKEDSTATUS,
      @DISCOUNT, @EXCHRATE, @BOMTYPE, @LINETYPE, @UPDATE_STOCK
  END
  CLOSE INSERTED_INVCURSOR
  DEALLOCATE INSERTED_INVCURSOR
  SET NOCOUNT OFF
END


Entity: CR_INVLINES_SERIALS
CommentThis table contains details of serial numbers on Creditor Invoice lines.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique ID number for the line.
SERIALNONoVARCHAR(50)NoThe serial number.
INVLINEIDNoINTEGERNoThe associated Creditors Invoice line - links to CR_INVLINES.CRINVLINEID.
POSTTIMENoDATETIMENoThe date and time when the line was saved to the database.

Relationships:
NameRelationship typeParentChildCardinality
CR_INVLINES_CR_INVLINES_SERIALSNon IdentifyingCR_INVLINESCR_INVLINES_SERIALSZero Or More

Indexes:
NameIndex columnsIndex type
CR_INVLINES_SERIALS_INDEXSERIALNO ASC, INVLINEID ASCUNIQUE

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (SEQNO)
CR_INVLINES_CR_INVLINES_SERIALSForeign KeyTable ConstraintFOREIGN KEY (INVLINEID) REFERENCES CR_INVLINES(CRINVLINEID)
DF__CR_INVLIN__POSTT__575EB44EDefaultColumn ConstraintPOSTTIME DEFAULT getdate()
PK__CR_INVLINES_SERI__566A9015Primary KeyTable ConstraintPRIMARY KEY (SEQNO)



Entity: CR_LISTS
CommentThis table defines the members of the Account Lists used by the Creditors Payment Processor.
Primary key columnsLIST_NO

Attributes:
Column namePrimary keyData typeNot NULLComment
LIST_NOYesINTEGERYesThe ID number of the Account List that this line applies to (CR_LIST_NAMES.LIST_NO).
ACCNONoINTEGERYesThe ID number of the Creditor account.

Relationships:
NameRelationship typeParentChildCardinality
CR_ACCS_CR_LISTSNon IdentifyingCR_ACCSCR_LISTSZero Or More
CR_LISTS_CR_LIST_NAMEIdentifyingCR_LISTSCR_LIST_NAMEZero Or More

Indexes:
NameIndex columnsIndex type
CR_LISTS_INDEXLIST_NO ASC, ACCNO ASCUNIQUE

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (ACCNO)
Not NullColumn ConstraintNOT NULL (LIST_NO)
CR_ACCS_CR_LISTSForeign KeyTable ConstraintFOREIGN KEY (ACCNO) REFERENCES CR_ACCS(ACCNO)
PK__CR_LISTS__40058253Primary KeyTable ConstraintPRIMARY KEY (LIST_NO)



Entity: CR_LIST_NAME
CommentThis table defines the Account Lists used by the Creditors Payment Processor.
Primary key columnsLIST_NO

Attributes:
Column namePrimary keyData typeNot NULLComment
LIST_NOYesINTEGERYesA unique ID number for the list.
LIST_NAMENoVARCHAR(50)NoThe name of the list.

Relationships:
NameRelationship typeParentChildCardinality
CR_LISTS_CR_LIST_NAMEIdentifyingCR_LISTSCR_LIST_NAMEZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (LIST_NO)
CR_LISTS_CR_LIST_NAMEForeign KeyTable ConstraintFOREIGN KEY (LIST_NO) REFERENCES CR_LISTS(LIST_NO)
PK__CR_LIST_NAME__40F9A68CPrimary KeyTable ConstraintPRIMARY KEY (LIST_NO)



Entity: CR_PRICES
CommentThis table contains information on Creditor price rules.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique ID number for the price record.
ACCNONoINTEGERNoThe Creditor account that the price rule is defined for. Has the value -1 if the price rule belongs to a generic price policy.
STOCKCODENoVARCHAR(23)NoIf the price rule is defined for an individual Stock item, this field stores the item's stockcode.
STOCKPRICEGROUPNoINTEGERNoIf the price rule is defined against a price group rather than an individual product, this field stores the Stock price group.
PRICENoFLOAT(53)NoThe substitute price to be applied to the stockcode/group.
DISCOUNTNoFLOAT(53)NoThe percentage discount to be applied, as per a price rule.
STARTDATENoDATETIMENoDate from which the price rule is active.
STOPDATENoDATETIMENoDate to which the price rule remains active.
MINQTYNoFLOAT(53)NoMinimum quantity for the price rule to apply.
ISACTIVENoCHAR(1)NoThis field is set to 'Y' if the pricing rule is active.
NARRATIVE_SEQNONoINTEGERNoNot used.
FIXEDNoCHAR(1)YesThis field contains 'Y' if the rule is a fixed price rule.


Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (FIXED)
Not NullColumn ConstraintNOT NULL (SEQNO)
DF__CR_PRICES__FIXED__64997F32DefaultColumn ConstraintFIXED DEFAULT N
DF__CR_PRICES__ISACT__769833DCDefaultColumn ConstraintISACTIVE DEFAULT Y
PK__CR_PRICES__75A40FA3Primary KeyTable ConstraintPRIMARY KEY (SEQNO)



Entity: CR_TRANS
CommentThis table contains header information for all Creditor transactions.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique transaction ID.
POSTTIMENoDATETIMENoThe actual date/time the transaction was posted at.
TRANSDATENoDATETIMENoThe date/time mentioned in the transaction itself.
ACCNONoINTEGERNoThe ID number of the Creditor account against which the transaction was generated. If the transaction is against a branch account, this field is set to the head account's ACCNO.
TRANSTYPENoINTEGERNo1 = Postive amount is Invoice, Negative amount is Credit; 4 = Negative amount is Payment, Positive amount is Refund
INVNONoVARCHAR(20)NoThe invoice number.
REF1NoVARCHAR(20)NoFor payments, this field contains the payment type, e.g. CASH, CHEQUE. For invoices, this field contains whatever was entered into the Order no field.
REF2NoVARCHAR(20)NoFor payments, this field contains the payment reference/cheque number. For invoices, this field contains the ID number of the job selected for the Job no field.
REF3NoVARCHAR(30)NoFor payments, this field contains the text 'PAYMENT'. For invoices, this field contains the text 'Invoice'.
NAMENoVARCHAR(70)NoThe ID number and name of the Creditor account against which the transaction was generated.
SUBTOTALNoFLOAT(53)NoThe tax-exclusive amount, in the currency of the Creditor account.
TAXTOTALNoFLOAT(53)NoThe tax total in the currency of the Creditor account.
TAXINCNoCHAR(1)NoY = tax inclusive, N = tax exclusive.
ANALYSISNoVARCHAR(12)NoFor payments, this field holds the payment type.
ALLOCATEDBALNoFLOAT(53)NoThe amount that has been allocated.
ALLOCATEDNoCHAR(1)No0 = Unallocated or partially allocated. 1 = Allocated in the current period. 2 = Allocated in any prior period.
ALLOCAGENoINTEGERNoThe age in which the transaction was allocated.
SALESNONoINTEGERNoThe ID number of the salesperson assigned to the transaction.
GLPOSTEDNoCHAR(1)NoY = the transaction has been posted to GL. N = the transaction has not been posted to GL.
GLCODENoINTEGERNoFor payments, this field contains the GL code of the bank account.
DUEDATENoDATETIMENoThe payment due date.
BRANCH_ACCNONoINTEGERNoOnly used in head account/branch account scenarios. This field contains the account number of the branch account.
CONTACT_SEQNONoINTEGERNoThe SEQNO of the Contact assigned to this transaction.
CURRENCYNONoINTEGERNoThe ID of the currency being used for the transaction.
EXCHRATENoFLOAT(53)NoThe exchange rate being used for the transaction, as determined by the currency in use.
GLSUBCODENoINTEGERNoFor payments, this field contains the GL subcode of the bank account.
BRANCHNONoINTEGERNoThe branch ID number.
PO_SEQNONoINTEGERNoFor invoices generated from Purchase Orders, this field holds the SEQNO of the Purchase Order.
TAXRATENoFLOAT(53)NoThe tax rate used by the transaction, e.g. 12.5 = 12.5%.
TAXRATE_NONoINTEGERNoThe ID number of the tax rate used by the transaction.
PREV_PERIOD_OPENNoFLOAT(53)NoBalance as at the start of the previous period.
PAYSTATUSNoINTEGERNoThe pay status of the transaction. Will be one of: -1 = HELD 0 = NOT RELEASED 1 = RELEASED
AUTHORISEDNoCHAR(1)NoIf this field contains 'Y', the transaction was authorised
AUTHORISEDBYNoINTEGERNoThe ID number of the staff member who authorised the transaction.
AUTH_DATENoDATETIMENoThe time and date when the transaction was authorised.
UNREALISED_GAINS_GL_BATCHNoINTEGERYesThe batch number for the unrealised gains journal that the transaction is a part of. Reset to zero when the journal is reversed.
TAXRETCODENoVARCHAR(15)NoThe tax return code for the GST return that this transaction applies to.
N_TOTVENDISCNoFLOAT(53)NoThe total vendor discount.
RELEASEDAMTNoFLOAT(53)NoThe released amount (applies to the Creditors Payment Processor).
PURCH_ACCNONoINTEGERNoIf the transaction is against a branch account, this field holds the account number for the branch account and the ACCNO field holds the account number of the head account. In all other cases, this field and the ACCNO field always have same number.
RECEIPTNONoINTEGERNoIf the transaction is sourced from Inwards Goods, this field contains the Inwards Goods receipt ID.
N_TOTVENDISC_EXCLTAXNoFLOAT(53)NoThe total vendor discount, excluding tax.
GLBATCHNONoINTEGERNoThe batch number for the journals that have sourced from this transaction.
TOAGEDBALNoINTEGERNoOnly applicable in case of balance brought forward accounts payments and adjustments. Used in the trigger POST_CR_TRANS to refresh the aged balances on the account. 0 = current 1 = 1 months 2 = 2 months 3 = 3 months 4 = from oldest
NARRATIVE_SEQNONoINTEGERNoID number of the narrative attached to the transaction.
IMAGE_URLNoVARCHAR(80)NoURL of the image.
MANUAL_ROUNDINGNoFLOAT(53)YesThis field contains the manual rounding amount (if any).
AMOUNTNoASNoThe amount of the transaction, including tax, in the currency of the Creditor account.
PREV_PERIOD_CLOSENoFLOAT(53)NoBalance as at the end of the previous period.
TXIDNoVARBINARY(256)NoA unique transaction ID number, populated by the trigger TRG_TXID_CR_TRANS. Used to separate native transactions inserted by EXO Business from other transactions.
PTNONoINTEGERNoThe payment number.
SESSION_IDNoINTEGERNoThe session ID number.
PERIOD_SEQNONoINTEGERYesID number of the period that the transaction is in.
AGE_STAMPNoINTEGERNoThis is a historical field that has been superseded by the AGE calculated field.
AGENoASNoThe transaction's age. This is calculated based on PERIOD_SEQNO.
BANKNONoINTEGERNoThe Bank ID number (entered via payment entry).
PP_BATCHREFNoVARCHAR(20)NoThis field contains the Creditors Payment Processor batch reference.
CITPNoCHAR(1)YesAustralian companies only. This field is set to 'Y' if the transaction should be tracked for reporting to the ATO on the "Taxable payments annual report".

Relationships:
NameRelationship typeParentChildCardinality
CONTACTS_CR_TRANSNon IdentifyingCONTACTSCR_TRANSZero Or More
CR_ACCS_CR_TRANSNon IdentifyingCR_ACCSCR_TRANSZero Or More
CR_TRANS_CR_ALLOCATIONSNon IdentifyingCR_TRANSCR_ALLOCATIONSZero Or More
CR_TRANS_CR_INVLINESNon IdentifyingCR_TRANSCR_INVLINESZero Or More
CURRENCIES_CR_TRANSNon IdentifyingCURRENCIESCR_TRANSZero Or More
GLACCS_CR_TRANSNon IdentifyingGLACCSCR_TRANSZero Or More
NARRATIVES_CR_TRANSIdentifyingNARRATIVESCR_TRANSZero Or More
PERIOD_STATUS_CR_TRANSNon IdentifyingPERIOD_STATUSCR_TRANSZero Or More
PURCHORD_HDR_CR_TRANSNon IdentifyingPURCHORD_HDRCR_TRANSZero Or More
TAX_RATES_CR_TRANSNon IdentifyingTAX_RATESCR_TRANSZero Or More

Indexes:
NameIndex columnsIndex type
CR_TRANS_ACCNOACCNO ASC
CR_TRANS_ALLOCATEDALLOCATED ASC
CR_TRANS_INVNOINVNO ASC
CR_TRANS_PERIODSEQNO_INDEXPERIOD_SEQNO ASC
CR_TRANS_PERIOD_SEQNOPERIOD_SEQNO ASC
CR_TRANS_TRANSDATETRANSDATE ASC
CR_TRANS_TRANSTYPETRANSTYPE ASC

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (CITP)
Not NullColumn ConstraintNOT NULL (SEQNO)
Not NullColumn ConstraintNOT NULL (PERIOD_SEQNO)
Not NullColumn ConstraintNOT NULL (MANUAL_ROUNDING)
Not NullColumn ConstraintNOT NULL (UNREALISED_GAINS_GL_BATCH)
CONTACTS_CR_TRANSForeign KeyTable ConstraintFOREIGN KEY (CONTACT_SEQNO) REFERENCES CONTACTS(SEQNO)
CR_ACCS_CR_TRANSForeign KeyTable ConstraintFOREIGN KEY (ACCNO) REFERENCES CR_ACCS(ACCNO)
CURRENCIES_CR_TRANSForeign KeyTable ConstraintFOREIGN KEY (CURRENCYNO) REFERENCES CURRENCIES(CURRENCYNO)
DF_CR_TRANS_RELEASEDAMTDefaultColumn ConstraintRELEASEDAMT DEFAULT 0
DF__CR_TRANS__ACCNO__60924D76DefaultColumn ConstraintACCNO DEFAULT 0
DF__CR_TRANS__AGE_ST__4500D848DefaultColumn ConstraintAGE_STAMP DEFAULT -1
DF__CR_TRANS__ALLOCA__6B0FDBE9DefaultColumn ConstraintALLOCATEDBAL DEFAULT 0
DF__CR_TRANS__ALLOCA__6C040022DefaultColumn ConstraintALLOCATED DEFAULT 0
DF__CR_TRANS__ALLOCA__6CF8245BDefaultColumn ConstraintALLOCAGE DEFAULT 0
DF__CR_TRANS__AUTHOR__3572E547DefaultColumn ConstraintAUTHORISED DEFAULT N
DF__CR_TRANS__BRANCH__33008CF0DefaultColumn ConstraintBRANCHNO DEFAULT 0
DF__CR_TRANS__CITP__70E025DDDefaultColumn ConstraintCITP DEFAULT Y
DF__CR_TRANS__CURREN__349EBC9FDefaultColumn ConstraintCURRENCYNO DEFAULT 0
DF__CR_TRANS__EXCHRA__3592E0D8DefaultColumn ConstraintEXCHRATE DEFAULT 1
DF__CR_TRANS__GLPOST__6FD49106DefaultColumn ConstraintGLPOSTED DEFAULT N
DF__CR_TRANS__GLSUBC__320C68B7DefaultColumn ConstraintGLSUBCODE DEFAULT 0
DF__CR_TRANS__MANUAL__4DD54A14DefaultColumn ConstraintMANUAL_ROUNDING DEFAULT 0
DF__CR_TRANS__N_TOTV__2E1BDC42DefaultColumn ConstraintN_TOTVENDISC DEFAULT 0
DF__CR_TRANS__N_TOTV__5540965BDefaultColumn ConstraintN_TOTVENDISC_EXCLTAX DEFAULT 0
DF__CR_TRANS__PAYSTA__347EC10EDefaultColumn ConstraintPAYSTATUS DEFAULT 0
DF__CR_TRANS__PERIOD__440CB40FDefaultColumn ConstraintPERIOD_SEQNO DEFAULT 0
DF__CR_TRANS__POSTTI__5EAA0504DefaultColumn ConstraintPOSTTIME DEFAULT getdate()
DF__CR_TRANS__PO_SEQ__0E8E2250DefaultColumn ConstraintPO_SEQNO DEFAULT 0
DF__CR_TRANS__PREV_P__2B2A60FEDefaultColumn ConstraintPREV_PERIOD_OPEN DEFAULT 0
DF__CR_TRANS__PREV_P__7E78816FDefaultColumn ConstraintPREV_PERIOD_CLOSE DEFAULT 0
DF__CR_TRANS__PTNO__3746EA77DefaultColumn ConstraintPTNO DEFAULT -1
DF__CR_TRANS__RECEIP__422DC1E7DefaultColumn ConstraintRECEIPTNO DEFAULT 0
DF__CR_TRANS__SALESN__6EE06CCDDefaultColumn ConstraintSALESNO DEFAULT 0
DF__CR_TRANS__SESSIO__32E2280DDefaultColumn ConstraintSESSION_ID DEFAULT -1
DF__CR_TRANS__SUBTOT__673F4B05DefaultColumn ConstraintSUBTOTAL DEFAULT 0
DF__CR_TRANS__TAXINC__69279377DefaultColumn ConstraintTAXINC DEFAULT N
DF__CR_TRANS__TAXRAT__19FFD4FCDefaultColumn ConstraintTAXRATE DEFAULT 0
DF__CR_TRANS__TAXRAT__1AF3F935DefaultColumn ConstraintTAXRATE_NO DEFAULT 0
DF__CR_TRANS__TAXTOT__68336F3EDefaultColumn ConstraintTAXTOTAL DEFAULT 0
DF__CR_TRANS__TRANSD__5F9E293DDefaultColumn ConstraintTRANSDATE DEFAULT getdate()
DF__CR_TRANS__TRANST__618671AFDefaultColumn ConstraintTRANSTYPE DEFAULT 0
DF__CR_TRANS__UNREAL__1D66518CDefaultColumn ConstraintUNREALISED_GAINS_GL_BATCH DEFAULT 0
GLACCS_CR_TRANSForeign KeyTable ConstraintFOREIGN KEY (GLCODE) REFERENCES GLACCS(ACCNO)
NARRATIVES_CR_TRANSForeign KeyTable ConstraintFOREIGN KEY (SEQNO) REFERENCES NARRATIVES(SEQNO)
PERIOD_STATUS_CR_TRANSForeign KeyTable ConstraintFOREIGN KEY (PERIOD_SEQNO) REFERENCES PERIOD_STATUS(SEQNO)
PK__CR_TRANS__5DB5E0CBPrimary KeyTable ConstraintPRIMARY KEY (SEQNO)
PURCHORD_HDR_CR_TRANSForeign KeyTable ConstraintFOREIGN KEY (PO_SEQNO) REFERENCES PURCHORD_HDR(SEQNO)
TAX_RATES_CR_TRANSForeign KeyTable ConstraintFOREIGN KEY (TAXRATE_NO) REFERENCES TAX_RATES(SEQNO)

Triggers:
Trigger nameCode
AUTHORISE_TRANSCREATE TRIGGER [dbo].[AUTHORISE_TRANS]
ON [dbo].[CR_TRANS]
FOR INSERT
AS
BEGIN
  SET NOCOUNT ON
  UPDATE [dbo].[CR_TRANS]
  SET
    AUTHORISED = 'Y',
    AUTHORISEDBY=0,
    AUTH_DATE=GETDATE()
  WHERE SEQNO IN
    (SELECT I.SEQNO
     FROM INSERTED I JOIN CR_ACCS A ON (I.ACCNO = A.ACCNO)
     WHERE A.AUTO_AUTH_AMT > I.AMOUNT
     AND I.TRANSTYPE = 1)
  SET NOCOUNT OFF
END
POST_CR_TRANSCREATE TRIGGER [dbo].[POST_CR_TRANS]
ON [dbo].[CR_TRANS]
FOR INSERT
AS
BEGIN
  SET NOCOUNT ON
  DECLARE @ACCNO INTEGER, @BRANCH_ACCNO INTEGER, @SUBTOTAL FLOAT, @TAXTOTAL FLOAT,
    @AGE INTEGER, @TRANSTYPE INTEGER, @TOAGEDBAL INTEGER, @PERIODSTHISYEAR INTEGER, @PERIODSINYEAR INTEGER,
    @MONTHVAL FLOAT, @LASTMONTH FLOAT, @YEARVAL FLOAT, @LASTYEAR FLOAT,
    @AMOUNT FLOAT, @AGEDBAL0 FLOAT, @AGEDBAL1 FLOAT, @AGEDBAL2 FLOAT, @AGEDBAL3 FLOAT,
    @PRIOR_AGEDBAL0 FLOAT, @PRIOR_AGEDBAL1 FLOAT, @PRIOR_AGEDBAL2 FLOAT, @PRIOR_AGEDBAL3 FLOAT,
    @TURNOVER_ACCNO INTEGER, @OPENITEM CHAR(1)

  SELECT @PERIODSTHISYEAR = PERIODSTHISYEAR FROM GL_CONTROL
  SELECT @PERIODSINYEAR = COUNT(SEQNO) FROM PERIODS_DEFN WHERE SEQNO > 0

  DECLARE INSERTED_CURSOR CURSOR
  FOR SELECT ACCNO, BRANCH_ACCNO, SUBTOTAL, TAXTOTAL, AMOUNT, AGE, TRANSTYPE, TOAGEDBAL
  FROM INSERTED

  OPEN INSERTED_CURSOR

  FETCH NEXT FROM INSERTED_CURSOR
  INTO @ACCNO, @BRANCH_ACCNO, @SUBTOTAL, @TAXTOTAL, @AMOUNT, @AGE, @TRANSTYPE, @TOAGEDBAL

  WHILE @@FETCH_STATUS = 0
  BEGIN
    SELECT @OPENITEM = OPENITEM FROM CR_ACCS WHERE ACCNO = @ACCNO

    SET @MONTHVAL = 0
    SET @LASTMONTH = 0
    SET @YEARVAL = 0
    SET @LASTYEAR = 0
    SET @AGEDBAL0 = 0
    SET @AGEDBAL1 = 0
    SET @AGEDBAL2 = 0
    SET @AGEDBAL3 = 0
    SET @PRIOR_AGEDBAL0 = 0
   SET @PRIOR_AGEDBAL1 = 0
   SET @PRIOR_AGEDBAL2 = 0
   SET @PRIOR_AGEDBAL3 = 0

   /* Set Turnover variables */
   IF (@TRANSTYPE = 1)
   BEGIN
     IF (@AGE = 0)
       SET @MONTHVAL = @SUBTOTAL
     ELSE IF (@AGE = 1)
       SET @LASTMONTH = @SUBTOTAL

     IF ((@AGE+1) <= @PERIODSTHISYEAR)
       SET @YEARVAL = @SUBTOTAL
     ELSE IF ((@AGE+1) <= (@PERIODSTHISYEAR+@PERIODSINYEAR))
       SET @LASTYEAR = @SUBTOTAL
   END

   /* Set Aged Balance variables */
   IF ((NOT (@OPENITEM = 'Y')) AND (@TOAGEDBAL IS NOT NULL)) /* set according to Age selected */
     EXECUTE CR_ACCS_BALFWD_BAL_DELTAS @ACCNO, @TOAGEDBAL, @AMOUNT,
       @AGEDBAL0 OUTPUT, @AGEDBAL1 OUTPUT, @AGEDBAL2 OUTPUT, @AGEDBAL3 OUTPUT,
        @PRIOR_AGEDBAL0 OUTPUT, @PRIOR_AGEDBAL1 OUTPUT, @PRIOR_AGEDBAL2 OUTPUT
    ELSE /* set as usual */
    BEGIN
      IF (@AGE = 0)
        SET @AGEDBAL0 = @AMOUNT
      ELSE IF (@AGE = 1)
      BEGIN
        SET @AGEDBAL1 = @AMOUNT
        SET @PRIOR_AGEDBAL0 = @AGEDBAL1
      END
      ELSE IF (@AGE = 2)
      BEGIN
        SET @AGEDBAL2 = @AMOUNT
        SET @PRIOR_AGEDBAL1 = @AGEDBAL2
      END
      ELSE
      BEGIN
        SET @AGEDBAL3 = @AMOUNT
        IF (@AGE = 3)
          SET @PRIOR_AGEDBAL2 = @AGEDBAL3
        ELSE
          SET @PRIOR_AGEDBAL3 = @AGEDBAL3
      END
    END

    /* Determine which A/c to set Turnover field values in */
    IF (@BRANCH_ACCNO > 0) /* If there is a Branch A/c */
      SET @TURNOVER_ACCNO = @BRANCH_ACCNO
    ELSE
      SET @TURNOVER_ACCNO = @ACCNO

    /* Set Turnover field values */
    UPDATE CR_ACCS SET
      MONTHVAL = MONTHVAL + @MONTHVAL,
      LASTMONTH = LASTMONTH + @LASTMONTH,
      YEARVAL = YEARVAL + @YEARVAL,
      LASTYEAR = LASTYEAR + @LASTYEAR
    WHERE
      ACCNO = @TURNOVER_ACCNO

    /* Set Aged Balance field values */
    UPDATE CR_ACCS SET
      AGEDBAL0 = AGEDBAL0 + @AGEDBAL0,
      AGEDBAL1 = AGEDBAL1 + @AGEDBAL1,
      AGEDBAL2 = AGEDBAL2 + @AGEDBAL2,
      AGEDBAL3 = AGEDBAL3 + @AGEDBAL3,
      PRIOR_AGEDBAL0 = PRIOR_AGEDBAL0 + @PRIOR_AGEDBAL0,
      PRIOR_AGEDBAL1 = PRIOR_AGEDBAL1 + @PRIOR_AGEDBAL1,
      PRIOR_AGEDBAL2 = PRIOR_AGEDBAL2 + @PRIOR_AGEDBAL2,
      PRIOR_AGEDBAL3 = PRIOR_AGEDBAL3 + @PRIOR_AGEDBAL3
    WHERE
      ACCNO = @ACCNO

    FETCH NEXT FROM INSERTED_CURSOR
    INTO @ACCNO, @BRANCH_ACCNO, @SUBTOTAL, @TAXTOTAL, @AMOUNT, @AGE, @TRANSTYPE, @TOAGEDBAL
  END
  CLOSE INSERTED_CURSOR
  DEALLOCATE INSERTED_CURSOR
  SET NOCOUNT OFF
END
SET_CR_TRANS_PREV_PERIOD_OPENCREATE TRIGGER [dbo].[SET_CR_TRANS_PREV_PERIOD_OPEN]
ON [dbo].[CR_TRANS]
FOR INSERT
AS
  DECLARE @NEW_SEQNO INTEGER,
         @NEW_AGE INTEGER,
         @NEW_AMOUNT FLOAT
BEGIN
  SET NOCOUNT ON
  SELECT @NEW_SEQNO=SEQNO, @NEW_AGE=AGE, @NEW_AMOUNT=AMOUNT FROM INSERTED

  IF (@NEW_AGE > 0)
  BEGIN
   IF (@NEW_AGE>=2)
     UPDATE [dbo].[CR_TRANS] SET ALLOCAGE=@NEW_AGE,
       PREV_PERIOD_OPEN = @NEW_AMOUNT - ISNULL((SELECT SUM(AMOUNT) FROM CR_ALLOCATIONS WHERE TRANS_SEQNO=@NEW_SEQNO AND AGE>=2), 0),
       PREV_PERIOD_CLOSE = @NEW_AMOUNT - ISNULL((SELECT SUM(AMOUNT) FROM CR_ALLOCATIONS WHERE TRANS_SEQNO=@NEW_SEQNO AND AGE>=1), 0)
         WHERE SEQNO = @NEW_SEQNO
   ELSE
   IF (@NEW_AGE=1)
     UPDATE [dbo].[CR_TRANS] SET ALLOCAGE=@NEW_AGE,
       PREV_PERIOD_OPEN=0,
       PREV_PERIOD_CLOSE = @NEW_AMOUNT - ISNULL((SELECT SUM(AMOUNT) FROM CR_ALLOCATIONS WHERE TRANS_SEQNO=@NEW_SEQNO AND AGE>=1), 0)
         WHERE SEQNO = @NEW_SEQNO
  END
  SET NOCOUNT OFF
END


Entity: CURRENCIES
CommentThis table contains details of all currencies used in the EXO Business system.
Primary key columnsCURRENCYNO

Attributes:
Column namePrimary keyData typeNot NULLComment
CURRENCYNOYesINTEGERYesA unique ID code for the currency.
CURRCODENoVARCHAR(3)NoThe three-letter currency code, e.g. AUD, NZD.
CURRNAMENoVARCHAR(30)NoThe descriptive name for the currency.
BUYRATENoFLOAT(53)NoThe buy rate (for purchases).
SELLRATENoFLOAT(53)NoThe sell rate (for sales).
CURRSYMBOLNoVARCHAR(5)NoThe symbol for the currency, e.g. $, £.
AVERAGE_RATENoFLOAT(53)NoThis field relates to the Intercompany module.
CLOSING_RATENoFLOAT(53)NoThis field relates to the Intercompany module.
RE_MOVEMENTSNoFLOAT(53)NoThis field relates to the Intercompany module.
ALERTPCNoINTEGERYesThe % Change Alert for the currency - when editing currencies, the user will be alerted if the currency is changed by a percentage greater than this.

Relationships:
NameRelationship typeParentChildCardinality
CURRENCIES_CR_ALLOCATIONSNon IdentifyingCURRENCIESCR_ALLOCATIONSZero Or More
CURRENCIES_CR_INVLINESNon IdentifyingCURRENCIESCR_INVLINESZero Or More
CURRENCIES_CR_TRANSNon IdentifyingCURRENCIESCR_TRANSZero Or More
CURRENCIES_DR_ALLOCATIONSNon IdentifyingCURRENCIESDR_ALLOCATIONSZero Or More
CURRENCIES_DR_INVLINESNon IdentifyingCURRENCIESDR_INVLINESZero Or More
CURRENCIES_DR_TRANSNon IdentifyingCURRENCIESDR_TRANSZero Or More
CURRENCIES_GLACCSNon IdentifyingCURRENCIESGLACCSZero Or More
CURRENCIES_JOBCOST_LINESNon IdentifyingCURRENCIESJOBCOST_LINESZero Or More
CURRENCIES_JOB_CONTRACT_BILLINGSNon IdentifyingCURRENCIESJOB_CONTRACT_BILLINGSZero Or More
CURRENCIES_JOB_TRANSACTIONSNon IdentifyingCURRENCIESJOB_TRANSACTIONSZero Or More
CURRENCIES_OPPORTUNITY_QUOTENon IdentifyingCURRENCIESOPPORTUNITY_QUOTEZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (ALERTPC)
Not NullColumn ConstraintNOT NULL (CURRENCYNO)
DF__CURRENCIE__ALERT__25BE0270DefaultColumn ConstraintALERTPC DEFAULT 5
DF__CURRENCIE__AVERA__17642ACADefaultColumn ConstraintAVERAGE_RATE DEFAULT 0
DF__CURRENCIE__BUYRA__2CFD9AD7DefaultColumn ConstraintBUYRATE DEFAULT 0
DF__CURRENCIE__CLOSI__18584F03DefaultColumn ConstraintCLOSING_RATE DEFAULT 0
DF__CURRENCIE__RE_MO__2B6B2377DefaultColumn ConstraintRE_MOVEMENTS DEFAULT 0
DF__CURRENCIE__SELLR__2DF1BF10DefaultColumn ConstraintSELLRATE DEFAULT 0
PK__CURRENCIE__CURRE__2C09769EPrimary KeyTable ConstraintPRIMARY KEY (CURRENCYNO)

Triggers:
Trigger nameCode
CURRENCY_RATE_CHANGECREATE TRIGGER [dbo].[CURRENCY_RATE_CHANGE] ON [dbo].[CURRENCIES]
FOR INSERT, UPDATE AS
BEGIN
  DECLARE @DR_PERIOD INT
  DECLARE @CR_PERIOD INT
  DECLARE @STK_PERIOD INT
  DECLARE @GL_PERIOD INT

  SELECT @DR_PERIOD=SEQNO FROM PERIOD_STATUS WHERE AGE=0 AND LEDGER ='D'
  SELECT @CR_PERIOD=SEQNO FROM PERIOD_STATUS WHERE AGE=0 AND LEDGER ='C'
  SELECT @STK_PERIOD=SEQNO FROM PERIOD_STATUS WHERE AGE=0 AND LEDGER ='S'
  SELECT @GL_PERIOD=SEQNO FROM PERIOD_STATUS WHERE AGE=0 AND LEDGER ='G'

  SET NOCOUNT ON
  INSERT INTO CURRENCY_RATECHANGES
  (CURRENCYNO, CURRCODE, NEWBUYRATE, NEWSELLRATE, DR_PERIOD, CR_PERIOD, STK_PERIOD, GL_PERIOD )
  SELECT INSERTED.CURRENCYNO, INSERTED.CURRCODE,
         INSERTED.BUYRATE, INSERTED.SELLRATE, @DR_PERIOD, @CR_PERIOD, @STK_PERIOD, @GL_PERIOD
  FROM INSERTED
  SET NOCOUNT OFF
END


Entity: GLACCS
CommentThis table contains details of all General Ledger accounts.
Primary key columnsACCNO

Attributes:
Column namePrimary keyData typeNot NULLComment
ACCNOYesINTEGERYesThe unique GL account number.
NAMENoVARCHAR(40)NoThe account name.
DRCRNoCHAR(1)NoThis field is set to 'C' for Credit accounts or 'D' for Debit accounts.
SECTIONNoINTEGERNoThis field is set to 0 for Profit and loss accounts or 1 for Balance sheet accounts.
OPENINGBALNoFLOAT(53)NoThe account's opening balance.
BALANCENoFLOAT(53)NoThe account's balance.
USESUBCODESNoCHAR(1)NoNot used.
REPORTCODENoVARCHAR(15)NoThe report code used by the GL account.
TAXSTATUSNoINTEGERNoThe Override GST rate specified for the GL account. A value of -1 corresponds to the AUTO SELECT RATE option.
CURRENCYNONoINTEGERNoThe ID number of the currency that the GL account is in.
ISACTIVENoCHAR(1)NoThis field contains 'Y' if the GL account is active.
ACCGROUPNoINTEGERNoThe GL account's Account Group.
ALLOWJOURNALNoCHAR(1)NoThis field is set to 'Y' if the GL account allows journals.
LAST_UPDATEDNoDATETIMENoThe date and time when the GL account was last updated.
BALSHEETACCTOTNoASNoThe balance sheet total for the account.
BALANCE_SHEET_TYPENoINTEGERYesFor balance sheet accounts, this field indicates the balance sheet type. Will be one of:
-1 = Not a balance sheet account
0 = Asset
1 = Liability
2 = Equity
NOTESNoVARCHAR(4096)NoAny notes on the GL account.
EXCLUDE_FROM_REVALNoCHAR(1)NoIf this field is set to 'Y', the account is excluded from revaluation.
PRIVATE_ACCNoCHAR(1)YesThis field is set to 'Y' if the GL account is a private account.
CREATED_DATENoDATETIMENoThe date and time that the GL account was created.

Relationships:
NameRelationship typeParentChildCardinality
CURRENCIES_GLACCSNon IdentifyingCURRENCIESGLACCSZero Or More
GLACCS_CR_TRANSNon IdentifyingGLACCSCR_TRANSZero Or More
GLACCS_DR_TRANSNon IdentifyingGLACCSDR_TRANSZero Or More
GLACCS_JOBCOST_HDRNon IdentifyingGLACCSJOBCOST_HDRZero Or More
GLACCS_JOBCOST_HDR_SALESNon IdentifyingGLACCSJOBCOST_HDRZero Or More
GLACCS_JOBCOST_LINESNon IdentifyingGLACCSJOBCOST_LINESZero Or More
GLACCS_JOB_CONTRACT_BILLINGSNon IdentifyingGLACCSJOB_CONTRACT_BILLINGSZero Or More
GLACCS_JOB_CONTRACT_BILLINGS_SUBNon IdentifyingGLACCSJOB_CONTRACT_BILLINGSZero Or More
GLACCS_JOB_TRANSACTIONSNon IdentifyingGLACCSJOB_TRANSACTIONSZero Or More
GLACCS_OPPORTUNITY_QUOTENon IdentifyingGLACCSOPPORTUNITY_QUOTEZero Or More
GLACCS_STOCK_GROUPSNon IdentifyingGLACCSSTOCK_GROUPSZero Or More
GLACCS_STOCK_GROUPS_COSNon IdentifyingGLACCSSTOCK_GROUPSZero Or More
GLACCS_STOCK_GROUPS_PNon IdentifyingGLACCSSTOCK_GROUPSZero Or More
GLACCS_STOCK_ITEMSNon IdentifyingGLACCSSTOCK_ITEMSZero Or More
GLACCS_STOCK_ITEMS_COSNon IdentifyingGLACCSSTOCK_ITEMSZero Or More
GLACCS_STOCK_TRANSNon IdentifyingGLACCSSTOCK_TRANSZero Or More
GL_ACCS_STOCKITEMS_PONon IdentifyingGLACCSSTOCK_ITEMSZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (PRIVATE_ACC)
Not NullColumn ConstraintNOT NULL (ACCNO)
Not NullColumn ConstraintNOT NULL (BALANCE_SHEET_TYPE)
CURRENCIES_GLACCSForeign KeyTable ConstraintFOREIGN KEY (CURRENCYNO) REFERENCES CURRENCIES(CURRENCYNO)
DF__GLACCS__ACCGROUP__613C58ECDefaultColumn ConstraintACCGROUP DEFAULT 0
DF__GLACCS__ALLOWJOU__2882FE7DDefaultColumn ConstraintALLOWJOURNAL DEFAULT Y
DF__GLACCS__BALANCE__3E082B48DefaultColumn ConstraintBALANCE DEFAULT 0
DF__GLACCS__BALANCE___40113AA2DefaultColumn ConstraintBALANCE_SHEET_TYPE DEFAULT -1
DF__GLACCS__CURRENCY__3A228BCBDefaultColumn ConstraintCURRENCYNO DEFAULT 0
DF__GLACCS__DRCR__3B2BBE9DDefaultColumn ConstraintDRCR DEFAULT D
DF__GLACCS__EXCLUDE___23CA01AFDefaultColumn ConstraintEXCLUDE_FROM_REVAL DEFAULT N
DF__GLACCS__ISACTIVE__58A712EBDefaultColumn ConstraintISACTIVE DEFAULT Y
DF__GLACCS__OPENINGB__3D14070FDefaultColumn ConstraintOPENINGBAL DEFAULT 0
DF__GLACCS__PRIVATE___13697CB4DefaultColumn ConstraintPRIVATE_ACC DEFAULT N
DF__GLACCS__SECTION__3C1FE2D6DefaultColumn ConstraintSECTION DEFAULT 0
DF__GLACCS__TAXSTATU__51700577DefaultColumn ConstraintTAXSTATUS DEFAULT 0
DF__GLACCS__USESUBCO__3FF073BADefaultColumn ConstraintUSESUBCODES DEFAULT N
PK__GLACCS__3A379A64Primary KeyTable ConstraintPRIMARY KEY (ACCNO)



Entity: NARRATIVES
CommentThis table contains the narratives attached to transactions.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique ID number for the narrative.
NARRATIVENoVARCHAR(4096)NoThe text of the narrative.

Relationships:
NameRelationship typeParentChildCardinality
NARRATIVES_CR_INVLINESNon IdentifyingNARRATIVESCR_INVLINESZero Or More
NARRATIVES_CR_TRANSIdentifyingNARRATIVESCR_TRANSZero Or More
NARRATIVES_DR_INVLINESNon IdentifyingNARRATIVESDR_INVLINESZero Or More
NARRATIVES_DR_TRANSNon IdentifyingNARRATIVESDR_TRANSZero Or More
NARRATIVES_JOBCOST_LINESNon IdentifyingNARRATIVESJOBCOST_LINESZero Or More
NARRATIVES_JOB_CONTRACT_BILLINGSNon IdentifyingNARRATIVESJOB_CONTRACT_BILLINGSZero Or More
NARRATIVES_JOB_TRANSACTIONSNon IdentifyingNARRATIVESJOB_TRANSACTIONSZero Or More
NARRATIVES_OPPORTUNITY_QUOTENon IdentifyingNARRATIVESOPPORTUNITY_QUOTEZero Or More
NARRATIVES_PURCHORD_HDRNon IdentifyingNARRATIVESPURCHORD_HDRZero Or More
NARRATIVES_SALESORD_HDRNon IdentifyingNARRATIVESSALESORD_HDRZero Or More
NARRATIVES_STOCK_REQUESTLINESNon IdentifyingNARRATIVESSTOCK_REQUESTLINESZero Or More
NARRATIVES_STOCK_REQUESTSNon IdentifyingNARRATIVESSTOCK_REQUESTSZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (SEQNO)
PK__NARRATIVES__2E31B632Primary KeyTable ConstraintPRIMARY KEY (SEQNO)



Entity: PERIOD_STATUS
CommentThis table contains details of the age periods set up in the system.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique ID number for the period.
AGENoINTEGERYesThe age of the period. The current period has an age of 0.
LEDGERNoCHAR(1)YesThe ledger for a specific age.
LOCKEDNoCHAR(1)NoIf set to 'Y', the period is locked, implying that this age in a specific ledger is closed and no more transactions should take place
PERIOD_SEQNONoINTEGERYesThe period's sequence number within fiscal year.
PERIODNAMENoVARCHAR(20)NoThe name/description for the period.
PERIOD_SHORTNAMENoVARCHAR(8)NoA short name for the period.
REPORTCODENoVARCHAR(8)NoA code used for reporting purposes.
YEARAGENoINTEGERYesThe ageing of the year that the period falls in. The current year has an age of 0.
STARTDATENoDATETIMENoThe start date for the period.
STOPDATENoDATETIMENoThe end date for the period.
MINSTOCKSEQNONoINTEGERNoThe first transaction for the period found in the Stock ledger.
MINGLSEQNONoINTEGERNoThe first transaction for the period found in the GLTRANS table.
MINTRANSEQNONoINTEGERNoFor the Debtors ledger, this specifies the first transaction for the period found in the DR_TRANS table.
For the Creditors ledger, this specifies the first transaction for the period found in the CR_TRANS table.
MINTRANLINESEQNONoINTEGERNoFor the Debtors ledger, this specifies the first transaction for the period found in the DR_INVLINES table.
For the Creditors ledger, this specifies the first transaction for the period found in the CR_INVLINES table.
MINORDSEQNONoINTEGERNoFor the Debtors ledger, this specifies the first transaction for the period found in the SALESORD_HDR table.
For the Creditors ledger, this specifies the first transaction for the period found in the PURCHORD_HDR table.
MINORDLINESEQNONoINTEGERNoFor the Debtors ledger, this specifies the first transaction for the period found in the SALESORD_LINES table.
For the Creditors ledger, this specifies the first transaction for the period found in the PURCHORD_LINES table.
FIN_QTRNoINTEGERYesThe financial quarter that the period belongs to.

Relationships:
NameRelationship typeParentChildCardinality
FK_CRM_BUDGET_PERIOD_STATUSNon IdentifyingPERIOD_STATUSCRM_BUDGETZero Or More
FK_CRM_BUDGET_PERIOD_STATUS1Non IdentifyingPERIOD_STATUSCRM_BUDGETZero Or More
PERIOD_STATUS_CR_ALLOCATIONSNon IdentifyingPERIOD_STATUSCR_ALLOCATIONSZero Or More
PERIOD_STATUS_CR_TRANSNon IdentifyingPERIOD_STATUSCR_TRANSZero Or More
PERIOD_STATUS_DR_ALLOCATIONSNon IdentifyingPERIOD_STATUSDR_ALLOCATIONSZero Or More
PERIOD_STATUS_DR_TRANSNon IdentifyingPERIOD_STATUSDR_TRANSZero Or More
PERIOD_STATUS_INWARDS_GOODS_COSTSNon IdentifyingPERIOD_STATUSINWARDS_GOODS_COSTSZero Or More
PERIOD_STATUS_INWARDS_GOODS_LINESNon IdentifyingPERIOD_STATUSINWARDS_GOODS_LINESZero Or More
PERIOD_STATUS_STOCK_TRANSNon IdentifyingPERIOD_STATUSSTOCK_TRANSZero Or More

Indexes:
NameIndex columnsIndex type
PERIOD_STATUS_AGE_INDEXAGE ASC

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (FIN_QTR)
Not NullColumn ConstraintNOT NULL (SEQNO)
Not NullColumn ConstraintNOT NULL (AGE)
Not NullColumn ConstraintNOT NULL (YEARAGE)
Not NullColumn ConstraintNOT NULL (LEDGER)
Not NullColumn ConstraintNOT NULL (PERIOD_SEQNO)
DF__PERIOD_STAT__AGE__0ABE5CC3DefaultColumn ConstraintAGE DEFAULT 0
DF__PERIOD_ST__FIN_Q__1F1104E1DefaultColumn ConstraintFIN_QTR DEFAULT 0
DF__PERIOD_ST__LOCKE__0BB280FCDefaultColumn ConstraintLOCKED DEFAULT N
DF__PERIOD_ST__MINGL__5B301089DefaultColumn ConstraintMINGLSEQNO DEFAULT -1
DF__PERIOD_ST__MINOR__5E0C7D34DefaultColumn ConstraintMINORDSEQNO DEFAULT -1
DF__PERIOD_ST__MINOR__5F00A16DDefaultColumn ConstraintMINORDLINESEQNO DEFAULT -1
DF__PERIOD_ST__MINST__5A3BEC50DefaultColumn ConstraintMINSTOCKSEQNO DEFAULT -1
DF__PERIOD_ST__MINTR__5C2434C2DefaultColumn ConstraintMINTRANSEQNO DEFAULT -1
DF__PERIOD_ST__MINTR__5D1858FBDefaultColumn ConstraintMINTRANLINESEQNO DEFAULT -1
DF__PERIOD_ST__PERIO__0CA6A535DefaultColumn ConstraintPERIOD_SEQNO DEFAULT 0
DF__PERIOD_ST__YEARA__0D9AC96EDefaultColumn ConstraintYEARAGE DEFAULT 0
PK__PERIOD_STATUS__09CA388APrimary KeyTable ConstraintPRIMARY KEY (SEQNO)



Entity: PURCHORD_HDR
CommentThis table contains header information for all Purchase Orders.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique ID number for the Purchase Order.
STATUSNoINTEGERNoThe status of the Purchase Order. Will be one of:
0 = Not Processed
1 = Partly Processed
2 = Fully Processed
ACCNONoINTEGERNoThe ID number of the Creditor account that the Purchase Order was created for.
ORDERDATENoDATETIMENoThe date and time when the Purchase Order was created.
DUEDATENoDATETIMENoThe date and time when the Purchase Order is due.
REFERENCENoVARCHAR(20)NoAn additional reference code for the Purchase Order.
ADDRESS1NoVARCHAR(30)NoDelivery address line 1.
ADDRESS2NoVARCHAR(30)NoDelivery address line 2.
ADDRESS3NoVARCHAR(30)NoDelivery address line 3.
ADDRESS4NoVARCHAR(30)NoDelivery address line 4.
INSTRUCTIONSNoVARCHAR(255)NoThis field is set via the On-Demand Purchase Orders function of the EXO Distribution Advantage module.
SUBTOTALNoFLOAT(53)NoThe subtotal amount on the Purchase Order.
TAXTOTALNoFLOAT(53)NoThe total tax amount on the Purchase Order.
SALESNONoINTEGERNoThe ID number of the staff member assigned to the Purchase Order.
CONTACT_SEQNONoINTEGERNoThe ID number of the Contact assigned to the Purchase Order.
CURRENCYNONoINTEGERNoThe ID number of the currency that the Purchase Order is in.
EXCHRATENoFLOAT(53)NoThe exchange rate for the currency that the Purchase Order is in.
TAXINCNoCHAR(1)NoSet to 'Y' if the Purchase Order is tax-inclusive.
LAST_UPDATEDNoDATETIMENoThe date and time when the Purchase Order was last updated.
BRANCHNONoINTEGERNoThe Branch number on the Purchase Order.
AUTH_STAFFNONoINTEGERNoThe ID number of the staff member who authorised the Purchase Order.
AUTH_DATENoDATETIMENoThe date and time when the Purchase Order was authorised.
ORDTOTALNoASNoThe total amount for the Sales Order.
ISCONFIRMEDNoCHAR(1)NoIf this field is set to 'Y', this means that all lines in the Purchase Order have been confirmed, i.e. the supplier/creditor has acknowledged the order.
LEADTIMEUSEDNoINTEGERNoSpecifies which of the Lead Times defined for the Creditor the Purchase Order uses. Will be one of:
0 = Primary Lead Time
1 = Secondary Lead Time
ADDRESS5NoVARCHAR(30)NoDelivery address line 5.
ADDRESS6NoVARCHAR(30)NoDelivery address line 6.
NARRATIVE_SEQNONoINTEGERNoThe ID number of the narrative attached to the Sales Order header.
HSTATUSNoINTEGERNoFor On-Demand Purchase orders, this field contains the line status. Comes from the profile setting 'B2B new purchase line status'.
DEFLOCNONoINTEGERNoThe default location that stock is being supplied from.
PROCESSFINALISATIONNoINTEGERNoWill be one of:
0 = Normal
1 = Deleted
2 = Forced Fully Processed
TXIDNoVARBINARY(256)NoThe Transaction ID assigned to the Purchase Order - this applies when using a payment gateway.
SO_SOURCE_REFNoVARCHAR(20)NoIf the Purchase Order was generated from a Sales Order, the Sales Order's ID number is recorded here.
CREATE_DATENoDATETIMENoThe date and time when the Purchase Order was created.
ACTIVATION_DATENoDATETIMENoThe date and time when the Purchase Order was activated.
FINALISATION_DATENoDATETIMENoThe date and time when the Purchase Order was finalised.
LOCALVALUENoASNoThe value of the Purchase Order in the local currency.
CAMPAIGN_WAVE_SEQNONoINTEGERNoIf the Purchase Order is associated with a campaign wave (EXO CRM), its ID number is recorded here.

Relationships:
NameRelationship typeParentChildCardinality
CR_ACCS_PURCHORD_HDRNon IdentifyingCR_ACCSPURCHORD_HDRZero Or More
NARRATIVES_PURCHORD_HDRNon IdentifyingNARRATIVESPURCHORD_HDRZero Or More
PURCHORD_HDR_CR_TRANSNon IdentifyingPURCHORD_HDRCR_TRANSZero Or More
PURCHORD_HDR_INWARDS_GOODS_LINESNon IdentifyingPURCHORD_HDRINWARDS_GOODS_LINESZero Or More
PURCHORD_HDR_TASKSNon IdentifyingPURCHORD_HDRTASKSZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (SEQNO)
CR_ACCS_PURCHORD_HDRForeign KeyTable ConstraintFOREIGN KEY (ACCNO) REFERENCES CR_ACCS(ACCNO)
DF_PURCHORD_HDR_ACCNODefaultColumn ConstraintACCNO DEFAULT 0
DF_PURCHORD_HDR_DUEDATEDefaultColumn ConstraintDUEDATE DEFAULT getdate()
DF_PURCHORD_HDR_ORDERDATEDefaultColumn ConstraintORDERDATE DEFAULT getdate()
DF_PURCHORD_HDR_STATUSDefaultColumn ConstraintSTATUS DEFAULT 0
DF_PURCHORD_HDR_SUBTOTALDefaultColumn ConstraintSUBTOTAL DEFAULT 0
DF_PURCHORD_HDR_TAXTOTALDefaultColumn ConstraintTAXTOTAL DEFAULT 0
DF__PURCHORD___BRANC__3C54ED00DefaultColumn ConstraintBRANCHNO DEFAULT 0
DF__PURCHORD___CAMPA__571566E2DefaultColumn ConstraintCAMPAIGN_WAVE_SEQNO DEFAULT -1
DF__PURCHORD___CURRE__30CE2BBBDefaultColumn ConstraintCURRENCYNO DEFAULT 0
DF__PURCHORD___DEFLO__3BB699D9DefaultColumn ConstraintDEFLOCNO DEFAULT 0
DF__PURCHORD___EXCHR__31C24FF4DefaultColumn ConstraintEXCHRATE DEFAULT 1
DF__PURCHORD___HSTAT__4FD2A11FDefaultColumn ConstraintHSTATUS DEFAULT 0
DF__PURCHORD___ISCON__74B941B4DefaultColumn ConstraintISCONFIRMED DEFAULT N
DF__PURCHORD___LEADT__76A18A26DefaultColumn ConstraintLEADTIMEUSED DEFAULT 0
DF__PURCHORD___NARRA__496FBC53DefaultColumn ConstraintNARRATIVE_SEQNO DEFAULT -1
DF__PURCHORD___PROCE__3D9EE24BDefaultColumn ConstraintPROCESSFINALISATION DEFAULT 0
DF__PURCHORD___SALES__71DCD509DefaultColumn ConstraintSALESNO DEFAULT 0
DF__PURCHORD___TAXIN__5649C92DDefaultColumn ConstraintTAXINC DEFAULT N
NARRATIVES_PURCHORD_HDRForeign KeyTable ConstraintFOREIGN KEY (NARRATIVE_SEQNO) REFERENCES NARRATIVES(SEQNO)
PK_PURCHORD_HDRPrimary KeyTable ConstraintPRIMARY KEY (SEQNO)



Entity: STAFF
CommentThis table stores details of all EXO Business staff members. These are the people who are authorised to log in to and use the EXO Business system.
Primary key columnsSTAFFNO

Attributes:
Column namePrimary keyData typeNot NULLComment
STAFFNOYesINTEGERYesA unique identifier for the staff record.
NAMENoVARCHAR(30)NoThe staff member's full name.
JOBTITLENoVARCHAR(30)NoThe staff member's job title.
EXTENSIONNoVARCHAR(12)NoThe staff member's telephone extension.
PHONENoVARCHAR(30)NoThe staff member's work telephone number.
HOMEPHONENoVARCHAR(30)NoThe staff member's home telephone number.
ISACTIVENoCHAR(1)NoThis field is set to 'Y' if the staff member is currently active, i.e. if their Active flag is ticked in EXO Business Configurator.
APP_PASSWORDNoVARCHAR(30)NoThe staff member's password, used when logging in to the EXO Business system. Passwords are stored in an encrypted format.
MENU_NONoINTEGERNoThe ID number of the Menu Definition specified for the staff member. Corresponds to the menu's SEQNO field in the MENU_COLLECTION table.
AUTH_AMTNoFLOAT(53)NoThe staff member's Credit Invoice Authorisation Limit.
STOCK_AUTH_AMTNoFLOAT(53)NoThe staff member's Stock Purchase Order Authorisation Limit.
NON_STOCK_AUTH_AMTNoFLOAT(53)NoThe staff member's Non-Stock Purchase Order Authorisation Limit.
SECURITYPROFILEIDNoINTEGERYesThe ID number of the staff member's Security profile. Corresponds to the profile's ID field in the PROFILE table.
USERPROFILEIDNoINTEGERYesThe ID number of the staff member's User profile. Corresponds to the profile's ID field in the PROFILE table.
LOGINIDNoVARCHAR(30)YesThe staff member's login ID. This is the ID used to log in to the EXO Business system.
PASSWORD_CHANGEDNoDATETIMEYesThe date and time when the staff member's password was last changed.
LAST_BAD_LOGINNoDATETIMENoThe date and time when the staff member last attempted to log in but failed.
BAD_LOGIN_COUNTNoINTEGERYesThe number of times the staff member has attempted to log in but failed.
LAST_LOGINNoDATETIMENoThe date and time when the staff member last successfully logged in.
ACCOUNT_STATUSNoINTEGERYesThe staff member's account status. Will be one of:
0 = Account OK
1 = Account Locked
2 = Password Expired
EMAIL_ADDRESSNoVARCHAR(50)NoThe staff member's email address.
DISCOUNTRATENoFLOAT(53)YesThe staff member's Discount Rate Limit.
PAYROLL_IDNoVARCHAR(15)NoThe staff member's Employee ID (Payroll) number. This field is used when EXO Business is integrating with an external payroll system, e.g. MYOB EXO Payroll. It must contain the employee's corresponding ID number in the payroll system.
IS_SUPERVISORNoCHAR(1)YesThis field is set to 'Y' if the staff member is designated as a supervisor, i.e. if their Has supervisory override authority flag is ticked.
NICKNAMENoVARCHAR(15)NoA short nickname for the employee.
ABSENTNoCHAR(1)YesThis field is set to 'Y' if the staff member is currently absent, i.e. if their Absent flag is ticked in EXO Business Configurator.
EMPLOYEE_CODENoINTEGERYesThis field is used by the payroll integration functionality.
SMTP_SEQNONoINTEGERNoWhere emails are sent via SMTP using the EXO Business Email Sender, this field contains the ID of the SMTP settings that apply to the staff member (SMTP_ACCOUNT.SEQNO). Set up via the SMTP Server Settings window.
HAS_BUDGETSNoCHAR(1)NoThis field is set to 'Y' if the staff member has been assigned a Sales Team Budget, i.e. if their Has Budget flag is ticked in EXO Business Configurator.
REPORTS_TO_STAFFNONoINTEGERNoThe ID number of the staff member that this staff member reports to.
FACEBOOK_ACCESS_TOKENNoVARCHAR(max)NoIf the staff member uses their own Facebook account when using the EXO Business social media functions, their encrypted access token is stored here.
LINKEDIN_TOKEN_KEYNoVARCHAR(max)NoIf the staff member uses their own LinkedIn account when using the EXO Business social media functions, their encrypted access token key is stored here.
LINKEDIN_TOKEN_SECRETNoVARCHAR(max)NoIf the staff member uses their own LinkedIn account when using the EXO Business social media functions, their encrypted access token secret is stored here.
TWITTER_TOKEN_KEYNoVARCHAR(max)NoIf the staff member uses their own Twitter account when using the EXO Business social media functions, their encrypted access token key is stored here.
TWITTER_TOKEN_SECRETNoVARCHAR(max)NoIf the staff member uses their own Twitter account when using the EXO Business social media functions, their encrypted access token secret is stored here.
API_ACCESSNoCHAR(1)NoThis field contains 'Y' if the staff member is authorised to use the EXO API.
MOBILE_ACCESSNoCHAR(1)YesThis field contains 'Y' if the staff member is authorised to use the EXO OnTheGo mobile app.
BANKFEED_REFRESHTOKENNoVARCHAR(500)NoEncrypted OAuth refresh token used for Bank Feeds.
SBR_REFRESHTOKENNoVARCHAR(1024)NoThe refresh token used for SBR authentication.

Relationships:
NameRelationship typeParentChildCardinality
FK_CRM_BUDGET_EXCLUDED_STAFF_STAFFNon IdentifyingSTAFFCRM_BUDGET_EXCLUDED_STAFFZero Or More
FK_CRM_BUDGET_LINE_STAFFNon IdentifyingSTAFFCRM_BUDGET_LINEZero Or More
MENU_COLLECTION_STAFFNon IdentifyingMENU_COLLECTIONSTAFFZero Or More
STAFF_BILLOMAT_TEMPNon IdentifyingSTAFFBILLOMAT_TEMPZero Or More
STAFF_CAMPAIGNNon IdentifyingSTAFFCAMPAIGNZero Or More
STAFF_CAMPAIGN_HISTNon IdentifyingSTAFFCAMPAIGN_HISTZero Or More
STAFF_CONTACTSNon IdentifyingSTAFFCONTACTSZero Or More
STAFF_CONTACT_LISTNon IdentifyingSTAFFCONTACT_LISTZero Or More
STAFF_CONTACT_LIST1Non IdentifyingSTAFFCONTACT_LISTZero Or More
STAFF_CR_ACCSNon IdentifyingSTAFFCR_ACCSZero Or More
STAFF_CR_CONT_HISTNon IdentifyingSTAFFCR_CONT_HISTZero Or More
STAFF_DR_ACCSNon IdentifyingSTAFFDR_ACCSOne Or More
STAFF_DR_CONT_HISTNon IdentifyingSTAFFDR_CONT_HISTOne Or More
STAFF_DR_TRANSNon IdentifyingSTAFFDR_TRANSZero Or More
STAFF_JOBCOST_HDRNon IdentifyingSTAFFJOBCOST_HDRZero Or More
STAFF_JOBCOST_HDR_MGRNon IdentifyingSTAFFJOBCOST_HDRZero Or More
STAFF_JOBCOST_RESOURCENon IdentifyingSTAFFJOBCOST_RESOURCEZero Or More
STAFF_JOB_TIMESHEETSNon IdentifyingSTAFFJOB_TIMESHEETSZero Or More
STAFF_JOB_TIMESHEET_ALLOWANCENon IdentifyingSTAFFJOB_TIMESHEET_ALLOWANCEZero Or More
STAFF_JOB_TRANSACTIONSNon IdentifyingSTAFFJOB_TRANSACTIONSZero Or More
STAFF_OPPORTUNITY_HISTNon IdentifyingSTAFFOPPORTUNITY_HISTZero Or More
STAFF_STOCK_REQUESTSNon IdentifyingSTAFFSTOCK_REQUESTSZero Or More
STAFF_STOCK_TRANS_HDRNon IdentifyingSTAFFSTOCK_TRANS_HDRZero Or More
STAFF_TASKSNon IdentifyingSTAFFTASKSZero Or More
STAFF_TASKS1Non IdentifyingSTAFFTASKSZero Or More
STAFF_TASKS2Non IdentifyingSTAFFTASKSZero Or More
STAFF_TASKS3Non IdentifyingSTAFFTASKSZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (MOBILE_ACCESS)
Not NullColumn ConstraintNOT NULL (STAFFNO)
Not NullColumn ConstraintNOT NULL (SECURITYPROFILEID)
Not NullColumn ConstraintNOT NULL (EMPLOYEE_CODE)
Not NullColumn ConstraintNOT NULL (USERPROFILEID)
Not NullColumn ConstraintNOT NULL (ABSENT)
Not NullColumn ConstraintNOT NULL (LOGINID)
Not NullColumn ConstraintNOT NULL (PASSWORD_CHANGED)
Not NullColumn ConstraintNOT NULL (IS_SUPERVISOR)
Not NullColumn ConstraintNOT NULL (BAD_LOGIN_COUNT)
Not NullColumn ConstraintNOT NULL (DISCOUNTRATE)
Not NullColumn ConstraintNOT NULL (ACCOUNT_STATUS)
DF__STAFF__ABSENT__12CA5E36DefaultColumn ConstraintABSENT DEFAULT N
DF__STAFF__ACCOUNT_S__5CACADF9DefaultColumn ConstraintACCOUNT_STATUS DEFAULT 0
DF__STAFF__BAD_LOGIN__5BB889C0DefaultColumn ConstraintBAD_LOGIN_COUNT DEFAULT 0
DF__STAFF__DISCOUNTR__2C146396DefaultColumn ConstraintDISCOUNTRATE DEFAULT 0
DF__STAFF__EMPLOYEE___3DB4BC3BDefaultColumn ConstraintEMPLOYEE_CODE DEFAULT -1
DF__STAFF__HAS_BUDGE__6855017DDefaultColumn ConstraintHAS_BUDGETS DEFAULT N
DF__STAFF__IS_SUPERV__24F33012DefaultColumn ConstraintIS_SUPERVISOR DEFAULT N
DF__STAFF__MOBILE_AC__38F0D275DefaultColumn ConstraintMOBILE_ACCESS DEFAULT N
DF__STAFF__PASSWORD___5AC46587DefaultColumn ConstraintPASSWORD_CHANGED DEFAULT getdate()
DF__STAFF__REPORTS_T__694925B6DefaultColumn ConstraintREPORTS_TO_STAFFNO DEFAULT -1
DF__STAFF__SECURITYP__58DC1D15DefaultColumn ConstraintSECURITYPROFILEID DEFAULT 0
DF__STAFF__SMTP_SEQN__6B667852DefaultColumn ConstraintSMTP_SEQNO DEFAULT -1
DF__STAFF__USERPROFI__59D0414EDefaultColumn ConstraintUSERPROFILEID DEFAULT 0
MENU_COLLECTION_STAFFForeign KeyTable ConstraintFOREIGN KEY (MENU_NO) REFERENCES MENU_COLLECTION(SEQNO)
PK_STAFFPrimary KeyTable ConstraintPRIMARY KEY (STAFFNO)



Entity: STOCK_ITEMS
CommentThis table contains details of all stock items.
Primary key columnsSTOCKCODE

Attributes:
Column namePrimary keyData typeNot NULLComment
STOCKCODEYesVARCHAR(23)YesA unique ID code for the stock item.
DESCRIPTIONNoVARCHAR(40)NoThe stock item's description.
STOCKGROUPNoINTEGERNoThe Primary (Fine) Stock Group that the item belongs to.
STATUSNoCHAR(1)NoThe stock item's status. Will be one of:
S = Stock item
L = Lookup item
SELLPRICE1NoFLOAT(53)NoSell price 1.
SELLPRICE2NoFLOAT(53)NoSell price 2.
SELLPRICE3NoFLOAT(53)NoSell price 3.
SELLPRICE4NoFLOAT(53)NoSell price 4.
SELLPRICE5NoFLOAT(53)NoSell price 5.
SELLPRICE6NoFLOAT(53)NoSell price 6.
SELLPRICE7NoFLOAT(53)NoSell price 7.
SELLPRICE8NoFLOAT(53)NoSell price 8.
SELLPRICE9NoASNoSell price 9.
SELLPRICE10NoFLOAT(53)NoSell price 10.
LATESTCOSTNoFLOAT(53)NoThe stock item's Last Cost Price.
AVECOSTNoFLOAT(53)NoThe stock item's Average Cost Price.
MINSTOCKNoFLOAT(53)NoThe minimum default stock level for each location.
MAXSTOCKNoFLOAT(53)NoThe maximum default stock level for each location.
SUPPLIERNONoINTEGERNoThe ID number (CR_ACCS.ACCNO) of the stock item's main supplier.
MONTHUNITSNoFLOAT(53)NoSales totals in terms of quantity for the current month.
YEARUNITSNoFLOAT(53)NoYear to date sales totals in terms of quantity.
LASTYEARUNITSNoFLOAT(53)NoUnits of stock item sold in for the previous year.
MONTHVALUENoFLOAT(53)NoSales value for the current month.
YEARVALUENoFLOAT(53)NoSales value for the current year.
LASTYEARVALUENoFLOAT(53)NoSales value for last year.
BINCODENoVARCHAR(12)NoBincode for the stock item.
DISCOUNTLEVELNoINTEGERNo
DEFDAYSNoINTEGERNo
BARCODE1NoVARCHAR(30)NoBarcode/alternate code 1.
BARCODE2NoVARCHAR(30)NoBarcode/alternate code 2.
BARCODE3NoVARCHAR(30)NoBarcode/alternate code 3.
LASTMONTHVALUENoFLOAT(53)NoSales value for the previous month for the stock item.
LASTMONTHUNITSNoFLOAT(53)NoUnits of stock item sold in the previous month.
SALES_GL_CODENoINTEGERNoThe default GL code that sales transactions for this stock item are posted to.
PURCH_GL_CODENoINTEGERNoThe GL code that purchase transactions for this stock are posted to.
WEB_SHOWNoCHAR(1)No
ISACTIVENoCHAR(1)NoIf this field is set to 'Y', the stock item is active.
WEIGHTNoFLOAT(53)NoPhysical weight of the stock item.
CUBICNoFLOAT(53)NoCubic weight of the item.
ALERTNoVARCHAR(60)NoText of the pop-up alert message that appears when the stock item is sold or purchased.
NOTESNoVARCHAR(4096)NoAny notes for the stock item.
PQTYNoFLOAT(53)No
PACKNoVARCHAR(10)NoDescribes the unit of sale for pricing, e.g. EACH or PACK.
HAS_SNNoCHAR(1)NoThis field is set to 'Y' if the stock item is serial number tracked.
STDCOSTNoFLOAT(53)NoThe stock item's standard cost.
SUPPLIERNO2NoINTEGERNoAlternate supplier for the stock item.
SUPPLIERNO3NoINTEGERNoAlternate supplier for the stock item.
SALES_GLSUBCODENoINTEGERNoThe default GL sub-account code that sales transactions for this stock item are posted to.
PURCH_GLSUBCODENoINTEGERNoThe default GL sub-account code that purchase transactions for this stock item are posted to.
BRANCHNONoINTEGERNoBranch number for the stock item.
SALESTAXRATENoINTEGERNoDefault GST rate for sales transactions.
PURCHTAXRATENoINTEGERNoDefault GST rate for purchase transactions.
LAST_UPDATEDNoDATETIMENoDate and time when the stock item record was last updated.
UPDATEITEM_CODENoVARCHAR(23)NoOnly applies to lookup items. The ID number of the stocked item that maintains the actual stock.
UPDATEITEM_QTYNoFLOAT(53)NoOnly applies to lookup items. Quantity of the stocked item.
COS_GL_CODENoINTEGERNoThe Cost of Sales account updated in the General Ledger when this stock item is sold.
COS_GLSUBCODENoINTEGERNoThe Cost of Sales sub-account updated in the General Ledger when the stock item is sold.
STOCKPRICEGROUPNoINTEGERNoThe price group that the stock item belongs to.
SUPPLIERCOSTNoFLOAT(53)YesThe supplier cost price.
ECONORDERQTYNoFLOAT(53)NoThe economic order quantity (EOQ) for the stock item.
LINKED_BILLCODENoVARCHAR(23)No
STOCK_CLASSIFICATIONNoINTEGERYesThe stock classification that the item belongs to.
STOCKGROUP2NoINTEGERNoThe stock item's Secondary (Coarse) Stock Group.
TOTALSTOCKNoFLOAT(53)YesTotal units of stock for the item.
HAS_BNNoCHAR(1)NoThis field is set to 'Y' if the stock item is batch tracked.
HAS_EXPIRYNoCHAR(1)YesThis field is set to 'Y' if the stock item has an expiry date. This flag is only available in the UI if the "Use expiry dates for batched & serial numbers" profile setting is enabled.
EXPIRY_DAYSNoINTEGERNoNumber of days before expiry of the stock item.
DUTYNoFLOAT(53)YesThe duty percentage on the stock item.
SERIALNO_TYPENoINTEGERYesHow the stock item is serialised. Will be one of:
0 = Not Serialised
1 = Fully Tracked (In & Internal & Out)
2 = Creditor & Internal (In & Internal)
3 = Debtor Only (Out only)
4 = Creditor & Debtor (In & Out Only)
5 = Creditor Only (In Only)
6 = Internal & Debtor (Internal & Out only)
7 = Internal Only
COSTTYPENoINTEGERYes
COSTGROUPNoINTEGERYes
LABEL_QTYNoINTEGERYes
IS_DISCOUNTABLENoCHAR(1)YesThis field is set to 'Y' if the stock item is discountable.
RESTRICTED_ITEMNoCHAR(1)YesThis field is set to 'Y' if the stock item is a restricted item.
NUMDECIMALSNoINTEGERYesThe number of decimal places that can be entered for the stock item's quantity.
COGSMETHODNoINTEGERYes
DEFAULTWARRANTYNONoINTEGERYesThe default Warranty No for the stock item.
DIMENSIONSNoINTEGERYesHow the dimensions of the stock item are specified. Will be one of:
0=None
1=Length
2=Square
3=Cubic
X_SIZEIDNoINTEGERNoStyle size ID of the stock item. Used by the Style, Size Colour functionality.
X_COLOURIDNoINTEGERNoStyle colour ID of the stock item. Used by the Style, Size Colour functionality.
AUTO_NARRATIVENoINTEGERNoThe setting of the stock item's Auto Narrative property. Will be one of:
0=No
1=Yes with Blank
2=Yes with Notes
VARIABLECOSTNoCHAR(1)YesThe field is set to 'Y for Variable Cost stock items.
PRICEQTYNoFLOAT(53)NoThe stock item's sell price per quantity.
PRICEPERKGNoFLOAT(53)NoThe stock item's sell price per kg.
LOOKUP_RECOVERABLENoCHAR(1)NoIf this field contains 'Y', the stock item is a recoverable expense in EXO Job Costing.

Relationships:
NameRelationship typeParentChildCardinality
CR_ACCS_STOCK_ITEMSNon IdentifyingCR_ACCSSTOCK_ITEMSZero Or More
FK_CRM_BUDGET_EXCLUDED_STOCK_ITEMS_STOCK_ITEMSNon IdentifyingSTOCK_ITEMSCRM_BUDGET_EXCLUDED_STOCK_ITEMSZero Or More
FK_CRM_BUDGET_LINE_STOCK_ITEMSNon IdentifyingSTOCK_ITEMSCRM_BUDGET_LINEZero Or More
GLACCS_STOCK_ITEMSNon IdentifyingGLACCSSTOCK_ITEMSZero Or More
GLACCS_STOCK_ITEMS_COSNon IdentifyingGLACCSSTOCK_ITEMSZero Or More
GL_ACCS_STOCKITEMS_PONon IdentifyingGLACCSSTOCK_ITEMSZero Or More
STOCK_CLASSIFICATIONS_STOCK_ITEMSNon IdentifyingSTOCK_CLASSIFICATIONSSTOCK_ITEMSZero Or More
STOCK_GROUP2S_STOCK_ITEMSNon IdentifyingSTOCK_GROUP2SSTOCK_ITEMSZero Or More
STOCK_GROUPS_STOCK_ITEMSNon IdentifyingSTOCK_GROUPSSTOCK_ITEMSZero Or More
STOCK_ITEMS_BILLOMAT_LINESNon IdentifyingSTOCK_ITEMSBILLOMAT_LINESZero Or More
STOCK_ITEMS_BILLOMAT_TEMPNon IdentifyingSTOCK_ITEMSBILLOMAT_TEMPZero Or More
STOCK_ITEMS_CR_INVLINESNon IdentifyingSTOCK_ITEMSCR_INVLINESZero Or More
STOCK_ITEMS_DR_INVLINESNon IdentifyingSTOCK_ITEMSDR_INVLINESZero Or More
STOCK_ITEMS_DR_PRICESNon IdentifyingSTOCK_ITEMSDR_PRICESZero Or More
STOCK_ITEMS_INWARDS_GOODS_LINESNon IdentifyingSTOCK_ITEMSINWARDS_GOODS_LINESZero Or More
STOCK_ITEMS_JOBCOST_LINESNon IdentifyingSTOCK_ITEMSJOBCOST_LINESZero Or More
STOCK_ITEMS_JOBCOST_LINES_DESCNon IdentifyingSTOCK_ITEMSJOBCOST_LINESZero Or More
STOCK_ITEMS_JOB_CONTRACT_BILLINGSNon IdentifyingSTOCK_ITEMSJOB_CONTRACT_BILLINGSZero Or More
STOCK_ITEMS_JOB_OUTPUT_ITEMSNon IdentifyingSTOCK_ITEMSJOB_OUTPUT_ITEMSZero Or More
STOCK_ITEMS_JOB_OUTPUT_ITEMS_DESCNon IdentifyingSTOCK_ITEMSJOB_OUTPUT_ITEMSZero Or More
STOCK_ITEMS_JOB_TIMESHEETSNon IdentifyingSTOCK_ITEMSJOB_TIMESHEETSZero Or More
STOCK_ITEMS_JOB_TRANSACTIONSNon IdentifyingSTOCK_ITEMSJOB_TRANSACTIONSZero Or More
STOCK_ITEMS_JOB_TRANSACTIONS_DESCNon IdentifyingSTOCK_ITEMSJOB_TRANSACTIONSZero Or More
STOCK_ITEMS_OPPORTUNITY_QUOTENon IdentifyingSTOCK_ITEMSOPPORTUNITY_QUOTEZero Or More
STOCK_ITEMS_STOCKREQUIREMENTNon IdentifyingSTOCK_ITEMSSTOCKREQUIREMENTZero Or More
STOCK_ITEMS_STOCKTAKE_TOTALSNon IdentifyingSTOCK_ITEMSSTOCKTAKE_TOTALSZero Or More
STOCK_ITEMS_STOCKTAKE_TOTALS_BNNon IdentifyingSTOCK_ITEMSSTOCKTAKE_TOTALSZero Or More
STOCK_ITEMS_STOCKTAKE_TOTALS_EXPDAYSNon IdentifyingSTOCK_ITEMSSTOCKTAKE_TOTALSZero Or More
STOCK_ITEMS_STOCKTAKE_TOTALS_EXPIRYNon IdentifyingSTOCK_ITEMSSTOCKTAKE_TOTALSZero Or More
STOCK_ITEMS_STOCKTAKE_TOTALS_SERIALNon IdentifyingSTOCK_ITEMSSTOCKTAKE_TOTALSZero Or More
STOCK_ITEMS_STOCK_LOC_INFOIdentifyingSTOCK_ITEMSSTOCK_LOC_INFOZero Or More
STOCK_ITEMS_STOCK_REQUESTLINESNon IdentifyingSTOCK_ITEMSSTOCK_REQUESTLINESZero Or More
STOCK_ITEMS_STOCK_REQUESTLINES_DESCNon IdentifyingSTOCK_ITEMSSTOCK_REQUESTLINESZero Or More
STOCK_ITEMS_STOCK_SERIALNOSNon IdentifyingSTOCK_ITEMSSTOCK_SERIALNOSZero Or More
STOCK_ITEMS_STOCK_TRANSNon IdentifyingSTOCK_ITEMSSTOCK_TRANSZero Or More
STOCK_ITEMS_STOCK_WEBNon IdentifyingSTOCK_ITEMSSTOCK_WEBZero Or More
STOCK_ITEMS_SUPPLIER_STOCK_ITEMSNon IdentifyingSTOCK_ITEMSSUPPLIER_STOCK_ITEMSZero Or More
STOCK_PRICEGROUPS_STOCK_ITEMSNon IdentifyingSTOCK_PRICEGROUPSSTOCK_ITEMSZero Or More

Indexes:
NameIndex columnsIndex type
STOCK_ITEMS_DESCDESCRIPTION ASC

Constraints:
NameTypeLevelConstraint
DefaultColumn ConstraintLOOKUP_RECOVERABLE DEFAULT Y
Not NullColumn ConstraintNOT NULL (STOCKCODE)
Not NullColumn ConstraintNOT NULL (VARIABLECOST)
Not NullColumn ConstraintNOT NULL (DIMENSIONS)
Not NullColumn ConstraintNOT NULL (DEFAULTWARRANTYNO)
Not NullColumn ConstraintNOT NULL (COGSMETHOD)
Not NullColumn ConstraintNOT NULL (NUMDECIMALS)
Not NullColumn ConstraintNOT NULL (RESTRICTED_ITEM)
Not NullColumn ConstraintNOT NULL (IS_DISCOUNTABLE)
Not NullColumn ConstraintNOT NULL (LABEL_QTY)
Not NullColumn ConstraintNOT NULL (COSTGROUP)
Not NullColumn ConstraintNOT NULL (COSTTYPE)
Not NullColumn ConstraintNOT NULL (SERIALNO_TYPE)
Not NullColumn ConstraintNOT NULL (DUTY)
Not NullColumn ConstraintNOT NULL (HAS_EXPIRY)
Not NullColumn ConstraintNOT NULL (TOTALSTOCK)
Not NullColumn ConstraintNOT NULL (STOCK_CLASSIFICATION)
Not NullColumn ConstraintNOT NULL (SUPPLIERCOST)
CR_ACCS_STOCK_ITEMSForeign KeyTable ConstraintFOREIGN KEY (SUPPLIERNO) REFERENCES CR_ACCS(ACCNO)
DF__STOCK_ITEM__DUTY__675F4696DefaultColumn ConstraintDUTY DEFAULT 0
DF__STOCK_ITEM__PQTY__7C255952DefaultColumn ConstraintPQTY DEFAULT 1
DF__STOCK_ITE__AUTO___43ECB87EDefaultColumn ConstraintAUTO_NARRATIVE DEFAULT 0
DF__STOCK_ITE__AVECO__18A19C6FDefaultColumn ConstraintAVECOST DEFAULT 0
DF__STOCK_ITE__BRANC__5FD33367DefaultColumn ConstraintBRANCHNO DEFAULT 0
DF__STOCK_ITE__COGSM__0BD27C8DDefaultColumn ConstraintCOGSMETHOD DEFAULT 0
DF__STOCK_ITE__COSTG__50BBD860DefaultColumn ConstraintCOSTGROUP DEFAULT 0
DF__STOCK_ITE__COSTT__4FC7B427DefaultColumn ConstraintCOSTTYPE DEFAULT 0
DF__STOCK_ITE__COS_G__4D7F7902DefaultColumn ConstraintCOS_GL_CODE DEFAULT 0
DF__STOCK_ITE__COS_G__4E739D3BDefaultColumn ConstraintCOS_GLSUBCODE DEFAULT 0
DF__STOCK_ITE__CUBIC__45C948A1DefaultColumn ConstraintCUBIC DEFAULT 0
DF__STOCK_ITE__DEFAU__6F0133B5DefaultColumn ConstraintDEFAULTWARRANTYNO DEFAULT -1
DF__STOCK_ITE__DEFDA__2D9CB955DefaultColumn ConstraintDEFDAYS DEFAULT 0
DF__STOCK_ITE__DIMEN__3CFFC3CDDefaultColumn ConstraintDIMENSIONS DEFAULT 0
DF__STOCK_ITE__DISCO__2CA8951CDefaultColumn ConstraintDISCOUNTLEVEL DEFAULT 0
DF__STOCK_ITE__EXPIR__666B225DDefaultColumn ConstraintEXPIRY_DAYS DEFAULT 1
DF__STOCK_ITE__HAS_B__526429B0DefaultColumn ConstraintHAS_BN DEFAULT N
DF__STOCK_ITE__HAS_E__6576FE24DefaultColumn ConstraintHAS_EXPIRY DEFAULT N
DF__STOCK_ITE__HAS_S__7FF5EA36DefaultColumn ConstraintHAS_SN DEFAULT N
DF__STOCK_ITE__ISACT__74B941B4DefaultColumn ConstraintISACTIVE DEFAULT Y
DF__STOCK_ITE__IS_DI__3044E72DDefaultColumn ConstraintIS_DISCOUNTABLE DEFAULT Y
DF__STOCK_ITE__LABEL__6C04CB79DefaultColumn ConstraintLABEL_QTY DEFAULT 1
DF__STOCK_ITE__LASTM__2E90DD8EDefaultColumn ConstraintLASTMONTHVALUE DEFAULT 0
DF__STOCK_ITE__LASTM__2F8501C7DefaultColumn ConstraintLASTMONTHUNITS DEFAULT 0
DF__STOCK_ITE__LASTY__28D80438DefaultColumn ConstraintLASTYEARUNITS DEFAULT 0
DF__STOCK_ITE__LASTY__2BB470E3DefaultColumn ConstraintLASTYEARVALUE DEFAULT 0
DF__STOCK_ITE__LATES__17AD7836DefaultColumn ConstraintLATESTCOST DEFAULT 0
DF__STOCK_ITE__MAXST__25077354DefaultColumn ConstraintMAXSTOCK DEFAULT 0
DF__STOCK_ITE__MINST__24134F1BDefaultColumn ConstraintMINSTOCK DEFAULT 0
DF__STOCK_ITE__MONTH__26EFBBC6DefaultColumn ConstraintMONTHUNITS DEFAULT 0
DF__STOCK_ITE__MONTH__29CC2871DefaultColumn ConstraintMONTHVALUE DEFAULT 0
DF__STOCK_ITE__NUMDE__0801EBA9DefaultColumn ConstraintNUMDECIMALS DEFAULT -1
DF__STOCK_ITE__PURCH__451F3D2BDefaultColumn ConstraintPURCH_GLSUBCODE DEFAULT 0
DF__STOCK_ITE__PURCH__4727812EDefaultColumn ConstraintPURCH_GL_CODE DEFAULT 0
DF__STOCK_ITE__PURCH__68687968DefaultColumn ConstraintPURCHTAXRATE DEFAULT -1
DF__STOCK_ITE__RESTR__77CB83E0DefaultColumn ConstraintRESTRICTED_ITEM DEFAULT N
DF__STOCK_ITE__SALES__442B18F2DefaultColumn ConstraintSALES_GLSUBCODE DEFAULT 0
DF__STOCK_ITE__SALES__46335CF5DefaultColumn ConstraintSALES_GL_CODE DEFAULT 0
DF__STOCK_ITE__SALES__6774552FDefaultColumn ConstraintSALESTAXRATE DEFAULT -1
DF__STOCK_ITE__SELLP__13DCE752DefaultColumn ConstraintSELLPRICE1 DEFAULT 0
DF__STOCK_ITE__SELLP__14D10B8BDefaultColumn ConstraintSELLPRICE2 DEFAULT 0
DF__STOCK_ITE__SELLP__15C52FC4DefaultColumn ConstraintSELLPRICE3 DEFAULT 0
DF__STOCK_ITE__SELLP__16B953FDDefaultColumn ConstraintSELLPRICE4 DEFAULT 0
DF__STOCK_ITE__SELLP__39987BE6DefaultColumn ConstraintSELLPRICE5 DEFAULT 0
DF__STOCK_ITE__SELLP__3A8CA01FDefaultColumn ConstraintSELLPRICE6 DEFAULT 0
DF__STOCK_ITE__SELLP__3B80C458DefaultColumn ConstraintSELLPRICE7 DEFAULT 0
DF__STOCK_ITE__SELLP__3C74E891DefaultColumn ConstraintSELLPRICE8 DEFAULT 0
DF__STOCK_ITE__SELLP__3E5D3103DefaultColumn ConstraintSELLPRICE10 DEFAULT 0
DF__STOCK_ITE__SERIA__1C481021DefaultColumn ConstraintSERIALNO_TYPE DEFAULT 0
DF__STOCK_ITE__STATU__12E8C319DefaultColumn ConstraintSTATUS DEFAULT L
DF__STOCK_ITE__STDCO__392E6792DefaultColumn ConstraintSTDCOST DEFAULT 0
DF__STOCK_ITE__STOCK__11F49EE0DefaultColumn ConstraintSTOCKGROUP DEFAULT 0
DF__STOCK_ITE__STOCK__4F87BD05DefaultColumn ConstraintSTOCKGROUP2 DEFAULT 0
DF__STOCK_ITE__STOCK__6442E2C9DefaultColumn ConstraintSTOCK_CLASSIFICATION DEFAULT 0
DF__STOCK_ITE__STOCK__69279377DefaultColumn ConstraintSTOCKPRICEGROUP DEFAULT 0
DF__STOCK_ITE__SUPPL__16B953FDDefaultColumn ConstraintSUPPLIERCOST DEFAULT 0
DF__STOCK_ITE__SUPPL__25FB978DDefaultColumn ConstraintSUPPLIERNO DEFAULT 0
DF__STOCK_ITE__TOTAL__51700577DefaultColumn ConstraintTOTALSTOCK DEFAULT 0
DF__STOCK_ITE__UPDAT__257187A8DefaultColumn ConstraintUPDATEITEM_QTY DEFAULT 0
DF__STOCK_ITE__VARIA__611DF409DefaultColumn ConstraintVARIABLECOST DEFAULT N
DF__STOCK_ITE__WEB_S__44160A59DefaultColumn ConstraintWEB_SHOW DEFAULT N
DF__STOCK_ITE__WEIGH__44D52468DefaultColumn ConstraintWEIGHT DEFAULT 0
DF__STOCK_ITE__X_COL__02890975DefaultColumn ConstraintX_COLOURID DEFAULT 0
DF__STOCK_ITE__X_SIZ__0194E53CDefaultColumn ConstraintX_SIZEID DEFAULT 0
DF__STOCK_ITE__YEARU__27E3DFFFDefaultColumn ConstraintYEARUNITS DEFAULT 0
DF__STOCK_ITE__YEARV__2AC04CAADefaultColumn ConstraintYEARVALUE DEFAULT 0
GLACCS_STOCK_ITEMSForeign KeyTable ConstraintFOREIGN KEY (SALES_GL_CODE) REFERENCES GLACCS(ACCNO)
GLACCS_STOCK_ITEMS_COSForeign KeyTable ConstraintFOREIGN KEY (COS_GL_CODE) REFERENCES GLACCS(ACCNO)
GL_ACCS_STOCKITEMS_POForeign KeyTable ConstraintFOREIGN KEY (PURCH_GL_CODE) REFERENCES GLACCS(ACCNO)
PK__STOCK_ITEMS__11007AA7Primary KeyTable ConstraintPRIMARY KEY (STOCKCODE)
STOCK_CLASSIFICATIONS_STOCK_ITEMSForeign KeyTable ConstraintFOREIGN KEY (STOCK_CLASSIFICATION) REFERENCES STOCK_CLASSIFICATIONS(CLASSNO)
STOCK_GROUP2S_STOCK_ITEMSForeign KeyTable ConstraintFOREIGN KEY (STOCKGROUP2) REFERENCES STOCK_GROUP2S(GROUPNO)
STOCK_GROUPS_STOCK_ITEMSForeign KeyTable ConstraintFOREIGN KEY (STOCKGROUP) REFERENCES STOCK_GROUPS(GROUPNO)
STOCK_PRICEGROUPS_STOCK_ITEMSForeign KeyTable ConstraintFOREIGN KEY (STOCKPRICEGROUP) REFERENCES STOCK_PRICEGROUPS(GROUPNO)

Triggers:
Trigger nameCode
AFTER_STOCK_ITEMS_DELETECREATE TRIGGER [dbo].[AFTER_STOCK_ITEMS_DELETE] ON [dbo].[STOCK_ITEMS]
FOR DELETE
AS
SET NOCOUNT ON
  DELETE FROM STOCK_LOC_INFO WHERE STOCKCODE IN (SELECT STOCKCODE FROM DELETED)
SET NOCOUNT OFF
STOCK_ITEMS_LOC_INFOCREATE TRIGGER [dbo].[STOCK_ITEMS_LOC_INFO] ON [dbo].[STOCK_ITEMS]
FOR INSERT
AS
BEGIN
  SET NOCOUNT ON
  INSERT INTO STOCK_LOC_INFO
    (STOCKCODE, LOCATION, BINCODE, MINSTOCK, MAXSTOCK, QTY)
  SELECT I.STOCKCODE, SL.LOCNO, I.BINCODE, I.MINSTOCK, I.MAXSTOCK, 0
  FROM STOCK_LOCATIONS SL, INSERTED I
  SET NOCOUNT OFF
END
STOCK_ITEMS_ONEOFFCREATE TRIGGER [dbo].[STOCK_ITEMS_ONEOFF] ON [dbo].[STOCK_ITEMS]
FOR UPDATE
AS
BEGIN
  DECLARE @UPDATEDLINES INT
  SET @UPDATEDLINES=@@ROWCOUNT
  SET NOCOUNT ON
  IF (@UPDATEDLINES > 0) AND NOT UPDATE(ISACTIVE)
    BEGIN
    UPDATE S
    SET ISACTIVE = 'N'
    FROM [dbo].[STOCK_ITEMS] S
    JOIN INSERTED I ON S.STOCKCODE = I.STOCKCODE
    JOIN STOCK_TRANS ST ON I.STOCKCODE = ST.STOCKCODE
    WHERE ((S.STOCK_CLASSIFICATION = 100) OR (S.STOCK_CLASSIFICATION = 70))
    AND (S.TOTALSTOCK <= 0)
    END
  SET NOCOUNT OFF
END


Entity: TAX_RATES
CommentThis table contains all tax rates used by the system.
Primary key columnsSEQNO

Attributes:
Column namePrimary keyData typeNot NULLComment
SEQNOYesINTEGERYesA unique ID number for the tax rate.
RATENoFLOAT(53)NoThe percentage taxation rate.
NAMENoVARCHAR(30)NoThe full name of the taxation rate.
SHORTNAMENoVARCHAR(6)NoA short name for the taxation rate.
BASENoFLOAT(53)No
GLACCNoINTEGERNoThe GL account used for the tax rate (if it is not using the default control account).
GLSUBACCNoINTEGERNoThe GL subaccount used for the tax rate (if it is not using the default control subaccount).
KEY_POINTNoVARCHAR(5)NoThe tax return key point that applies to the tax rate.

Relationships:
NameRelationship typeParentChildCardinality
TAX_RATES_CR_INVLINESNon IdentifyingTAX_RATESCR_INVLINESZero Or More
TAX_RATES_CR_TRANSNon IdentifyingTAX_RATESCR_TRANSZero Or More
TAX_RATES_DR_INVLINESNon IdentifyingTAX_RATESDR_INVLINESZero Or More
TAX_RATES_DR_TRANSNon IdentifyingTAX_RATESDR_TRANSZero Or More
TAX_RATES_JOBCOST_LINESNon IdentifyingTAX_RATESJOBCOST_LINESZero Or More
TAX_RATES_JOB_TRANSACTIONSNon IdentifyingTAX_RATESJOB_TRANSACTIONSZero Or More
TAX_RATES_OPPORTUNITY_QUOTENon IdentifyingTAX_RATESOPPORTUNITY_QUOTEZero Or More

Constraints:
NameTypeLevelConstraint
Not NullColumn ConstraintNOT NULL (SEQNO)
DF__TAX_RATES__BASE__1E5A75C5DefaultColumn ConstraintBASE DEFAULT 0
DF__TAX_RATES__GLACC__1F4E99FEDefaultColumn ConstraintGLACC DEFAULT 0
DF__TAX_RATES__GLSUB__2042BE37DefaultColumn ConstraintGLSUBACC DEFAULT 0
DF__TAX_RATES__RATE__668030F6DefaultColumn ConstraintRATE DEFAULT 0
PK__TAX_RATES__658C0CBDPrimary KeyTable ConstraintPRIMARY KEY (SEQNO)

Triggers:
Trigger nameCode
BEFORE_TAX_RATES_INSERTCREATE TRIGGER [dbo].[BEFORE_TAX_RATES_INSERT] ON [dbo].[TAX_RATES]
FOR INSERT
AS
SET NOCOUNT ON
  DECLARE @NEW_SHORTNAME VARCHAR(6)
  DECLARE @NEW_SEQNO INTEGER
  DECLARE @NEW_RATE FLOAT
  SELECT
    @NEW_SHORTNAME=SHORTNAME,
    @NEW_RATE=RATE,
    @NEW_SEQNO=SEQNO
  FROM
    INSERTED
  IF (@NEW_SHORTNAME IS NULL) OR (@NEW_SHORTNAME = '')
    UPDATE [dbo].[TAX_RATES] SET SHORTNAME = CAST(@NEW_RATE AS VARCHAR(5))+'%' WHERE SEQNO=@NEW_SEQNO
SET NOCOUNT OFF
RETURN