Guest User

Untitled

a guest
May 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.38 KB | None | 0 0
  1. Sub Process_PAF (db As notesdatabase, PAF_Doc As notesdocument)
  2. Dim session As New NotesSession
  3. Dim view As notesview
  4. Dim PP_Doc As notesdocument
  5. Dim keys (1 To 2) As String
  6. Dim item As NotesItem
  7. Dim contents As String
  8. Dim agent As NotesAgent
  9. Dim server As String
  10.  
  11. Set agent = session.CurrentAgent
  12. server = agent.ServerName
  13.  
  14. Set view=db.getview("All Employees")
  15.  
  16. keys(1)=PAF_Doc.LastName(0)
  17. keys(2)=PAF_Doc.FirstName(0)
  18.  
  19. Set PP_Doc=view.getdocumentbykey(keys)
  20. If PP_Doc Is Nothing Then
  21. Messagebox "Error finding profile for " + keys(1) + ", " + keys(2),MB_OK,"Error"
  22. Exit Sub
  23. End If
  24.  
  25. Set item = PAF_Doc.GetFirstItem( "Text" )
  26. contents = item.Text
  27.  
  28.  
  29. ' Replace values on Profile form
  30.  
  31. If PAF_Doc.TermFlag(0) = "Yes" Then
  32. PP_Doc.ActiveInactive="Inactive"
  33. PP_Doc.PeopleType="Ex-internal"
  34. PP_Doc.EndRIADate=PAF_Doc.EffDate(0)
  35. PP_Doc.Status="Termination"
  36.  
  37. End If
  38. If PAF_Doc.NewTitle(0)<>"" Then
  39. PP_Doc.JobTitleDescription=PAF_Doc.NewTitle(0)
  40. PP_Doc.StartTitle=PAF_Doc.EffDate(0)
  41. End If
  42. If PAF_Doc.NewTitleCode(0)<>"" Then
  43. PP_Doc.JobTitleCode=PAF_Doc.NewTitleCode(0)
  44. PP_Doc.StartTitle=PAF_Doc.EffDate(0)
  45. End If
  46. If PAF_Doc.NewAssignGroup(0)<> "" Then
  47. PP_Doc.AssignGroup=PAF_Doc.NewAssignGroup(0)
  48. End If
  49. If PAF_Doc.NewExempt(0)<> "" Then
  50. PP_Doc.Exempt=PAF_Doc.NewExempt(0)
  51. End If
  52. If PAF_Doc.NewEmpCat(0)<> "" Then
  53. PP_Doc.EmpCat=PAF_Doc.NewEmpCat(0)
  54. End If
  55. If PAF_Doc.NewSalGrade(0)<>"" Then
  56. PP_Doc.SalaryGrade=PAF_Doc.NewSalGrade(0)
  57. PP_Doc.LastRateChange=PAF_Doc.EffDate(0)
  58. End If
  59. If Cstr(PAF_Doc.NewAnnSal(0))<>"" Then
  60. PP_Doc.AnnualSalary=Cdbl(PAF_Doc.NewAnnSal(0))
  61. PP_Doc.Biweekly=PAF_Doc.NewBiweekly
  62. PP_Doc.LastRateChange=PAF_Doc.EffDate(0)
  63. End If
  64. If PAF_Doc.NewHourlyRate(0)<> "" Then
  65. PP_Doc.HourlyRate=PAF_Doc.NewHourlyRate(0)
  66. PP_Doc.LastRateChange=PAF_Doc.EffDate(0)
  67. End If
  68. If Cstr(PAF_Doc.NewAwardAmount(0))<> "" Then
  69. PP_Doc.AwardAmount=PAF_Doc.NewAwardAmount(0)
  70. End If
  71. If PAF_Doc.NewSalaryBasis(0)<> "" Then
  72. PP_Doc.SalaryBasis=PAF_Doc.NewSalaryBasis(0)
  73. End If
  74. If PAF_Doc.NewEarnElement(0)<> "" Then
  75. PP_Doc.EarnElement=PAF_Doc.NewEarnElement(0)
  76. End If
  77. If PAF_Doc.NewStatus(0)<> "" Then
  78. PP_Doc.Status=PAF_Doc.NewStatus(0)
  79. End If
  80. If PAF_Doc.NewAddress(0)<>"" Then
  81. PP_Doc.Address=PAF_Doc.NewAddress(0)
  82. End If
  83. If PAF_Doc.NewCity(0)<>"" Then
  84. PP_Doc.City=PAF_Doc.NewCity(0)
  85. End If
  86. If PAF_Doc.NewState(0)<>"" Then
  87. PP_Doc.State=PAF_Doc.NewState(0)
  88. End If
  89. If PAF_Doc.NewZip(0)<>"" Then
  90. PP_Doc.Zip=PAF_Doc.NewZip(0)
  91. End If
  92. If PAF_Doc.NewHomePhone(0)<>"" Then
  93. PP_Doc.HomePhone=PAF_Doc.NewHomePhone(0)
  94. End If
  95. If PAF_Doc.NewLN(0)<>"" Then
  96. PP_Doc.LastName=PAF_Doc.NewLN(0)
  97. End If
  98. If PAF_Doc.NewFN(0)<>"" Then
  99. PP_Doc.FirstName=PAF_Doc.NewFN(0)
  100. End If
  101.  
  102.  
  103. If PAF_Doc.A1(0) = "Yes" Then
  104. PP_Doc.fd1 = ""
  105. If PAF_Doc.AccountSel(0) = "Yes" Then
  106. PP_Doc.Account1 = PAF_Doc.NewAcc1(0)
  107. PP_Doc.Project1 = PAF_Doc.Project_1(0)
  108. PP_Doc.Task1 = PAF_Doc.Task_1(0)
  109. PP_Doc.Award1 = PAF_Doc.Award_1(0)
  110. PP_Doc.EXP_1 = PAF_Doc.NewEXP_1(0)
  111. PP_Doc.td1 = PAF_Doc.NewTerm1(0)
  112. PP_Doc.Actual1 = PAF_Doc.NewActual1(0)
  113. PP_Doc.Effort1 = PAF_Doc.NewEff1(0)
  114. PP_Doc.FTE = PAF_Doc.NewFTE(0)
  115. If PAF_Doc.NewAcc1(0) <> "" Then
  116. PP_Doc.fd1=PAF_Doc.EffDate(0)
  117. End If
  118. End If
  119. End If
  120. If PAF_Doc.A2(0) = "Yes" Then
  121. PP_Doc.fd2 = ""
  122. If PAF_Doc.AccountSel(0) = "Yes" Then
  123. PP_Doc.Account2 = PAF_Doc.NewAcc2(0)
  124. PP_Doc.Project2 = PAF_Doc.Project_2(0)
  125. PP_Doc.Task2 = PAF_Doc.Task_2(0)
  126. PP_Doc.Award2 = PAF_Doc.Award_2(0)
  127. PP_Doc.EXP_2 = PAF_Doc.NewEXP_2(0)
  128. PP_Doc.td2 = PAF_Doc.NewTerm2(0)
  129. PP_Doc.Actual2 = PAF_Doc.NewActual2(0)
  130. PP_Doc.Effort2 = PAF_Doc.NewEff2(0)
  131. If PAF_Doc.NewAcc2(0) <> "" Then
  132. PP_Doc.fd2=PAF_Doc.EffDate(0)
  133. End If
  134. End If
  135. End If
  136. If PAF_Doc.A3(0) = "Yes" Then
  137. PP_Doc.fd3 = ""
  138. If PAF_Doc.AccountSel(0) = "Yes" Then
  139. PP_Doc.Account3 = PAF_Doc.NewAcc3(0)
  140. PP_Doc.Project3 = PAF_Doc.Project_3(0)
  141. PP_Doc.Task3 = PAF_Doc.Task_3(0)
  142. PP_Doc.Award3 = PAF_Doc.Award_3(0)
  143. PP_Doc.EXP_3 = PAF_Doc.NewEXP_3(0)
  144. PP_Doc.td3 = PAF_Doc.NewTerm3(0)
  145. PP_Doc.Actual3 = PAF_Doc.NewActual3(0)
  146. PP_Doc.Effort3 = PAF_Doc.NewEff3(0)
  147. If PAF_Doc.NewAcc3(0) <> "" Then
  148. PP_Doc.fd3=PAF_Doc.EffDate(0)
  149. End If
  150. End If
  151. End If
  152. If PAF_Doc.A4(0) = "Yes" Then
  153. PP_Doc.fd4 = ""
  154. If PAF_Doc.AccountSel(0) = "Yes" Then
  155. PP_Doc.Account4 = PAF_Doc.NewAcc4(0)
  156. PP_Doc.Project4 = PAF_Doc.Project_4(0)
  157. PP_Doc.Task4 = PAF_Doc.Task_4(0)
  158. PP_Doc.Award4 = PAF_Doc.Award_4(0)
  159. PP_Doc.EXP_4 = PAF_Doc.NewEXP_4(0)
  160. PP_Doc.td4 = PAF_Doc.NewTerm4(0)
  161. PP_Doc.Actual4 = PAF_Doc.NewActual4(0)
  162. PP_Doc.Effort4 = PAF_Doc.NewEff4(0)
  163. If PAF_Doc.NewAcc4(0) <> "" Then
  164. PP_Doc.fd4=PAF_Doc.EffDate(0)
  165. End If
  166. End If
  167. End If
  168.  
  169. PP_Doc.ECFHistory=PP_Doc.ECFHistory(0) + Chr(10) + Cstr(PAF_Doc.EffDate(0)) + ": " + PAF_Doc.Reason_disp(0) + "; " + contents
  170.  
  171. Call PP_Doc.Save(False,True)
  172.  
  173. PAF_Doc.PafStatus="Complete" 'Change status of PAF to "Complete" and save
  174. PAF_Doc.LastEditor=server + " (" + agent.name + ")" 'Records server & agent name as LastEditor on paf4 (ECF)
  175. PP_Doc.LastEditor=server + " (" + agent.name + ")" 'Records current server & agent name as LastEditor on Personnel Profile
  176. PP_Doc.ModifiedDate=Now 'Records date & time in ModifiedDate field on Personnel Profile
  177.  
  178. Call PAF_Doc.Save(False,True)
  179. Call PAF_Doc.Save(False,True)
  180. Call PP_Doc.Save(False,True)
  181. Call PP_Doc.Save(False,True)
  182. End Sub
Add Comment
Please, Sign In to add comment