Staff Utilisation Reports

These require Visual Studio 2015 unless stated otherwise
VS 2015 should be available as part of your campus agreement
Post Reply
User avatar
robinwilson16
Site Admin
Posts: 184
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16

Staff Utilisation Reports

Post by robinwilson16 » Mon Oct 17, 2016 9:23 am

I have attached Staff Utilisation Reports in case they are of use to other UNIT-e Colleges.

They have been written directly in SQL and do not use RepGens.

Here is a preview of what they look like when run:

Summary:
StaffUtilisation1.png
StaffUtilisation1.png (45.44 KiB) Viewed 84 times
By Faculty:
StaffUtilisation2.png
StaffUtilisation2.png (46.23 KiB) Viewed 84 times
By Staff Member:
StaffUtilisation3.png
StaffUtilisation3.png (68.95 KiB) Viewed 84 times
Attachments
STA003 - Staff Utilisation by Staff Register.rdl
(305.88 KiB) Downloaded 37 times
STA002 - Staff Utilisation by Staff Member.rdl
(266.39 KiB) Downloaded 38 times
STA001 - Staff Utilisation by Faculty.rdl
(219.48 KiB) Downloaded 36 times

User avatar
robinwilson16
Site Admin
Posts: 184
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16

Re: Staff Utilisation Reports

Post by robinwilson16 » Mon Oct 17, 2016 9:27 am

You will also need to add these table valued functions somewhere:

Code: Select all

USE [GC]
GO
/****** Object:  UserDefinedFunction [dbo].[iFUN_ActivityStaffFaculties]    Script Date: 17/10/2016 09:26:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER FUNCTION [dbo].[iFUN_ActivityStaffFaculties] (
	@Session VARCHAR(10), 
	@StaffCode VARCHAR(20)
)
RETURNS TABLE
AS
RETURN

	--DECLARE @StaffCode VARCHAR(20) = '017518'

	SELECT
		Faculties = 
			STUFF (
				(
					SELECT DISTINCT
						', ' + FAC.d_reference
					FROM ulive.dbo.capd_staff STF2
					INNER JOIN ulive.dbo.capd_staffactivity STFA
						ON STFA.sa_activitystaff = STF2.s_id
					INNER JOIN ulive.dbo.capd_activity A
						ON A.a_id = STFA.sa_activity
					INNER JOIN ulive.dbo.capd_moduleactivity MA
						ON MA.ma_activity = A.a_id
					INNER JOIN ulive.dbo.capd_module GRP
						ON GRP.m_id = MA.ma_activitymodule
					INNER JOIN ulive.dbo.capd_department FAC
						ON FAC.d_id = GRP.m_moduledept
					WHERE 
						STF2.s_id = STF.s_id
						AND GRP.m_start <= LEFT ( @Session, 2 ) + RIGHT ( @Session, 2 ) + '-07-31'
						AND GRP.m_end >= LEFT ( @Session, 4 ) + '-08-01'​​
					ORDER BY ', ' + FAC.d_reference FOR XML PATH(''),
					TYPE 
				).value('.','varchar(max)') ,1,2, '' 
			)
	FROM ulive.dbo.capd_staff STF
	WHERE
		STF.s_staffreference = @StaffCode
	GROUP BY
		STF.s_id

Code: Select all

USE [GC]
GO
/****** Object:  UserDefinedFunction [dbo].[iFUN_ActivityRooms]    Script Date: 17/10/2016 09:27:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER FUNCTION [dbo].[iFUN_ActivityRooms] (
	@ActivityID numeric(16, 0)
)
RETURNS TABLE
AS
RETURN

SELECT
	Rooms = 
		STUFF (
			(
				SELECT DISTINCT
					', ' + RM.r_reference
				FROM ulive.dbo.capd_roomregister RREG2
				INNER JOIN ulive.dbo.capd_room RM
					ON RM.r_id = RREG2.rr_room
				WHERE 
					RREG2.rr_activity = RREG.rr_activity
				ORDER BY ', ' + RM.r_reference FOR XML PATH(''),
				TYPE 
			).value('.','varchar(max)') ,1,2, '' 
		)
FROM ulive.dbo.capd_roomregister RREG
INNER JOIN ulive.dbo.capd_room RM
	ON RM.r_id = RREG.rr_room
WHERE
	RREG.rr_activity = @ActivityID
GROUP BY
	RREG.rr_activity

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests