/*
Created		1/28/2003
Modified		3/13/2010
Project		FocuSQL
Model			ServicePoint
Company		RTM Computer Solutions
Author		RF
Version		9.3.50
Database		MS SQL 2000 
*/


Drop index [SVC_TECH].[SVC_TECH_X1] 
go
Drop index [SVC_TECH].[SVC_TECH_X2] 
go
Drop index [SVC_ADDRESS].[SVC_ADDRESS_X1] 
go
Drop index [SVC_ADDRESS].[SVC_ADDRESS_X2] 
go
Drop index [SVC_ADDRESS_NOTES].[SVC_ADDRESS_NOTES_X1] 
go
Drop index [CUST_EQUIPMENT].[CUST_EQUIPMENT_X1] 
go
Drop index [CUST_EQUIPMENT].[CUST_EQUIPMENT_X2] 
go
Drop index [CUST_EQUIPMENT].[CUST_EQUIPMENT_X3] 
go
Drop index [CUST_EQUIPMENT_NOTES].[CUST_EQUIPMENT_NOTES_X1] 
go
Drop index [WORK_ORDER].[WORK_ORDER_X1] 
go
Drop index [WORK_ORDER].[WORK_ORDER_X2] 
go
Drop index [WO_ADDL_CHG].[WO_ADDL_CHG_X1] 
go
Drop index [WO_PMNT].[WO_PMNT_X1] 
go
Drop index [WO_TAX].[WO_TAX_X1] 
go
Drop index [WO_PARTS].[WO_PARTS_X1] 
go
Drop index [WO_LABOR].[WO_LABOR_X1] 
go
Drop index [WO_NOTES].[WO_NOTES_X1] 
go
Drop index [WO_TASK].[WO_TASK_X1] 
go
Drop index [WO_LABOR_NOTES].[WO_LABOR_NOTES_X1] 
go
Drop index [HISTORY_WORK_ORDER].[HISTORY_WORK_ORDER_X1] 
go
Drop index [HISTORY_WORK_ORDER].[HISTORY_WORK_ORDER_X2] 
go
Drop index [HISTORY_WO_NOTES].[HISTORY_WO_NOTES_X1] 
go
Drop index [HISTORY_WO_TAX].[HISTORY_WO_TAX_X1] 
go
Drop index [HISTORY_WO_PMNT].[HISTORY_WO_PMNT_X1] 
go
Drop index [HISTORY_WO_TASK].[HISTORY_WO_TASK_X1] 
go
Drop index [HISTORY_WO_ADDL_CHG].[HISTORY_WO_ADDL_CHG_X1] 
go
Drop index [HISTORY_WO_PARTS].[HISTORY_WO_PARTS_X1] 
go
Drop index [HISTORY_WO_LABOR].[HISTORY_WO_LABOR_X1] 
go
Drop index [HISTORY_WO_LABOR_NOTES].[HISTORY_WO_LABOR_NOTES_X1] 
go
Drop index [CONTRACT].[CONTRACT_X1] 
go
Drop index [CONTRACT].[CONTRACT_X2] 
go
Drop index [CONTRACT_NOTES].[CONTRACT_NOTES_X1] 
go
Drop index [CONTRACT_TAX].[CONTRACT_TAX_X1] 
go
Drop index [HISTORY_CONTRACT].[HISTORY_CONTRACT_X1] 
go
Drop index [HISTORY_CONTRACT].[HISTORY_CONTRACT_X2] 
go
Drop index [HISTORY_CONTRACT_NOTES].[HISTORY_CONTRACT_NOTES_X1] 
go
Drop index [HISTORY_CONTRACT_TAX].[HISTORY_CONTRACT_TAX_X1] 
go
Drop index [HISTORY_CUST_EQUIPMENT].[HISTORY_CUST_EQUIPMENT_X1] 
go
Drop index [HISTORY_CUST_EQUIPMENT].[HISTORY_CUST_EQUIPMENT_X2] 
go
Drop index [HISTORY_CUST_EQUIPMENT].[HISTORY_CUST_EQUIPMENT_X3] 
go
Drop index [SP_USER].[SP_USER_X1] 
go
Drop index [WO_PARTS_SERIALS].[WO_PARTS_SERIALS_X1] 
go
Drop index [HISTORY_WO_PARTS_SERIALS].[HISTORY_WO_PARTS_SERIALS_X1] 
go
Drop index [CUST_EQUIPMENT_METERS].[EQUIPMENT_METERS_X1] 
go
Drop index [WO_TASK_NOTES].[WO_TASK_NOTES_X1] 
go
Drop index [HISTORY_WO_TASK_NOTES].[HISTORY_WO_TASK_NOTES_X1] 
go
Drop index [PREDEF_JOB].[PREDEF_JOB_X1] 
go
Drop index [PREDEF_JOB].[PREDEF_JOB_X2] 
go
Drop index [PREDEF_JOB_NOTES].[JOB_NOTES_X1] 
go
Drop index [PREDEF_JOB_TASK].[JOB_TASK_X1] 
go
Drop index [PREDEF_JOB_ADDL_CHG].[JOB_ADDL_CHG_X1] 
go
Drop index [PREDEF_JOB_PARTS].[JOB_PARTS_X1] 
go
Drop index [PREDEF_JOB_LABOR].[JOB_LABOR_X1] 
go
Drop index [PREDEF_JOB_LABOR_NOTES].[JOB_LABOR_NOTES_X1] 
go
Drop index [PREDEF_JOB_TASK_NOTES].[JOB_TASK_NOTES_X1] 
go
Drop index [METER_READINGS].[METER_READINGS_X1] 
go
Drop index [PREDEF_NOTES].[PREDEF_NOTE_X1] 
go
Drop index [HISTORY_METER_READINGS].[HISTORY_METER_READINGS_X1] 
go
Drop index [WO_PARTS_GRID_CELL].[WO_PARTS_GRID_CELL_X1] 
go
Drop index [HISTORY_WO_PARTS_GRID_CELL].[HISTORY_WO_PARTS_GRID_CELL_X1] 
go


Drop table [HISTORY_WO_PARTS_GRID_CELL] 
go
Drop table [WO_PARTS_GRID_CELL] 
go
Drop table [HISTORY_METER_READINGS] 
go
Drop table [PREDEF_NOTES] 
go
Drop table [METER_READINGS] 
go
Drop table [PREDEF_JOB_TASK_NOTES] 
go
Drop table [PREDEF_JOB_LABOR_NOTES] 
go
Drop table [PREDEF_JOB_LABOR] 
go
Drop table [PREDEF_JOB_PARTS] 
go
Drop table [PREDEF_JOB_ADDL_CHG] 
go
Drop table [PREDEF_JOB_TASK] 
go
Drop table [PREDEF_JOB_NOTES] 
go
Drop table [PREDEF_JOB] 
go
Drop table [HISTORY_WO_TASK_NOTES] 
go
Drop table [WO_TASK_NOTES] 
go
Drop table [CUST_EQUIPMENT_METERS] 
go
Drop table [USAGE_CODE] 
go
Drop table [HISTORY_WO_PARTS_SERIALS] 
go
Drop table [WO_PARTS_SERIALS] 
go
Drop table [SP_USER] 
go
Drop table [HISTORY_CUST_EQUIPMENT] 
go
Drop table [HISTORY_CONTRACT_TAX] 
go
Drop table [HISTORY_CONTRACT_NOTES] 
go
Drop table [HISTORY_CONTRACT] 
go
Drop table [CONTRACT_TAX] 
go
Drop table [CONTRACT_NOTES] 
go
Drop table [CONTRACT] 
go
Drop table [HISTORY_WO_LABOR_NOTES] 
go
Drop table [HISTORY_WO_LABOR] 
go
Drop table [HISTORY_WO_PARTS] 
go
Drop table [HISTORY_WO_ADDL_CHG] 
go
Drop table [HISTORY_WO_TASK] 
go
Drop table [HISTORY_WO_PMNT] 
go
Drop table [HISTORY_WO_TAX] 
go
Drop table [HISTORY_WO_NOTES] 
go
Drop table [HISTORY_WORK_ORDER] 
go
Drop table [TAX_DEFAULT] 
go
Drop table [PRIORITY_CODE] 
go
Drop table [STATUS_CODE] 
go
Drop table [WO_LABOR_NOTES] 
go
Drop table [WO_TASK] 
go
Drop table [WO_NOTES] 
go
Drop table [WO_LABOR] 
go
Drop table [WO_PARTS] 
go
Drop table [WO_TAX] 
go
Drop table [WO_PMNT] 
go
Drop table [WO_ADDL_CHG] 
go
Drop table [WORK_ORDER] 
go
Drop table [CUST_EQUIPMENT_NOTES] 
go
Drop table [CUST_EQUIPMENT] 
go
Drop table [SVC_ADDRESS_NOTES] 
go
Drop table [SVC_ADDRESS] 
go
Drop table [CONTROL_INFO] 
go
Drop table [WARRANTY] 
go
Drop table [INVOICING_CODE] 
go
Drop table [EQP_MODEL] 
go
Drop table [WORK_CAT] 
go
Drop table [REFERRAL_SOURCE] 
go
Drop table [PROBLEM_CODE] 
go
Drop table [PM_SCHED] 
go
Drop table [CONTRACT_CAT] 
go
Drop table [SETUP_NOTES] 
go
Drop table [SVC_TECH] 
go
Drop table [TECH_CAT] 
go


Exec sp_droptype [U_CODE]
go
Exec sp_droptype [U_DESC]
go
Exec sp_droptype [U_COST]
go
Exec sp_droptype [U_PRICE]
go
Exec sp_droptype [U_PHONE]
go
Exec sp_droptype [U_EMAIL_ADRS]
go
Exec sp_droptype [U_FLAG]
go
Exec sp_droptype [U_DATE]
go
Exec sp_droptype [U_NOTE]
go
Exec sp_droptype [U_NOTE_ID]
go
Exec sp_droptype [U_INTEGER]
go
Exec sp_droptype [U_LONG_CODE]
go
Exec sp_droptype [U_QTY]
go
Exec sp_droptype [U_GL_ACCT_NO]
go
Exec sp_droptype [U_GENERAL_ID]
go
Exec sp_droptype [U_UDEF]
go
Exec sp_droptype [U_ITEM_NO]
go
Exec sp_droptype [U_NAME]
go
Exec sp_droptype [U_USAGE_PRICE]
go


Exec sp_addtype 'U_CODE', 'Varchar(10)', 'NOT NULL'
go

Exec sp_addtype 'U_DESC', 'Varchar(30)', 'NOT NULL'
go

Exec sp_addtype 'U_COST', 'Decimal(15,4)', 'NOT NULL'
go

Exec sp_addtype 'U_PRICE', 'Decimal(15,4)', 'NOT NULL'
go

