'Created By: Xavier Arias
'Date Created: DECEMBER 02, 2014
'Date Revised: DECEMBER 03, 2014
'Title: KEA_BATCH_APP_UNSUSP_To_9_Loop
'Reading File from S:\KEA\Financial_Adjustments\PROCESS_FILE.csv
'S:\KEA\Financial_Adjustments\INFO_FILE.txt
Sub KEA_BATCH_APP_UNSUSP_To_9_Loop()
Dim hostSettleTimeout As Integer
Dim hostSettleTime As Integer
Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer
Dim hiddenTextEntry As String
hostSettleTimeout = 5000
hostSettleTime = 300
Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen
Dim myUser As String
myUser = Environ("username")
' ******** This is for BATCH APPLICATION from Unapplied Suspense to Disposition Suspense OPT 9.*************************
Dim MyString1, MyString2
Dim MyFile As String
'**************************MENU ACCESS TO LIFT BATCH*******************************************************
MyFile = "S:\KEA\Financial_Adjustments\INFO_FILE.txt"
Open MyFile For Input As #1 ' Open file for input.
Input #1, BatchNumVar, MemoVar, EmailVar, EmailVar2 ' Read data into variables.
Reset_to_InfoLease_Master_Menu
osCurrentScreen.SendKeys "2"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendKeys "5"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendKeys "1"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Call osCurrentScreen.SendKeys(BatchNumVar) ' Batch Number
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendKeys "0"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendKeys "USD"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendKeys "5"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Close #1 ' Close file.
'**************************MENU ACCESS TO LIFT BATCH*******************************************************
'**************************DATA INPUT**********************************************************************
MyFile2 = "S:\KEA\Financial_Adjustments\PROCESS_FILE.csv"
Open MyFile2 For Input As #1 ' Open file for input.
Do While Not EOF(1) ' Loop until end of file.
Input #1, PositionVar, LessorVar, Contract1Var, Contract2Var, TransNumVar ' Read data into variables.
LessorVar = Format(LessorVar, String(3, "0"))
Contract1Var = Format(Contract1Var, String(7, "0"))
Contract2Var = Format(Contract2Var, String(3, "0"))
osCurrentScreen.SendKeys "1"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Call osCurrentScreen.SendKeys(LessorVar) ' Lessor
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Call osCurrentScreen.SendKeys(Contract1Var) ' Contract Number
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendKeys "."
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Call osCurrentScreen.SendKeys(Contract2Var) ' Contract Number
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendKeys "6"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Call osCurrentScreen.SendKeys(TransNumVar) ' Trans Number
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendKeys "Y"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
For x = 1 To 5
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Next x
osCurrentScreen.SendKeys "9"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Loop
Close #1 ' Close file.
'**************************DATA INPUT**********************************************************************
For x = 1 To 3
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(200)
Next x
'**************************MEMO****************************************************************************
MyFile2 = "S:\KEA\Financial_Adjustments\PROCESS_FILE.csv"
Open MyFile2 For Input As #1 ' Open file for input.
Do While Not EOF(1) ' Loop until end of file.
Input #1, PositionVar, LessorVar, Contract1Var, Contract2Var, TransNumVar ' Read data into variables.
LessorVar = Format(LessorVar, String(3, "0"))
Contract1Var = Format(Contract1Var, String(7, "0"))
Contract2Var = Format(Contract2Var, String(3, "0"))
Call osCurrentScreen.SendKeys(PositionVar) ' Position
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
For x = 1 To 9
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Next x
osCurrentScreen.SendKeys "TIC"
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Call osCurrentScreen.SendKeys(MemoVar) ' Memo
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
osCurrentScreen.SendControlKey ControlKeyCode_Enter
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(50)
Loop
Close #1 ' Close file.
'**************************MEMO****************************************************************************
'**************************EMAIL***************************************************************************
MyFile = "S:\KEA\Financial_Adjustments\INFO_FILE.txt"
Open MyFile For Input As #1 ' Open file for input.
Input #1, BatchNumVar, MemoVar, EmailVar, EmailVar2 ' Read data into variables.
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0)
With MyItem
.To = (EmailVar)
.CC = (EmailVar2)
.Subject = "TICKET " & (MemoVar) & ". Batch " & (BatchNumVar) & " process was completed"
.ReadReceiptRequested = False
.HTMLBody = "The Process was completed on " & FormatDateTime(Now, vbGeneralDate) & " for TICKET " & (MemoVar) & ". Please review and finish processing batch " & (BatchNumVar) & ". The file contained " & (MyString1) & " Items. Thank You."
End With
MyItem.Send
Close #1 ' Close file.
'**************************EMAIL***************************************************************************
End Sub