if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GLogData]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GLogData]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Group_Emp]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Group_Emp]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SLog]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Salary_TaxSet]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Salary_TaxSet]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Salary_Type]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Salary_Type]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Salary_UnFixed]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Salary_UnFixed]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Salary_base]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Salary_base]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Salary_formula]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Salary_formula]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Salary_month]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Salary_month]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_day]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_day]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_flex]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_flex]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_holidaySet]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_holidaySet]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_leave]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_leave]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_leaveType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_leaveType]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_leavetotal]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_leavetotal]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_month]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_month]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_overTimeTotal]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_overTimeTotal]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_overTimeType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_overTimeType]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_overtime]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_overtime]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_period]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_period]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_scheduleClass]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_scheduleClass]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_yearSchedule]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_yearSchedule]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[door_group]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[door_group]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[door_key]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[door_key]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[door_period]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[door_period]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[empschedule]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[empschedule]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[group_period]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[group_period]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[hum_Enroll]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[hum_Enroll]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[hum_department]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[hum_department]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[hum_employee]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[hum_employee]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pay_month]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[pay_month]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[r_device]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[r_device]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[salary]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[salary]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[systemUser]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[systemUser]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ts_device]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ts_device]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_schedule]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_schedule]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[att_day_temp]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[att_day_temp]
GO

CREATE TABLE [dbo].[att_schedule](
	[ID] [uniqueidentifier] NOT NULL,
	[YEAR] [varchar](50) NOT NULL,
	[MONTH] [varchar](50) NOT NULL,
	[DAY] [varchar](50) NOT NULL,
	[SCHEDULEID] [int] NOT NULL,
	[YEARID] [int] NOT NULL
) ON [PRIMARY]

GO
 
CREATE TABLE [dbo].[att_day_temp](
[id] [int] IDENTITY(1,1) NOT NULL,
[empid] [int] NULL,
[empno] [varchar](50) NULL,
[empname] [nvarchar](50) NULL,
[deptno] [varchar](50) NULL,
[deptname] [nvarchar](50) NULL,
[scheduleid] [int] NULL,
[scheduletype] [varchar](50) NULL,
[schedulename] [nvarchar](50) NULL,
[attdate] [datetime] NULL,
[checkin] [datetime] NULL,
[checkout] [datetime] NULL,
[shouldpresent] [float] NULL,
[present] [float] NULL,
[absent] [float] NULL,
[lateinnum] [int] NULL,
[latein] [int] NULL,
[earlyoutnum] [int] NULL,
[earlyout] [int] NULL
) ON [PRIMARY]

GO


CREATE TABLE [dbo].[GLogData] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[deviceid] [int] NULL ,
	[MachineNo] [int] NULL ,
	[EnrollNo] [int] NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[recordType] [int] NULL ,
	[deptno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[VerifyMode] [int] NULL ,
	[InoutMode] [int] NULL ,
	[LogTime] [datetime] NULL ,
	[repairid] [int] NULL ,
	[repairoperator] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[repairreason] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[repairdate] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Group_Emp] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[deviceID] [int] NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[groupid] [int] NULL ,
	[period1] [int] NULL ,
	[period2] [int] NULL ,
	[period3] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SLog] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[deviceid] [int] NULL ,
	[MachineNo] [int] NULL ,
	[SEnrollNo] [int] NULL ,
	[GEnrollNo] [int] NULL ,
	[Manipulation] [int] NULL ,
	[BackNo] [int] NULL ,
	[LogTime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Salary_TaxSet] (
	[id] [int] NOT NULL ,
	[colCumnName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[startPrice] [float] NULL ,
	[taxBegin] [float] NULL ,
	[taxEnd] [float] NULL ,
	[cess] [float] NULL ,
	[deductmoney] [float] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Salary_Type] (
	[id] [int] NOT NULL ,
	[proID] [int] NULL ,
	[proName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[isShow] [int] NULL ,
	[proType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[colType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[tableType] [int] NULL ,
	[isSave] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Salary_UnFixed] (
	[id] [int] NOT NULL ,
	[empid] [int] NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[YearMonth] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[UnfixProgram1] [float] NULL ,
	[UnfixProgram2] [float] NULL ,
	[UnfixProgram3] [float] NULL ,
	[UnfixProgram4] [float] NULL ,
	[UnfixProgram5] [float] NULL ,
	[UnfixProgram6] [float] NULL ,
	[UnfixProgram7] [float] NULL ,
	[UnfixProgram8] [float] NULL ,
	[UnfixProgram9] [float] NULL ,
	[UnfixProgram10] [float] NULL ,
	[UnfixProgram11] [float] NULL ,
	[UnfixProgram12] [float] NULL ,
	[UnfixProgram13] [float] NULL ,
	[UnfixProgram14] [float] NULL ,
	[UnfixProgram15] [float] NULL ,
	[OperatorID] [int] NULL ,
	[operatorEmpno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[operatorName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[operatorTime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Salary_base] (
	[id] [int] NOT NULL ,
	[empid] [int] NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[fixProgram1] [float] NULL ,
	[fixProgram2] [float] NULL ,
	[fixProgram3] [float] NULL ,
	[fixProgram4] [float] NULL ,
	[fixProgram5] [float] NULL ,
	[fixProgram6] [float] NULL ,
	[fixProgram7] [float] NULL ,
	[fixProgram8] [float] NULL ,
	[fixProgram9] [float] NULL ,
	[fixProgram10] [float] NULL ,
	[fixProgram11] [float] NULL ,
	[fixProgram12] [float] NULL ,
	[fixProgram13] [float] NULL ,
	[fixProgram14] [float] NULL ,
	[fixProgram15] [float] NULL ,
	[OperatorID] [int] NULL ,
	[operatorEmpno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[operatorName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[operatorTime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Salary_formula] (
	[id] [int] NOT NULL ,
	[salaryID] [int] NULL ,
	[formulaStr] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Salary_month] (
	[id] [int] NOT NULL ,
	[Months] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[workday] [float] NULL ,
	[restday] [float] NULL ,
	[totalday] [float] NULL ,
	[workTime] [float] NULL ,
	[restTime] [float] NULL ,
	[totalTime] [float] NULL ,
	[remark] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[startdate] [datetime] NULL ,
	[endate] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_day] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[empid] [int] NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[attdate] [datetime] NULL ,
	[scheduleid] [int] NULL ,
	[scheduletype] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[schedulename] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[checkin] [datetime] NULL ,
	[checkout] [datetime] NULL ,
	[shouldpresent] [float] NULL ,
	[present] [float] NULL ,
	[absent] [float] NULL ,
	[lateinnum] [int] NULL ,
	[latein] [int] NULL ,
	[earlyoutnum] [int] NULL ,
	[earlyout] [int] NULL ,
	[generalovertime] [float] NULL ,
	[restovertime] [float] NULL ,
	[holidayovertime] [float] NULL ,
	[generaltime] [float] NULL ,
	[resttime] [float] NULL ,
	[holidaytime] [float] NULL ,
	[actualtime] [float] NULL ,
	[leavetype] [int] NULL ,
	[lavepayleave] [float] NULL ,
	[nopayleave] [float] NULL ,
	[operatorid] [int] NULL ,
	[operatorname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[updatetime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_flex] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[scheduleID] [int] NULL ,
	[startID] [int] NULL ,
	[startName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[endID] [int] NULL ,
	[endname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[maxTime] [float] NULL ,
	[minTime] [float] NULL ,
	[workType] [int] NULL ,
	[ignoreTime] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_holidaySet] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[holidayDate] [smalldatetime] NULL ,
	[holidayStopDate] [smalldatetime] NULL ,
	[holidayName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[holidayType] [int] NULL ,
	[dept] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[remark] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_leave] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[documentno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[leavedate] [datetime] NULL ,
	[starttime] [datetime] NULL ,
	[endtime] [datetime] NULL ,
	[leavetype] [int] NULL ,
	[leavetime] [float] NULL ,
	[remark] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[operatorid] [int] NULL ,
	[operatorName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[updatetime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_leaveType] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[leaveType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[leaveName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[payType] [int] NULL ,
	[remark] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_leavetotal] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[leavemonth] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[startdate] [datetime] NULL ,
	[enddate] [datetime] NULL ,
	[r1] [float] NULL ,
	[r2] [float] NULL ,
	[r3] [float] NULL ,
	[r4] [float] NULL ,
	[r5] [float] NULL ,
	[r6] [float] NULL ,
	[r7] [float] NULL ,
	[r8] [float] NULL ,
	[r9] [float] NULL ,
	[r10] [float] NULL ,
	[r11] [float] NULL ,
	[r12] [float] NULL ,
	[r13] [float] NULL ,
	[r14] [float] NULL ,
	[r15] [float] NULL ,
	[r16] [float] NULL ,
	[remark] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[operatorid] [int] NULL ,
	[operatorname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[updatetime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_month] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[empid] [int] NULL ,
	[empname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[attmonth] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[startdate] [datetime] NULL ,
	[enddate] [datetime] NULL ,
	[shouldpresent] [float] NULL ,
	[present] [float] NULL ,
	[absent] [float] NULL ,
	[absentnum] [int] NULL ,
	[worktime] [float] NULL ,
	[latein] [float] NULL ,
	[lateinnum] [int] NULL ,
	[earlyout] [float] NULL ,
	[earlyoutnum] [int] NULL ,
	[generalovertime] [float] NULL ,
	[restovertime] [float] NULL ,
	[holidayovertime] [float] NULL ,
	[generaltime] [float] NULL ,
	[resttime] [float] NULL ,
	[holidaytime] [float] NULL ,
	[havepayleave] [float] NULL ,
	[nopayleave] [float] NULL ,
	[actualtime] [float] NULL ,
	[operatorid] [int] NULL ,
	[operatorname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[updatetime] [datetime] NULL ,
	[remark] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_overTimeTotal] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[OverTimemonth] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[startdate] [datetime] NULL ,
	[enddate] [datetime] NULL ,
	[r1] [float] NULL ,
	[r2] [float] NULL ,
	[r3] [float] NULL ,
	[r4] [float] NULL ,
	[r5] [float] NULL ,
	[r6] [float] NULL ,
	[remark] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[operatorid] [int] NULL ,
	[operatorname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[updatetime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_overTimeType] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[overTimeType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[overTimeName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[payType] [int] NULL ,
	[remark] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_overtime] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[documentno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empid] [int] NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[overtimedate] [datetime] NULL ,
	[starttime] [datetime] NULL ,
	[endtime] [datetime] NULL ,
	[overtimetype] [int] NULL ,
	[overtime] [float] NULL ,
	[remark] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[operatorid] [int] NULL ,
	[operatorname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[updatetime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_period] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[scheduleID] [int] NULL ,
	[name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[checkin] [datetime] NULL ,
	[checkout] [datetime] NULL ,
	[aheadtime] [datetime] NULL ,
	[delaytime] [datetime] NULL ,
	[fixdin] [int] NULL ,
	[fixedout] [int] NULL ,
	[standin] [int] NULL ,
	[standout] [int] NULL ,
	[startabsence] [int] NULL ,
	[startnowork] [int] NULL ,
	[endabsence] [int] NULL ,
	[endnowork] [int] NULL ,
	[latetype] [int] NULL ,
	[worktime] [int] NULL ,
	[spanday] [int] NULL ,
	[ConvertHour] [float] NULL ,
	[convertday] [int] NULL ,
	[aheadovertime] [int] NULL ,
	[aheadovertimecheck] [int] NULL ,
	[delayovertime] [int] NULL ,
	[delayovertimecheck] [int] NULL ,
	[fixInIsSpan] [int] NULL ,
	[fixOutIsSpan] [int] NULL ,
	[isOverTimePeriod] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_scheduleClass] (
	[scheduleID] [int] NOT NULL ,
	[scheduleName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[color] [int] NULL ,
	[scheduleKind] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[att_yearSchedule] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Data] [image] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[door_group] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[groupSerial] [int] NULL ,
	[deviceID] [int] NULL ,
	[GroupName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[GroupDes] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[door_key] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[deviceid] [int] NULL ,
	[serial] [int] NULL ,
	[group1] [int] NULL ,
	[group2] [int] NULL ,
	[group3] [int] NULL ,
	[group4] [int] NULL ,
	[group5] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[door_period] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[deviceID] [int] NULL ,
	[serial] [int] NULL ,
	[w1s] [datetime] NULL ,
	[w1e] [datetime] NULL ,
	[w2s] [datetime] NULL ,
	[w2e] [datetime] NULL ,
	[w3s] [datetime] NULL ,
	[w3e] [datetime] NULL ,
	[w4s] [datetime] NULL ,
	[w4e] [datetime] NULL ,
	[w5s] [datetime] NULL ,
	[w5e] [datetime] NULL ,
	[w6s] [datetime] NULL ,
	[w6e] [datetime] NULL ,
	[w7s] [datetime] NULL ,
	[w7e] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[empschedule] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[userid] [int] NULL ,
	[yearscheduleid] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[group_period] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[groupID] [int] NULL ,
	[periodID] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[hum_Enroll] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[EMachineNumber] [int] NULL ,
	[EnrollNumber] [int] NULL ,
	[EnrollType] [int] NULL ,
	[Privilige] [int] NULL ,
	[Password] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[FpData] [image] NULL ,
	[EnrollName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[hum_department] (
	[deptno] [varchar] (32) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[deptname] [varchar] (64) COLLATE Chinese_PRC_CI_AS NULL ,
	[parentno] [varchar] (32) COLLATE Chinese_PRC_CI_AS NULL ,
	[sortno] [int] NULL ,
	[amount] [decimal](12, 0) NULL ,
	[amount_plan] [decimal](12, 0) NULL ,
	[administrator] [varchar] (32) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptduty] [varchar] (254) COLLATE Chinese_PRC_CI_AS NULL ,
	[remark] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[scheduleid] [varchar] (32) COLLATE Chinese_PRC_CI_AS NULL ,
	[weekrest] [varchar] (32) COLLATE Chinese_PRC_CI_AS NULL ,
	[schflag] [varchar] (32) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[hum_employee] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[EmpNo] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[EmpName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[EmpSex] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[DeptNo] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[DeptName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[EmpPhoto] [image] NULL ,
	[l1] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[l2] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[l3] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[l4] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[l5] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[l6] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[l7] [datetime] NULL ,
	[l8] [datetime] NULL ,
	[l9] [datetime] NULL ,
	[l10] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[pay_month] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[months] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[workDay] [float] NULL ,
	[workTime] [float] NULL ,
	[restDay] [float] NULL ,
	[restTime] [float] NULL ,
	[totalDay] [float] NULL ,
	[totalTime] [int] NULL ,
	[startDate] [datetime] NULL ,
	[endDate] [datetime] NULL ,
	[remark] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[r_device] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[Num] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[CI] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[SI] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[HI] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[CodeStr] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[Rdate] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[salary] (
	[id] [int] NOT NULL ,
	[empid] [int] NULL ,
	[empname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[empno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptno] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[attmonth] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[startdate] [datetime] NULL ,
	[enddate] [datetime] NULL ,
	[shouldpresent] [float] NULL ,
	[present] [float] NULL ,
	[absent] [float] NULL ,
	[absentnum] [int] NULL ,
	[worktime] [float] NULL ,
	[latein] [float] NULL ,
	[lateinnum] [int] NULL ,
	[earlyout] [float] NULL ,
	[earlyoutnum] [int] NULL ,
	[generalovertime] [float] NULL ,
	[restovertime] [float] NULL ,
	[holidayovertime] [float] NULL ,
	[generaltime] [float] NULL ,
	[resttime] [float] NULL ,
	[holidaytime] [float] NULL ,
	[havepayleave] [float] NULL ,
	[nopayleave] [float] NULL ,
	[actualtime] [float] NULL ,
	[l1] [float] NULL ,
	[l2] [float] NULL ,
	[l3] [float] NULL ,
	[l4] [float] NULL ,
	[l5] [float] NULL ,
	[l6] [float] NULL ,
	[l7] [float] NULL ,
	[l8] [float] NULL ,
	[l9] [float] NULL ,
	[l10] [float] NULL ,
	[l11] [float] NULL ,
	[l12] [float] NULL ,
	[l13] [float] NULL ,
	[l14] [float] NULL ,
	[l15] [float] NULL ,
	[l16] [float] NULL ,
	[gl1] [float] NULL ,
	[gl2] [float] NULL ,
	[gl3] [float] NULL ,
	[gl4] [float] NULL ,
	[gl5] [float] NULL ,
	[gl6] [float] NULL ,
	[gl7] [float] NULL ,
	[gl8] [float] NULL ,
	[gl9] [float] NULL ,
	[gl10] [float] NULL ,
	[gl11] [float] NULL ,
	[gl12] [float] NULL ,
	[gl13] [float] NULL ,
	[gl14] [float] NULL ,
	[gl15] [float] NULL ,
	[ul1] [float] NULL ,
	[ul2] [float] NULL ,
	[ul3] [float] NULL ,
	[ul4] [float] NULL ,
	[ul5] [float] NULL ,
	[ul6] [float] NULL ,
	[ul7] [float] NULL ,
	[ul8] [float] NULL ,
	[ul9] [float] NULL ,
	[ul10] [float] NULL ,
	[ul11] [float] NULL ,
	[ul12] [float] NULL ,
	[ul13] [float] NULL ,
	[ul14] [float] NULL ,
	[ul15] [float] NULL ,
	[sl1] [float] NULL ,
	[sl2] [float] NULL ,
	[sl3] [float] NULL ,
	[sl4] [float] NULL ,
	[sl5] [float] NULL ,
	[sl6] [float] NULL ,
	[sl7] [float] NULL ,
	[sl8] [float] NULL ,
	[sl9] [float] NULL ,
	[sl10] [float] NULL ,
	[sl11] [float] NULL ,
	[sl12] [float] NULL ,
	[sl13] [float] NULL ,
	[sl14] [float] NULL ,
	[sl15] [float] NULL ,
	[operatorid] [int] NULL ,
	[operatorname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[updatetime] [datetime] NULL ,
	[remark] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[systemUser] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[username] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[password] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[authority] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ts_device] (
	[dev_serial] [int] IDENTITY (1, 1) NOT NULL ,
	[dev_type] [int] NULL ,
	[dev_name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[dev_code] [int] NULL ,
	[dev_licence] [int] NULL ,
	[dev_host] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[dev_ip] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[dev_port] [int] NULL ,
	[dev_add] [int] NULL ,
	[dev_baudrate] [int] NULL ,
	[dev_password] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[dev_state] [int] NULL ,
	[dev_jc] [int] NULL ,
	[dev_text] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[dev_log] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[dev_link] [int] NULL ,
	[dev_devrulezu] [int] NULL ,
	[dev_devrulezuc] [int] NULL ,
	[dev_devrulezuo] [int] NULL ,
	[dev_devrulezul] [int] NULL ,
	[dev_cs] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[dev_admin] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[gly_no] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[dev_update] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[GLogData] ADD 
	CONSTRAINT [PK_GLogData] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Group_Emp] ADD 
	CONSTRAINT [PK_Group_Emp] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[SLog] ADD 
	CONSTRAINT [PK_SLog] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Salary_TaxSet] ADD 
	CONSTRAINT [PK_Salary_TaxSet] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Salary_Type] ADD 
	CONSTRAINT [DF_Salary_fixType_isShow] DEFAULT (0) FOR [isShow],
	CONSTRAINT [DF_Salary_Type_isSave] DEFAULT (0) FOR [isSave],
	CONSTRAINT [PK_Salary_fixType] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Salary_UnFixed] ADD 
	CONSTRAINT [PK_Salary_UnFixed] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Salary_base] ADD 
	CONSTRAINT [PK_Salary_base] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Salary_formula] ADD 
	CONSTRAINT [PK_Salary_formula] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Salary_month] ADD 
	CONSTRAINT [PK_Salary_month] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_day] ADD 
	CONSTRAINT [PK_att_day] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_flex] ADD 
	CONSTRAINT [PK_att_flex] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_holidaySet] ADD 
	CONSTRAINT [PK_att_holidaySet] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_leave] ADD 
	CONSTRAINT [PK_att_leave] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_leaveType] ADD 
	CONSTRAINT [PK_att_leaveType] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_leavetotal] ADD 
	CONSTRAINT [PK_att_leavetotal] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_month] ADD 
	CONSTRAINT [PK_att_month] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_overTimeTotal] ADD 
	CONSTRAINT [PK_att_overTimeTotal] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_overTimeType] ADD 
	CONSTRAINT [PK_att_overTimeType] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_overtime] ADD 
	CONSTRAINT [PK_att_overtime] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_period] ADD 
	CONSTRAINT [PK_att_period] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_scheduleClass] ADD 
	CONSTRAINT [PK_att_scheduleClass] PRIMARY KEY  CLUSTERED 
	(
		[scheduleID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[att_yearSchedule] ADD 
	CONSTRAINT [PK_att_yearSchedule] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[door_group] ADD 
	CONSTRAINT [PK_door_group] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[door_key] ADD 
	CONSTRAINT [PK_door_key] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[door_period] ADD 
	CONSTRAINT [PK_door_period] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[empschedule] ADD 
	CONSTRAINT [PK_empschedule] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[group_period] ADD 
	CONSTRAINT [PK_group_period] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[hum_Enroll] ADD 
	CONSTRAINT [PK_hum_Enroll] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[hum_department] ADD 
	CONSTRAINT [PK_hum_department] PRIMARY KEY  CLUSTERED 
	(
		[deptno]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[hum_employee] ADD 
	CONSTRAINT [PK_hum_employee] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[pay_month] ADD 
	CONSTRAINT [PK_pay_month] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[r_device] ADD 
	CONSTRAINT [PK_r_device] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[salary] ADD 
	CONSTRAINT [PK_salary] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[systemUser] ADD 
	CONSTRAINT [PK_systemUser] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ts_device] ADD 
	CONSTRAINT [PK_ts_device] PRIMARY KEY  CLUSTERED 
	(
		[dev_serial]
	)  ON [PRIMARY] 
GO


ALTER TABLE [dbo].[att_schedule] ADD  CONSTRAINT [DF_att_schedule_ID]  DEFAULT (newid()) FOR [ID]
GO

ALTER TABLE [dbo].[att_schedule] ADD  CONSTRAINT [DF_att_schedule_YEARID]  DEFAULT ((0)) FOR [YEARID]
GO



INSERT INTO att_overTimeType (overtimeType,overtimeName,paytype) values('01','NormalWork','1');
GO

INSERT INTO att_overTimeType (overtimeType,overtimeName,paytype) values('02','WeekendWork','1');
GO

INSERT INTO att_overTimeType (overtimeType,overtimeName,paytype) values('03','FestivalWork','1');
GO

INSERT INTO att_overTimeType (overtimeType,overtimeName,paytype) values('04','NormalOvertime','1');
GO

INSERT INTO att_overTimeType (overtimeType,overtimeName,paytype) values('05','WeekendOvertime','1');
GO

INSERT INTO att_overTimeType (overtimeType,overtimeName,paytype) values('06','FestivalOvertime','1');
GO



INSERT INTO att_leaveType (leavetype,leavename,paytype) values('01','AffairLeave','0');
GO

INSERT INTO att_leaveType (leavetype,leavename,paytype) values('02','SickLeave','0');
GO

INSERT INTO att_leaveType (leavetype,leavename,paytype) values('03','BusinessLeave','1');
GO

INSERT INTO att_leaveType (leavetype,leavename,paytype) values('04','InjuryLeave','1');
GO

INSERT INTO att_leaveType (leavetype,leavename,paytype) values('05','HomeLeave','1');
GO

INSERT INTO att_leaveType (leavetype,leavename,paytype) values('06','MarriageLeave','1');
GO



INSERT INTO att_leaveType (leavetype,leavename,paytype) values('07','MaternityLeave','1');
GO

INSERT INTO att_leaveType (leavetype,leavename,paytype) values('08','BereavementLeave','1');
GO

INSERT INTO att_leaveType (leavetype,leavename,paytype) values('09','AnnualLeave','1');
GO

INSERT INTO att_leaveType (leavetype,leavename,paytype) values('10','OfficialLeave','1');
GO

INSERT INTO att_scheduleclass values(1,'RestDay',16761024,'0001');
GO
GO

INSERT INTO systemuser values('ss','d48U+lPRrsRbgF3E7HIgmA==','NG1tCv1fNF4lRr2kikmDLk1jvGvEodETt4MaxonVk/Enc3DYlWrzrXRD1Vy2FEaf87QeJskmQAVgpN78LzgkC4KaHBQcA2mHvJoPFQKTBT8=');
GO

INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (1, 1, 0, 1, 1, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (2, 2, 0, 1, 2, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (3, 3, 0, 1, 3, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (4, 4, 0, 1, 4, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (5, 5, 0, 1, 5, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (6, 6, 0, 1, 6, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (7, 7, 0, 1, 7, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (8, 8, 0, 1, 8, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (9, 9, 0, 1, 9, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (10, 10, 0, 1, 10, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (11, 11, 0, 1, 11, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (12, 12, 0, 1, 12, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (13, 13, 0, 1, 13, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (14, 14, 0, 1, 14, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (15, 15, 0, 1, 15, 0)



INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (16, 1, 0, 2, 1, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (17, 2, 0, 2, 2, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (18, 3, 0, 2, 3, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (19, 4, 0, 2, 4, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (20, 5, 0, 2, 5, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (21, 6, 0, 2, 6, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (22, 7, 0, 2, 7, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (23, 8, 0, 2, 8, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (24, 9, 0, 2, 9, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (25, 10, 0, 2, 10, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (26, 11, 0, 2, 11, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (27, 12, 0, 2, 12, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (28, 13, 0, 2, 13, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (29, 14, 0, 2, 14, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (30, 15, 0, 2, 15, 0)


INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (31, 1, 0, 3, 1, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (32, 2, 0, 3, 2, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (33, 3, 0, 3, 3, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (34, 4, 0, 3, 4, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (35, 5, 0, 3, 5, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (36, 6, 0, 3, 6, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (37, 7, 0, 3, 7, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (38, 8, 0, 3, 8, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (39, 9, 0, 3, 9, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (40, 10, 0, 3, 10, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (41, 11, 0, 3, 11, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (42, 12, 0, 3, 12, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (43, 13, 0, 3, 13, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (44, 14, 0, 3, 14, 0)
INSERT INTO Salary_Type
      (id, proID, isShow, proType, tableType, isSave)
VALUES (45, 15, 0, 3, 15, 0)
go


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TS_GETALLSHIFT]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[TS_GETALLSHIFT]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TS_GETYEAESCHEDULE]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[TS_GETYEAESCHEDULE]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TS_SAVEYEARSCHEDULE]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[TS_SAVEYEARSCHEDULE]
GO

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE TS_GETALLSHIFT
 AS 
	SELECT 
	[scheduleID],[scheduleName],[color]
	 FROM att_scheduleClass
 
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE TS_GETYEAESCHEDULE
(@id int)
 AS 
	SELECT 
	 *
	 FROM att_yearschedule where id=@id
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

CREATE   PROCEDURE TS_SAVEYEARSCHEDULE
(
@id int,
@Name nvarchar(255),
@Data image = null
)
AS
if @id=0
begin
	insert att_yearschedule values(
		@Name,		
		@Data )
end 
else 
begin
update  att_yearschedule set name=@name ,data=@data where id=@id
end
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO





