CNCEC_SUBQHSE_WUHUAN/DataBase/版本日志/SUBQHSE_V2025-07-16-gf.sql

43 lines
1.2 KiB
Transact-SQL

alter table Information_MillionsMonthlyReport add KeyWorkNum int null
alter table Information_MillionsMonthlyReport add KeyWorkOKNum int null
alter table Information_MillionsMonthlyReport add KeyWorkOKRate nvarchar(20) null
GO
/*************企业百万工时安全统计月报表**************/
ALTER VIEW [dbo].[View_Information_MillionsMonthlyReport]
AS
SELECT
Report.MillionsMonthlyReportId,
Report.UnitId,
Report.FillingDate,
Report.UpState,
(ISNULL(Group_0008.ConstText,'-') + ISNULL(Group_0009.ConstText,'-')) AS ReportDate,
Group_0008.ConstText as YearStr,
Group_0009.ConstText as MonthStr,
U.UnitName,
Report.Year,
Report.Month,
Report.DutyPerson,
Report.RecordableIncidentRate,
Report.LostTimeRate,
Report.LostTimeInjuryRate,
Report.DeathAccidentFrequency,
Report.AccidentMortality,
Report.HandleState,
Report.HandleMan,
Report.KeyWorkNum,
Report.KeyWorkOKNum,
Report.KeyWorkOKRate,
US.UserName
FROM dbo.Information_MillionsMonthlyReport AS Report
LEFT JOIN Base_Unit AS U ON U.UnitId=Report.UnitId
LEFT JOIN Sys_Const AS Group_0008 ON Group_0008.GroupId='0008' AND Group_0008.ConstValue =Report.[Year]
LEFT JOIN Sys_Const AS Group_0009 ON Group_0009.GroupId='0009' AND Group_0009.ConstValue =Report.[Month]
LEFT JOIN Sys_User AS US ON US.UserId=Report.HandleMan
GO