Please explain me the agent pasted below:-
Sub Initialize
On Error Goto ERRORHAND
Dim ss As New notessession
Dim db As notesdatabase
Dim doc1 As notesdocument
Dim SapNetPay As Double
Set db=ss.currentdatabase
Set vw=db.getView("(config view)")
Set doc1=vw.getfirstdocument
If doc1 Is Nothing Then
connectSAP ="Configuration document does not exist"
End If
Set objServer = New RFCserver
objServer.Destination = doc1.SAPDestination(0)
objServer.HostName= doc1.SAPHost(0)
objServer.System = Val(doc1.SAPSystem(0))
objServer.Client = doc1.SAPClient(0)
objServer.User = doc1.SAPUser(0)
objServer.Language = doc1.SAPLanguage(0)
objServer.Password = doc1.SAPPassword(0)
If objServer.Logon() <> True Then
connectSAP="Logon error : " & objServer.Message
End If
'----------------------------------------
' CALLING EMPLOYEE DATA
Dim vw1 As notesview
Dim doc As notesdocument
Dim doc2 As notesdocument
Dim nm As notesname
Dim nm1 As notesname
Set vw1=db.getview("(EmpRelationView)")
Set doc=ss.documentcontext
Set doc2=vw1.getdocumentbykey(doc.empid(0),True)
If doc2 Is Nothing Then
Print "<h1>"+"Invalid Employee Number. Please check your Employee ID"+"</h1>"
Print "<br><h4><a href=http://10.1.1.36/onlinepay.nsf/PaySlip?OpenForm>Try Again</a>"
Exit Sub
'Print "Invalid Employee Number. Please check your Employee ID"
Else
Set nm = New notesname(doc.initiator(0))
Set nm1= New notesname(doc2.LotusUser(0))
If Not nm.abbreviated=nm1.abbreviated And Not nm.abbreviated="Purna Mehta/AUCKLAND/hpl/IN" And Not nm.abbreviated="Gopichand Talasila/hpl/IN" Then
Print "<h1>"+"This ID does not belong to you or your name not match with PAB. Please contact Administrator" +"</h1>"
Print "<br><h4><a href=http://10.1.1.36/onlinepay.nsf/PaySlip?OpenForm>Try Again</a>"
Exit Sub
End If
'Print "Valid Employee Number"
End If
Dim RfcCompanyDetails As RFCfunction
Dim DetailedInfo As RFCStructure
'Dim doc As notesdocument
Dim name1 As String
Dim name2 As String
Dim name3 As String
Dim name4 As String
Dim eval4 As String
'Set doc=ss.documentcontext
eval1=Cint(doc.empid(0))
eval3=Cstr(doc.year(0))
name3= doc.FNAME1(0)
name4= doc.LNAME1(0)
Set RfcCompanyDetails = New RFCfunction(objServer, "BAPI_GET_EMPLOYEE_DATA")
RfcCompanyDetails.Exports("PERSON_ID").Value = Cint(eval1)
RfcCompanyDetails.Exports("Selection_Begin").Value = Format(Now,"yyyymmdd")
RfcCompanyDetails.Exports("Selection_End").Value = Format(Now,"yyyymmdd")
'SETTING PAY DATA
Dim RfcPayDetails As RFCfunction
Dim DetailedInfos As RfcStructure
Dim tblcustomer_t As RFCtable
Dim allrows As RfcRowCollection
If (doc.year(0)="2007" ) Then
SDT="04/01/2007"
EDT="03/31/2008"
Else
SDT="04/01/2008"
EDT="03/31/2009"
End If
Set RfcPayDetails=New RFCfunction(objServer,"Z_GET_INVESTMENT")
RfcPayDetails.Exports("EMPNO").Value = Cint(eval1)
RfcPayDetails.Exports("ST_DT").Value =Format(SDT,"yyyymmdd")
RfcPayDetails.Exports("END_DT").Value = Format(EDT,"yyyymmdd")
'CALLING EMPLOYEE DETAILS
If RfcCompanyDetails.Call = True Then
Set DetailedInfo = RfcCompanyDetails.Imports ("PERSONAL_DATA")
name2= Cstr(RfcCompanyDetails.Imports("FNAME").value)
name1=Cstr(RfcCompanyDetails.Imports("LNAME").value)
doc.validate="yes"
doc.empfname=Cstr(RfcCompanyDetails.Imports("FNAME").value)
doc.emplname=Cstr(RfcCompanyDetails.Imports("LNAME").value)
doc.empdept=Cstr(RfcCompanyDetails.Imports ("DEPARTMENT").value)
doc.emploc=Cstr(RfcCompanyDetails.Imports ("ZLOCATION").value)
doc.empgrade=Cstr(RfcCompanyDetails.Imports("EMPGRADE").value)
doc.empno= Cstr(doc.empid(0))
If (doc.year(0)="2007" ) Then
doc.month1="Investment Details For Financial Year 2007-08"
Else
doc.month1="Investment Details For Financial Year 2008-09"
End If
'doc.month1=Cstr(doc.month(0))
'doc.year1=Cstr(doc.year(0))
End If
' CALLING INVESTMENT
If RfcPayDetails.Call = True Then
Set DetailedInfos = RfcPayDetails.Imports ("RETURN")
Set tblcustomer_t=RfcPayDetails.Tables("TAB_DEL")
Set allrows=tblcustomer_t.rows
Forall rowNames In allrows
empbasic=Cstr(rowNames.GetCell("INFOTYPE"))
empdetails1=Cstr(rowNames.GetCell("PROPOSED"))
empdetails=Cstr(rowNames.GetCell("DETAIL"))
If empbasic="582" Then
'doc.invest1 =Cstr(doc.invest1(0))&""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
If(Cstr(rowNames.GetCell("DETAIL"))="SCEA") Then
doc.invest1 =Cstr(doc.invest1(0))&""& Cstr(rowNames.GetCell("DETAIL"))+"- Children Education Exemption"++Chr(10)
End If
If(Cstr(rowNames.GetCell("DETAIL"))="SCHA") Then
doc.invest1 =Cstr(doc.invest1(0))&""& Cstr(rowNames.GetCell("DETAIL"))+"- Children Hostel Exemption"++Chr(10)
End If
If(Cstr(rowNames.GetCell("DETAIL"))="ZUN1") Then
doc.invest1 =Cstr(doc.invest1(0))&""& Cstr(rowNames.GetCell("DETAIL"))+"- Uniform Exemption"++Chr(10)
End If
If(Cstr(rowNames.GetCell("DETAIL"))<>"ZUN1"And Cstr(rowNames.GetCell("DETAIL"))<>"SCEA" And Cstr(rowNames.GetCell("DETAIL"))<>"SCHA")Then
doc.invest1 =Cstr(doc.invest1(0))&""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
End If
'doc.invest1=Cstr(doc.invest1(0)) &" "& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
doc.Pro1=Cstr(doc.Pro1(0)) &" "& Cstr(rowNames.GetCell("PROPOSED"))+Chr(10)
doc.Act1=Cstr(doc.Act1(0)) &" "& Cstr(rowNames.GetCell("ACTUAL"))+Chr(10)
Elseif empbasic="584" Then
doc.invest2=Cstr(doc.invest2(0)) &""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
doc.Pro2=Cstr(doc.Pro2(0)) &" "& Cstr(rowNames.GetCell("PROPOSED"))+Chr(10)
doc.Act2=Cstr(doc.Act2(0)) &" "& Cstr(rowNames.GetCell("ACTUAL"))+Chr(10)
Elseif empbasic="" Then
doc.invest8=Cstr(doc.invest8(0)) &""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
doc.Pro8=Cstr(doc.Pro8(0)) &" "& Cstr(rowNames.GetCell("PROPOSED"))+Chr(10)
doc.Act8=Cstr(doc.Act8(0)) &" "& Cstr(rowNames.GetCell("ACTUAL"))+Chr(10)
Elseif empbasic="585" And empdetails <> "Contr. to Certain Pension Funds(80CCC)" And empdetails1 <> "" Then
'doc.invest3=Cstr(doc.test3(0)) +Chr(10) &""& +Chr(10) &""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
'doc.invest3=Cstr(doc.test3(0))
'doc.invest3_1=Cstr(doc.invest3_1(0)) &""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
'doc.invest3_2=Cstr(doc.invest3_1(0))&""&Cstr(doc.test(0))+Chr(10)
'doc.test=Cstr(doc.test3(0)) +Chr(10) &""& "Contr. to Certain Pension Funds"
doc.invest3_1=Cstr(doc.test3(0))
doc.invest3=Cstr(doc.invest3(0))+Chr(10) &""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
doc.Pro3=doc.Pro3(0)&""&" "+Chr(10)
doc.Pro3=Cstr(doc.Pro3(0)) &" "& Cstr(rowNames.GetCell("PROPOSED"))+Chr(10)
doc.Act3= doc.Act3(0)&""&" "+Chr(10)
doc.Act3=Cstr(doc.Act3(0)) &" "& Cstr(rowNames.GetCell("ACTUAL"))+Chr(10)
Elseif empbasic="585" And empdetails="Contr. to Certain Pension Funds(80CCC)" Then
doc.invest4=Cstr(doc.invest4(0))+Chr(10) &""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
doc.test="Contr. to Certain Pension Funds(80CCC)"
doc.Pro7=Cstr(doc.Pro7(0)) &" "& Cstr(rowNames.GetCell("PROPOSED"))+Chr(10)
doc.Pro4= doc.Pro4(0)&""&" "+Chr(10)
doc.Pro4=Cstr(doc.Pro4(0)) &" "& Cstr(rowNames.GetCell("PROPOSED"))+Chr(10)
doc.Act7=Cstr(doc.Act7(0)) &" "& Cstr(rowNames.GetCell("ACTUAL"))+Chr(10)
doc.Act4= doc.Act4(0)&""&" "+Chr(10)
doc.Act4=Cstr(doc.Act4(0)) &" "& Cstr(rowNames.GetCell("ACTUAL"))+Chr(10)
Elseif empbasic="586" And empdetails <> "Investment Details (Sec88)(0586):" Then
doc.invest5=Cstr(doc.invest5(0)) &""& Cstr(rowNames.GetCell("DETAIL"))+Chr(10)
doc.invest6=Cstr(doc.invest5(0))&""&Cstr(doc.test(0))+Chr(10)
doc.Pro5=Cstr(doc.Pro5(0)) &" "& Cstr(rowNames.GetCell("PROPOSED"))+Chr(10)
doc.Pro6=Cstr(doc.Pro5(0))&""&Cstr(doc.Pro7(0))+Chr(10)
'doc.Act5=Cstr(doc.Act5(0)) &" "& Cstr(rowNames.GetCell("ACTUAL"))+Chr(10)
'doc.Act6=Cstr(doc.Act5(0)) &" "& Cstr(doc.Act7(0))+Chr(10)
If( Cstr(rowNames.GetCell("ACTUAL"))=" 0.00")Then
doc.Act5=""
Else
doc.Act5=Cstr(doc.Act5(0)) &" "& Cstr(rowNames.GetCell("ACTUAL"))+Chr(10)
doc.Act6=Cstr(doc.Act5(0)) &" "& Cstr(doc.Act7(0))+Chr(10)
End If
End If
End Forall
End If
Exit Sub
ERRORHAND:
Print "<br><font color=red><b>ERROR: </b>" & Cstr(Error$) & ".<br><b>Line Number:</b> " & Cstr(Erl) & "</font>"
Print "<br><b><font color=red>Please contact system administrator.</font></b>"
End Sub
Thanks in advance.