Link to home
Create AccountLog in
Avatar of Stacie
StacieFlag for United States of America

asked on

I'm trying to understand this simple vb code!

I'm trying to understand the following code bellow when the following text is displayed... NO ROLE PLANS ASSIGNED

<%@ Language=VBScript %>

<%Response.Buffer =true%>

<%Response.Expires=0%>
<html>
<head>

<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">


<link rel="stylesheet" type="text/css" href="css/master.css">
    <link rel="stylesheet" type="text/css" href="css/globalNav.css">
    <script language="JavaScript" type="text/javascript" src="js/global.js"></script>
    <script language="JavaScript" type="text/javascript" src="js/globalNav.js"></script>

<script language="javascript">
// Set these to true to enable debugging or tracing

function change_form_action(targetpage) {
document.form1.action = targetpage;
}
function change_action(targetpage) {
document.form1.action = targetpage;
}
function goBack() {
    window.history.back();
}

function popit1a( UID, CID, RID, PCID, EID)  {
  //  var winpops = window.open("RMK_Dept_Review.asp?rekn=" + rekn, "",  "toolbar=no,width=400,height=400,resizable=no,top=200,left=100");
    window.location = "http://TEST/LDA/CAN_DEV.asp?UID=" + UID + "&CID=" + CID + "&RID=" + RID + "&PCID=" + PCID + "&EID=" + EID;
 //  alert("test");
        } 
function popit1b(UID, CRID, RID, PCID,EID) {
    //  var winpops = window.open("RMK_Dept_Review.asp?rekn=" + rekn, "",  "toolbar=no,width=400,height=400,resizable=no,top=200,left=100");
    window.location = "http://TEST/LDA/CAN_CHEK.asp?UID=" + UID + "&CR_ID=" + CRID + "&RID=" + RID + "&PCID=" + PCID + "&EID=" + EID;
    //  alert("test");
}
</script>
</head>
<title></title>
<!--#include file="includes/topNav1.inc"-->
<!--#include file="includes/DB_Connect.asp"-->
<body onload="init();">
<%UID=Request.QueryString("UID")
Division=Request.QueryString("Division")
CID=Request.QueryString("CID")
    PCID=Request.QueryString("PCID")
    EID=Request.QueryString("EID")
        DPER=Request.QueryString("DPER")
    RID=Request.QueryString("RID")
    
 '   response.write("PCID=" & PCID) %>
<%DIM NUID%>
<%DIM SBU%>
<%Dim K%>
<%DPER=Request.QueryString("DPER") %>
    <%IF DPER="" then DPER=90 %>
<%K=1%>
<table  cellpadding=7>
<% j="Yes" %>
<tr><td valign=top>

<tr><td>
<INPUT  type= "submit"  value= "Return To Me" id= submit6 name= submit6 class = "LDAButton2e" onclick = "location.href='startmenu.asp?UID=<%=UID%>&CID=<%=CID%>&PCID=<%=PCID%>'"></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td class="Subhead1b">&nbsp;&nbsp;&nbsp;  CANDIDATE&nbsp; DEVELOPMENT PLANS</td>
    </tr></table>

 <form id="form1" name="form1"  method="post" action="MYRoles.asp?UID=<%=UID%>&PCID=<%=PCID%>">


<%  Dim FieldCount
    
%>

<table border="1" cellpadding="10" cellspacing="0" width="860" >

<tr bgcolor="#fffffc">

<td bgcolor="#ffefd3" rowspan="2" width="27%" colspan="2" height="50" class="TableHeadText"><font color="navy"><B>Candidate Name</b></font></td>
<td bgcolor="#ffefd3" rowspan="2" width="28%" colspan="2" class="TableHeadText" nowrap><font color="navy"><B>Target Role</B></font></td>
<td bgcolor="#ffefd3" rowspan="2" width="27%" colspan="2" class="TableHeadText" nowrap><font color="navy"><B>Reporting To</B></font></td>
    <td bgcolor="#ffefd3" rowspan="2" width="7%" colspan="2" class="TableHeadText" nowrap><font color="navy"><B>Date Assigned</B></font></td>

    <td bgcolor="#ffefd3" rowspan="2" width="7%" colspan="2" class="TableHeadText" nowrap><font color="navy"><B>Last Status<br />Update</B></font></td>
    <td bgcolor="#ffefd3" rowspan="2" width="7%" colspan="2" class="TableHeadText" nowrap><font color="navy"><B>Assigned By</B></font></td>
    <td bgcolor="#ffefd3" rowspan="2" width="7%" class="TableHeadText"><font color="navy"><b>Succession Status</b></font></td></tr>
    <td bgcolor="#ffefd3" rowspan="2" width="7%" class="TableHeadText"><font color="navy"><b>Check In</b></font></td></tr>
    <tr>


</tr>
 
<%'strSQL="SELECT LDA_ROLE.ID, LDA_ROLE.JobTitle, LDA_CANDI.Name, LDA_CANDI.CUR_TITLE"
  '  strSQL=strSQL & " FROM LDA_ROLE INNER JOIN LDA_CANDI ON LDA_CANDI.MGR_ID = LDA_ROLE.MGR_ID where lda_role.MGR_ID='" & UID & "'" %>

<% set oRs4 = server.CreateObject ("ADODB.Recordset") %>
<% set oRs3 = server.CreateObject ("ADODB.Recordset") %>
<% set oRs8 = server.CreateObject ("ADODB.Recordset") %>
    <%strSQL1="Select Name from LDA_CANDI where PCHEX_ID='" & EID & "'" %>
    <%'response.write(strSQL1) %>
    <%oRs4.Open strSQL1, hrDSN %>
    <%CNAME=oRs4("NAME")
        oRs4.Close %>
 <%   strSQL ="Select ID, ROLE_ID from LDA_CAN_ROLE where CAN_ID='" & EID & "'"%>
    <%'response.write(strSQL) %>
<% oRs4.Open strSQL, hrDSN
    Do while not oRs4.eof
    RID=oRs4("Role_ID")%>
    <tr>
<%

IF DPER="999" then
    iF IsAdmin=1 then
        strSQL3="Select LDA_ROLE.ID,LDA_ROLE.JobTitle,SupervisorName As ReportsTo, LDA_CAN_ROLE.ID as Expr1, LDA_CAN_ROLE.Assign_Date As Expr2, LDA_CAN_ROLE.Assign_by as Expr3 From LDA_ROLE inner join LDA_CAN_ROLE on LDA_CAN_ROLE.ROLE_ID=LDA_ROLE.ID inner join performanceevaluation.dbo.paychexOrgchart b on b.employeeID=LDA_CAN_ROLE.CAN_id  where LDA_CAN_ROLE.ROLE_ID='" & RID & "' and LDA_CAN_ROLE.CAN_ID='" & EID & "'"
        strSQL3=strSQL3 & " UNION "
        strSQL3=strSQL3 & "Select LDA_ROLE.ID,LDA_ROLE.JobTitle,SupervisorName As ReportsTo, LDA_CAN_ROLE.ID as Expr1, LDA_CAN_ROLE.Assign_Date As Expr2, LDA_CAN_ROLE.Assign_by as Expr3 From LDA_ROLE inner join LDA_CAN_ROLE on LDA_CAN_ROLE.ROLE_ID=LDA_ROLE.ID inner join performanceevaluation.dbo.P_ORG_REGION b on b.employeeID=LDA_CAN_ROLE.CAN_id  where LDA_CAN_ROLE.ROLE_ID='" & RID & "' and LDA_CAN_ROLE.CAN_ID='" & EID & "'" 
    else

        strSQL3="Select LDA_ROLE.ID,LDA_ROLE.JobTitle, SupervisorName As ReportsTo,LDA_CAN_ROLE.ID as Expr1, LDA_CAN_ROLE.Assign_Date As Expr2, LDA_CAN_ROLE.Assign_by as Expr3 From LDA_ROLE inner join LDA_CAN_ROLE on LDA_CAN_ROLE.ROLE_ID=LDA_ROLE.ID inner join performanceevaluation.dbo.paychexOrgchart b on b.employeeID=LDA_CAN_ROLE.CAN_id  where LDA_CAN_ROLE.ROLE_ID='" & RID & "' and LDA_CAN_ROLE.CAN_ID='" & EID & "' and LDA_CAN_ROLE.SUP_ID='" & PCID & "'"
        strSQL3=strSQL3 & " UNION " 
        strSQL3=strSQL3 & "Select LDA_ROLE.ID,LDA_ROLE.JobTitle, SupervisorName,LDA_CAN_ROLE.ID as Expr1, LDA_CAN_ROLE.Assign_Date As Expr2, LDA_CAN_ROLE.Assign_by as Expr3 From LDA_ROLE inner join LDA_CAN_ROLE on LDA_CAN_ROLE.ROLE_ID=LDA_ROLE.ID inner join performanceevaluation.dbo.P_ORG_REGION b on b.employeeID=LDA_CAN_ROLE.CAN_id  where LDA_CAN_ROLE.ROLE_ID='" & RID & "' and LDA_CAN_ROLE.CAN_ID='" & EID & "' and LDA_CAN_ROLE.SUP_ID='" & PCID & "'"
    end if