Exec sp_addtype 'U_PHONE', 'Varchar(25)', 'NOT NULL'
go

Exec sp_addtype 'U_EMAIL_ADRS', 'Varchar(50)', 'NOT NULL'
go

Exec sp_addtype 'U_FLAG', 'Char(1)', 'NOT NULL'
go

Exec sp_addtype 'U_DATE', 'Datetime', 'NOT NULL'
go

Exec sp_addtype 'U_NOTE', 'Text', 'NOT NULL'
go

Exec sp_addtype 'U_NOTE_ID', 'Varchar(20)', 'NOT NULL'
go

Exec sp_addtype 'U_INTEGER', 'Numeric(7,0)', 'NOT NULL'
go

Exec sp_addtype 'U_LONG_CODE', 'Varchar(25)', 'NOT NULL'
go

Exec sp_addtype 'U_QTY', 'Numeric(7,2)', 'NOT NULL'
go

Exec sp_addtype 'U_GL_ACCT_NO', 'Varchar(20)', 'NOT NULL'
go

Exec sp_addtype 'U_GENERAL_ID', 'Varchar(15)', 'NOT NULL'
go

Exec sp_addtype 'U_UDEF', 'Varchar(100)', 'NOT NULL'
go

Exec sp_addtype 'U_ITEM_NO', 'Varchar(30)', 'NOT NULL'
go

Exec sp_addtype 'U_NAME', 'Varchar(40)', 'NOT NULL'
go

Exec sp_addtype 'U_USAGE_PRICE', 'Decimal(15,5)', 'NOT NULL'
go


Create table [TECH_CAT]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
Primary Key ([Code])
) 
go

Create table [SVC_TECH]
(
	[Tech_ID] Varchar(10) NOT NULL, UNIQUE ([Tech_ID]),
	[Name] Varchar(30) NOT NULL,
	[PHONE_1] Varchar(25) NULL,
	[PHONE_2] Varchar(25) NULL,
	[EMAIL_ADRS] Varchar(50) NULL,
	[STD_COST] Decimal(15,4) NULL,
	[OT_COST] Decimal(15,4) NULL,
	[SPEC_COST] Decimal(15,4) NULL,
	[TYPE] Char(1) NULL,
	[DFLT_PTS_LOC] Varchar(10) NULL,
	[CATEGORY_1] Varchar(10) NULL,
	[CATEGORY_2] Varchar(10) NULL,
	[CATEGORY_3] Varchar(10) NULL,
	[CATEGORY_4] Varchar(10) NULL,
	[CATEGORY_5] Varchar(10) NULL,
	[DEPARTMENT] Varchar(25) NULL,
	[INACTIVE_FLG] Char(1) NULL,
Primary Key ([Tech_ID])
) 
go

Create table [SETUP_NOTES]
(
	[CODE_TYPE] Char(1) NOT NULL,
	[CODE] Varchar(25) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
Primary Key ([CODE_TYPE],[CODE],[Note_ID])
) 
go

Create table [CONTRACT_CAT]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
Primary Key ([Code])
) 
go

Create table [PM_SCHED]
(
	[Schedule_ID] Varchar(10) NOT NULL, UNIQUE ([Schedule_ID]),
	[Description] Varchar(30) NULL,
	[TYPE] Char(1) NULL,
	[INTERVAL_QTY] Numeric(7,0) NULL,
	[INTERVAL_UNIT] Char(1) NULL,
	[EARLY_WIN_QTY] Numeric(7,0) NULL,
	[EARLY_WIN_UNIT] Char(1) NULL,
	[LATE_WIN_QTY] Numeric(7,0) NULL,
	[LATE_WIN_UNIT] Char(1) NULL,
	[DATE_01] Datetime NULL,
	[DATE_02] Datetime NULL,
	[DATE_03] Datetime NULL,
	[DATE_04] Datetime NULL,
	[DATE_05] Datetime NULL,
	[DATE_06] Datetime NULL,
	[DATE_07] Datetime NULL,
	[DATE_08] Datetime NULL,
	[DATE_09] Datetime NULL,
	[DATE_10] Datetime NULL,
	[DATE_11] Datetime NULL,
	[DATE_12] Datetime NULL,
	[DATE_13] Datetime NULL,
	[DATE_14] Datetime NULL,
	[DATE_15] Datetime NULL,
	[DATE_16] Datetime NULL,
	[DATE_17] Datetime NULL,
	[DATE_18] Datetime NULL,
	[DATE_19] Datetime NULL,
	[DATE_20] Datetime NULL,
	[DATE_21] Datetime NULL,
	[DATE_22] Datetime NULL,
	[DATE_23] Datetime NULL,
	[DATE_24] Datetime NULL,
	[DATE_25] Datetime NULL,
	[DATE_26] Datetime NULL,
	[DATE_27] Datetime NULL,
	[DATE_28] Datetime NULL,
	[DATE_29] Datetime NULL,
	[DATE_30] Datetime NULL,
Primary Key ([Schedule_ID])
) 
go

Create table [PROBLEM_CODE]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
	[PERFORM_PM] Char(1) NULL,
	[PERFORM_REPAIR] Char(1) NULL,
	[EST_TTR] Numeric(7,2) NULL,
	[DFLT_TECH] Varchar(10) NULL,
Primary Key ([Code])
) 
go

Create table [REFERRAL_SOURCE]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
Primary Key ([Code])
) 
go

Create table [WORK_CAT]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
Primary Key ([Code])
) 
go

Create table [EQP_MODEL]
(
	[Model_ID] Varchar(25) NOT NULL, UNIQUE ([Model_ID]),
	[Description] Varchar(30) NOT NULL,
	[Description_2] Varchar(30) NULL,
	[CATEGORY] Varchar(10) NULL,
	[SUB_CATEGORY] Varchar(10) NULL,
	[MANUFACTURER] Varchar(30) NULL,
	[DFLT_WARR] Varchar(10) NULL,
	[DFLT_PM_SCHED] Varchar(10) NULL,
	[DFLT_WORK_CAT] Varchar(10) NULL,
	[METER1_NAME] Varchar(30) NULL,
	[METER1_DFLT_UCODE] Varchar(10) NULL,
	[METER2_NAME] Varchar(30) NULL,
	[METER2_DFLT_UCODE] Varchar(10) NULL,
	[METER3_NAME] Varchar(30) NULL,
	[METER3_DFLT_UCODE] Varchar(10) NULL,
	[METER4_NAME] Varchar(30) NULL,
	[METER4_DFLT_UCODE] Varchar(10) NULL,
	[METER5_NAME] Varchar(30) NULL,
	[METER5_DFLT_UCODE] Varchar(10) NULL,
	[PROFILE1_USE_FLG] Char(1) NULL,
	[PROFILE1_DESC] Varchar(30) NULL,
	[PROFILE2_USE_FLG] Char(1) NULL,
	[PROFILE2_DESC] Varchar(30) NULL,
	[PROFILE3_USE_FLG] Char(1) NULL,
	[PROFILE3_DESC] Varchar(30) NULL,
	[PROFILE4_USE_FLG] Char(1) NULL,
	[PROFILE4_DESC] Varchar(30) NULL,
	[PROFILE5_USE_FLG] Char(1) NULL,
	[PROFILE5_DESC] Varchar(30) NULL,
	[PROFILE6_USE_FLG] Char(1) NULL,
	[PROFILE6_DESC] Varchar(30) NULL,
	[PROFILE7_USE_FLG] Char(1) NULL,
	[PROFILE7_DESC] Varchar(30) NULL,
	[PROFILE8_USE_FLG] Char(1) NULL,
	[PROFILE8_DESC] Varchar(30) NULL,
	[PROFILE9_USE_FLG] Char(1) NULL,
	[PROFILE9_DESC] Varchar(30) NULL,
	[PROFILE10_USE_FLG] Char(1) NULL,
	[PROFILE10_DESC] Varchar(30) NULL,
Primary Key ([Model_ID])
) 
go

Create table [INVOICING_CODE]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
	[FLAT_CHG] Decimal(15,4) NULL,
	[TIME_FOR_FLAT_CHG] Numeric(7,2) NULL,
	[ZONE_CHG] Decimal(15,4) NULL,
	[TECH_RATE_REG] Decimal(15,4) NULL,
	[TECH_RATE_OT] Decimal(15,4) NULL,
	[TECH_RATE_SPEC] Decimal(15,4) NULL,
	[HELP_RATE_REG] Decimal(15,4) NULL,
	[HELP_RATE_OT] Decimal(15,4) NULL,
	[HELP_RATE_SPEC] Decimal(15,4) NULL,
	[MIN_LBR_TIME_REG] Numeric(7,2) NULL,
	[MIN_LBR_TIME_OT] Numeric(7,2) NULL,
	[MIN_LBR_TIME_SPEC] Numeric(7,2) NULL,
	[LBR_TIME_INCR_REG] Numeric(7,2) NULL,
	[LBR_TIME_INCR_OT] Numeric(7,2) NULL,
	[LBR_TIME_INCR_SPEC] Numeric(7,2) NULL,
	[TECH_TVL_RATE_REG] Decimal(15,4) NULL,
	[TECH_TVL_RATE_OT] Decimal(15,4) NULL,
	[TECH_TVL_RATE_SPEC] Decimal(15,4) NULL,
	[HELP_TVL_RATE_REG] Decimal(15,4) NULL,
	[HELP_TVL_RATE_OT] Decimal(15,4) NULL,
	[HELP_TVL_RATE_SPEC] Decimal(15,4) NULL,
	[MIN_TVL_CHG_REG] Decimal(15,4) NULL,
	[MIN_TVL_CHG_OT] Decimal(15,4) NULL,
	[MIN_TVL_CHG_SPEC] Decimal(15,4) NULL,
	[MAX_TVL_CHG_REG] Decimal(15,4) NULL,
	[MAX_TVL_CHG_OT] Decimal(15,4) NULL,
	[MAX_TVL_CHG_SPEC] Decimal(15,4) NULL,
	[TVL_TIME_INCR_REG] Numeric(7,2) NULL,
	[TVL_TIME_INCR_OT] Numeric(7,2) NULL,
	[TVL_TIME_INCR_SPEC] Numeric(7,2) NULL,
	[CHG_PER_MILE_REG] Decimal(15,4) NULL,
	[CHG_PER_MILE_OT] Decimal(15,4) NULL,
	[CHG_PER_MILE_SPEC] Decimal(15,4) NULL,
	[PARTS_PRICING_GROUP] Varchar(10) NULL,
	[FLAT_CHG_DESC] Varchar(30) NULL,
	[TVL_CHG_DESC] Varchar(30) NULL,
	[ZONE_CHG_DESC] Varchar(30) NULL,
	[ADDL_CHG_4_DESC] Varchar(30) NULL,
	[ADDL_CHG_5_DESC] Varchar(30) NULL,
	[ACCT_LBR_REG] Varchar(20) NULL,
	[ACCT_LBR_OT] Varchar(20) NULL,
	[ACCT_LBR_SPEC] Varchar(20) NULL,
	[ACCT_PTS_REG] Varchar(20) NULL,
	[ACCT_PTS_OT] Varchar(20) NULL,
	[ACCT_PTS_SPEC] Varchar(20) NULL,
	[ACCT_FLAT_REG] Varchar(20) NULL,
	[ACCT_FLAT_OT] Varchar(20) NULL,
	[ACCT_FLAT_SPEC] Varchar(20) NULL,
	[ACCT_TVL_REG] Varchar(20) NULL,
	[ACCT_TVL_OT] Varchar(20) NULL,
	[ACCT_TVL_SPEC] Varchar(20) NULL,
	[ACCT_ZONE_REG] Varchar(20) NULL,
	[ACCT_ZONE_OT] Varchar(20) NULL,
	[ACCT_ZONE_SPEC] Varchar(20) NULL,
	[ACCT_ADDL_4_REG] Varchar(20) NULL,
	[ACCT_ADDL_4_OT] Varchar(20) NULL,
	[ACCT_ADDL_4_SPEC] Varchar(20) NULL,
	[ACCT_ADDL_5_REG] Varchar(20) NULL,
	[ACCT_ADDL_5_OT] Varchar(20) NULL,
	[ACCT_ADDL_5_SPEC] Varchar(20) NULL,
	[ACCT_DISC_REG] Varchar(20) NULL,
	[ACCT_DISC_OT] Varchar(20) NULL,
	[ACCT_DISC_SPEC] Varchar(20) NULL,
	[PTS_ACCT_PFT_CTR_SOURCE] Char(1) NULL,
	[PTS_ACCT_INVC_CODE_PFT_CTR] Varchar(20) NULL,
	[PTS_ACCT_PFT_CTR_SEGMENT] Numeric(7,0) NULL,
	[LBR_ACCT_PFT_CTR_FROM_ITEM] Char(1) NULL,
	[MISC_ACCT_PFT_CTR_FROM_ITEM] Char(1) NULL,
Primary Key ([Code])
) 
go

Create table [WARRANTY]
(
	[Warranty_ID] Varchar(10) NOT NULL,
	[Description] Varchar(30) NULL,
	[INVC_CODE_1] Varchar(10) NULL,
	[INTERVAL_QTY_1] Numeric(7,0) NULL,
	[INTERVAL_UNIT_1] Char(1) NULL,
	[INVC_CODE_2] Varchar(10) NULL,
	[INTERVAL_QTY_2] Numeric(7,0) NULL,
	[INTERVAL_UNIT_2] Char(1) NULL,
	[INVC_CODE_3] Varchar(10) NULL,
	[INTERVAL_QTY_3] Numeric(7,0) NULL,
	[INTERVAL_UNIT_3] Char(1) NULL,
	[INVC_CODE_4] Varchar(10) NULL,
	[INTERVAL_QTY_4] Numeric(7,0) NULL,
	[INTERVAL_UNIT_4] Char(1) NULL,
	[INVC_CODE_5] Varchar(10) NULL,
	[INTERVAL_QTY_5] Numeric(7,0) NULL,
	[INTERVAL_UNIT_5] Char(1) NULL,
	[INVC_CODE_6] Varchar(10) NULL,
	[INTERVAL_QTY_6] Numeric(7,0) NULL,
	[INTERVAL_UNIT_6] Char(1) NULL,
Primary Key ([Warranty_ID])
) 
go

Create table [CONTROL_INFO]
(
	[CTL_KEY] Varchar(10) NOT NULL, UNIQUE ([CTL_KEY]),
	[NXT_CALL_NO] Varchar(15) NULL,
	[NXT_CONTR_NO] Varchar(15) NULL,
	[NXT_INVOICE_NO] Numeric(7,0) NULL,
	[DFLT_INVC_CODE] Varchar(10) NULL,
	[DFLT_LOGGED_STATUS] Varchar(10) NULL,
	[DFLT_SCHED_STATUS] Varchar(10) NULL,
	[DFLT_DISP_STATUS] Varchar(10) NULL,
	[DFLT_COMPL_STATUS] Varchar(10) NULL,
	[DFLT_CALL_INVC_FORM] Varchar(30) NULL,
	[DFLT_CONTR_INVC_FORM] Varchar(30) NULL,
	[DFLT_WO_FORM] Varchar(30) NULL,
	[DFLT_WO_CR_MEMO_FORM] Varchar(30) NULL,
	[UDEF_1_TYPE] Char(1) NULL,
	[UDEF_1_LEN] Numeric(7,2) NULL,
	[UDEF_1_DESC] Varchar(30) NULL,
	[UDEF_2_TYPE] Char(1) NULL,
	[UDEF_2_LEN] Numeric(7,2) NULL,
	[UDEF_2_DESC] Varchar(30) NULL,
	[UDEF_3_TYPE] Char(1) NULL,
	[UDEF_3_LEN] Numeric(7,2) NULL,
	[UDEF_3_DESC] Varchar(30) NULL,
	[UDEF_4_TYPE] Char(1) NULL,
	[UDEF_4_LEN] Numeric(7,2) NULL,
	[UDEF_4_DESC] Varchar(30) NULL,
	[CUST_CONTS_FOR_MAIN] Char(1) NULL,
	[ALLOW_POST_TO] Char(1) NULL,
	[CALL_DEL_PWD_FLG] Char(1) NULL,
	[CALL_DEL_PWD] Varchar(15) NULL,
	[CRED_OVRD_PWD_FLG] Char(1) NULL,
	[CRED_OVRD_PWD] Varchar(15) NULL,
	[POS_STORE] Varchar(10) NULL,
	[POS_DRAWER] Varchar(10) NULL,
	[NOTE_ID_FOR_ATTACH] Varchar(20) NULL,
	[NOTE_ID_FOR_POP] Varchar(20) NULL,
	[LAST_WO_INVC_COMMENT] Text NULL,
	[LAST_CONT_INVC_COMMENT] Text NULL,
	[LAST_WO_CR_MEMO_COMMENT] Text NULL,
	[NOTE_DFLT_PRINT_ON_WO] Char(1) NULL,
	[NOTE_DFLT_PRINT_ON_INVOICE] Char(1) NULL,
	[ALLOW_POS_XFER] Char(1) NULL,
	[UPDATE_SYS_HIST] Char(1) NULL,
	[SP_DB_VERSION] Varchar(10) NULL,
	[CONTRACT_EQP_COST_OFFSET_ACCT] Varchar(20) NULL,
	[METERS_IN_USE_FLG] Char(1) NULL,
	[SPLIT_BILLING_IN_USE_FLG] Char(1) NULL,
	[DIST_DTL_FLG] Char(1) NULL,
	[SUPPRESS_AUTO_ITEM_LOOKUP_FLG] Char(1) NULL,
	[AUTO_SEL_TEXT_FLG] Char(1) NULL,
	[DFLT_PROBLEM_CODE] Varchar(10) NULL,
	[SCHED_CONFLICT_CHECK_FLG] Char(1) NULL,
	[GP_TRX_TYPE_FLG] Char(1) NULL,
	[ORDER_SCHED_IN_USE_FLG] Char(1) NULL,
	[REQUESTED_SCHED_DATE] Datetime NULL,
	[INVENTORY_OVRD_FLG] Char(1) NULL,
Primary Key ([CTL_KEY])
) 
go

Create table [SVC_ADDRESS]
(
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Name] Varchar(40) NULL,
	[ADDRESS_1] Varchar(40) NULL,
	[ADDRESS_2] Varchar(40) NULL,
	[CITY] Varchar(30) NULL,
	[STATE] Varchar(10) NULL,
	[ZIP_CODE] Varchar(15) NULL,
	[COUNTRY] Varchar(30) NULL,
	[CONTACT_1] Varchar(40) NULL,
	[PHONE_1] Varchar(25) NULL,
	[FAX_1] Varchar(25) NULL,
	[EMAIL_1] Varchar(50) NULL,
	[CONTACT_2] Varchar(40) NULL,
	[PHONE_2] Varchar(25) NULL,
	[FAX_2] Varchar(25) NULL,
	[EMAIL_2] Varchar(50) NULL,
	[REFERRAL_SOURCE] Varchar(10) NULL,
	[MAIL_TO_CUST] Varchar(15) NULL,
	[ZONE] Varchar(10) NULL,
	[TAX_CODE] Varchar(15) NULL,
	[SVC_TECH] Varchar(10) NULL,
	[INVOICING_CODE] Varchar(10) NULL,
	[PO_NUMBER] Varchar(25) NULL,
	[MAP_GRID] Varchar(30) NULL,
	[SVC_HOLD_FLG] Char(1) NULL,
Primary Key ([Customer],[Address_ID])
) 
go

Create table [SVC_ADDRESS_NOTES]
(
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
Primary Key ([Customer],[Address_ID],[Note_ID])
) 
go

Create table [CUST_EQUIPMENT]
(
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Model_ID] Varchar(25) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[CONTRACT_NO] Varchar(15) NULL,
	[Description] Varchar(30) NULL,
	[Description_2] Varchar(30) NULL,
	[Tag_ID] Varchar(30) NULL,
	[WARRANTY] Varchar(10) NULL,
	[PM_SCHEDULE] Varchar(10) NULL,
	[WORK_CAT] Varchar(10) NULL,
	[CATEGORY] Varchar(15) NULL,
	[SUB_CATEGORY] Varchar(15) NULL,
	[MANUFACTURER] Varchar(30) NULL,
	[LOCATION] Varchar(100) NULL,
	[INSTALL_DATE] Datetime NULL,
	[WARRANTY_START] Datetime NULL,
	[LAST_REPAIR] Datetime NULL,
	[LAST_PM] Datetime NULL,
	[NEXT_PM] Datetime NULL,
	[CONTRACT_BILL_AMT] Decimal(15,4) NULL,
	[CONTRACT_TAXABLE] Char(1) NULL,
	[WO_INVC_CODE] Varchar(10) NULL,
	[QUANTITY] Numeric(7,2) NULL,
	[BILL_AMT_EACH_OR_TOTAL] Char(1) NULL,
	[LAST_AUTO_PM_DATE] Datetime NULL,
	[CONTRACT_COST_AMT] Decimal(15,4) NULL,
	[CONTRACT_SALES_ACCT] Varchar(20) NULL,
	[CONTRACT_COST_ACCT] Varchar(20) NULL,
	[IMPORTED_FROM_TKT_NO] Varchar(15) NULL,
	[USER_DEFINED_1] Varchar(100) NULL,
	[USER_DEFINED_2] Varchar(100) NULL,
	[USER_DEFINED_3] Varchar(100) NULL,
	[USER_DEFINED_4] Varchar(100) NULL,
	[USER_DEFINED_5] Varchar(100) NULL,
	[USER_DEFINED_6] Varchar(100) NULL,
	[USER_DEFINED_7] Varchar(100) NULL,
	[USER_DEFINED_8] Varchar(100) NULL,
	[USER_DEFINED_9] Varchar(100) NULL,
	[USER_DEFINED_10] Varchar(100) NULL,
	[LAST_USAGE_BILL_AMT] Decimal(15,4) NULL,
	[PM_DUE_RPT_NEXT_DATE] Datetime NULL,
	[PM_DUE_RPT_EARLY_DATE] Datetime NULL,
	[PM_DUE_RPT_LATE_DATE] Datetime NULL,
	[PM_DUE_RPT_INCL_FLG] Char(1) NULL,
