Sub UCC_INSURANCE()
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")
'Machine Log Report
Dim MyDate
MyDate = Format(Date, "YYYYMMDD")
Dim MyTime
MyTime = Format(Time, "hhmmss")
Dim MyYear
MyYear = Mid(MyDate, 1, 4)
Dim MyMonth
MyMonth = Mid(MyDate, 5, 2)
Dim MyDay
MyDay = Mid(MyDate, 7, 2)
Lessor = Format(Lessor, String(3, "0"))
ContractVar = Format(ContractVar, String(7, "0"))
ScheduleVar = Format(ScheduleVar, String(3, "0"))
folderFilePath = "S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "\" & MyDay & ""
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FolderExists("S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "\" & MyDay & "") Then
Dim fs1, f1, ts1
Set fs1 = CreateObject("Scripting.FileSystemObject")
fs1.CopyFile "S:\KEA\UCC\INS_FILE.csv", "S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "\" & MyDay & "\" & MyYear & MyMonth & MyDay & "_UCC_INSURANCE_" & MyTime & ".csv"
Else
Dim fs2, f2, ts2
Set fs2 = CreateObject("Scripting.FileSystemObject")
CheckMyFile:
If fso.FolderExists("S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "\" & MyDay & "") Then
fs2.CopyFile "S:\KEA\UCC\INS_FILE.csv", "S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "\" & MyDay & "\" & MyYear & MyMonth & MyDay & "_UCC_INSURANCE_" & MyTime & ".csv"
Set f2 = fs2.CreateTextFile("S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "\" & MyDay & "\" & MyYear & MyMonth & MyDay & "_UCC_INSURANCE_" & MyTime & ".txt")
GoTo EndProcess
ElseIf fso.FolderExists("S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "") Then
Set f2 = fs2.CreateFolder("S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "\" & MyDay & "")
GoTo CheckMyFile
ElseIf fso.FolderExists("S:\FinAdj\Projects\" & MyYear & "") Then
Set f2 = fs2.CreateFolder("S:\FinAdj\Projects\" & MyYear & "\UCC\" & MyMonth & "")
GoTo CheckMyFile
ElseIf fso.FolderExists("S:\FinAdj\Projects") Then
Set f2 = fs2.CreateFolder("S:\FinAdj\Projects\" & MyYear & "")
GoTo CheckMyFile
ElseIf fso.FolderExists("S:\FinAdj") Then
Set f2 = fs2.CreateFolder("S:\FinAdj\Projects")
GoTo CheckMyFile
ElseIf fso.FolderExists("S:\Manual_Booking\BOOKING") Then
Set f2 = fs2.CreateFolder("S:\Manual_Booking\BOOKING\LOGS")
GoTo CheckMyFile
End If
EndProcess:
f2.Close
End If
End Sub