else




strSQL3="Select LDA_ROLE.ID,LDA_ROLE.JobTitle, SupervisorName As ReportsTo, LDA_CAN_ROLE.ID as Expr1, LDA_CAN_ROLE.Assign_Date As Expr2, LDA_CAN_ROLE.Assign_by as Expr3 From LDA_ROLE inner join LDA_CAN_ROLE on LDA_CAN_ROLE.ROLE_ID=LDA_ROLE.ID inner join performanceevaluation.dbo.paychexOrgchart b on b.employeeID=LDA_CAN_ROLE.CAN_id  where LDA_CAN_ROLE.ROLE_ID='" & RID & "' and LDA_CAN_ROLE.CAN_ID='" & EID & "'"


strSQL3=strSQL3 & " UNION "


strSQL3=strSQL3 & "Select LDA_ROLE.ID,LDA_ROLE.JobTitle, SupervisorName As ReportsTo, LDA_CAN_ROLE.ID as Expr1, LDA_CAN_ROLE.Assign_Date As Expr2, LDA_CAN_ROLE.Assign_by as Expr3 From LDA_ROLE inner join LDA_CAN_ROLE on LDA_CAN_ROLE.ROLE_ID=LDA_ROLE.ID inner join performanceevaluation.dbo.P_ORG_REGION b on b.employeeID=LDA_CAN_ROLE.CAN_id  where LDA_CAN_ROLE.ROLE_ID='" & RID & "' and LDA_CAN_ROLE.CAN_ID='" & EID & "'" 


end if
'response.write(strSQL3)
oRs3.Open strSQL3, hrDSN %>


        <%If oRs3.EOF=False then %>
