Project

General

Profile

Feature #3226 » monitoring user.txt

SP nya - Muhammad Bintar, 11/19/2024 03:05 PM

 
1
USE [Bintang_Prod]
2
GO
3
/****** Object:  StoredProcedure [dbo].[MONITORINGUSER]    Script Date: 19/11/2024 15.04.29 ******/
4
SET ANSI_NULLS ON
5
GO
6
SET QUOTED_IDENTIFIER ON
7
GO
8
ALTER PROCEDURE [dbo].[MONITORINGUSER]
9
    (
10
      @UserID VARCHAR(12) ,
11
      @MenuID VARCHAR(10)
12
    )
13
AS 
14

    
15

    
16
--DECLARE @UserID VARCHAR(10) = ''
17
--DECLARE @MenuID VARCHAR(10) = ''
18

    
19
SELECT DISTINCT
20
        mduser.user_id AS UserID,
21
		mduser.format_name AS FormatName,
22
		mduser.emp_id AS EmployeeID,
23
		md01.full_name AS EmployeeName,
24
		mduser.created_by AS CreateBy,
25
		FORMAT(
26
			CAST(SUBSTRING(mduser.created_date, 1, 4) + '-' + 
27
				 SUBSTRING(mduser.created_date, 5, 2) + '-' + 
28
				 SUBSTRING(mduser.created_date, 7, 2) + ' ' + 
29
				 SUBSTRING(mduser.created_date, 9, 2) + ':' + 
30
				 SUBSTRING(mduser.created_date, 11, 2) AS DATETIME),
31
			'dd MMMM yyyy HH:mm', 'id-ID') AS CreateDate,
32
		mduser.user_change AS ChangeBy,
33
		FORMAT(
34
			CAST(SUBSTRING(mduser.last_change, 1, 4) + '-' + 
35
				 SUBSTRING(mduser.last_change, 5, 2) + '-' + 
36
				 SUBSTRING(mduser.last_change, 7, 2) + ' ' + 
37
				 SUBSTRING(mduser.last_change, 9, 2) + ':' + 
38
				 SUBSTRING(mduser.last_change, 11, 2) AS DATETIME),
39
			'dd MMMM yyyy HH:mm', 'id-ID') AS ChangeDate
40

    
41
	
42
FROM    dbo.base_sys_user mduser
43
LEFT  JOIN hr_md_emp_md0001 AS md01 ON mduser.emp_id = md01.emp_id 
44
AND md01.end_date='99991231'
45

    
46
WHERE
47
      ( mduser.user_id = @UserID
48
              OR @UserID = ''
49
            )
(2-2/5)