--分為兩部分數據表（當前賬套、歷史賬套）
--以下是當前賬套（非歷史數據表）
IF OBJECT_ID('dbo.KQ_Monthly') IS NULL
   CREATE TABLE dbo.KQ_Monthly (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       MustWork_Hour        float NULL,
       MustWork_Days        float NULL,
       FactWork_Hour        float NULL,
       FactWork_Days        float NULL,
       AbsentWork_Hour      float NULL,
       AbsentWork_Days      float NULL,
       Overtime_Hour        float NULL,
       Overtime_Days        float NULL,
       Overrest_Hour        float NULL,
       Overrest_Days        float NULL,
       Overholiday_Hour     float NULL,
       Overholiday_Days     float NULL,
       Late1_Minute         float NULL,
       Late1_Times          tinyint NULL,
       Late2_Minute         float NULL,
       Late2_Times          tinyint NULL,
       Late3_Minute         float NULL,
       Late3_Times          tinyint NULL,
       Early1_Minute        float NULL,
       Early1_Times         tinyint NULL,
       Early2_Minute        float NULL,
       Early2_Times         tinyint NULL,
       Early3_Minute        float NULL,
       Early3_Times         tinyint NULL,
       TotalLate_Minute     float NULL,
       TotalLate_Times      tinyint NULL,
       TotalEarly_Minute    float NULL,
       TotalEarly_Times     tinyint NULL,
       J101_Hour            float NULL,
       J101_Days            float NULL,
       J102_Hour            float NULL,
       J102_Days            float NULL,
       J103_Hour            float NULL,
       J103_Days            float NULL,
       J104_Hour            float NULL,
       J104_Days            float NULL,
       J105_Hour            float NULL,
       J105_Days            float NULL,
       J106_Hour            float NULL,
       J106_Days            float NULL,
       J107_Hour            float NULL,
       J107_Days            float NULL,
       J108_Hour            float NULL,
       J108_Days            float NULL,
       J109_Hour            float NULL,
       J109_Days            float NULL,
       J110_Hour            float NULL,
       J110_Days            float NULL,
       J111_Hour            float NULL,
       J111_Days            float NULL,
       J112_Hour            float NULL,
       J112_Days            float NULL,
       J113_Hour            float NULL,
       J113_Days            float NULL,
       J114_Hour            float NULL,
       J114_Days            float NULL,
       J115_Hour            float NULL,
       J115_Days            float NULL,
       J116_Hour            float NULL,
       J116_Days            float NULL,
       J117_Hour            float NULL,
       J117_Days            float NULL,
       J118_Hour            float NULL,
       J118_Days            float NULL,
       TotalLeave_Hour      float NULL,
       TotalLeave_Days      float NULL,
       A                    smallint NULL,
       B                    smallint NULL,
       C                    smallint NULL,
       D                    smallint NULL,
       E                    smallint NULL,
       F                    smallint NULL,
       G                    smallint NULL,
       H                    smallint NULL,
       I                    smallint NULL,
       J                    smallint NULL,
       K                    smallint NULL,
       L                    smallint NULL, 
       Account_Code         varchar(20) NULL,
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_Monthly_DateIndex')
   CREATE INDEX KQ_Monthly_DateIndex ON dbo.KQ_Monthly(Account_Code  ASC)
GO


IF OBJECT_ID('dbo.KQ_DefineClass') IS NULL
CREATE TABLE dbo.KQ_DefineClass (
       Class_No             varchar(6) NOT NULL,
       Class_Name           varchar(40) NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (Class_No ASC)
)
GO

IF OBJECT_ID('dbo.KQ_DefineClassSub') IS NULL
CREATE TABLE dbo.KQ_DefineClassSub (
       ID_KEY               int IDENTITY,
       Class_No             varchar(6)  NOT NULL,
       Worktime_Date        varchar(10) NOT NULL,
       OfWeek               varchar(2)  NULL,
       Day_ClassNo          varchar(6)  NULL,
       PRIMARY KEY (ID_KEY ASC), 
       FOREIGN KEY (Class_No)
                             REFERENCES dbo.KQ_DefineClass  (Class_No)
                             ON DELETE NO ACTION
                             ON UPDATE NO ACTION
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'XIF1KQ_DefineClassSub')
   CREATE INDEX XIF1KQ_DefineClassSub ON dbo.KQ_DefineClassSub(Class_No  ASC)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_DefineClassSub_DateIndex')
   CREATE INDEX KQ_DefineClassSub_DateIndex ON dbo.KQ_DefineClassSub(Worktime_Date  ASC)
GO

IF OBJECT_ID('dbo.KQ_Download') IS NULL
CREATE TABLE dbo.KQ_Download (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       Card_No              varchar(12) NOT NULL,
       Brush_Date           varchar(10) NOT NULL,
       Brush_Time           varchar(5) NOT NULL,
       Moc_No               varchar(3) NOT NULL,
       Data_Flag            smallint NOT NULL,
       Brush_DateTime       datetime NULL,
       Is_Falsity           BIT DEFAULT 0,
       FileName             VARCHAR(128),
       PRIMARY KEY (ID_KEY ASC)
	 ON "PRIMARY"
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_KQ_Download_Date')
 CREATE  INDEX [IX_KQ_Download_Date] ON [dbo].[KQ_Download]([Brush_Date]) ON [PRIMARY]
GO
IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_KQ_Download_PID_Date')
 CREATE  INDEX [IX_KQ_Download_PID_Date] ON [dbo].[KQ_Download]([Person_ID], [Brush_Date]) ON [PRIMARY]
GO
IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_KQ_Download_PID_DateTime')
 CREATE  INDEX [IX_KQ_Download_PID_DateTime] ON [dbo].[KQ_Download]([Person_ID], [Brush_DateTime]) ON [PRIMARY]
GO
IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_KQ_Download_CardNo_Date')
 CREATE  INDEX [IX_KQ_Download_CardNo_Date] ON [dbo].[KQ_Download]([Card_No], [Brush_Date]) ON [PRIMARY]
GO

IF OBJECT_ID('dbo.KQ_Account') IS NULL
CREATE TABLE dbo.KQ_Account (
       ID_KEY               int IDENTITY,
       Account_Code         varchar(10) NULL,
       Account_Name         varchar(40) NOT NULL,
       Account_Date         datetime NULL,
       Date_Bgn             varchar(10) NULL,
       Date_End             varchar(10) NULL,
       Account_Flag         tinyint NOT NULL DEFAULT 0,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC),
       UNIQUE (
              Account_Code ASC
       )
)
GO


IF OBJECT_ID('dbo.KQ_BrushCard') IS NULL
CREATE TABLE dbo.KQ_BrushCard (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Card_No              varchar(12) NULL,
       Brush_Date           varchar(10) NULL,
       Brush_Data           varchar(256) NULL,
       PRIMARY KEY (ID_KEY ASC)
	 ON "PRIMARY"
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'BrushCardIndex')
CREATE INDEX BrushCardIndex ON dbo.KQ_BrushCard(Person_ID ASC, Brush_Date ASC)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_BrushCard_DateIndex')
CREATE INDEX KQ_BrushCard_DateIndex ON dbo.KQ_BrushCard(Brush_Date ASC)
GO

IF OBJECT_ID('dbo.KQ_Daily') IS NULL
CREATE TABLE dbo.KQ_Daily (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       Worktime_Date        varchar(10) NULL,
       OfWeek               varchar(2) NULL,
       Class_No             varchar(6) NOT NULL,
       Class_Data           varchar(256) NULL,
       Sect1_InFact         varchar(16) NULL,
       Sect1_OutFact        varchar(16) NULL,
       Sect2_InFact         varchar(16) NULL,
       Sect2_OutFact        varchar(16) NULL,
       Sect3_InFact         varchar(16) NULL,
       Sect3_OutFact        varchar(16) NULL,
       Sect4_InFact         varchar(16) NULL,
       Sect4_OutFact        varchar(16) NULL,
       Sect5_InFact         varchar(16) NULL,
       Sect5_OutFact        varchar(16) NULL,
       Must_Work            float NULL,
       Fact_Work            float NULL,
       Absent_Work          float NULL,
       Reason               varchar(40) NULL,
       Leave_Hour           float NULL,
       Leave_Data           varchar(40) NULL,
       Leave_Name           varchar(40) NULL,
       Overtime_Hour        float NULL,
       Overtime_Class       varchar(1) NULL,
       Late_Minute          float NULL,
       Late_Data            varchar(30) NULL,
       Early_Minute         float NULL,
       Early_Data           varchar(30) NULL,
       Brush_Data           varchar(256) NOT NULL,
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_Daily_DateIndex')
CREATE INDEX KQ_Daily_DateIndex ON dbo.KQ_Daily(Worktime_Date ASC)
GO

IF OBJECT_ID('dbo.KQ_LeaveKind') IS NULL
CREATE TABLE dbo.KQ_LeaveKind (
       Kind_No              varchar(4) NOT NULL,
       Kind_Name            varchar(10) NOT NULL,
       Kind_Code            varchar(3) NULL,
       Is_Deduct            bit NOT NULL DEFAULT 1,
       PRIMARY KEY (Kind_No ASC)
)
GO

IF OBJECT_ID('dbo.KQ_Leave') IS NULL
CREATE TABLE dbo.KQ_Leave (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Kind_No              varchar(4) NULL,
       Leave_Date           varchar(10) NULL,
       Leave_Hour           float NOT NULL,
       IsOutLeave           bit NOT NULL DEFAULT 0,
       Leave_Sect           tinyint NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Leave_TimeBgn        varchar(20) null,
       Leave_TimeEnd        varchar(20) null,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC), 
       FOREIGN KEY (Kind_No)
                             REFERENCES dbo.KQ_LeaveKind  (Kind_No)
                             ON DELETE NO ACTION
                             ON UPDATE NO ACTION
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'XIF1KQ_Leave')
CREATE INDEX XIF1KQ_Leave ON dbo.KQ_Leave(Kind_No ASC)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_Leave_DateIndex')
CREATE INDEX KQ_Leave_DateIndex ON dbo.KQ_Leave(Leave_Date ASC)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_Leave_QueryIndex')
CREATE INDEX KQ_Leave_QueryIndex ON dbo.KQ_Leave(Person_ID ASC,Leave_Date ASC)
GO

IF OBJECT_ID('dbo.KQ_Yearly') IS NULL
CREATE TABLE dbo.KQ_Yearly (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       MustWork_Hour        float NULL,
       MustWork_Days        float NULL,
       FactWork_Hour        float NULL,
       FactWork_Days        float NULL,
       AbsentWork_Hour      float NULL,
       AbsentWork_Days      float NULL,
       Overtime_Hour        float NULL,
       Overtime_Days        float NULL,
       Overrest_Hour        float NULL,
       Overrest_Days        float NULL,
       Overholiday_Hour     float NULL,
       Overholiday_Days     float NULL,
       Late1_Minute         float NULL,
       Late1_Times          tinyint NULL,
       Late2_Minute         float NULL,
       Late2_Times          tinyint NULL,
       Late3_Minute         float NULL,
       Late3_Times          tinyint NULL,
       Early1_Minute        float NULL,
       Early1_Times         tinyint NULL,
       Early2_Minute        float NULL,
       Early2_Times         tinyint NULL,
       Early3_Minute        float NULL,
       Early3_Times         tinyint NULL,
       TotalLate_Minute     float NULL,
       TotalLate_Times      tinyint NULL,
       TotalEarly_Minute    float NULL,
       TotalEarly_Times     tinyint NULL,
       J101_Hour            float NULL,
       J101_Days            float NULL,
       J102_Hour            float NULL,
       J102_Days            float NULL,
       J103_Hour            float NULL,
       J103_Days            float NULL,
       J104_Hour            float NULL,
       J104_Days            float NULL,
       J105_Hour            float NULL,
       J105_Days            float NULL,
       J106_Hour            float NULL,
       J106_Days            float NULL,
       J107_Hour            float NULL,
       J107_Days            float NULL,
       J108_Hour            float NULL,
       J108_Days            float NULL,
       J109_Hour            float NULL,
       J109_Days            float NULL,
       J110_Hour            float NULL,
       J110_Days            float NULL,
       J111_Hour            float NULL,
       J111_Days            float NULL,
       J112_Hour            float NULL,
       J112_Days            float NULL,
       J113_Hour            float NULL,
       J113_Days            float NULL,
       J114_Hour            float NULL,
       J114_Days            float NULL,
       J115_Hour            float NULL,
       J115_Days            float NULL,
       J116_Hour            float NULL,
       J116_Days            float NULL,
       J117_Hour            float NULL,
       J117_Days            float NULL,
       J118_Hour            float NULL,
       J118_Days            float NULL,
       TotalLeave_Hour      float NULL,
       TotalLeave_Days      float NULL,
       A                    smallint NULL,
       B                    smallint NULL,
       C                    smallint NULL,
       D                    smallint NULL,
       E                    smallint NULL,
       F                    smallint NULL,
       G                    smallint NULL,
       H                   smallint NULL,
       I                    smallint NULL,
       J                    smallint NULL,
       K                    smallint NULL,
       L                    smallint NULL,
       Account_Code         varchar(20) NULL,
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_Yearly_DateIndex')
CREATE INDEX KQ_Yearly_DateIndex ON dbo.KQ_Yearly(Account_Code ASC)
GO

IF OBJECT_ID('dbo.KQ_InOutData') IS NULL
CREATE TABLE dbo.KQ_InOutData (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       Card_No              varchar(12) NULL,
       Brush_Date           varchar(10) NOT NULL,
       Data_In              varchar(256) NULL,
       Data_Out             varchar(256) NULL,
       PRIMARY KEY (ID_KEY ASC)
	 ON "PRIMARY"
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_InOutData_DateIndex')
CREATE INDEX KQ_InOutData_DateIndex ON dbo.KQ_InOutData(Brush_Date ASC)
GO

IF OBJECT_ID('dbo.KQ_Person') IS NULL
CREATE TABLE dbo.KQ_Person (
       Person_ID            int NOT NULL,
       Class_No             varchar(6) NOT NULL DEFAULT '',
       Worktime_Mode        tinyint NULL DEFAULT 1,
       Overtime_Mode        tinyint NULL DEFAULT 1,
       Rest_Mode            tinyint NULL,
       Rest_Days            varchar(40) NULL,
       IsHolidayAsWorkTime  bit NULL DEFAULT 0,
       IsOverTimeAsWorkTime  bit NULL DEFAULT 0,
       Person_State         tinyint NOT NULL DEFAULT 0,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (Person_ID ASC)
)
GO

IF OBJECT_ID('dbo.KQ_Holiday') IS NULL
CREATE TABLE dbo.KQ_Holiday (
       Holiday_Date         varchar(5) NOT NULL,
       Holiday_Name         varchar(20) NOT NULL,
       PRIMARY KEY (Holiday_Date ASC)
)
GO

IF OBJECT_ID('dbo.KQ_Overtime') IS NULL
CREATE TABLE dbo.KQ_Overtime (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Over_Date            varchar(10) NULL,
       Over_Hour            float NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_Overtime_DateIndex')
CREATE INDEX KQ_Overtime_DateIndex ON dbo.KQ_Overtime(Over_Date ASC)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_Overtime_QueryIndex')
CREATE INDEX KQ_Overtime_QueryIndex ON dbo.KQ_Overtime(Person_ID ASC,Over_Date ASC)
GO

IF OBJECT_ID('dbo.KQ_RuleClass') IS NULL
CREATE TABLE dbo.KQ_RuleClass (
       Class_No             varchar(6) NOT NULL,
       Class_Name           varchar(40) NULL,
       Start_Date           varchar(10) NULL,
       Rule_Mode            tinyint NULL DEFAULT 0,
       Rule_Cycle           smallint NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (Class_No ASC)
)
GO

IF OBJECT_ID('dbo.KQ_AdjustRest') IS NULL
CREATE TABLE dbo.KQ_AdjustRest (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Adjust_Date          varchar(10) NULL,
       Adjust_Class         tinyint NOT NULL DEFAULT 0,
       Adjust_Hour          float NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_AdjustRest_DateIndex')
CREATE INDEX KQ_AdjustRest_DateIndex ON dbo.KQ_AdjustRest
(
       Adjust_Date                    ASC
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_AdjustRest_QueryIndex')
CREATE INDEX KQ_AdjustRest_QueryIndex ON dbo.KQ_AdjustRest
(
       Adjust_Class                   ASC,
       Person_ID                      ASC,
       Adjust_Date                    ASC
)
GO

IF OBJECT_ID('dbo.KQ_SupplyTime') IS NULL
CREATE TABLE dbo.KQ_SupplyTime (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Supply_Date          varchar(10) NULL,
       Supply_Time          varchar(5) NOT NULL,
       Supply_Reason        varchar(40) NULL,
       Supply_Class         smallint NOT NULL DEFAULT 0,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_SupplyTime_DateIndex')
CREATE INDEX KQ_SupplyTime_DateIndex ON dbo.KQ_SupplyTime
(
       Supply_Date                    ASC
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_SupplyTime_QueryIndex')
CREATE INDEX KQ_SupplyTime_QueryIndex ON dbo.KQ_SupplyTime
(
       Person_ID                      ASC,
       Supply_Date                    ASC
)
GO

IF OBJECT_ID('dbo.KQ_FillAttend') IS NULL
CREATE TABLE dbo.KQ_FillAttend (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Fill_Date            varchar(10) NULL,
       Fill_Class           tinyint NOT NULL DEFAULT 0,
       Fill_Hour            float NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_FillAttend_DateIndex')
CREATE INDEX KQ_FillAttend_DateIndex ON dbo.KQ_FillAttend
(
       Fill_Date                      ASC
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_FillAttend_QueryIndex')
CREATE INDEX KQ_FillAttend_QueryIndex ON dbo.KQ_FillAttend
(
       Fill_Class                     ASC,
       Person_ID                      ASC,
       Fill_Date                      ASC
)
GO

IF OBJECT_ID('dbo.KQ_AdjustClass') IS NULL
CREATE TABLE dbo.KQ_AdjustClass (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Adjust_Date          varchar(10) NULL,
       Class_No             varchar(6) NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_AdjustClass_DateIndex')
CREATE INDEX KQ_AdjustClass_DateIndex ON dbo.KQ_AdjustClass
(
       Adjust_Date                    ASC
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_AdjustClass_QueryIndex')
CREATE INDEX KQ_AdjustClass_QueryIndex ON dbo.KQ_AdjustClass
(
       Person_ID                      ASC,
       Adjust_Date                    ASC
)
GO

IF OBJECT_ID('dbo.KQ_Class') IS NULL
CREATE TABLE dbo.KQ_Class (
       Class_No             varchar(6) NOT NULL,
       Class_Name           varchar(40) NOT NULL,
       Sect1_Ahead          smallint NULL DEFAULT 0,
       Sect1_InTime         varchar(5) NULL,
       Sect1_InCard         tinyint NULL DEFAULT 1,
       Sect1_OutTime        varchar(5) NULL,
       Sect1_OutCard        tinyint NULL DEFAULT 1,
       Sect1_After          smallint NULL DEFAULT 0,
       Sect1_Deduct         smallint NULL DEFAULT 0,
       Sect1_Overtime       bit NOT NULL DEFAULT 0,
       Sect2_Ahead          smallint NULL DEFAULT 0,
       Sect2_InTime         varchar(5) NULL,
       Sect2_InCard         tinyint NULL DEFAULT 1,
       Sect2_OutTime        varchar(5) NULL,
       Sect2_OutCard        tinyint NULL DEFAULT 1,
       Sect2_After          smallint NULL DEFAULT 0,
       Sect2_Deduct         smallint NULL DEFAULT 0,
       Sect2_Overtime       bit NOT NULL DEFAULT 0,
       Sect3_Ahead          smallint NULL DEFAULT 0,
       Sect3_InTime         varchar(5) NULL,
       Sect3_InCard         tinyint NULL DEFAULT 1,
       Sect3_OutTime        varchar(5) NULL,
       Sect3_OutCard        tinyint NULL DEFAULT 1,
       Sect3_After          smallint NULL DEFAULT 0,
       Sect3_Deduct         smallint NULL DEFAULT 0,
       Sect3_Overtime       bit NOT NULL DEFAULT 0,
       Sect4_Ahead          smallint NULL DEFAULT 0,
       Sect4_InTime         varchar(5) NULL,
       Sect4_InCard         tinyint NULL DEFAULT 1,
       Sect4_OutTime        varchar(5) NULL,
       Sect4_OutCard        tinyint NULL DEFAULT 1,
       Sect4_Deduct         smallint NULL DEFAULT 0,
       Sect4_After          smallint NULL DEFAULT 0,
       Sect4_Overtime       bit NOT NULL DEFAULT 0,
       Sect5_Ahead          smallint NULL DEFAULT 0,
       Sect5_InTime         varchar(5) NULL,
       Sect5_InCard         tinyint NULL DEFAULT 1,
       Sect5_OutTime        varchar(5) NULL,
       Sect5_OutCard        tinyint NULL DEFAULT 1,
       Sect5_Deduct         smallint NULL DEFAULT 0,
       Sect5_After          smallint NULL DEFAULT 0,
       Sect5_Overtime       bit NOT NULL DEFAULT 0,
       Class_Mark           tinyint NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (Class_No ASC)
)
GO

IF OBJECT_ID('dbo.KQ_SysParam') IS NULL
CREATE TABLE dbo.KQ_SysParam (
       Param_ID             int IDENTITY,
       Param_Code           varchar(20) NOT NULL,
       Param_Name           varchar(40) NOT NULL,
       Param_Value          varchar(100) NOT NULL,
       PRIMARY KEY (Param_ID ASC)
)
GO

IF OBJECT_ID('dbo.KQ_RuleClassSub') IS NULL
CREATE TABLE dbo.KQ_RuleClassSub (
       ID_KEY               int IDENTITY,
       Class_No             varchar(6) NOT NULL,
       Shift_ClassNo        varchar(6) NOT NULL,
       Shift_Days           int NOT NULL,
       PRIMARY KEY (ID_KEY ASC), 
       FOREIGN KEY (Class_No)
                             REFERENCES dbo.KQ_RuleClass  (Class_No)
                             ON DELETE NO ACTION
                             ON UPDATE NO ACTION
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'XIF1KQ_RuleClassSub')
CREATE INDEX XIF1KQ_RuleClassSub ON dbo.KQ_RuleClassSub
(
       Class_No                       ASC
)
GO

IF OBJECT_ID('dbo.KQ_AgileClass') IS NULL
CREATE TABLE dbo.KQ_AgileClass (
       Class_No             varchar(6) NOT NULL,
       Class_Name           varchar(40) NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (Class_No ASC)
)
GO

IF OBJECT_ID('dbo.KQ_AgileClassSub') IS NULL
CREATE TABLE dbo.KQ_AgileClassSub (
       ID_KEY               int IDENTITY,
       Class_No             varchar(6) NOT NULL,
       Shift_ClassNo        varchar(6) NOT NULL,
       PRIMARY KEY (ID_KEY ASC), 
       FOREIGN KEY (Class_No)
                             REFERENCES dbo.KQ_AgileClass  (Class_No)
                             ON DELETE NO ACTION
                             ON UPDATE NO ACTION
)
GO

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'XIF1KQ_AgileClassSub')
CREATE INDEX XIF1KQ_AgileClassSub ON dbo.KQ_AgileClassSub
(
       Class_No                       ASC
)
GO

IF OBJECT_ID('dbo.KQ_TransferTables') IS NULL
CREATE TABLE dbo.KQ_TransferTables (
       Table_Name           varchar(40) NOT NULL,
       Date_Field           varchar(40) NOT NULL,
       Transfer_Index       smallint NOT NULL,
       Delete_Index         smallint NOT NULL,
       PRIMARY KEY (Table_Name ASC)
)
GO

--$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
--以下是歷史賬套（歷史數據表）
IF OBJECT_ID('dbo.KQ_DefineClassSubHistory') IS NULL
CREATE TABLE dbo.KQ_DefineClassSubHistory (
       ID_KEY               int IDENTITY,
       Class_No             varchar(6)  NOT NULL,
       Day_ClassNo          varchar(6)  NULL,
       Worktime_Date        varchar(10) NOT NULL,
       OfWeek               varchar(2)  NULL,
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_DefineClassSubHistory_DateIndex')
CREATE INDEX KQ_DefineClassSubHistory_DateIndex ON dbo.KQ_DefineClassSubHistory
(
       Worktime_Date                  ASC
)
go

IF OBJECT_ID('dbo.KQ_SupplyTimeHistory') IS NULL
CREATE TABLE dbo.KQ_SupplyTimeHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Supply_Date          varchar(10) NULL,
       Supply_Time          varchar(5) NOT NULL,
       Supply_Reason        varchar(40) NULL,
       Supply_Class         smallint NOT NULL DEFAULT 0,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_SupplyTimeHistory_DateIndex')
CREATE INDEX KQ_SupplyTimeHistory_DateIndex ON dbo.KQ_SupplyTimeHistory
(
       Supply_Date                    ASC
)
go

IF OBJECT_ID('dbo.KQ_LeaveHistory') IS NULL
CREATE TABLE dbo.KQ_LeaveHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Kind_No              varchar(4) NULL,
       Leave_Date           varchar(10) NULL,
       Leave_Hour           float NOT NULL,
       IsOutLeave           bit NOT NULL DEFAULT 0,
       Leave_Sect           tinyint NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Leave_TimeBgn        varchar(20) null,
       Leave_TimeEnd        varchar(20) null,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_LeaveHistory_DateIndex')
CREATE INDEX KQ_LeaveHistory_DateIndex ON dbo.KQ_LeaveHistory
(
       Leave_Date                     ASC
)
go

IF OBJECT_ID('dbo.KQ_OvertimeHistory') IS NULL
CREATE TABLE dbo.KQ_OvertimeHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Over_Date            varchar(10) NULL,
       Over_Hour            float NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_OvertimeHistory_DateIndex')
CREATE INDEX KQ_OvertimeHistory_DateIndex ON dbo.KQ_OvertimeHistory
(
       Over_Date                      ASC
)
go

IF OBJECT_ID('dbo.KQ_AdjustRestHistory') IS NULL
CREATE TABLE dbo.KQ_AdjustRestHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Adjust_Date          varchar(10) NULL,
       Adjust_Class         tinyint NOT NULL DEFAULT 0,
       Adjust_Hour          float NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_AdjustRestHistory_DateIndex')
CREATE INDEX KQ_AdjustRestHistory_DateIndex ON dbo.KQ_AdjustRestHistory
(
       Adjust_Date                    ASC
)
go

IF OBJECT_ID('dbo.KQ_FillAttendHistory') IS NULL
CREATE TABLE dbo.KQ_FillAttendHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Fill_Date            varchar(10) NULL,
       Fill_Class           tinyint NOT NULL DEFAULT 0,
       Fill_Hour            float NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_FillAttendHistory_DateIndex')
CREATE INDEX KQ_FillAttendHistory_DateIndex ON dbo.KQ_FillAttendHistory
(
       Fill_Date                      ASC
)
go

IF OBJECT_ID('dbo.KQ_AdjustClassHistory') IS NULL
CREATE TABLE dbo.KQ_AdjustClassHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Adjust_Date          varchar(10) NULL,
       Class_No             varchar(6) NOT NULL,
       Remark               varchar(100) NULL,
       User_No              varchar(20) NULL,
       Update_Date          datetime NULL DEFAULT GETDATE(),
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_AdjustClassHistory_DateIndex')
CREATE INDEX KQ_AdjustClassHistory_DateIndex ON dbo.KQ_AdjustClassHistory
(
       Adjust_Date                      ASC
)
go

IF OBJECT_ID('dbo.KQ_DownloadHistory') IS NULL
CREATE TABLE dbo.KQ_DownloadHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Card_No              varchar(12) NULL,
       Brush_Date           varchar(10) NOT NULL,
       Brush_Time           varchar(5) NOT NULL,
       Moc_No               varchar(3) NOT NULL,
       Data_Flag            smallint NOT NULL,
       Brush_DateTime       datetime NULL,
       Is_Falsity           BIT DEFAULT 0,
       FileName             VARCHAR(128),       
       PRIMARY KEY (ID_KEY ASC)
	 ON "PRIMARY"
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_KQ_DownloadHistory')
CREATE INDEX IX_KQ_DownloadHistory ON dbo.KQ_DownloadHistory
(
       Card_No                        ASC,
       Brush_Date                     ASC,
       Brush_Time                     ASC
)
	 ON "PRIMARY"
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_KQ_DownloadHistory_Date')
CREATE INDEX IX_KQ_DownloadHistory_Date ON dbo.KQ_DownloadHistory
(
       Brush_Date                     ASC
)
go

IF OBJECT_ID('dbo.KQ_BrushCardHistory') IS NULL
CREATE TABLE dbo.KQ_BrushCardHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NOT NULL,
       Card_No              varchar(12) NULL,
       Brush_Date           varchar(10) NULL,
       Brush_Data           varchar(256) NULL,
       PRIMARY KEY (ID_KEY ASC)
	 ON "PRIMARY"
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_BrushCardHistory_DateIndex')
CREATE INDEX KQ_BrushCardHistory_DateIndex ON dbo.KQ_BrushCardHistory
(
       Brush_Date                     ASC
)
go

IF OBJECT_ID('dbo.KQ_DailyHistory') IS NULL
CREATE TABLE dbo.KQ_DailyHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       Worktime_Date        varchar(10) NULL,
       OfWeek               varchar(2) NULL,
       Class_No             varchar(6) NOT NULL,
       Class_Data           varchar(256) NULL,
       Sect1_InFact         varchar(16) NULL,
       Sect1_OutFact        varchar(16) NULL,
       Sect2_InFact         varchar(16) NULL,
       Sect2_OutFact        varchar(16) NULL,
       Sect3_InFact         varchar(16) NULL,
       Sect3_OutFact        varchar(16) NULL,
       Sect4_InFact         varchar(16) NULL,
       Sect4_OutFact        varchar(16) NULL,
       Sect5_InFact         varchar(16) NULL,
       Sect5_OutFact        varchar(16) NULL,
       Must_Work            float NULL,
       Fact_Work            float NULL,
       Absent_Work          float NULL,
       Reason               varchar(40) NULL,
       Leave_Hour           float NULL,
       Leave_Data           varchar(40) NULL,
       Leave_Name           varchar(40) NULL,
       Overtime_Hour        float NULL,
       Overtime_Class       varchar(1) NULL,
       Late_Minute          float NULL,
       Late_Data            varchar(30) NULL,
       Early_Minute         float NULL,
       Early_Data           varchar(30) NULL,
       Brush_Data           varchar(256) NOT NULL,
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_DailyHistory_DateIndex')
CREATE INDEX KQ_DailyHistory_DateIndex ON dbo.KQ_DailyHistory
(
       Worktime_Date                  ASC
)
go

IF OBJECT_ID('dbo.KQ_InOutDataHistory') IS NULL
CREATE TABLE dbo.KQ_InOutDataHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       Card_No              varchar(12) NULL,
       Brush_Date           varchar(10) NOT NULL,
       Data_In              varchar(256) NULL,
       Data_Out             varchar(256) NULL,
       PRIMARY KEY (ID_KEY ASC)
	 ON "PRIMARY"
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_InOutDataHistory_DateIndex')
CREATE INDEX KQ_InOutDataHistory_DateIndex ON dbo.KQ_InOutDataHistory
(
       Brush_Date                     ASC
)
go

IF OBJECT_ID('dbo.KQ_MonthlyHistory') IS NULL
CREATE TABLE dbo.KQ_MonthlyHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       MustWork_Hour        float NULL,
       MustWork_Days        float NULL,
       FactWork_Hour        float NULL,
       FactWork_Days        float NULL,
       AbsentWork_Hour      float NULL,
       AbsentWork_Days      float NULL,
       Overtime_Hour        float NULL,
       Overtime_Days        float NULL,
       Overrest_Hour        float NULL,
       Overrest_Days        float NULL,
       Overholiday_Hour     float NULL,
       Overholiday_Days     float NULL,
       Late1_Minute         float NULL,
       Late1_Times          tinyint NULL,
       Late2_Minute         float NULL,
       Late2_Times          tinyint NULL,
       Late3_Minute         float NULL,
       Late3_Times          tinyint NULL,
       Early1_Minute        float NULL,
       Early1_Times         tinyint NULL,
       Early2_Minute        float NULL,
       Early2_Times         tinyint NULL,
       Early3_Minute        float NULL,
       Early3_Times         tinyint NULL,
       TotalLate_Minute     float NULL,
       TotalLate_Times      tinyint NULL,
       TotalEarly_Minute    float NULL,
       TotalEarly_Times     tinyint NULL,
       J101_Hour            float NULL,
       J101_Days            float NULL,
       J102_Hour            float NULL,
       J102_Days            float NULL,
       J103_Hour            float NULL,
       J103_Days            float NULL,
       J104_Hour            float NULL,
       J104_Days            float NULL,
       J105_Hour            float NULL,
       J105_Days            float NULL,
       J106_Hour            float NULL,
       J106_Days            float NULL,
       J107_Hour            float NULL,
       J107_Days            float NULL,
       J108_Hour            float NULL,
       J108_Days            float NULL,
       J109_Hour            float NULL,
       J109_Days            float NULL,
       J110_Hour            float NULL,
       J110_Days            float NULL,
       J111_Hour            float NULL,
       J111_Days            float NULL,
       J112_Hour            float NULL,
       J112_Days            float NULL,
       J113_Hour            float NULL,
       J113_Days            float NULL,
       J114_Hour            float NULL,
       J114_Days            float NULL,
       J115_Hour            float NULL,
       J115_Days            float NULL,
       J116_Hour            float NULL,
       J116_Days            float NULL,
       J117_Hour            float NULL,
       J117_Days            float NULL,
       J118_Hour            float NULL,
       J118_Days            float NULL,
       TotalLeave_Hour      float NULL,
       TotalLeave_Days      float NULL,
       A                    smallint NULL,
       B                    smallint NULL,
       C                    smallint NULL,
       D                    smallint NULL,
       E                    smallint NULL,
       F                    smallint NULL,
       G                    smallint NULL,
       H                   smallint NULL,
       I                    smallint NULL,
       J                    smallint NULL,
       K                    smallint NULL,
       L                    smallint NULL,
       Account_Code         varchar(20) NULL,
       PRIMARY KEY (ID_KEY ASC)
)
go

IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'KQ_MonthlyHistory_DateIndex')
CREATE INDEX KQ_MonthlyHistory_DateIndex ON dbo.KQ_MonthlyHistory
(
       Account_Code                   ASC
)
go

IF OBJECT_ID('dbo.KQ_ModifyMonthly') IS NULL
   CREATE TABLE dbo.KQ_ModifyMonthly (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       MustWork_Hour        float NULL,
       MustWork_Days        float NULL,
       FactWork_Hour        float NULL,
       FactWork_Days        float NULL,
       AbsentWork_Hour      float NULL,
       AbsentWork_Days      float NULL,
       Overtime_Hour        float NULL,
       Overtime_Days        float NULL,
       Overrest_Hour        float NULL,
       Overrest_Days        float NULL,
       Overholiday_Hour     float NULL,
       Overholiday_Days     float NULL,
       Late1_Minute         float NULL,
       Late1_Times          tinyint NULL,
       Late2_Minute         float NULL,
       Late2_Times          tinyint NULL,
       Late3_Minute         float NULL,
       Late3_Times          tinyint NULL,
       Early1_Minute        float NULL,
       Early1_Times         tinyint NULL,
       Early2_Minute        float NULL,
       Early2_Times         tinyint NULL,
       Early3_Minute        float NULL,
       Early3_Times         tinyint NULL,
       TotalLate_Minute     float NULL,
       TotalLate_Times      tinyint NULL,
       TotalEarly_Minute    float NULL,
       TotalEarly_Times     tinyint NULL,
       J101_Hour            float NULL,
       J101_Days            float NULL,
       J102_Hour            float NULL,
       J102_Days            float NULL,
       J103_Hour            float NULL,
       J103_Days            float NULL,
       J104_Hour            float NULL,
       J104_Days            float NULL,
       J105_Hour            float NULL,
       J105_Days            float NULL,
       J106_Hour            float NULL,
       J106_Days            float NULL,
       J107_Hour            float NULL,
       J107_Days            float NULL,
       J108_Hour            float NULL,
       J108_Days            float NULL,
       J109_Hour            float NULL,
       J109_Days            float NULL,
       J110_Hour            float NULL,
       J110_Days            float NULL,
       J111_Hour            float NULL,
       J111_Days            float NULL,
       J112_Hour            float NULL,
       J112_Days            float NULL,
       J113_Hour            float NULL,
       J113_Days            float NULL,
       J114_Hour            float NULL,
       J114_Days            float NULL,
       J115_Hour            float NULL,
       J115_Days            float NULL,
       J116_Hour            float NULL,
       J116_Days            float NULL,
       J117_Hour            float NULL,
       J117_Days            float NULL,
       J118_Hour            float NULL,
       J118_Days            float NULL,
       TotalLeave_Hour      float NULL,
       TotalLeave_Days      float NULL,
       A                    smallint NULL,
       B                    smallint NULL,
       C                    smallint NULL,
       D                    smallint NULL,
       E                    smallint NULL,
       F                    smallint NULL,
       G                    smallint NULL,
       H                    smallint NULL,
       I                    smallint NULL,
       J                    smallint NULL,
       K                    smallint NULL,
       L                    smallint NULL, 
       Account_Code         varchar(20) NULL,
       PRIMARY KEY (ID_KEY ASC)
)
GO

IF OBJECT_ID('dbo.KQ_ModifyMonthlyHistory') IS NULL
   CREATE TABLE dbo.KQ_ModifyMonthlyHistory (
       ID_KEY               int IDENTITY,
       Person_ID            int NULL,
       MustWork_Hour        float NULL,
       MustWork_Days        float NULL,
       FactWork_Hour        float NULL,
       FactWork_Days        float NULL,
       AbsentWork_Hour      float NULL,
       AbsentWork_Days      float NULL,
       Overtime_Hour        float NULL,
       Overtime_Days        float NULL,
       Overrest_Hour        float NULL,
       Overrest_Days        float NULL,
       Overholiday_Hour     float NULL,
       Overholiday_Days     float NULL,
       Late1_Minute         float NULL,
       Late1_Times          tinyint NULL,
       Late2_Minute         float NULL,
       Late2_Times          tinyint NULL,
       Late3_Minute         float NULL,
       Late3_Times          tinyint NULL,
       Early1_Minute        float NULL,
       Early1_Times         tinyint NULL,
       Early2_Minute        float NULL,
       Early2_Times         tinyint NULL,
       Early3_Minute        float NULL,
       Early3_Times         tinyint NULL,
       TotalLate_Minute     float NULL,
       TotalLate_Times      tinyint NULL,
       TotalEarly_Minute    float NULL,
       TotalEarly_Times     tinyint NULL,
       J101_Hour            float NULL,
       J101_Days            float NULL,
       J102_Hour            float NULL,
       J102_Days            float NULL,
       J103_Hour            float NULL,
       J103_Days            float NULL,
       J104_Hour            float NULL,
       J104_Days            float NULL,
       J105_Hour            float NULL,
       J105_Days            float NULL,
       J106_Hour            float NULL,
       J106_Days            float NULL,
       J107_Hour            float NULL,
       J107_Days            float NULL,
       J108_Hour            float NULL,
       J108_Days            float NULL,
       J109_Hour            float NULL,
       J109_Days            float NULL,
       J110_Hour            float NULL,
       J110_Days            float NULL,
       J111_Hour            float NULL,
       J111_Days            float NULL,
       J112_Hour            float NULL,
       J112_Days            float NULL,
       J113_Hour            float NULL,
       J113_Days            float NULL,
       J114_Hour            float NULL,
       J114_Days            float NULL,
       J115_Hour            float NULL,
       J115_Days            float NULL,
       J116_Hour            float NULL,
       J116_Days            float NULL,
       J117_Hour            float NULL,
       J117_Days            float NULL,
       J118_Hour            float NULL,
       J118_Days            float NULL,
       TotalLeave_Hour      float NULL,
       TotalLeave_Days      float NULL,
       A                    smallint NULL,
       B                    smallint NULL,
       C                    smallint NULL,
       D                    smallint NULL,
       E                    smallint NULL,
       F                    smallint NULL,
       G                    smallint NULL,
       H                    smallint NULL,
       I                    smallint NULL,
       J                    smallint NULL,
       K                    smallint NULL,
       L                    smallint NULL, 
       Account_Code         varchar(20) NULL,
       PRIMARY KEY (ID_KEY ASC)
)
GO