Primary Key ([Customer],[Address_ID],[Model_ID],[Serial_No])
) 
go

Create table [CUST_EQUIPMENT_NOTES]
(
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Model_ID] Varchar(25) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
Primary Key ([Customer],[Address_ID],[Model_ID],[Serial_No],[Note_ID])
) 
go

Create table [WORK_ORDER]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Customer] Varchar(15) NULL,
	[Address_ID] Varchar(15) NULL,
	[Status] Varchar(10) NULL,
	[OPEN_DATE] Datetime NULL,
	[OPEN_TIME] Datetime NULL,
	[SVC_SITE_NAME] Varchar(40) NULL,
	[SVC_ADDR_1] Varchar(40) NULL,
	[SVC_ADDR_2] Varchar(40) NULL,
	[SVC_CITY] Varchar(30) NULL,
	[SVC_STATE] Varchar(10) NULL,
	[SVC_ZIP_CODE] Varchar(15) NULL,
	[SVC_COUNTRY] Varchar(30) NULL,
	[CONTACT_1_NAME] Varchar(40) NULL,
	[CONTACT_1_PHONE] Varchar(25) NULL,
	[PO_NO] Varchar(25) NULL,
	[MAP_GRID] Varchar(30) NULL,
	[PRIORITY] Varchar(10) NULL,
	[DISPATCH_NOTE] Varchar(100) NULL,
	[USR_DEFINED_1] Varchar(100) NULL,
	[USR_DEFINED_2] Varchar(100) NULL,
	[USR_DEFINED_3] Varchar(100) NULL,
	[USR_DEFINED_4] Varchar(100) NULL,
	[TAX_CODE] Varchar(15) NULL,
	[INVOICE_NO] Numeric(7,0) NULL,
	[INVOICE_DATE] Datetime NULL,
	[INVOICE_PRINT_STAT] Char(1) NULL,
	[INVOICE_POST_STAT] Char(1) NULL,
	[DISC_PCT] Numeric(7,2) NULL,
	[TOTAL_SALES] Decimal(15,4) NULL,
	[TOTAL_TXBL_SALES] Decimal(15,4) NULL,
	[FLAT_CHG_HOURS] Numeric(7,2) NULL,
	[BILL_GROUP] Varchar(10) NULL,
	[POST_TO_CUSTOMER] Varchar(15) NULL,
	[ZONE] Varchar(10) NULL,
	[SALES_REP] Varchar(15) NULL,
	[COMMISSION_AMT] Decimal(15,4) NULL,
	[TERMS_CODE] Varchar(25) NULL,
	[SEL_FOR_BILLING_FLG] Char(1) NULL,
	[SPLIT_BILL_SEQ_NO] Numeric(7,0) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
	[TOT_TAX_AMT] Decimal(15,4) NULL,
	[TOT_PAYMENTS] Decimal(15,4) NULL,
	[XFER_TO_TKT_NO] Varchar(15) NULL,
	[DEPARTMENT] Varchar(25) NULL,
	[POS_STORE] Varchar(10) NULL,
	[POS_DRAWER] Varchar(10) NULL,
	[ENTRY_USER] Varchar(10) NULL,
	[ENTRY_DATE] Datetime NULL,
	[LAST_MAINT_USER] Varchar(10) NULL,
	[LAST_MAINT_DATE] Datetime NULL,
Primary Key ([Work_Order_No])
) 
go

Create table [WO_ADDL_CHG]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Addl_Chg_Seq_No] Numeric(7,0) NOT NULL,
	[Description] Varchar(100) NULL,
	[Amount] Decimal(15,4) NULL,
	[Cost] Decimal(15,4) NULL,
	[IS_TAXABLE] Char(1) NULL,
	[Sales_Acct_No] Varchar(20) NULL,
	[Cost_Acct_No] Varchar(20) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
Primary Key ([Work_Order_No],[Task_Seq_No],[Addl_Chg_Seq_No])
) 
go

Create table [WO_PMNT]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Seq_No] Numeric(7,0) NOT NULL,
	[Pay_Code] Varchar(10) NULL,
	[Amount] Decimal(15,4) NULL,
	[Description] Varchar(30) NULL,
	[Reference_1] Varchar(50) NULL,
	[Reference_2] Varchar(50) NULL,
	[Reference_3] Varchar(50) NULL,
Primary Key ([Work_Order_No],[Seq_No])
) 
go

Create table [WO_TAX]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Seq_No] Numeric(7,0) NOT NULL,
	[TAX_CODE] Varchar(15) NULL,
	[AUTH_CODE] Varchar(15) NULL,
	[AUTH_RULE_CODE] Varchar(15) NULL,
	[Amount] Decimal(15,4) NULL,
	[TAX_ACCOUNT_NO] Varchar(20) NULL,
Primary Key ([Work_Order_No],[Seq_No])
) 
go

Create table [WO_PARTS]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Pts_Seq_No] Numeric(7,0) NOT NULL,
	[Item_No] Varchar(30) NULL,
	[Inv_Loc] Varchar(10) NULL,
	[Description] Varchar(100) NULL,
	[Qty_Used] Numeric(7,2) NULL,
	[Unit_Cost] Decimal(15,4) NULL,
	[Unit_Price] Decimal(15,4) NULL,
	[DISCOUNT_PCT] Numeric(7,2) NULL,
	[IS_TAXABLE] Char(1) NULL,
	[SALES_ACCT_NO] Varchar(20) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
	[PRICING_TYPE_FLG] Char(1) NULL,
	[XFERRED_FROM_POS] Char(1) NULL,
Primary Key ([Work_Order_No],[Task_Seq_No],[Pts_Seq_No])
) 
go

Create table [WO_LABOR]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Lbr_Seq_No] Numeric(7,0) NOT NULL,
	[Tech_ID] Varchar(10) NULL,
	[Work_Description] Varchar(100) NULL,
	[TYPE_FLG] Char(1) NULL,
	[SCHED_DATE] Datetime NULL,
	[SCHED_TIME] Datetime NULL,
	[DISP_DATE] Datetime NULL,
	[DISP_TIME] Datetime NULL,
	[START_DATE] Datetime NULL,
	[START_TIME] Datetime NULL,
	[STOP_DATE] Datetime NULL,
	[STOP_TIME] Datetime NULL,
	[RETURN_DATE] Datetime NULL,
	[RETURN_TIME] Datetime NULL,
	[HOURLY_COST] Decimal(15,4) NULL,
	[Hourly_Price] Decimal(15,4) NULL,
	[Hours_To_Bill] Numeric(7,2) NULL,
	[HRS_ADJ_FOR_FLAT] Numeric(7,2) NULL,
	[HRS_ADJ_UP_FOR_INCR] Numeric(7,2) NULL,
	[Date_For_Sched] Datetime NULL,
	[Time_For_Sched] Datetime NULL,
	[IS_TAXABLE] Char(1) NULL,
	[SALES_ACCT_NO] Varchar(20) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
Primary Key ([Work_Order_No],[Task_Seq_No],[Lbr_Seq_No])
) 
go

Create table [WO_NOTES]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Work_Order_No],[Note_ID])
) 
go

Create table [WO_TASK]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Name] Varchar(40) NULL,
	[Model] Varchar(30) NULL,
	[Serial_No] Varchar(30) NULL,
	[Description] Varchar(30) NULL,
	[Description_2] Varchar(30) NULL,
	[WORK_CAT] Varchar(10) NULL,
	[LOCATION] Varchar(100) NULL,
	[INVOICING_CODE] Varchar(10) NULL,
	[CONTRACT_NO] Varchar(15) NULL,
	[PROBLEM] Varchar(10) NULL,
	[IS_REPAIR] Char(1) NULL,
	[IS_PM] Char(1) NULL,
	[ESTIMATED_TTR] Numeric(7,2) NULL,
	[TASK_STATUS] Char(1) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
	[ESTIMATED_COMPL_DATE] Datetime NULL,
Primary Key ([Work_Order_No],[Task_Seq_No])
) 
go

Create table [WO_LABOR_NOTES]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Lbr_Seq_No] Numeric(7,0) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Work_Order_No],[Task_Seq_No],[Lbr_Seq_No],[Note_ID])
) 
go

Create table [STATUS_CODE]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
	[IS_FROZEN] Char(1) NULL,
	[COMMIT_PTS] Char(1) NULL,
	[ALLOW_LBR] Char(1) NULL,
	[ALLOW_PTS] Char(1) NULL,
	[ALLOW_BILL] Char(1) NULL,
	[INVOICE_TYPE] Char(1) NULL,
	[DFLT_INVC_FORM] Varchar(30) NULL,
	[DFLT_WO_FORM] Varchar(30) NULL,
	[EMAIL_CHNG_TO_FLG] Char(1) NULL,
	[EMAIL_CHNG_FROM_FLG] Char(1) NULL,
	[EMAIL_CUST_FLG] Char(1) NULL,
	[EMAIL_CUST_FORM] Varchar(30) NULL,
	[EMAIL_TECH_FLG] Char(1) NULL,
	[EMAIL_TECH_FORM] Varchar(30) NULL,
	[EMAIL_THIS_ADDR] Varchar(50) NULL,
	[EMAIL_THIS_FORM] Varchar(30) NULL,
Primary Key ([Code])
) 
go

Create table [PRIORITY_CODE]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
	[RESPONSE_TIME] Numeric(7,2) NULL,
	[FORE_COLOR] Varchar(10) NULL,
	[BACK_COLOR] Varchar(10) NULL,
Primary Key ([Code])
) 
go

Create table [TAX_DEFAULT]
(
	[Tax_Code] Varchar(15) NOT NULL, UNIQUE ([Tax_Code]),
	[TAX_PARTS] Char(1) NULL,
	[TAX_LABOR] Char(1) NULL,
	[TAX_FLAT_CHG] Char(1) NULL,
	[TAX_TRAVEL_CHG] Char(1) NULL,
	[TAX_ZONE_CHG] Char(1) NULL,
	[TAX_OTHER_ADDL_CHG] Char(1) NULL,
	[TAX_CONTRACT_CHGS] Char(1) NULL,
Primary Key ([Tax_Code])
) 
go

Create table [HISTORY_WORK_ORDER]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Customer] Varchar(15) NULL,
	[Address_ID] Varchar(15) NULL,
	[Status] Varchar(10) NULL,
	[OPEN_DATE] Datetime NULL,
	[OPEN_TIME] Datetime NULL,
	[SVC_SITE_NAME] Varchar(40) NULL,
	[SVC_ADDR_1] Varchar(40) NULL,
	[SVC_ADDR_2] Varchar(40) NULL,
	[SVC_CITY] Varchar(30) NULL,
	[SVC_STATE] Varchar(10) NULL,
	[SVC_ZIP_CODE] Varchar(15) NULL,
	[SVC_COUNTRY] Varchar(30) NULL,
	[CONTACT_1_NAME] Varchar(40) NULL,
	[CONTACT_1_PHONE] Varchar(25) NULL,
	[PO_NO] Varchar(25) NULL,
	[MAP_GRID] Varchar(30) NULL,
	[PRIORITY] Varchar(10) NULL,
	[DISPATCH_NOTE] Varchar(100) NULL,
	[USR_DEFINED_1] Varchar(100) NULL,
	[USR_DEFINED_2] Varchar(100) NULL,
	[USR_DEFINED_3] Varchar(100) NULL,
	[USR_DEFINED_4] Varchar(100) NULL,
	[TAX_CODE] Varchar(15) NULL,
	[INVOICE_NO] Numeric(7,0) NULL,
	[INVOICE_DATE] Datetime NULL,
	[INVOICE_PRINT_STAT] Char(1) NULL,
	[INVOICE_POST_STAT] Char(1) NULL,
	[DISC_PCT] Numeric(7,2) NULL,
	[TOTAL_SALES] Decimal(15,4) NULL,
	[TOTAL_TXBL_SALES] Decimal(15,4) NULL,
	[FLAT_CHG_HOURS] Numeric(7,2) NULL,
	[BILL_GROUP] Varchar(10) NULL,
	[POST_TO_CUSTOMER] Varchar(15) NULL,
	[ZONE] Varchar(10) NULL,
	[SALES_REP] Varchar(15) NULL,
	[COMMISSION_AMT] Decimal(15,4) NULL,
	[TERMS_CODE] Varchar(25) NULL,
	[SEL_FOR_BILLING_FLG] Char(1) NULL,
	[SPLIT_BILL_SEQ_NO] Numeric(7,0) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
	[TOT_TAX_AMT] Decimal(15,4) NULL,
	[TOT_PAYMENTS] Decimal(15,4) NULL,
	[XFER_TO_TKT_NO] Varchar(15) NULL,
	[POS_STORE] Varchar(10) NULL,
	[POS_DRAWER] Varchar(10) NULL,
	[ENTRY_USER] Varchar(10) NULL,
	[ENTRY_DATE] Datetime NULL,
	[LAST_MAINT_USER] Varchar(10) NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[CR_MEMO_NO] Numeric(7,0) NULL,
	[CR_MEMO_DATE] Datetime NULL,
	[CR_MEMO_FLG] Char(1) NULL,
	[POSTING_EVENT_NO] Varchar(15) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No])
) 
go

Create table [HISTORY_WO_NOTES]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Note_ID])
) 
go

Create table [HISTORY_WO_TAX]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Seq_No] Numeric(7,0) NOT NULL,
	[TAX_CODE] Varchar(15) NULL,
	[AUTH_CODE] Varchar(15) NULL,
	[AUTH_RULE_CODE] Varchar(15) NULL,
	[Amount] Decimal(15,4) NULL,
	[TAX_ACCOUNT_NO] Varchar(20) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Seq_No])
) 
go

Create table [HISTORY_WO_PMNT]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Seq_No] Numeric(7,0) NOT NULL,
	[Pay_Code] Varchar(10) NULL,
	[Amount] Decimal(15,4) NULL,
	[Description] Varchar(30) NULL,
	[Reference_1] Varchar(50) NULL,
	[Reference_2] Varchar(50) NULL,
	[Reference_3] Varchar(50) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Seq_No])
) 
go

Create table [HISTORY_WO_TASK]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Name] Varchar(40) NULL,
	[Model] Varchar(30) NULL,
	[Serial_No] Varchar(30) NULL,
	[Description] Varchar(30) NULL,
	[Description_2] Varchar(30) NULL,
	[WORK_CAT] Varchar(10) NULL,
	[LOCATION] Varchar(100) NULL,
	[INVOICING_CODE] Varchar(10) NULL,
	[CONTRACT_NO] Varchar(15) NULL,
	[PROBLEM] Varchar(10) NULL,
	[IS_REPAIR] Char(1) NULL,
	[IS_PM] Char(1) NULL,
	[ESTIMATED_TTR] Numeric(7,2) NULL,
	[TASK_STATUS] Char(1) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
	[ESTIMATED_COMPL_DATE] Datetime NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No])
) 
go

Create table [HISTORY_WO_ADDL_CHG]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Addl_Chg_Seq_No] Numeric(7,0) NOT NULL,
	[Description] Varchar(100) NULL,
	[Amount] Decimal(15,4) NULL,
	[Cost] Decimal(15,4) NULL,
	[IS_TAXABLE] Char(1) NULL,
	[Sales_Acct_No] Varchar(20) NULL,
	[Cost_Acct_No] Varchar(20) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Addl_Chg_Seq_No])
) 
go

Create table [HISTORY_WO_PARTS]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Pts_Seq_No] Numeric(7,0) NOT NULL,
	[Item_No] Varchar(30) NULL,
	[Inv_Loc] Varchar(10) NULL,
	[Description] Varchar(100) NULL,
	[Qty_Used] Numeric(7,2) NULL,
	[Unit_Cost] Decimal(15,4) NULL,
	[Unit_Price] Decimal(15,4) NULL,
	[DISCOUNT_PCT] Numeric(7,2) NULL,
	[IS_TAXABLE] Char(1) NULL,
	[SALES_ACCT_NO] Varchar(20) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
	[PRICING_TYPE_FLG] Char(1) NULL,
	[XFERRED_FROM_POS] Char(1) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Pts_Seq_No])
) 
go

Create table [HISTORY_WO_LABOR]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Lbr_Seq_No] Numeric(7,0) NOT NULL,
	[Tech_ID] Varchar(10) NULL,
	[Work_Description] Varchar(100) NULL,
	[TYPE_FLG] Char(1) NULL,
	[SCHED_DATE] Datetime NULL,
	[SCHED_TIME] Datetime NULL,
	[DISP_DATE] Datetime NULL,
	[DISP_TIME] Datetime NULL,
	[START_DATE] Datetime NULL,
	[START_TIME] Datetime NULL,
	[STOP_DATE] Datetime NULL,
	[STOP_TIME] Datetime NULL,
	[RETURN_DATE] Datetime NULL,
	[RETURN_TIME] Datetime NULL,
	[HOURLY_COST] Decimal(15,4) NULL,
	[Hourly_Price] Decimal(15,4) NULL,
	[Hours_To_Bill] Numeric(7,2) NULL,
	[HRS_ADJ_FOR_FLAT] Numeric(7,2) NULL,
	[HRS_ADJ_UP_FOR_INCR] Numeric(7,2) NULL,
	[Date_For_Sched] Datetime NULL,
	[Time_For_Sched] Datetime NULL,
	[IS_TAXABLE] Char(1) NULL,
	[SALES_ACCT_NO] Varchar(20) NULL,
	[SPLIT_BILL_SEL_FLG] Char(1) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Lbr_Seq_No])
) 
go

Create table [HISTORY_WO_LABOR_NOTES]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Lbr_Seq_No] Numeric(7,0) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Lbr_Seq_No],[Note_ID])
) 
go

Create table [CONTRACT]
(
	[Contract_No] Varchar(15) NOT NULL,
	[Customer] Varchar(15) NULL,
	[ORIGINAL_DATE] Datetime NULL,
	[Start_Date] Datetime NULL,
	[End_Date] Datetime NULL,
	[Cycle_Qty] Numeric(7,0) NULL,
	[Cycle_Unit] Char(1) NULL,
	[Last_Invoice_Date] Datetime NULL,
	[Next_Invoice_Date] Datetime NULL,
	[Renewal_Type] Char(1) NULL,
	[Category] Varchar(10) NULL,
	[SALES_ACCOUNT_NUMBER] Varchar(20) NULL,
	[PO_NO] Varchar(25) NULL,
	[Sel_For_Billing_Flg] Char(1) NULL,
	[TAX_CODE] Varchar(15) NULL,
	[INVOICE_NO] Numeric(7,0) NULL,
	[INVOICE_DATE] Datetime NULL,
	[Invoice_Print_Stat] Char(1) NULL,
	[INVOICE_POST_STAT] Char(1) NULL,
	[DISC_PCT] Numeric(7,2) NULL,
	[TOTAL_SALES] Decimal(15,4) NULL,
	[TOTAL_TXBL_SALES] Decimal(15,4) NULL,
	[TOT_PAYMENTS] Decimal(15,4) NULL,
	[PAID_IN_FULL_FLG] Char(1) NULL,
	[TOT_TAX_AMT] Decimal(15,4) NULL,
	[PREV_START_DATE] Datetime NULL,
	[PREV_END_DATE] Datetime NULL,
	[POST_TO_CUSTOMER] Varchar(15) NULL,
	[SALES_REP] Varchar(15) NULL,
	[COMMISSION_AMT] Decimal(15,4) NULL,
	[LAST_RU_USAGE_BILL_AMT] Decimal(15,4) NULL,
Primary Key ([Contract_No])
) 
go

Create table [CONTRACT_NOTES]
(
	[Contract_No] Varchar(15) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Contract_No],[Note_ID])
) 
go

Create table [CONTRACT_TAX]
(
	[Contract_No] Varchar(15) NOT NULL,
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Model_ID] Varchar(25) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[Seq_No] Numeric(7,0) NOT NULL,
	[TAX_CODE] Varchar(15) NULL,
	[AUTH_CODE] Varchar(15) NULL,
	[AUTH_RULE_CODE] Varchar(15) NULL,
	[Amount] Decimal(15,4) NULL,
	[TAX_ACCOUNT_NO] Varchar(20) NULL,
Primary Key ([Contract_No],[Customer],[Address_ID],[Model_ID],[Serial_No],[Seq_No])
) 
go

Create table [HISTORY_CONTRACT]
(
	[Contract_No] Varchar(15) NOT NULL,
	[Contract_Seq_No] Numeric(7,0) NOT NULL,
	[Customer] Varchar(15) NULL,
	[ORIGINAL_DATE] Datetime NULL,
	[Start_Date] Datetime NULL,
	[End_Date] Datetime NULL,
	[Cycle_Qty] Numeric(7,0) NULL,
	[Cycle_Unit] Char(1) NULL,
	[Last_Invoice_Date] Datetime NULL,
	[Next_Invoice_Date] Datetime NULL,
	[Renewal_Type] Char(1) NULL,
	[Category] Varchar(10) NULL,
	[SALES_ACCOUNT_NUMBER] Varchar(20) NULL,
	[PO_NO] Varchar(25) NULL,
	[Sel_For_Billing_Flg] Char(1) NULL,
	[TAX_CODE] Varchar(15) NULL,
	[INVOICE_NO] Numeric(7,0) NULL,
	[INVOICE_DATE] Datetime NULL,
	[Invoice_Print_Stat] Char(1) NULL,
	[INVOICE_POST_STAT] Char(1) NULL,
	[DISC_PCT] Numeric(7,2) NULL,
	[TOTAL_SALES] Decimal(15,4) NULL,
	[TOTAL_TXBL_SALES] Decimal(15,4) NULL,
	[TOT_PAYMENTS] Decimal(15,4) NULL,
	[PAID_IN_FULL_FLG] Char(1) NULL,
	[TOT_TAX_AMT] Decimal(15,4) NULL,
	[PREV_START_DATE] Datetime NULL,
	[PREV_END_DATE] Datetime NULL,
	[POST_TO_CUSTOMER] Varchar(15) NULL,
	[SALES_REP] Varchar(15) NULL,
	[COMMISSION_AMT] Decimal(15,4) NULL,
	[POSTING_EVENT_NO] Varchar(15) NULL,
	[LAST_RU_USAGE_BILL_AMT] Decimal(15,4) NULL,
Primary Key ([Contract_No],[Contract_Seq_No])
) 
go

Create table [HISTORY_CONTRACT_NOTES]
(
	[Contract_No] Varchar(15) NOT NULL,
	[Contract_Seq_No] Numeric(7,0) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Contract_No],[Contract_Seq_No],[Note_ID])
) 
go

Create table [HISTORY_CONTRACT_TAX]
(
	[Contract_No] Varchar(15) NOT NULL,
	[Contract_Seq_No] Numeric(7,0) NOT NULL,
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Model_ID] Varchar(25) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[Seq_No] Numeric(7,0) NOT NULL,
	[TAX_CODE] Varchar(15) NULL,
	[AUTH_CODE] Varchar(15) NULL,
	[AUTH_RULE_CODE] Varchar(15) NULL,
	[Amount] Decimal(15,4) NULL,
	[TAX_ACCOUNT_NO] Varchar(20) NULL,
Primary Key ([Contract_No],[Contract_Seq_No],[Customer],[Address_ID],[Model_ID],[Serial_No],[Seq_No])
) 
go

Create table [HISTORY_CUST_EQUIPMENT]
(
	[Customer] Varchar(15) NOT NULL,
	[Contract_No] Varchar(15) NOT NULL,
	[Contract_Seq_No] Numeric(7,0) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Model_ID] Varchar(25) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[Description] Varchar(30) NULL,
	[Description_2] Varchar(30) NULL,
	[Tag_ID] Varchar(30) NULL,
	[WARRANTY] Varchar(10) NULL,
	[PM_SCHEDULE] Varchar(10) NULL,
	[WORK_CAT] Varchar(10) NULL,
	[CATEGORY] Varchar(15) NULL,
	[SUB_CATEGORY] Varchar(15) NULL,
	[MANUFACTURER] Varchar(30) NULL,
	[LOCATION] Varchar(100) NULL,
	[INSTALL_DATE] Datetime NULL,
	[WARRANTY_START] Datetime NULL,
	[LAST_REPAIR] Datetime NULL,
	[LAST_PM] Datetime NULL,
	[NEXT_PM] Datetime NULL,
	[CONTRACT_BILL_AMT] Decimal(15,4) NULL,
	[CONTRACT_TAXABLE] Char(1) NULL,
	[WO_INVC_CODE] Varchar(10) NULL,
	[QUANTITY] Numeric(7,2) NULL,
	[BILL_AMT_EACH_OR_TOTAL] Char(1) NULL,
	[LAST_AUTO_PM_DATE] Datetime NULL,
	[CONTRACT_COST_AMT] Decimal(15,4) NULL,
	[CONTRACT_SALES_ACCT] Varchar(20) NULL,
	[CONTRACT_COST_ACCT] Varchar(20) NULL,
	[IMPORTED_FROM_TKT_NO] Varchar(15) NULL,
	[LAST_USAGE_BILL_AMT] Decimal(15,4) NULL,
Primary Key ([Customer],[Contract_No],[Contract_Seq_No],[Address_ID],[Model_ID],[Serial_No])
) 
go

Create table [SP_USER]
(
	[User_ID] Varchar(10) NOT NULL, UNIQUE ([User_ID]),
	[Name] Varchar(30) NULL,
	[PASSWORD] Varchar(100) NULL,
	[DATE_PWD_CHGD] Datetime NULL,
	[MENU] Text NULL,
	[VIEW_COSTS] Char(1) NULL,
	[DEPARTMENT] Varchar(25) NULL,
	[USER_TYPE] Char(1) NULL,
Primary Key ([User_ID])
) 
go

Create table [WO_PARTS_SERIALS]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Pts_Seq_No] Numeric(7,0) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[Item_No] Varchar(30) NULL,
	[Inv_Loc] Varchar(10) NULL,
	[XFERRED_FROM_POS] Char(1) NULL,
Primary Key ([Work_Order_No],[Task_Seq_No],[Pts_Seq_No],[Serial_No])
) 
go

Create table [HISTORY_WO_PARTS_SERIALS]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Pts_Seq_No] Numeric(7,0) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[Item_No] Varchar(30) NULL,
	[Inv_Loc] Varchar(10) NULL,
	[XFERRED_FROM_POS] Char(1) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Pts_Seq_No],[Serial_No])
) 
go

Create table [USAGE_CODE]
(
	[Code] Varchar(10) NOT NULL, UNIQUE ([Code]),
	[Description] Varchar(30) NULL,
	[Type] Char(1) NULL,
	[LEVEL_1] Decimal(15,4) NULL,
	[CHG_PER_USE_1] Decimal(15,5) NULL,
	[LEVEL_2] Decimal(15,4) NULL,
	[CHG_PER_USE_2] Decimal(15,5) NULL,
	[LEVEL_3] Decimal(15,4) NULL,
	[CHG_PER_USE_3] Decimal(15,5) NULL,
	[LEVEL_4] Decimal(15,4) NULL,
	[CHG_PER_USE_4] Decimal(15,5) NULL,
	[LEVEL_5] Decimal(15,4) NULL,
	[CHG_PER_USE_5] Decimal(15,5) NULL,
	[LEVEL_6] Decimal(15,4) NULL,
	[CHG_PER_USE_6] Decimal(15,5) NULL,
Primary Key ([Code])
) 
go

Create table [CUST_EQUIPMENT_METERS]
(
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Model_ID] Varchar(25) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[METER1_USAGE_CODE] Varchar(10) NULL,
	[METER1_START_READING] Decimal(15,4) NULL,
	[METER1_END_READING] Decimal(15,4) NULL,
	[METER1_UNBILLED_USAGE] Decimal(15,4) NULL,
	[METER1_USAGE_CREDIT] Decimal(15,4) NULL,
	[METER1_LAST_READ_DATE] Datetime NULL,
	[METER1_PM_DUE_USAGE] Decimal(15,4) NULL,
	[METER1_LAST_PM_READING] Decimal(15,4) NULL,
	[METER1_NEXT_PM_READING] Decimal(15,4) NULL,
	[METER1_CONTRACT_USAGE] Decimal(15,4) NULL,
	[METER2_USAGE_CODE] Varchar(10) NULL,
	[METER2_START_READING] Decimal(15,4) NULL,
	[METER2_END_READING] Decimal(15,4) NULL,
	[METER2_UNBILLED_USAGE] Decimal(15,4) NULL,
	[METER2_USAGE_CREDIT] Decimal(15,4) NULL,
	[METER2_LAST_READ_DATE] Datetime NULL,
	[METER2_PM_DUE_USAGE] Decimal(15,4) NULL,
	[METER2_LAST_PM_READING] Decimal(15,4) NULL,
	[METER2_NEXT_PM_READING] Decimal(15,4) NULL,
	[METER2_CONTRACT_USAGE] Decimal(15,4) NULL,
	[METER3_USAGE_CODE] Varchar(10) NULL,
	[METER3_START_READING] Decimal(15,4) NULL,
	[METER3_END_READING] Decimal(15,4) NULL,
	[METER3_UNBILLED_USAGE] Decimal(15,4) NULL,
	[METER3_USAGE_CREDIT] Decimal(15,4) NULL,
	[METER3_LAST_READ_DATE] Datetime NULL,
	[METER3_PM_DUE_USAGE] Decimal(15,4) NULL,
	[METER3_LAST_PM_READING] Decimal(15,4) NULL,
	[METER3_NEXT_PM_READING] Decimal(15,4) NULL,
	[METER3_CONTRACT_USAGE] Decimal(15,4) NULL,
	[METER4_USAGE_CODE] Varchar(10) NULL,
	[METER4_START_READING] Decimal(15,4) NULL,
	[METER4_END_READING] Decimal(15,4) NULL,
	[METER4_UNBILLED_USAGE] Decimal(15,4) NULL,
	[METER4_USAGE_CREDIT] Decimal(15,4) NULL,
	[METER4_LAST_READ_DATE] Datetime NULL,
	[METER4_PM_DUE_USAGE] Decimal(15,4) NULL,
	[METER4_LAST_PM_READING] Decimal(15,4) NULL,
	[METER4_NEXT_PM_READING] Decimal(15,4) NULL,
	[METER4_CONTRACT_USAGE] Decimal(15,4) NULL,
	[METER5_USAGE_CODE] Varchar(10) NULL,
	[METER5_START_READING] Decimal(15,4) NULL,
	[METER5_END_READING] Decimal(15,4) NULL,
	[METER5_UNBILLED_USAGE] Decimal(15,4) NULL,
	[METER5_USAGE_CREDIT] Decimal(15,4) NULL,
	[METER5_LAST_READ_DATE] Datetime NULL,
	[METER5_PM_DUE_USAGE] Decimal(15,4) NULL,
	[METER5_LAST_PM_READING] Decimal(15,4) NULL,
	[METER5_NEXT_PM_READING] Decimal(15,4) NULL,
	[METER5_CONTRACT_USAGE] Decimal(15,4) NULL,
Primary Key ([Customer],[Address_ID],[Model_ID],[Serial_No])
) 
go

Create table [WO_TASK_NOTES]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Work_Order_No],[Task_Seq_No],[Note_ID])
) 
go

Create table [HISTORY_WO_TASK_NOTES]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Note_ID])
) 
go

Create table [PREDEF_JOB]
(
	[Job_ID] Varchar(15) NOT NULL,
	[Description] Varchar(30) NULL,
Primary Key ([Job_ID])
) 
go

Create table [PREDEF_JOB_NOTES]
(
	[Job_ID] Varchar(15) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Job_ID],[Note_ID])
) 
go

Create table [PREDEF_JOB_TASK]
(
	[Job_ID] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Name] Varchar(40) NULL,
	[Model] Varchar(30) NULL,
	[Serial_No] Varchar(30) NULL,
	[Description] Varchar(30) NULL,
	[Description_2] Varchar(30) NULL,
	[WORK_CAT] Varchar(10) NULL,
	[LOCATION] Varchar(100) NULL,
	[INVOICING_CODE] Varchar(10) NULL,
	[CONTRACT_NO] Varchar(15) NULL,
	[PROBLEM] Varchar(10) NULL,
	[IS_REPAIR] Char(1) NULL,
	[IS_PM] Char(1) NULL,
	[ESTIMATED_TTR] Numeric(7,2) NULL,
	[TASK_STATUS] Char(1) NULL,
Primary Key ([Job_ID],[Task_Seq_No])
) 
go

Create table [PREDEF_JOB_ADDL_CHG]
(
	[Job_ID] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Addl_Chg_Seq_No] Numeric(7,0) NOT NULL,
	[Description] Varchar(100) NULL,
	[Amount] Decimal(15,4) NULL,
	[Cost] Decimal(15,4) NULL,
	[IS_TAXABLE] Char(1) NULL,
	[Sales_Acct_No] Varchar(20) NULL,
	[Cost_Acct_No] Varchar(20) NULL,
Primary Key ([Job_ID],[Task_Seq_No],[Addl_Chg_Seq_No])
) 
go

Create table [PREDEF_JOB_PARTS]
(
	[Job_ID] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Pts_Seq_No] Numeric(7,0) NOT NULL,
	[Item_No] Varchar(30) NULL,
	[Inv_Loc] Varchar(10) NULL,
	[Description] Varchar(100) NULL,
	[Qty_Used] Numeric(7,2) NULL,
	[Unit_Cost] Decimal(15,4) NULL,
	[Unit_Price] Decimal(15,4) NULL,
	[DISCOUNT_PCT] Numeric(7,2) NULL,
	[IS_TAXABLE] Char(1) NULL,
	[SALES_ACCT_NO] Varchar(20) NULL,
Primary Key ([Job_ID],[Task_Seq_No],[Pts_Seq_No])
) 
go

Create table [PREDEF_JOB_LABOR]
(
	[Job_ID] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Lbr_Seq_No] Numeric(7,0) NOT NULL,
	[Tech_ID] Varchar(10) NULL,
	[Work_Description] Varchar(100) NULL,
	[TYPE_FLG] Char(1) NULL,
	[Hourly_Price] Decimal(15,4) NULL,
	[Hours_To_Bill] Numeric(7,2) NULL,
	[HRS_ADJ_FOR_FLAT] Numeric(7,2) NULL,
	[HRS_ADJ_UP_FOR_INCR] Numeric(7,2) NULL,
	[Date_For_Sched] Datetime NULL,
	[Time_For_Sched] Datetime NULL,
	[IS_TAXABLE] Char(1) NULL,
Primary Key ([Job_ID],[Task_Seq_No],[Lbr_Seq_No])
) 
go

Create table [PREDEF_JOB_LABOR_NOTES]
(
	[Job_ID] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Lbr_Seq_No] Numeric(7,0) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Job_ID],[Task_Seq_No],[Lbr_Seq_No],[Note_ID])
) 
go

Create table [PREDEF_JOB_TASK_NOTES]
(
	[Job_ID] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
	[PRT_ON_WO] Char(1) NULL,
	[PRT_ON_INVOICE] Char(1) NULL,
Primary Key ([Job_ID],[Task_Seq_No],[Note_ID])
) 
go

Create table [METER_READINGS]
(
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Model_ID] Varchar(25) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[WORK_ORDER_NO] Varchar(15) NULL,
	[READING_DATE] Datetime NULL,
	[METER1_READING_TYPE] Char(1) NULL,
	[METER1_READING_AMT] Decimal(15,4) NULL,
	[METER1_READING_CREDIT] Decimal(15,4) NULL,
	[METER2_READING_TYPE] Char(1) NULL,
	[METER2_READING_AMT] Decimal(15,4) NULL,
	[METER2_READING_CREDIT] Decimal(15,4) NULL,
	[METER3_READING_TYPE] Char(1) NULL,
	[METER3_READING_AMT] Decimal(15,4) NULL,
	[METER3_READING_CREDIT] Decimal(15,4) NULL,
	[METER4_READING_TYPE] Char(1) NULL,
	[METER4_READING_AMT] Decimal(15,4) NULL,
	[METER4_READING_CREDIT] Decimal(15,4) NULL,
	[METER5_READING_TYPE] Char(1) NULL,
	[METER5_READING_AMT] Decimal(15,4) NULL,
	[METER5_READING_CREDIT] Decimal(15,4) NULL,
Primary Key ([Customer],[Address_ID],[Model_ID],[Serial_No])
) 
go

Create table [PREDEF_NOTES]
(
	[Note_ID] Varchar(20) NOT NULL,
	[Description] Varchar(50) NULL,
	[NOTE_SAMPLE] Varchar(30) NULL,
	[NOTE_TEXT] Text NULL,
	[RAW_TEXT] Text NULL,
	[LAST_MAINT_DATE] Datetime NULL,
Primary Key ([Note_ID])
) 
go

Create table [HISTORY_METER_READINGS]
(
	[Customer] Varchar(15) NOT NULL,
	[Address_ID] Varchar(15) NOT NULL,
	[Model_ID] Varchar(25) NOT NULL,
	[Serial_No] Varchar(30) NOT NULL,
	[READING_DATE] Datetime NOT NULL,
	[SEQ_NO] Numeric(7,0) NOT NULL,
	[WORK_ORDER_NO] Varchar(15) NULL,
	[METER1_READING_TYPE] Char(1) NULL,
	[METER1_READING_AMT] Decimal(15,4) NULL,
	[METER1_READING_CREDIT] Decimal(15,4) NULL,
	[METER2_READING_TYPE] Char(1) NULL,
	[METER2_READING_AMT] Decimal(15,4) NULL,
	[METER2_READING_CREDIT] Decimal(15,4) NULL,
	[METER3_READING_TYPE] Char(1) NULL,
	[METER3_READING_AMT] Decimal(15,4) NULL,
	[METER3_READING_CREDIT] Decimal(15,4) NULL,
	[METER4_READING_TYPE] Char(1) NULL,
	[METER4_READING_AMT] Decimal(15,4) NULL,
	[METER4_READING_CREDIT] Decimal(15,4) NULL,
	[METER5_READING_TYPE] Char(1) NULL,
	[METER5_READING_AMT] Decimal(15,4) NULL,
	[METER5_READING_CREDIT] Decimal(15,4) NULL,
Primary Key ([Customer],[Address_ID],[Model_ID],[Serial_No],[READING_DATE],[SEQ_NO])
) 
go

Create table [WO_PARTS_GRID_CELL]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Pts_Seq_No] Numeric(7,0) NOT NULL,
	[Item_No] Varchar(30) NULL,
	[Inv_Loc] Varchar(10) NULL,
	[DIM_1_UPPER] Varchar(30) NULL,
	[DIM_2_UPPER] Varchar(30) NULL,
	[DIM_3_UPPER] Varchar(30) NULL,
	[QTY] Numeric(7,2) NULL,
	[XFERRED_FROM_POS] Char(1) NULL,
Primary Key ([Work_Order_No],[Task_Seq_No],[Pts_Seq_No])
) 
go

Create table [HISTORY_WO_PARTS_GRID_CELL]
(
	[Work_Order_No] Varchar(15) NOT NULL,
	[Work_Order_Seq_No] Numeric(7,0) NOT NULL,
	[Task_Seq_No] Numeric(7,0) NOT NULL,
	[Pts_Seq_No] Numeric(7,0) NOT NULL,
	[Item_No] Varchar(30) NULL,
	[Inv_Loc] Varchar(10) NULL,
	[DIM_1_UPPER] Varchar(30) NULL,
	[DIM_2_UPPER] Varchar(30) NULL,
	[DIM_3_UPPER] Varchar(30) NULL,
	[QTY] Numeric(7,2) NULL,
	[XFERRED_FROM_POS] Char(1) NULL,
Primary Key ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Pts_Seq_No])
) 
go


