如何以表格形式显示员工出勤情况

本文关键字:情况 显示 表格 | 更新日期: 2023-09-27 18:04:48

我有一个通过手动打孔机存储员工考勤的表。它的工作原理是先入后出逻辑,并显示员工的出勤情况。

现在我要准备全部门员工每月的考勤表

管理层提出的表格形式是

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#开发。我们将使用水晶报告。

Table Structure:

tbl_Attendancetbl_departmenttbl_employeetbl_employeeShiftstbl_leavestbl_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]

是表结构。所有我想做一些连接,并得到这种格式的报告。

如上所述

如果在查询逻辑方面有一点帮助,将不胜感激。

如何以表格形式显示员工出勤情况

你可以使用交叉选项卡报告,这是用于表格格式的。

使用交叉选项卡创建考勤报告

卡例子添加

卡exmple2添加

相关文章: