-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRegistration
455 lines (348 loc) · 15 KB
/
Registration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Registration (Module)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Provides the necessary commands for performing a program registration for _
Job Corps students.
' Requires two sets of actions: Adding the student to the AddressBook, then _
performing the course enrollment.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
'AS400 specific values
Const rowHome As Long = 19
Const colHome As Long = 7
Const optionCustomerService As String = "1"
Const optionAddressBook As String = "3"
Const optionOrderEntry As String = "20"
Const optionEducationInquiry As String = "15"
Const locationAddressBook As String = "01051"
Const locationExtraEnrollScreen As String = "66302"
Const locationPaymentTerms As String = "66314"
Const actionCodeC As String = "C"
Const actionCodeI As String = "I"
Const actionCodeA As String = "A"
Const searchType As String = "TR"
Const schoolType As String = "HS"
Const degreeCode As String = "N"
Const emailCode As String = "E"
Const PACode As String = "PA"
Const TUICode As String = "TUI"
Public Sub RegisterToAddressBook(ByRef Student As cStudent, _
ByVal AS400 As cAS400, ByRef Exception As cException)
'Passes error handling up the call stack
On Error GoTo 0
Exception.Push "Registration.RegisterToAddressBook"
NavigateHome AS400, Exception
If ConfirmHomeScreen(AS400, Exception) = False Then GoTo NavigationFailure
Exception.ErrMessage = "Navigating to the AddressBook"
AS400.SetText optionCustomerService, rowHome, colHome
AS400.SendKeys EnterKey
AS400.SetText optionAddressBook, rowHome, colHome
AS400.SendKeys EnterKey
Exception.ErrMessage = "Checking if navigation successful"
If AS400.SearchText(locationAddressBook, 1, 1, forward) = False Then GoTo NavigationFailure
Exception.ErrMessage = "Entering the student information"
With AS400
.SetText actionCodeA, 3, 19
.SetText searchType, 14, 19
.SetText Student.GetPrefixCode, 23, 19
.SetText Student.GetMailingName, 4, 19
.SetText Student.GetAlphaName, 6, 19
.SetText Student.GetParentCode, 17, 55
If Len(Student.GetLongNumber) >= 1 Then
.SetText Student.GetLongNumber, 2, 60
End If
.SendKeys EnterKey
Exception.ErrMessage = "Pulling the Student ID#"
Student.StudentID = Trim(.GetText(4, 32, modLength))
End With
If Len(Student.StudentID) < modLength Or Not IsNumeric(Student.StudentID) Then GoTo NavigationFailure
Exception.ErrMessage = "Navigating the Enter=>F3 sequence"
With AS400
.SendKeys EnterKey
.SendKeys F3Key
.SendKeys EnterKey
.SendKeys F3Key
.SendKeys EnterKey
.SendKeys F3Key
.SendKeys EnterKey
.SendKeys F3Key
Exception.ErrMessage = "Entering the Web Times"
.SetText Student.GetWebStartTime, 13, 23
.SetText Student.GetWebEndTime, 14, 23
.SendKeys EnterKey
.SendKeys F3Key
Exception.ErrMessage = "Entering the Account Info"
.SetText schoolType, 6, 23
.SetText degreeCode, 10, 23
.SetText Student.GetGender, 19, 57
.SendKeys EnterKey
.SendKeys F3Key
.SendKeys EnterKey
.SendKeys EnterKey
Exception.ErrMessage = "Entering the phone number"
If Len(Trim(Student.GetPhoneNumber)) > 0 Then
.SendKeys F12Key
.SetText actionCodeC, 4, 21
.SetText Student.GetAreaCode, 11, 9
.SetText Student.GetPhoneNumber, 11, 16
.SendKeys EnterKey
.SendKeys F3Key
End If
Exception.ErrMessage = "Entering the email"
.SendKeys F5Key
.SendKeys F4Key
.SetText actionCodeC, 3, 18
.SetText emailCode, 11, 62
.SetText Student.GetEmail, 10, 4
.SendKeys EnterKey
.SendKeys F3Key
.SendKeys F3Key
End With
Cleanup:
Exception.Pop
Exit Sub
NavigationFailure:
Exception.Flag = True
GoTo Cleanup
End Sub
Public Sub RegisterToProgramEntry(ByRef Student As cStudent, _
ByVal AS400 As cAS400, ByRef Exception As cException, Optional ByRef StatusBox As Object)
'Passes error handling up the call stack
On Error GoTo 0
Exception.Push "Registration.RegisterToAddressBook"
NavigateHome AS400, Exception
If ConfirmHomeScreen(AS400, Exception) = False Then GoTo NavigationFailure
Exception.ErrMessage = "Navigating to OrderEntry"
With AS400
.SetText optionOrderEntry, rowHome, colHome
.SendKeys EnterKey
Exception.ErrMessage = "Applying the enrollment information"
.SetText actionCodeA, 3, 20
.SetText Student.StudentID, 4, 20
.SetText Student.GetSalesperson, 6, 20
.SetText Student.GetProgramNumber, 7, 20
If Len(Trim(Student.GetPONumber)) > 0 Then
.SetText Student.GetPONumber, 8, 20
End If
.SendKeys EnterKey
Exception.ErrMessage = "Checking for PS screen 66302"
If .SearchText(locationExtraEnrollScreen, 1, 1, forward) Then
.SendKeys EnterKey
End If
Exception.ErrMessage = "Entering the tuition information"
.SetText PACode, 11, 11
.SetText TUICode, 11, 16
.SetText Student.GetProgramTuition, 11, 54
.SendKeys EnterKey
End With
Exception.ErrMessage = "Entering the payment terms"
If AS400.SearchText(locationPaymentTerms, 1, 1, forward) = False Then GoTo ItemNotFound
With AS400
.SendKeys EnterKey
.SendKeys EnterKey
.SendKeys F3Key
End With
Exception.ErrMessage = "Executing final registration"
AS400.SendKeys F11Key
Exception.ErrMessage = "Navigating the Eduction Inquiry screen"
With AS400
.SendKeys F3Key
.SetText optionCustomerService, rowHome, colHome
.SendKeys EnterKey
.SetText optionEducationInquiry, rowHome, colHome
.SendKeys EnterKey
.SetText Student.StudentID, 3, 13
.SendKeys EnterKey
End With
Cleanup:
Exception.Pop
Exit Sub
ItemNotFound:
With Exception
.Flag = True
.IsError = False
.ErrMessage = "The AS/400 has red bar'd an entry field"
.Throw "The Parent, Salesperson, or Course Number is invalid and " & _
"has prevented the AS/400 from proceeding forward."
End With
NavigationFailure:
With Exception
.Flag = True
.IsError = False
.ErrMessage = "Navigation has failed"
End With
GoTo Cleanup
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' LoadUserformObjects
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub LoadUserformObjects(ByRef Student As cStudent, ByVal RegForm As MSForms.UserForm, _
ByRef Exception As cException)
'Pass error handling up the call stack
On Error GoTo 0
Exception.Push "Registration.LoadUserformObjects"
'Pass userform
Set Student.UserFormObject = RegForm
With RegForm
'Pass textboxes
Set Student.SalespersonTextbox = .Salesperson_Textbox
Set Student.ParentCodeTextBox = .ParentCode_Textbox
Set Student.FirstNameTextbox = .Firstname_Textbox
Set Student.LastNameTextbox = .Lastname_Textbox
Set Student.MiddleNameTextbox = .Middlename_Textbox
Set Student.WebStartTimeTextbox = .WebStartTime_Textbox
Set Student.WebEndTimeTextbox = .WebEndTime_Textbox
Set Student.ProgramNumberTextbox = .ProgramNumber_Textbox
Set Student.ProgramTuitionTextbox = .ProgramTuition_Textbox
Set Student.EmailTextbox = .Email_Textbox
Set Student.PONumberTextbox = .PONumber_Textbox
Set Student.LongNumberTextbox = .LongNumber_Textbox
Set Student.AreaCodeTextbox = .AreaCode_Textbox
Set Student.PhoneNumberTextbox = .PhoneNumber_Textbox
'Pass comboboxes
Set Student.SessionComboBox = .Session_ComboBox
Set Student.PrefixCodeTextbox = .PrefixCode_Textbox
'Pass option selection
Set Student.MaleOptionButton = .Male_Optionselect
Set Student.FemaleOptionButton = .Female_Optionselect
End With
Cleanup:
If Not Exception Is Nothing Then Exception.Pop
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ApproveRegistration
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function ApproveRegistration(ByVal Student As cStudent, ByRef Exception As cException) As Boolean
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Allows the user to confirm the current enrollment _
information prior to executing the AS/400 procedures.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Pass error handling up the call stack
On Error GoTo 0
Exception.Push "Registration.ApproveRegistration"
Dim redMessage As String
redMessage = vbTab & "FINAL CONFIRMATION" & vbNewLine & vbNewLine & _
"One or more errors have occurred. Please" & _
"resolve the following issues before proceeding." & vbNewLine & vbNewLine
Dim blueMessage As String
blueMessage = vbTab & "FINAL CONFIRMATION" & vbNewLine & vbNewLine & _
"Please confirm the following information " & _
"before proceeding with the enrollment script." & vbNewLine & vbNewLine
Dim approvalFlag As Boolean
approvalFlag = True
Dim userSelection As Integer
userSelection = 2
If Exception.Flag = True Then approvalFlag = False
ConfirmAccountInfo Student, approvalFlag, redMessage, blueMessage, Exception
ConfirmStudentFile Student, approvalFlag, redMessage, blueMessage, Exception
If Not Exception Is Nothing Then Exception.ErrMessage = "Providing the final checklist..."
If approvalFlag = False Then
MsgBox redMessage, vbCritical, "Pre-Enrollment Checklist"
Else
userSelection = MsgBox(blueMessage, vbOKCancel, "Pre-Enrollment Checklist")
If userSelection = vbOK Then approvalFlag = True
If userSelection = vbCancel Then approvalFlag = False
End If
ApproveRegistration = approvalFlag
Cleanup:
Exception.Pop
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ConfirmAccountInfo
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub ConfirmAccountInfo(ByVal Student As cStudent, ByRef approvalFlag As Boolean, _
ByRef redMessage As String, ByRef blueMessage As String, Optional ByRef Exception As cException)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For the ApproveRegistration procedure
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Pass error handling up the call stack
On Error GoTo 0
If Not Exception Is Nothing Then Exception.Push "Registration.ConfirmAccountInfo"
Dim temp As String
With Student
'AS/400 Session
temp = .GetSession
If Len(temp) = 1 And InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ", temp) >= 1 Then
blueMessage = blueMessage & "Session:" & vbTab & vbTab & temp & vbNewLine & vbNewLine
Else
approvalFlag = False
redMessage = redMessage & "* The AS/400 session name must be a single letter" & vbNewLine
End If
'PrefixCode
temp = .GetPrefixCode
If Len(temp) = 3 Then
blueMessage = blueMessage & "PrefixCode:" & vbTab & temp & vbNewLine
Else
approvalFlag = False
redMessage = redMessage & "* The prefix code must be 3 characters long" & vbNewLine
End If
'Program Number
temp = .GetProgramNumber
If IsNumeric(temp) And Len(temp) = 8 Then
blueMessage = blueMessage & "Program Number:" & vbTab & temp & vbNewLine
Else
approvalFlag = False
redMessage = redMessage & "* The program number must be numeric and 8 digits long" & vbNewLine
End If
'Program Tuition
temp = .GetProgramTuition
If IsNumeric(temp) And Val(temp) >= 1 Then
blueMessage = blueMessage & "Program Tuition:" & vbTab & Format(temp, "Currency") & vbNewLine & vbNewLine
Else
approvalFlag = False
redMessage = redMessage & "* The program tuition must be numeric and greater than zero" & vbNewLine
End If
'Web Start Time
temp = .GetWebStartTime
If IsNumeric(temp) And Len(temp) <= 6 Then
blueMessage = blueMessage & "WebStartTime:" & vbTab & temp & vbNewLine
Else
blueMessage = blueMessage & "WebStartTime:" & vbTab & "000000" & vbNewLine
End If
'Web End Time
temp = .GetWebEndTime
If IsNumeric(temp) And Len(temp) <= 6 Then
blueMessage = blueMessage & "WebEndTime:" & vbTab & temp & vbNewLine & vbNewLine
Else
blueMessage = blueMessage & "WebEndTime:" & vbTab & "000000" & vbNewLine
End If
If Len(.GetPONumber) >= 1 Then
blueMessage = blueMessage & "PO Number:" & vbTab & .GetPONumber & vbNewLine & vbNewLine
End If
Cleanup:
End With
If Not Exception Is Nothing Then Exception.Pop
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ConfirmStudentFile
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub ConfirmStudentFile(ByVal Student As cStudent, ByRef approvalFlag As Boolean, _
ByRef redMessage As String, ByRef blueMessage As String, Optional ByRef Exception As cException)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For the ApproveRegistration procedure
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Pass error handling up the call stack
On Error GoTo 0
If Not Exception Is Nothing Then Exception.Push "Registration.ConfirmStudentFile"
With Student
'Student Name
If Len(.GetMailingName) < 4 Or Len(.GetMailingName) > 38 Then
approvalFlag = False
redMessage = redMessage & "* The student's full name must be between 4 and 38 characters" & vbNewLine
Else
blueMessage = blueMessage & "MailingName:" & vbTab & .GetMailingName & vbNewLine
blueMessage = blueMessage & "AlphaName:" & vbTab & .GetAlphaName & vbNewLine
End If
blueMessage = blueMessage & "Gender:" & vbTab & vbTab & .GetGender & vbNewLine
'Phone Number
blueMessage = blueMessage & "Phone:" & vbTab & vbTab & .GetAreaCode & "-" & .GetPhoneNumber & vbNewLine
'Student Email
blueMessage = blueMessage & "Email:" & vbTab & vbTab & .GetEmail & vbNewLine & vbNewLine
'Long Number
blueMessage = blueMessage & "Long#:" & vbTab & vbTab & .GetLongNumber & vbNewLine
'PO Number
blueMessage = blueMessage & "PO#:" & vbTab & vbTab & .GetPONumber & vbNewLine
Cleanup:
End With
If Not Exception Is Nothing Then Exception.Pop
End Sub