Create UNIQUE Index [SVC_TECH_X1] ON [SVC_TECH] ([Tech_ID] ) 
go
Create Index [SVC_TECH_X2] ON [SVC_TECH] ([Name] ) 
go
Create UNIQUE Index [SVC_ADDRESS_X1] ON [SVC_ADDRESS] ([Customer] ,[Address_ID] ) 
go
Create Index [SVC_ADDRESS_X2] ON [SVC_ADDRESS] ([Name] ) 
go
Create Index [SVC_ADDRESS_NOTES_X1] ON [SVC_ADDRESS_NOTES] ([Customer] ,[Address_ID] ,[Note_ID] ) 
go
Create UNIQUE Index [CUST_EQUIPMENT_X1] ON [CUST_EQUIPMENT] ([Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ) 
go
Create Index [CUST_EQUIPMENT_X2] ON [CUST_EQUIPMENT] ([Tag_ID] ,[Customer] ,[Address_ID] ) 
go
Create Index [CUST_EQUIPMENT_X3] ON [CUST_EQUIPMENT] ([CONTRACT_NO] ,[Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ) 
go
Create Index [CUST_EQUIPMENT_NOTES_X1] ON [CUST_EQUIPMENT_NOTES] ([Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ,[Note_ID] ) 
go
Create UNIQUE Index [WORK_ORDER_X1] ON [WORK_ORDER] ([Work_Order_No] ) 
go
Create UNIQUE Index [WORK_ORDER_X2] ON [WORK_ORDER] ([Customer] ,[Work_Order_No] ) 
go
Create Index [WO_ADDL_CHG_X1] ON [WO_ADDL_CHG] ([Work_Order_No] ,[Task_Seq_No] ,[Addl_Chg_Seq_No] ) 
go
Create Index [WO_PMNT_X1] ON [WO_PMNT] ([Work_Order_No] ,[Seq_No] ) 
go
Create Index [WO_TAX_X1] ON [WO_TAX] ([Work_Order_No] ,[Seq_No] ) 
go
Create Index [WO_PARTS_X1] ON [WO_PARTS] ([Work_Order_No] ,[Task_Seq_No] ,[Pts_Seq_No] ) 
go
Create Index [WO_LABOR_X1] ON [WO_LABOR] ([Work_Order_No] ,[Task_Seq_No] ,[Lbr_Seq_No] ) 
go
Create Index [WO_NOTES_X1] ON [WO_NOTES] ([Work_Order_No] ,[Note_ID] ) 
go
Create Index [WO_TASK_X1] ON [WO_TASK] ([Work_Order_No] ,[Task_Seq_No] ) 
go
Create Index [WO_LABOR_NOTES_X1] ON [WO_LABOR_NOTES] ([Work_Order_No] ,[Task_Seq_No] ,[Lbr_Seq_No] ,[Note_ID] ) 
go
Create Index [HISTORY_WORK_ORDER_X1] ON [HISTORY_WORK_ORDER] ([Work_Order_No] ,[Work_Order_Seq_No] ) 
go
Create Index [HISTORY_WORK_ORDER_X2] ON [HISTORY_WORK_ORDER] ([Customer] ,[Work_Order_No] ,[Work_Order_Seq_No] ) 
go
Create Index [HISTORY_WO_NOTES_X1] ON [HISTORY_WO_NOTES] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Note_ID] ) 
go
Create Index [HISTORY_WO_TAX_X1] ON [HISTORY_WO_TAX] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Seq_No] ) 
go
Create Index [HISTORY_WO_PMNT_X1] ON [HISTORY_WO_PMNT] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Seq_No] ) 
go
Create Index [HISTORY_WO_TASK_X1] ON [HISTORY_WO_TASK] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Task_Seq_No] ) 
go
Create Index [HISTORY_WO_ADDL_CHG_X1] ON [HISTORY_WO_ADDL_CHG] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Task_Seq_No] ,[Addl_Chg_Seq_No] ) 
go
Create Index [HISTORY_WO_PARTS_X1] ON [HISTORY_WO_PARTS] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Task_Seq_No] ,[Pts_Seq_No] ) 
go
Create Index [HISTORY_WO_LABOR_X1] ON [HISTORY_WO_LABOR] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Task_Seq_No] ,[Lbr_Seq_No] ) 
go
Create Index [HISTORY_WO_LABOR_NOTES_X1] ON [HISTORY_WO_LABOR_NOTES] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Task_Seq_No] ,[Lbr_Seq_No] ,[Note_ID] ) 
go
Create UNIQUE Index [CONTRACT_X1] ON [CONTRACT] ([Contract_No] ) 
go
Create UNIQUE Index [CONTRACT_X2] ON [CONTRACT] ([Customer] ,[Contract_No] ) 
go
Create Index [CONTRACT_NOTES_X1] ON [CONTRACT_NOTES] ([Contract_No] ,[Note_ID] ) 
go
Create Index [CONTRACT_TAX_X1] ON [CONTRACT_TAX] ([Contract_No] ,[Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ,[Seq_No] ) 
go
Create UNIQUE Index [HISTORY_CONTRACT_X1] ON [HISTORY_CONTRACT] ([Contract_No] ,[Contract_Seq_No] ) 
go
Create UNIQUE Index [HISTORY_CONTRACT_X2] ON [HISTORY_CONTRACT] ([Customer] ,[Contract_Seq_No] ,[Contract_No] ) 
go
Create Index [HISTORY_CONTRACT_NOTES_X1] ON [HISTORY_CONTRACT_NOTES] ([Contract_No] ,[Contract_Seq_No] ,[Note_ID] ) 
go
Create Index [HISTORY_CONTRACT_TAX_X1] ON [HISTORY_CONTRACT_TAX] ([Contract_No] ,[Contract_Seq_No] ,[Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ,[Seq_No] ) 
go
Create UNIQUE Index [HISTORY_CUST_EQUIPMENT_X1] ON [HISTORY_CUST_EQUIPMENT] ([Customer] ,[Contract_No] ,[Contract_Seq_No] ,[Address_ID] ,[Model_ID] ,[Serial_No] ) 
go
Create Index [HISTORY_CUST_EQUIPMENT_X2] ON [HISTORY_CUST_EQUIPMENT] ([Tag_ID] ,[Customer] ,[Address_ID] ) 
go
Create Index [HISTORY_CUST_EQUIPMENT_X3] ON [HISTORY_CUST_EQUIPMENT] ([Contract_No] ,[Contract_Seq_No] ,[Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ) 
go
Create UNIQUE Index [SP_USER_X1] ON [SP_USER] ([User_ID] ) 
go
Create Index [WO_PARTS_SERIALS_X1] ON [WO_PARTS_SERIALS] ([Work_Order_No] ,[Task_Seq_No] ,[Pts_Seq_No] ,[Serial_No] ) 
go
Create Index [HISTORY_WO_PARTS_SERIALS_X1] ON [HISTORY_WO_PARTS_SERIALS] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Task_Seq_No] ,[Pts_Seq_No] ,[Serial_No] ) 
go
Create Index [EQUIPMENT_METERS_X1] ON [CUST_EQUIPMENT_METERS] ([Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ) 
go
Create Index [WO_TASK_NOTES_X1] ON [WO_TASK_NOTES] ([Work_Order_No] ,[Task_Seq_No] ,[Note_ID] ) 
go
Create Index [HISTORY_WO_TASK_NOTES_X1] ON [HISTORY_WO_TASK_NOTES] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Task_Seq_No] ,[Note_ID] ) 
go
Create UNIQUE Index [PREDEF_JOB_X1] ON [PREDEF_JOB] ([Job_ID] ) 
go
Create UNIQUE Index [PREDEF_JOB_X2] ON [PREDEF_JOB] ([Description] ,[Job_ID] ) 
go
Create Index [JOB_NOTES_X1] ON [PREDEF_JOB_NOTES] ([Job_ID] ,[Note_ID] ) 
go
Create Index [JOB_TASK_X1] ON [PREDEF_JOB_TASK] ([Job_ID] ,[Task_Seq_No] ) 
go
Create Index [JOB_ADDL_CHG_X1] ON [PREDEF_JOB_ADDL_CHG] ([Job_ID] ,[Task_Seq_No] ,[Addl_Chg_Seq_No] ) 
go
Create Index [JOB_PARTS_X1] ON [PREDEF_JOB_PARTS] ([Job_ID] ,[Task_Seq_No] ,[Pts_Seq_No] ) 
go
Create Index [JOB_LABOR_X1] ON [PREDEF_JOB_LABOR] ([Job_ID] ,[Task_Seq_No] ,[Lbr_Seq_No] ) 
go
Create Index [JOB_LABOR_NOTES_X1] ON [PREDEF_JOB_LABOR_NOTES] ([Job_ID] ,[Task_Seq_No] ,[Lbr_Seq_No] ,[Note_ID] ) 
go
Create Index [JOB_TASK_NOTES_X1] ON [PREDEF_JOB_TASK_NOTES] ([Job_ID] ,[Task_Seq_No] ,[Note_ID] ) 
go
Create Index [METER_READINGS_X1] ON [METER_READINGS] ([Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ) 
go
Create Index [PREDEF_NOTE_X1] ON [PREDEF_NOTES] ([Note_ID] ) 
go
Create Index [HISTORY_METER_READINGS_X1] ON [HISTORY_METER_READINGS] ([Customer] ,[Address_ID] ,[Model_ID] ,[Serial_No] ,[READING_DATE] ,[SEQ_NO] ) 
go
Create Index [WO_PARTS_GRID_CELL_X1] ON [WO_PARTS_GRID_CELL] ([Work_Order_No] ,[Task_Seq_No] ,[Pts_Seq_No] ) 
go
Create Index [HISTORY_WO_PARTS_GRID_CELL_X1] ON [HISTORY_WO_PARTS_GRID_CELL] ([Work_Order_No] ,[Work_Order_Seq_No] ,[Task_Seq_No] ,[Pts_Seq_No] ) 
go


Alter table [WO_TAX] add  foreign key([Work_Order_No]) references [WORK_ORDER] ([Work_Order_No])  on update cascade on delete cascade 
go
Alter table [WO_ADDL_CHG] add  foreign key([Work_Order_No],[Task_Seq_No]) references [WO_TASK] ([Work_Order_No],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [WO_PARTS] add  foreign key([Work_Order_No],[Task_Seq_No]) references [WO_TASK] ([Work_Order_No],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [WO_LABOR] add  foreign key([Work_Order_No],[Task_Seq_No]) references [WO_TASK] ([Work_Order_No],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_WO_NOTES] add  foreign key([Work_Order_No],[Work_Order_Seq_No]) references [HISTORY_WORK_ORDER] ([Work_Order_No],[Work_Order_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_WO_TAX] add  foreign key([Work_Order_No],[Work_Order_Seq_No]) references [HISTORY_WORK_ORDER] ([Work_Order_No],[Work_Order_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_WO_PMNT] add  foreign key([Work_Order_No],[Work_Order_Seq_No]) references [HISTORY_WORK_ORDER] ([Work_Order_No],[Work_Order_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_WO_ADDL_CHG] add  foreign key([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No]) references [HISTORY_WO_TASK] ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_WO_PARTS] add  foreign key([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No]) references [HISTORY_WO_TASK] ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_WO_LABOR] add  foreign key([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No]) references [HISTORY_WO_TASK] ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_WO_TASK_NOTES] add  foreign key([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No]) references [HISTORY_WO_TASK] ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_WO_LABOR_NOTES] add  foreign key([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Lbr_Seq_No]) references [HISTORY_WO_LABOR] ([Work_Order_No],[Work_Order_Seq_No],[Task_Seq_No],[Lbr_Seq_No])  on update cascade on delete cascade 
go
Alter table [CONTRACT_TAX] add  foreign key([Contract_No]) references [CONTRACT] ([Contract_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_CUST_EQUIPMENT] add  foreign key([Contract_No],[Contract_Seq_No]) references [HISTORY_CONTRACT] ([Contract_No],[Contract_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_CONTRACT_NOTES] add  foreign key([Contract_No],[Contract_Seq_No]) references [HISTORY_CONTRACT] ([Contract_No],[Contract_Seq_No])  on update cascade on delete cascade 
go
Alter table [HISTORY_CONTRACT_TAX] add  foreign key([Contract_No],[Contract_Seq_No]) references [HISTORY_CONTRACT] ([Contract_No],[Contract_Seq_No])  on update cascade on delete cascade 
go
Alter table [PREDEF_JOB_ADDL_CHG] add  foreign key([Job_ID],[Task_Seq_No]) references [PREDEF_JOB_TASK] ([Job_ID],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [PREDEF_JOB_PARTS] add  foreign key([Job_ID],[Task_Seq_No]) references [PREDEF_JOB_TASK] ([Job_ID],[Task_Seq_No])  on update cascade on delete cascade 
go
Alter table [PREDEF_JOB_LABOR] add  foreign key([Job_ID],[Task_Seq_No]) references [PREDEF_JOB_TASK] ([Job_ID],[Task_Seq_No])  on update cascade on delete cascade 
go


Set quoted_identifier on
go


Set quoted_identifier off
go


/* Roles permissions */


/* Users permissions */


