%
' MyPAYE
' Module: UserEmployeeTabAccess.asp
'
' This software is the copyright of Mr T J Sheppard and may not be copied, duplicated or
' modified other than as permitted in the licence agreement.
'
' © 2012 - 2023 Mr T J Sheppard
' Lyndale House
' Church Street
' Bradwell
' Hope Valley
' S33 9HJ
'
' Tel 0845 643 5191
' Email Support@MyPAYE.co.uk
'
' MyPAYE is a Registered Trademark of MyPAYE Ltd
'-------------------------------------------------------------------
'
' Updated 13 June 2023
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Description - This module displays the Employee tabs that the displayed user is permitted to access
'
' Amendment Log
'------------------------------------------------------------------------------------------
' Date | Name | Vers. | Description
'------------------------------------------------------------------------------------------
' 09/01/13 | TJS | 3.0.00 | Page added
' 01/06/14 | TJS | 4.0.00 | Modified for new styling and operation without framesets
' 19/09/14 | TJS | 4.0.03 | Modified to cater for Hide_HR_Functions field on Employer
' | and to use fieldset rather than nested tables for iPad compatibility
' 05/10/14 | TJS | 4.0.04 | Modified for Encrypted Employer ID check
' 29/04/15 | TJS | 4.0.14 | Added set/clear all boxes button
' 26/11/15 | TJS | 5.0.00 | Modified to cater for separate User_Permissions table
' 10/10/17 | TJS | 5.1.10 | Corrected conflict where PSID param was used for both PaySlipID and PenSchID on new employee wizard
' 17/04/18 | TJS | 5.2.03 | Modified to cater for MenuPayrollExists on MainMenu.asp
' 20/10/19 | TJS | 5.7.00 | Modified to use GetMainMenuParam to save having to read lots of parameters for each page build
' 07/12/19 | TJS | 5.7.02 | Modified to prevent editing if user doesn't have user admin permissions or AddNewEdit is set to Disp
' 25/02/20 | TJS | 5.7.04 | Modified to cater for Partner only reports on Multi Employer Overview
' 30/05/20 | TJS | 5.8.00 | Modified for new styling - added centered class on body and modified to replace stylesheet.css, mainmenu.css and buttons-css.asp with BodyAndMenu-css.asp
' 09/04/21 | TJS | 5.9.09 | Modified to cater for View_Employee_Documents_Tab and Edit_Employee_Documents_Tab fields on user_permissions table
' | and to use ASPDotNet/UpdateUserRole.ashx , ASPDOTNET/LogOut.aspx and ASPDOTNET/AgencyCancel.aspx pages
' 17/04/21 | TJS | 5.9.09a | Modified to detect if some access allowed and adjust initial Set/Clear All button text accordingly
' 11/12/21 | TJS | 5.9.15 | Modified to cater for Request_Holiday_Or_Leave field and added label tags for checkboxes so clicking on the text sets/clears the box
' 13/06/23 | TJS | 5.9.24 | Modified to cater for no menus and re-reun payroll when opened from employee User Details page
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
PageID = 50525
NoBack = True
SessionID = request.querystring("ID")
SessionVarsID = RemoveHTML(request.querystring("SV"))
SourceFrame = RemoveHTML(request.querystring("S"))
DestFrame = RemoveHTML(request.querystring("D"))
UserID = CheckURLDBIDField(RemoveHTML(request.querystring("UID")), "UserID")
EmployeeID = CheckURLDBIDField(RemoveHTML(request.querystring("EE")), "EmployeeID")
EmployerID = CheckURLDBIDField(RemoveHTML(request.querystring("ER")), "EmployerID")
%>
<%GetSessionVarsIDRecord(SessionVarsID)%>
<%
AddNewEdit = RemoveHTML(request.querystring("ANE"))
CancelPage = RemoveHTML(request.querystring("CPge"))
FailureFields = RemoveHTML(request.querystring("FFld"))
' don't remove HTML yet as we use
to identify text for an alert box
FailureMessage = request.querystring("FMsg")
RerunPayroll = RemoveHTML(request.querystring("RrP")) ' TJS 13/06/23
WithMenus = RemoveHTML(request.querystring("WthMnu")) ' TJS 13/06/23
Function GetDBField(FieldName, ControlName)
if FailureFields <> "" and (AddNewEdit = "Add" or AddNewEdit = "Edit") then
if ControlName = "UserGenTabAccess" or ControlName = "UserGenTabNameAddrEdit" or ControlName = "UserGenTabPersDetEdit" or _
ControlName = "UserGenTabBankDetEdit" or ControlName = "UserGenTabTaxNIEmplEdit" or ControlName = "UserPrevEmplTabAccess" or _
ControlName = "UserPrevEmplTabEdit" or ControlName = "UserTotYTDTabAccess" or ControlName = "UserTotYTDTabEdit" or _
ControlName = "UserHolidayTabAccess" or ControlName = "UserHolidayTabEdit" or ControlName = "UserSSPSickTabAccess" or _
ControlName = "UserSSPSickTabEdit" or ControlName = "UserParentalTabAccess" or ControlName = "UserParentalTabEdit" or _
ControlName = "UserAttachTabAccess" or ControlName = "UserAttachTabEdit" or ControlName = "UserPensionTabAccess" or _
ControlName = "UserPensionTabEdit" or ControlName = "UserAddlPersTabAccess" or ControlName = "UserAddlPersTabEdit" or _
ControlName = "UserContactsTabAccess" or ControlName = "UserContactsTabEdit" or ControlName = "UserJobHistTabAccess" or _
ControlName = "UserJobHistTabEdit" or ControlName = "UserTrainingTabAccess" or ControlName = "UserTrainingTabEdit" or _
ControlName = "UserDisciplineTabAccess" or ControlName = "UserDisciplineTabEdit" or ControlName = "UserNotesTabAccess" or _
ControlName = "UserNotesTabEdit" or ControlName = "UserP9DTabAccess" or ControlName = "UserP9DTabEdit" or _
ControlName = "UserP11DTabAccess" or ControlName = "UserP11DTabEdit" or ControlName = "UserDocsTabAccess" or _
ControlName = "UserDocsTabEdit" or ControlName = "UserReqHolLeave" then ' TJS 11/12/21
if RemoveHTML(request.querystring(ControlName)) = "ON" then
GetDBField = -1
else
GetDBField = 0
end if
else
GetDBField = RemoveHTML(request.querystring(ControlName))
end if
elseif "" & FieldName <> "" then
' return recordset value
GetDBField = rsUserDetails(FieldName)
end if
end Function
sql = "SELECT " & UserTableMenuPermissionFields & ", User_Title, User_Fore_Name, User_Last_Name, Employer_ID, Edit_Employee_General_Tab_Name_Address, " ' TJS 01/06/14
sql = sql & "User_Role_ID, Edit_Employee_General_Tab_Pers_Details, Edit_Employee_General_Tab_Bank_Details, Edit_Employee_General_Tab_Tax_NI_Employ, " ' TJS 07/12/19
sql = sql & "Edit_Employee_Prev_Employ_Tab, Edit_Employee_Totals_YTD_Tab, Edit_Employee_Holidays_Tab, Request_Holiday_Or_Leave, Edit_Employee_Sick_Pay_Tab, " ' TJS 01/06/14 TJS 11/12/21
sql = sql & "Edit_Employee_Parental_Pay_Tab, Edit_Employee_Attachments_Tab, Edit_Employee_Pensions_Tab, Edit_Employee_Addl_Pers_Tab, " ' TJS 01/06/14
sql = sql & "Edit_Employee_Contacts_Tab, Edit_Employee_Job_History_Tab, Edit_Employee_Training_Tab, Edit_Employee_Discipline_Tab, Edit_Employee_Notes_Tab, " ' TJS 01/06/14
sql = sql & "View_Employee_Documents_Tab, Edit_Employee_Documents_Tab, Edit_Employee_P9D_Tab, Edit_Employee_P11D_Tab, User_Perm_ID FROM " & DBSchema & "Users INNER JOIN " ' TJS 26/11/15 TJS 09/04/21
sql = sql & DBSchema & "User_Permissions ON Users.User_ID = User_Permissions.User_ID AND (Employee_Employer_ID = '' OR Employee_Employer_ID = '" ' TJS 26/11/15
sql = sql & EncodeEmployerID(UserPermissionsTable, EmployerID) & "') WHERE Users.User_ID = " & UserID ' TJS 01/06/14 TJS 26/11/15
sql = sql & " AND User_Permissions.Deleted = 0 ORDER BY Employee_Employer_ID DESC" ' TJS 26/11/15
set rsUserDetails = OpenRecordset(objConn, sql)
UserName = ""
if "" & DecryptData(rsUserDetails("User_Title")) <> "" then
UserName = UserName & DecryptData(rsUserDetails("User_Title")) & " "
end if
if "" & DecryptData(rsUserDetails("User_Fore_Name")) <> "" then
UserName = UserName & DecryptData(rsUserDetails("User_Fore_Name")) & " "
end if
UserName = UserName & DecryptData(rsUserDetails("User_Last_Name"))
' start of code added TJS 01/06/14
sql = "SELECT " & EmployerTableMenuOptionFields & " FROM " & DBSchema & "Employers WHERE Employer_ID = " & EmployerID
set rsEmployer = OpenRecordset(objConn, sql)
' get details for user who is logged in
sql = "SELECT " & UserTableMenuPermissionFields & " FROM " & DBSchema & "Users INNER JOIN " & DBSchema & "User_Permissions " ' TJS 26/11/15
sql = sql & "ON Users.User_ID = User_Permissions.User_ID AND (Employee_Employer_ID = '' OR Employee_Employer_ID = '" ' TJS 26/11/15
sql = sql & EncodeEmployerID(UserPermissionsTable, EmployerID) & "') WHERE Users.User_ID = " & GetSessionVar("UserID") ' TJS 26/11/15
sql = sql & " AND User_Permissions.Deleted = 0 ORDER BY Employee_Employer_ID DESC" ' TJS 26/11/15
set rsUser = OpenRecordset(objConn, sql)
' end of code added TJS 01/06/14
ReadMainMenuParams SessionVarsID, cBool(rsUser("User_Admin")), (cBool(rsUser("Run_Payroll")) or cBool(rsUser("Payroll_EOY")) or cBool(rsUser("CIS_Returns"))), _
cBool(rsUser("Run_Payroll")), rsUser("Support_User_ID") ' TJS 20/10/19
' start of code added TJS 07/12/19
if AddNewEdit <> "Edit" then
ReadOnly=" readonly"
AllowChanges = false
else
ReadOnly=""
AllowChanges = true
end if
' end of code added TJS 07/12/19
bSomeAccessAllowed = false ' TJS 17/04/21
bSomeEditsAllowed = false ' TJS 17/04/21
response.Expires = -1500
response.Expiresabsolute = Now() - 2
response.AddHeader "pragma", "no-cache"
response.AddHeader "cache-control", "no-store"
response.CacheControl = "no-cache"
%>