Sunteți pe pagina 1din 6

Dim ReturnValue, CP_Count

If Not WpfWindow("CAIRO | Home - TD Securities").WpfList("MainMenu_NewItems").Ex


ist Then
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","https:
//cairoqa:1010/","","open"
Browser("TD Securities | CAIRO").Page("TD Securities | CAIRO").Link("Sta
rt CAIRO Application").Click
Browser("TD Securities | CAIRO").Page("TD Securities | CAIRO").Sync
If SwfWindow("Application Install -").Exist Then
SwfWindow("Application Install -").SwfButton("Install").Click
End If
Do
wait (5)
Loop Until WpfWindow("CAIRO | Home - TD Securities").WpfList("MainMenu_C
reditReview").Exist
WpfWindow("CAIRO | Home - TD Securities").WpfList("MainMenu_CreditReview
").Select "Credit Reviews"
End If
'WpfWindow("| CAIRO | Credit Profile").WpfLink("name:=Purpose").Click
Dim sVal(15)
DataTable.Import("P:\Narmada\Credit Review\CreditReview_InputData.xls")
iTotalCol = DataTable.GetSheet(1).GetParameterCount
iTotalRow = DataTable.GetRowCount
For iColCount = 2 To iTotalCol-1
If instr(1,DataTable.GetSheet(1).GetParameter(iColCount).Name,"CR") = 0
Then
Exit For
End If
DataTable.SetCurrentRow (1)
ExecuteYorN = DataTable.Value("CR"&iColCount-1)
If TRIM(UCASE(ExecuteYorN)) = "YES" Then
For irowCount = 2 To iTotalRow
DataTable.SetCurrentRow (irowCou
nt)
sVal(irowCount-2) = DataTable.Va
lue("CR"&iColCount-1)
Next
Wait 3
Legal_Name=sVal(0)
Review_Type=sVal(1)
Priority=sVal(2)
Account_Classification=sVal(3)
High_Risk=sVal(4)
High_Levered=sVal(5)
New_Review_Date=sVal(6)
Authorised_Review_Date=sVal(7)
Interim_Review_Date=sVal(8)
TD_Relationship=sVal(9)
Borrower_Number=sVal(10)
Originating_Office=sVal(11)
Division_Number=sVal(12)
Env_and_Social_Risk=sVal(13)
High_Level_Completed=sVal(14)
'Verify user has access to New Credit review if
not assign the access
If WpfWindow("CAIRO | Home - TD Securities").Wpf
List("MainMenu_NewItems").GetROProperty("visible") = False Then
app_CAIRO_CreditReviewAccess()
End If
If TRIM(Legal_Name) = "" Then
Legal_Name = "CR_Auto"
End If
Call app_CAIRO_CreateCounterParty(Legal_Name)
WpfWindow("CAIRO | Home - TD Securities").WpfLis
t("MainMenu_CreditReview").Select "Credit Reviews"
WpfWindow("CAIRO | Home - TD Securities").WpfLis
t("MainMenu_NewItems").Select "New Corporate Credit Review"
Wait 3
WpfWindow("| CAIRO | Credit Profile").Activate
WpfWindow("| CAIRO | Credit Profile").WpfComboBo
x("SelectReviewType").Select Review_Type
WpfWindow("| CAIRO | Credit Profile").WpfComboBo
x("PriorityCodeComboBox").Type Priority
WpfWindow("| CAIRO | Credit Profile").WpfComboBo
x("AccountClassificationCodeCombo").Select Account_Classification
Wait(3)
If TRIM(UCASE(High_Risk)) = "NO" Then
WpfWindow("| CAIRO | Credit Profile").Wp
fRadioButton("RadioBtn_HighRiskNo").Set "No"
Else
WpfWindow("| CAIRO | Credit Profile").Wp
fRadioButton("RadioBtn_HighRiskYes").Set "Yes"
End If
If TRIM(UCASE(High_Levered)) = "NO" Then
WpfWindow("| CAIRO | Credit Profile").Wp
fRadioButton("RadioBtn_HighLeveredNo").Set "No"
Else
WpfWindow("| CAIRO | Credit Profile").Wp
fRadioButton("RadioBtn_HighLeveredYes").Set "Yes"
End If
WpfWindow("| CAIRO | Credit Profile").WpfEdit("T
extBox_NewReviewDate").Set FormatDateTime(CDate(New_Review_Date) - 43,2)
WpfWindow("| CAIRO | Credit Profile").WpfEdit("T
extBox_AuthorisedReviewDate").Set FormatDateTime(CDate(Authorised_Review_Date) +
1,2)
WpfWindow("| CAIRO | Credit Profile").WpfEdit("T
extBox_InterimReviewDate").Set FormatDateTime(CDate(Interim_Review_Date) + 1,2)
WpfWindow("| CAIRO | Credit Profile").WpfButton(
"Insert...").Click
Wait 1
If WpfWindow("Search Counterparty").Exist Then
WpfWindow("Search Counterparty").Activate
WpfWindow("Search Counterparty").WpfRadioButton("Contain
s").Set "ON"
WpfWindow("Search Counterparty").WpfRadioButton("Starts
With").Set "ON"
WpfWindow("Search Counterparty").WpfEdit("SearchFor").Se
t Legal_Name
WpfWindow("Search Counterparty").WpfButton("Search").Cli
ck
Wait 2
End If
sAllVal = WpfWindow("Search Counterparty").WpfList("Counterparti
esListView").GetVisibleText
sList = Split(sAllVal,Chr(10))
For i=0 To UBound(sList)
'msgbox sList(i)
If instr(1,sList(i),Legal_Name) Then
WpfWindow("Search Counterparty").WpfList("Counte
rpartiesListView").Select(i-1)
End If
Next
WpfWindow("Search Counterparty").WpfButton("Select").Click
Wait 2
If TD_Relationship = "Primary" Then
WpfWindow("| CAIRO | Credit Profile").WpfCheckBox("Prima
ry Borrower").Set "ON"
End If
WpfWindow("| CAIRO | Credit Profile").WpfEdit("Borrower_Guaranto
r_No_TextBox").Type Borrower_Number
WpfWindow("| CAIRO | Credit Profile").WpfScrollBar("VerticalScro
llBar_Inner").Set 950
WpfWindow("| CAIRO | Credit Profile").WpfComboBox("LendingManage
rTransactionManag").Click
Wait 1
Call Select_Dropdown_List (225)
Wait 2
WpfWindow("| CAIRO | Credit Profile").WpfComboBox("RelationshipM
anagerCodeComboBo").MakeVisible
WpfWindow("| CAIRO | Credit Profile").WpfComboBox("RelationshipM
anagerCodeComboBo").Click
Wait 1
Call Select_Dropdown_List (265)
Wait 2
WpfWindow("| CAIRO | Credit Profile").WpfComboBox("AssociateCode
ComboBox").MakeVisible
WpfWindow("| CAIRO | Credit Profile").WpfComboBox("AssociateCode
ComboBox").Click
Wait 1
Call Select_Dropdown_List (245)
wait 2
WpfWindow("| CAIRO | Credit Profile").WpfComboBox("OriginatingOf
ficeCodeComboBox").Type Originating_Office
WpfWindow("| CAIRO | Credit Profile").WpfComboBox("DivisionNumbe
rCodeComboBox").Type Division_Number
Wait(2)
WpfWindow("| CAIRO | Credit Profile").WpfComboBox("EnvironmentaA
ndSocialRiskCodeC").Type Env_and_Social_Risk
If High_Level_Completed = "Yes" Then
WpfWindow("| CAIRO | Credit Profile").WpfRadioButton("Ra
dioBtn_SocialRiskYes").Set High_Level_Completed
End If
WpfWindow("| CAIRO | Credit Profile").WpfButton("Save").Click
Wait 10
WpfWindow("| CAIRO | Credit Profile").Close
WpfWindow("CAIRO | Home - TD Securities").Activate
WpfWindow("CAIRO | Home - TD Securities").WpfList("MainMenu_MySi
te").Select "Active"
Wait 2
WpfWindow("CAIRO | Home - TD Securities").WpfEdit("TextBoxFilter
").Object.Focus
WpfWindow("CAIRO | Home - TD Securities").WpfEdit("TextBoxFilter
").Set Legal_Name
WpfWindow("CAIRO | Home - TD Securities").WpfButton("Search").Cl
ick
WAit 4
Set oDesc = Description.Create()
oDesc("micclass").Value = "WpfButton"
oDesc("text").Value = Legal_Name
Set oObj = WpfWindow("CAIRO | Home - TD Securities").ChildObject
s(oDesc)
If oObj.Count > 0 Then
DataTable.SetCurrentRow(irowCount +1)
DataTable.Value("CR"&iColCount - 1) = "Passed"
End If
Wait 3
Erase sVal
End If
Next
Function Select_Dropdown_List (Index)
Set obj = CreateObject("WScript.Shell") ' Creates object we can use to call Se
ndKeys
For i=1 To Index
obj.SendKeys "{DOWN}" ' sends the down arrow key
If i MOD 40 = 0 Then
Wait 1
End If
Next
wait 1
obj.SendKeys "{ENTER}" ' sends the enter key
End Function
'///////////////////////////////////////////////////////////////////////////////
////////////////////
'Function Name : app_CAIRO_CreditReviewAccess
'Author : Narmada Yerramsetty
'Purpose : This function adds the user roles 'Lending Manager' &'Cairo Administr
ator'
'and removes additional roles to the cur
rent user
'Input Parameters : None
'///////////////////////////////////////////////////////////////////////////////
////////////////////
Function app_CAIRO_CreditReviewAccess()
WpfWindow("CAIRO | Home - TD Securities").WpfLink("Admin").Click
Wait 2
If WpfWindow("CAIRO | Admin Tool - TD").Exist Then
WpfWindow("CAIRO | Admin Tool - TD").WpfButton("Update My Profil
e").Click
Wait 1
End If
Wait 1
If wpfwindow("UserEditWindow").Exist Then
wpfwindow("UserEditWindow").WpfComboBox("combo_UserRole").Select
"Cairo Administrator"
wpfwindow("UserEditWindow").WpfComboBox("combo_UserRole").Select
"Lending Manager"
sUsers = wpfwindow("UserEditWindow").WpfList("list_UserRoles").
GetContent()
sAll = Split(sUsers,Chr(10))
For i=0 to UBound(sAll)
If Not(sAll(i) = "Lending Manager") AND Not(sAll(i) = "C
airo Administrator") Then
wpfwindow("UserEditWindow").WpfButton("w
pftypename:=button","index:="&i+1).Click
End If
Next
End If
wpfwindow("UserEditWindow").WpfButton("Save & Close").Click
WpfWindow("CAIRO | Admin Tool - TD").Close
Wait(1)
End Function
'///////////////////////////////////////////////////////////////////////////////
////////////////////
'Function Name : app_CAIRO_CreateCounterParty
'Author : Narmada Yerramsetty
'Purpose : This function creates a counter party with unique name
'Input Parameters : Legal_Name
'Output Parameters : Legal Name + Timestamp
'///////////////////////////////////////////////////////////////////////////////
////////////////////
Function app_CAIRO_CreateCounterParty(Legal_Name)
WpfWindow("CAIRO | Home - TD Securities").WpfList("MainMenu_Cred
itReview").Select "Counterparties"
WpfWindow("CAIRO | Home - TD Securities").WpfList("MainMenu_NewI
tems").Select "New Counterparty"
Wait 2
If WpfWindow("Document | CAIRO").Exist Then
Legal_Name = Legal_Name &"_" & common_Ge
tTimeStamp
WpfWindow("Document | CAIRO").WpfEdit("L
egal_Name_TextBox").Set Legal_Name
End If
WpfWindow("Document | CAIRO").WpfButton("Save").Click
Wait 5
WpfWindow("CAIRO | Counterparty").Close
Wait 1
app_CAIRO_CreateCounterParty = Legal_Name
End Function
'///////////////////////////////////////////////////////////////////////////////
////////////////////
'Function Name : common_GetTimeStamp
'Author : Narmada Yerramsetty
'Purpose : This function generates unique time stamp each time we execute
'Input Parameters : None
'///////////////////////////////////////////////////////////////////////////////
////////////////////
Function common_GetTimeStamp()
common_GetTimeStamp=Right(Year(Date),2) & Right("0" & Month(Date),2) & Right("0"
& Day(Date),2) & hour(now) & Minute(Now) & Second(Now)
End Function

S-ar putea să vă placă și