<% ' 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" %> User Employee Detail Tab Access <%if CheckBrowserVersion("MSIE", 8, true, false, false) then ' [if LT IE 8]%> <%end if if CheckBrowserVersion("MSIE", 7, true, true, false) then ' [if lte IE 7]%> <%end if if "" & GetSessionVar("PathModifier") <> "" then%> Partner-CSS.asp" /> <%end if%> <%if "" & WithMenus <> "No" then ' TJS 13/06/23%> <%end if%> "No" then ' TJS 30/05/20 TJS 13/06/23%>class="centered"<%else%>style="width:1190px; margin:auto; text-align:center;"<%end if%>> <%if "" & WithMenus <> "No" then ' TJS 13/06/23%> <%MenuShowHome = true MenuShowEmployer = true MenuShowFindEmployee = true MenuShowUsers = true MenuShowCreate = true MenuShowCreatePayroll = true MenuShowCreateEmployer = true MenuShowCreateUser = true MenuShowHMRC = true MenuShowReports = true MenuPartnerReportsOnly = false ' TJS 25/02/20 MenuShowPayrollData = true MenuShowTools = true MenuShowSupport = true MenuSelected = "" MenuEmployerExists = true MenuShowAccount = true%> <%' start of code added TJS 13/06/23 else%> <%end if ' end of code added TJS 13/06/23%>
/Secure/ASPDotNet/UpdateEmployeeTabAccess.ashx"> ">
<%if not cBool(rsEmployer("Hide_HR_Functions")) then ' TJS 19/09/14%> <%end if%> <%if not cBool(rsEmployer("Hide_HR_Functions")) then ' TJS 19/09/14%> <%' start of code added TJS 09/04/21%> <%' end of code added TJS 09/04/21 end if%> <%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%> <%end if ' start of code added TJS 07/12/19 if rsUserDetails("User_Role_ID") <> 0 then%> <%end if ' end of code added TJS 07/12/19%>

User Employee Detail Tab Access for <%=UserName%>

This User is allowed to access the following Employee tabs :-
Employee Tab   Permit Viewing
of Tab Contents
Permit Editing of Tab Contents
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">      onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">      onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">      onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>EditHolChng()<%else%>undoclick(this)<%end if%>"><%' start of code added TJS 11/12/21 if cBool(rsEmployer("Enable_Holiday_Approval")) then%>  onclick="<%if AllowChanges and rsUser("User_Admin") then%>ReqHolLeaveChng()<%else%>undoclick(this)<%end if%>"> <%else%> ON<%else%>OFF<%end if%>"> <%end if ' end of code added TJS 11/12/21%>
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
  onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">   onclick="<%if AllowChanges and rsUser("User_Admin") then ' TJS 07/12/19%>datachanged()<%else%>undoclick(this)<%end if%>">
    <%if bSomeAccessAllowed then ' TJS 17/04/21%>Clear All<%else%>Set All<%end if%> <%if bSomeEditsAllowed then ' TJS 17/04/21%>Clear All<%else%>Set All<%end if%>
User permissions are Role based and cannot be edited directly

Update Close

<% ReleaseASPEncrypt rsUserDetails.close rsUser.close rsEmployer.close set rsUserDetails = nothing set rsUser = nothing set rsEmployer = nothing SaveSessionVarsRecord SessionVarsID objConn.close set objConn = nothing%>