我有一张桌子,可以通过手动打孔机存储员工的出勤情况。它作为最后一个逻辑中的第一个工作,并显示了员工的出勤率。
现在我想在整个月内准备整个部门的员工出勤表单
管理层提出的表格形式是
Employee Name | 1 | 2 | 3 | 4 | 5 |6 |..... so on to the days in a month
John Carpenter | P | P | A | A | P | LFP
John Seraph A | P | P | A | A | P | LFP
我们在后端有SQL Server 2000,前端是在C#上开发的。我们将使用水晶报告。
表格结构:
tbl_Attendance tbl_department tbl_employee tbl_employeeShifts tbl_leaves tbl_shifts
CREATE TABLE [dbo].[tbl_Attendance] (
[AttendanceID] [bigint] IDENTITY (1, 1) NOT NULL ,
[PNO] [bigint] NULL ,
[AttDate] [datetime] NULL ,
[CurrentShift] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ReaderID] [bigint] NULL ,
[Status] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[flag] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ManualFlag] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_Department] (
[DeptID] [bigint] IDENTITY (1, 1) NOT NULL ,
[DeptName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_Employee] (
[EmpID] [bigint] IDENTITY (1, 1) NOT NULL ,
[PNO] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T1] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T2] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T3] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T4] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T5] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T6] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T7] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T8] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[T9] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CreatedDate] [datetime] NULL ,
[EmpName] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Type] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_EmployeeShifts] (
[EmpShiftID] [bigint] IDENTITY (1, 1) NOT NULL ,
[EmpID] [bigint] NULL ,
[ShiftID] [bigint] NULL ,
[DateFrom] [datetime] NULL ,
[DateTo] [datetime] NULL ,
[CreatedDate] [datetime] NULL ,
[DeptID] [bigint] NULL ,
[flag] [bit] NULL ,
[uFlag] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_LoginTime] (
[LoginTimeID] [bigint] IDENTITY (1, 1) NOT NULL ,
[UserID] [bigint] NULL ,
[LoginTime] [datetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_Permission] (
[EmpPermissionID] [bigint] IDENTITY (1, 1) NOT NULL ,
[EmpID] [bigint] NULL ,
[DateFrom] [datetime] NULL ,
[DateTo] [datetime] NULL ,
[Type] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CreatedDate] [datetime] NULL ,
[flag] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_Shifts] (
[ShiftID] [bigint] IDENTITY (1, 1) NOT NULL ,
[StartShift] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[EndShift] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CreatedDate] [datetime] NULL ,
[GraceTime] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ShiftType] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_UserInfo] (
[UserID] [bigint] IDENTITY (1, 1) NOT NULL ,
[UserName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[UserPassword] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CreatedDate] [datetime] NULL
) ON [PRIMARY]
以上是表格结构。所有我想做一些加入并以这种格式获得报告。
如上所述
对查询逻辑的一点帮助将不胜感激。
答案 0 :(得分:0)