<%Do while not oRs3.eof 
    STAT_REP_OK=0
    RID=oRs3("ID")
    CRID=oRs3("Expr1")
            strSQL8="Select * from LDA_CAN_ROLE_GAP where CR_ID='" & CRID & "' and DATEDIFF(D,Tdate,GetDate())>" & DPER & " order by CR_ID"
     '      response.write(StrSQL8)
            oRs8.Open strSQL8, hrDSN
                        If oRs8.EOF=True then
                        STAT_REP_OK=1
                        else
                      end if          
                     oRs8.Close
   ' strSQL8="Select S1,Tdate,Name,LDA_CAN_ROLE_GAP.pchex_id from LDA_CAN_ROLE_GAP inner join lda_candi on lda_candi.pchex_Id=lda_can_role_gap.pchex_sup_id  where CR_ID='" & CRID & "'"
     strSQL8="Select S1,Tdate,Name,LDA_CAN_ROLE_GAP.pchex_id from LDA_CAN_ROLE_GAP inner join lda_candi on lda_candi.pchex_Id=lda_can_role_gap.pchex_sup_id  where lda_can_role_gap.PCHEX_ID='" & EID & "'"
 '      response.write(strSQL8)
    
    oRs8.Open strSQL8, hrDSN
    If not oRs8.eof then
    TDATE=oRs8("Tdate")
    S1=oRs8("S1")
    MGR_NAME=oRs8("Name")
    XID=OrS8("PCHEX_id")
        else
    end if
    oRs8.Close

    %>
            <%strSQL1="Select Name from LDA_CANDI where PCHEX_ID='" & xid & "'" %>
    <%'response.write(strSQL1) %>
    <%oRs8.Open strSQL1, hrDSN %>
    <%CNAME=oRs8("NAME")
        oRs8.Close %>
<td colspan="2"class="TableHeadText"><font color="navy"><b><%=CName%></b></font></td>
<td colspan="2"class="TableHeadText"><font color="navy"><b><%=oRs3("JobTitle")%></b></font></td>
<td colspan="2"class="TableHeadText"><font color="navy"><b><%=oRs3("ReportsTo")%></b></font></td>
<td colspan="2"class="TableHeadText"><font color="navy"><b><%=oRs3("Expr2")%></b></font></td>
        <td colspan="2"class="TableHeadText"><font color="navy"><b><%=TDATE%></b></font></td>
  <%      IF DPER="9999" then%>
 <td colspan="2"class="TableHeadText"><font color="navy"><b><%=PCID%></b></font></td>
        <%else %>
 <td colspan="2"class="TableHeadText"><font color="navy"><b><%=oRs3("Expr3")%></b></font></td>
        <%end if %>
<%if S1=0 then %>
<td><input type="button" class="LDAButton2redsm" onclick="popit1a('<%=UID%>', '<%=CID%>', '<%=oRs3("ID")%>', '<%=PCID%>', '<%=XID%>');"  value="Select"></td>
        <%else if S1=1 then%>
<td><input type="button" class="LDAButton2eyellowsm" onclick="popit1a('<%=UID%>', '<%=CID%>', '<%=oRs3("ID")%>', '<%=PCID%>', '<%=XID%>');"  value="Select"></td>
        <%else if S1>1 then%>
<td><input type="button" class="LDAButton2egreensm" onclick="popit1a('<%=UID%>', '<%=CID%>', '<%=oRs3("ID")%>', '<%=PCID%>', '<%=xid%>');"  value="Select"></td>
        <%end if %>
        <%end if %>
        <%end if %>
        <td><input type="button" class="LDAButton2eblusm" onclick="popit1b('<%=UID%>', '<%=CRID%>', '<%=oRs3("ID")%>', '<%=PCID%>', '<%=xid%>');"   value="Start"></td>
</tr>
    <%STAT_REP_OK=0 %>
  <%oRs3.Movenext
    Loop
    oRs3.Close%>
    <%else %>
    </table>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td class="Subhead1bb"><FONT COLOR=RED>&nbsp;&nbsp;&nbsp;  NO ROLE PLANS ASSIGNED&nbsp;</FONT> </td>
    <%end if %>
<%oRs4.MoveNext
    Loop %>
<br />
     </TABLE>
<table border="0" cellpadding="3" cellspacing="0" width="600" >

    <tr>
        <td></td></tr>
    <tr>
<td><input type="button" class="LDAButton2e" size="1" onclick="goBack()" value="Go Back"></td>
    </tr>
</table>


</body>
</html>

Open in new window

Avatar of aikimark
aikimark
Flag of United States of America image

That's awfully difficult to read.
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer