contract enter common1
TRANSCRIPT
'' DIAD Automation Suite - ' Testing Functions'' The functions here execute the Account creation and contract entry tests defined on one line of the ' input spreadsheet. The main logic is in Diad_Test, he other functions are "supporting characters"'
Option Explicit
' Library level variables loaded from the datasheet or simply used in several functions' As much as I dispise "globals", it beat passing around large argument lists all the time, which is a ' maintenance issue, and once set are (generally) not changed for the duration of the test' ====================================================================================================' Account and Contract data for the output files' Each of the possible columns are defined as keys to the dictionary' join(dictionary.keys, ",") generates the .csv headers' join(dictionary.items,",") generates the .csv data row in the order that matches the header' If you need another column in the output file, add the empty header here, then insert a line in the' test script dictionary.item("KEY") = "VALUE" at the right placePrivate account_dict, contract_dict, eprofile_dictset account_dict = CreateObject("Scripting.Dictionary")account_dict.Add "Test_Name", ""account_dict.Add "Date", ""account_dict.Add "Time", ""account_dict.Add "Account_Id", ""account_dict.Add "Validate_Account", ""account_dict.Add "Complete", ""account_dict.Add "Database_Name", ""account_dict.Add "Company_Name", ""account_dict.Add "Company_Name2", ""account_dict.Add "Sort_Name", ""account_dict.Add "Contact_Name", ""account_dict.Add "Contact_Title", ""account_dict.Add "Salutation", ""account_dict.Add "Address_Line1", ""account_dict.Add "Address_Line2", ""account_dict.Add "City_Code", ""account_dict.Add "State_Code", ""account_dict.Add "Zip_Code", ""account_dict.Add "Geo_Code", ""account_dict.Add "Billing_Phone_Number", ""account_dict.Add "Listing_Phone_Number", ""account_dict.Add "Sales_Rep", ""account_dict.Add "Source_Code", ""account_dict.Add "Deliquent", ""account_dict.Add "Print_Statements", ""account_dict.Add "Tax_Exempt", ""account_dict.Add "Credit_Limit", ""account_dict.Add "Book_Count", ""account_dict.Add "Comments", ""account_dict.Add "Prior_Id", ""
account_dict.Add "SSN", ""account_dict.Add "Statement_Groups", ""account_dict.Add "Electronic_Billing", ""account_dict.Add "Email_Address", ""account_dict.Add "Website_Address", ""account_dict.Add "eProof_Address", ""
' A list of the fields on the account edit page hat have input values in the ' spreadsheet. So if these are edited, Ineed to update the dictionary objectPrivate field_names(30)field_names(1) = "Company_Name"field_names(2) = "Company_Name2"field_names(3) = "Sort_Name"field_names(4) = "Contact_Name"field_names(5) = "Contact_Title"field_names(6) = "Salutation"field_names(7) = "Address_Line1"field_names(8) = "Address_Line2"field_names(9) = "City_Code"field_names(10) = "State_Code"field_names(11) = "Zip_Code"field_names(12) = "Geo_Code"field_names(13) = "Billing_Phone_Number"field_names(14) = "Listing_Phone_Number"field_names(15) = "Sales_Rep"field_names(16) = "Source_Code"field_names(17) = "Deliquent"field_names(18) = "Print_Statements"field_names(19) = "Tax_Exempt"field_names(20) = "Credit_Limit"field_names(21) = "Book_Count"field_names(22) = "Comments"field_names(23) = "Prior_Id"field_names(24) = "SSN"field_names(25) = "Statement_Groups"field_names(26) = "Electronic_Billing"
set contract_dict = CreateObject("Scripting.Dictionary")contract_dict.Add "Test_Name", ""contract_dict.Add "Date", ""contract_dict.Add "Time", ""contract_dict.Add "Account_Id", ""contract_dict.Add "Contract_Number", ""contract_dict.Add "Contract_Number_Net", ""contract_dict.Add "Contract_Type", ""contract_dict.Add "Validate_Contract", ""contract_dict.Add "Complete", ""contract_dict.Add "Database_Name", ""contract_dict.Add "Book_Code", ""contract_dict.Add "Book_Year", ""contract_dict.Add "Sale_Date", ""contract_dict.Add "Sales_Rep", ""contract_dict.Add "Sub_Canvass", ""contract_dict.Add "Sales_Control_Total", ""contract_dict.Add "Rate_Band", ""contract_dict.Add "Source_Code", ""contract_dict.Add "DPay_Account_Id", ""contract_dict.Add "DPay_Description", ""contract_dict.Add "DPay_Registration_Id", ""
contract_dict.Add "Book_Count", ""contract_dict.Add "Date_Received", ""contract_dict.Add "Recorded_Call_Number", ""contract_dict.Add "Email_Address", ""contract_dict.Add "Website_Address", ""contract_dict.Add "Bundle_Udac", ""contract_dict.Add "Bundle_Coverage", ""contract_dict.Add "Bundle_Discount", ""
contract_dict.Add "Heading_1", ""contract_dict.Add "Udac_1", ""contract_dict.Add "Sbsct_1", ""contract_dict.Add "Discount_1", ""contract_dict.Add "Udac_Rate_1", ""contract_dict.Add "Anchor_1", ""contract_dict.Add "Heading_Date_1", ""contract_dict.Add "Layout_Code_1", ""contract_dict.Add "Web_Url_1", ""contract_dict.Add "DC_SalesRep_1", ""contract_dict.Add "DC_SubCanvass_1", ""contract_dict.Add "DC_Duration_1", ""contract_dict.Add "DC_Rate_1", ""contract_dict.Add "DC_SaleDate_1", ""contract_dict.Add "DC_StartDate_1", ""
contract_dict.Add "Heading_2", ""contract_dict.Add "Udac_2", ""contract_dict.Add "Sbsct_2", ""contract_dict.Add "Discount_2", ""contract_dict.Add "Udac_Rate_2", ""contract_dict.Add "Anchor_2", ""contract_dict.Add "Heading_Date_2", ""contract_dict.Add "Layout_Code_2", ""contract_dict.Add "Web_Url_2", ""contract_dict.Add "DC_SalesRep_2", ""contract_dict.Add "DC_SubCanvass_2", ""contract_dict.Add "DC_Duration_2", ""contract_dict.Add "DC_Rate_2", ""contract_dict.Add "DC_SaleDate_2", ""contract_dict.Add "DC_StartDate_2", ""
contract_dict.Add "Heading_3", ""contract_dict.Add "Udac_3", ""contract_dict.Add "Sbsct_3", ""contract_dict.Add "Discount_3", ""contract_dict.Add "Udac_Rate_3", ""contract_dict.Add "Anchor_3", ""contract_dict.Add "Heading_Date_3", ""contract_dict.Add "Layout_Code_3", ""contract_dict.Add "Web_Url_3", ""contract_dict.Add "DC_SalesRep_3", ""contract_dict.Add "DC_SubCanvass_3", ""contract_dict.Add "DC_Duration_3", ""contract_dict.Add "DC_Rate_3", ""contract_dict.Add "DC_SaleDate_3", ""contract_dict.Add "DC_StartDate_3", ""
contract_dict.Add "Heading_4", ""contract_dict.Add "Udac_4", ""contract_dict.Add "Sbsct_4", ""
contract_dict.Add "Discount_4", ""contract_dict.Add "Udac_Rate_4", ""contract_dict.Add "Anchor_4", ""contract_dict.Add "Heading_Date_4", ""contract_dict.Add "Layout_Code_4", ""contract_dict.Add "Web_Url_4", ""contract_dict.Add "DC_SalesRep_4", ""contract_dict.Add "DC_SubCanvass_4", ""contract_dict.Add "DC_Duration_4", ""contract_dict.Add "DC_Rate_4", ""contract_dict.Add "DC_SaleDate_4", ""contract_dict.Add "DC_StartDate_4", ""
contract_dict.Add "Heading_5", ""contract_dict.Add "Udac_5", ""contract_dict.Add "Sbsct_5", ""contract_dict.Add "Discount_5", ""contract_dict.Add "Udac_Rate_5", ""contract_dict.Add "Anchor_5", ""contract_dict.Add "Heading_Date_5", ""contract_dict.Add "Layout_Code_5", ""contract_dict.Add "Web_Url_5", ""contract_dict.Add "DC_SalesRep_5", ""contract_dict.Add "DC_SubCanvass_5", ""contract_dict.Add "DC_Duration_5", ""contract_dict.Add "DC_Rate_5", ""contract_dict.Add "DC_SaleDate_5", ""contract_dict.Add "DC_StartDate_5", ""
contract_dict.Add "Heading_6", ""contract_dict.Add "Udac_6", ""contract_dict.Add "Sbsct_6", ""contract_dict.Add "Discount_6", ""contract_dict.Add "Udac_Rate_6", ""contract_dict.Add "Anchor_6", ""contract_dict.Add "Heading_Date_6", ""contract_dict.Add "Layout_Code_6", ""contract_dict.Add "Web_Url_6", ""contract_dict.Add "DC_SalesRep_6", ""contract_dict.Add "DC_SubCanvass_6", ""contract_dict.Add "DC_Duration_6", ""contract_dict.Add "DC_Rate_6", ""contract_dict.Add "DC_SaleDate_6", ""contract_dict.Add "DC_StartDate_6", ""
contract_dict.Add "Heading_7", ""contract_dict.Add "Udac_7", ""contract_dict.Add "Sbsct_7", ""contract_dict.Add "Discount_7", ""contract_dict.Add "Udac_Rate_7", ""contract_dict.Add "Anchor_7", ""contract_dict.Add "Heading_Date_7", ""contract_dict.Add "Layout_Code_7", ""contract_dict.Add "Web_Url_7", ""contract_dict.Add "DC_SalesRep_7", ""contract_dict.Add "DC_SubCanvass_7", ""contract_dict.Add "DC_Duration_7", ""contract_dict.Add "DC_Rate_7", ""contract_dict.Add "DC_SaleDate_7", ""contract_dict.Add "DC_StartDate_7", ""
contract_dict.Add "Heading_8", ""contract_dict.Add "Udac_8", ""contract_dict.Add "Sbsct_8", ""contract_dict.Add "Discount_8", ""contract_dict.Add "Udac_Rate_8", ""contract_dict.Add "Anchor_8", ""contract_dict.Add "Heading_Date_8", ""contract_dict.Add "Layout_Code_8", ""contract_dict.Add "Web_Url_8", ""contract_dict.Add "DC_SalesRep_8", ""contract_dict.Add "DC_SubCanvass_8", ""contract_dict.Add "DC_Duration_8", ""contract_dict.Add "DC_Rate_8", ""contract_dict.Add "DC_SaleDate_8", ""contract_dict.Add "DC_StartDate_8", ""
contract_dict.Add "Heading_9", ""contract_dict.Add "Udac_9", ""contract_dict.Add "Sbsct_9", ""contract_dict.Add "Discount_9", ""contract_dict.Add "Udac_Rate_9", ""contract_dict.Add "Anchor_9", ""contract_dict.Add "Heading_Date_9", ""contract_dict.Add "Layout_Code_9", ""contract_dict.Add "Web_Url_9", ""contract_dict.Add "DC_SalesRep_9", ""contract_dict.Add "DC_SubCanvass_9", ""contract_dict.Add "DC_Duration_9", ""contract_dict.Add "DC_Rate_9", ""contract_dict.Add "DC_SaleDate_9", ""contract_dict.Add "DC_StartDate_9", ""
contract_dict.Add "Heading_10", ""contract_dict.Add "Udac_10", ""contract_dict.Add "Sbsct_10", ""contract_dict.Add "Discount_10", ""contract_dict.Add "Udac_Rate_10", ""contract_dict.Add "Anchor_10", ""contract_dict.Add "Heading_Date_10", ""contract_dict.Add "Layout_Code_10", ""contract_dict.Add "Web_Url_10", ""contract_dict.Add "DC_SalesRep_10", ""contract_dict.Add "DC_SubCanvass_10", ""contract_dict.Add "DC_Duration_10", ""contract_dict.Add "DC_Rate_10", ""contract_dict.Add "DC_SaleDate_10", ""contract_dict.Add "DC_StartDate_10", ""
contract_dict.Add "WR_Heading", ""contract_dict.Add "WR_Udac", ""contract_dict.Add "WR_Duration", ""contract_dict.Add "WR_Monthly_Rate", ""contract_dict.Add "WR_Start_Date", ""contract_dict.Add "Feature_1", ""contract_dict.Add "FeatureRate_1", ""contract_dict.Add "Feature_2", ""contract_dict.Add "FeatureRate_2", ""contract_dict.Add "Feature_3", ""contract_dict.Add "FeatureRate_3", ""
contract_dict.Add "Feature_4", ""contract_dict.Add "FeatureRate_4", ""contract_dict.Add "Feature_5", ""contract_dict.Add "FeatureRate_5", ""contract_dict.Add "Feature_6", ""contract_dict.Add "FeatureRate_6", ""contract_dict.Add "Feature_7", ""contract_dict.Add "FeatureRate_7", ""contract_dict.Add "Feature_8", ""contract_dict.Add "FeatureRate_8", ""
contract_dict.Add "Tax_Rate", ""contract_dict.Add "Deposit", ""contract_dict.Add "Check_Number", ""contract_dict.Add "Discount", ""contract_dict.Add "Trade_Credit", ""contract_dict.Add "Art_Charge", ""contract_dict.Add "Pay_Code", ""contract_dict.Add "Coupon_Code", ""
set eprofile_dict = CreateObject("Scripting.Dictionary")eprofile_dict.Add "Test_Name", ""eprofile_dict.Add "Date", ""eprofile_dict.Add "Time", ""eprofile_dict.Add "EP_Name_1", ""eprofile_dict.Add "EP_Address_Line1_1", ""eprofile_dict.Add "EP_Address_Line2_1", ""eprofile_dict.Add "EP_City_1", ""eprofile_dict.Add "EP_State_1", ""eprofile_dict.Add "EP_Zip_1", ""eprofile_dict.Add "EP_Phone_1", ""eprofile_dict.Add "EP_Fax_1", ""eprofile_dict.Add "EP_Email_1", ""eprofile_dict.Add "EP_Url_1", ""eprofile_dict.Add "EP_Contact_First_1", ""eprofile_dict.Add "EP_Contact_Last_1", ""eprofile_dict.Add "EP_Display_Url_1", ""eprofile_dict.Add "EP_Link_Url_1", ""eprofile_dict.Add "EP_RCF_1", ""eprofile_dict.Add "EP_Toll_Free_1", ""eprofile_dict.Add "EP_Coupon_Offer_1", ""eprofile_dict.Add "EP_Coupon_Disclaimer_1", ""eprofile_dict.Add "EP_Coupon_Expiration_1", ""
eprofile_dict.Add "EP_Name_2", ""eprofile_dict.Add "EP_Address_Line1_2", ""eprofile_dict.Add "EP_Address_Line2_2", ""eprofile_dict.Add "EP_City_2", ""eprofile_dict.Add "EP_State_2", ""eprofile_dict.Add "EP_Zip_2", ""eprofile_dict.Add "EP_Phone_2", ""eprofile_dict.Add "EP_Fax_2", ""eprofile_dict.Add "EP_Email_2", ""eprofile_dict.Add "EP_Url_2", ""eprofile_dict.Add "EP_Contact_First_2", ""eprofile_dict.Add "EP_Contact_Last_2", ""eprofile_dict.Add "EP_Display_Url_2", ""eprofile_dict.Add "EP_Link_Url_2", ""eprofile_dict.Add "EP_RCF_2", ""eprofile_dict.Add "EP_Toll_Free_2", ""
eprofile_dict.Add "EP_Coupon_Offer_2", ""eprofile_dict.Add "EP_Coupon_Disclaimer_2", ""eprofile_dict.Add "EP_Coupon_Expiration_2", ""
eprofile_dict.Add "EP_Name_3", ""eprofile_dict.Add "EP_Address_Line1_3", ""eprofile_dict.Add "EP_Address_Line2_3", ""eprofile_dict.Add "EP_City_3", ""eprofile_dict.Add "EP_State_3", ""eprofile_dict.Add "EP_Zip_3", ""eprofile_dict.Add "EP_Phone_3", ""eprofile_dict.Add "EP_Fax_3", ""eprofile_dict.Add "EP_Email_3", ""eprofile_dict.Add "EP_Url_3", ""eprofile_dict.Add "EP_Contact_First_3", ""eprofile_dict.Add "EP_Contact_Last_3", ""eprofile_dict.Add "EP_Display_Url_3", ""eprofile_dict.Add "EP_Link_Url_3", ""eprofile_dict.Add "EP_RCF_3", ""eprofile_dict.Add "EP_Toll_Free_3", ""eprofile_dict.Add "EP_Coupon_Offer_3", ""eprofile_dict.Add "EP_Coupon_Disclaimer_3", ""eprofile_dict.Add "EP_Coupon_Expiration_3", ""
eprofile_dict.Add "EP_Name_4", ""eprofile_dict.Add "EP_Address_Line1_4", ""eprofile_dict.Add "EP_Address_Line2_4", ""eprofile_dict.Add "EP_City_4", ""eprofile_dict.Add "EP_State_4", ""eprofile_dict.Add "EP_Zip_4", ""eprofile_dict.Add "EP_Phone_4", ""eprofile_dict.Add "EP_Fax_4", ""eprofile_dict.Add "EP_Email_4", ""eprofile_dict.Add "EP_Url_4", ""eprofile_dict.Add "EP_Contact_First_4", ""eprofile_dict.Add "EP_Contact_Last_4", ""eprofile_dict.Add "EP_Display_Url_4", ""eprofile_dict.Add "EP_Link_Url_4", ""eprofile_dict.Add "EP_RCF_4", ""eprofile_dict.Add "EP_Toll_Free_4", ""eprofile_dict.Add "EP_Coupon_Offer_4", ""eprofile_dict.Add "EP_Coupon_Disclaimer_4", ""eprofile_dict.Add "EP_Coupon_Expiration_4", ""
eprofile_dict.Add "EP_Name_5", ""eprofile_dict.Add "EP_Address_Line1_5", ""eprofile_dict.Add "EP_Address_Line2_5", ""eprofile_dict.Add "EP_City_5", ""eprofile_dict.Add "EP_State_5", ""eprofile_dict.Add "EP_Zip_5", ""eprofile_dict.Add "EP_Phone_5", ""eprofile_dict.Add "EP_Fax_5", ""eprofile_dict.Add "EP_Email_5", ""eprofile_dict.Add "EP_Url_5", ""eprofile_dict.Add "EP_Contact_First_5", ""eprofile_dict.Add "EP_Contact_Last_5", ""eprofile_dict.Add "EP_Display_Url_5", ""eprofile_dict.Add "EP_Link_Url_5", ""eprofile_dict.Add "EP_RCF_5", ""eprofile_dict.Add "EP_Toll_Free_5", ""
eprofile_dict.Add "EP_Coupon_Offer_5", ""eprofile_dict.Add "EP_Coupon_Disclaimer_5", ""eprofile_dict.Add "EP_Coupon_Expiration_5", ""
eprofile_dict.Add "EP_Name_6", ""eprofile_dict.Add "EP_Address_Line1_6", ""eprofile_dict.Add "EP_Address_Line2_6", ""eprofile_dict.Add "EP_City_6", ""eprofile_dict.Add "EP_State_6", ""eprofile_dict.Add "EP_Zip_6", ""eprofile_dict.Add "EP_Phone_6", ""eprofile_dict.Add "EP_Fax_6", ""eprofile_dict.Add "EP_Email_6", ""eprofile_dict.Add "EP_Url_6", ""eprofile_dict.Add "EP_Contact_First_6", ""eprofile_dict.Add "EP_Contact_Last_6", ""eprofile_dict.Add "EP_Display_Url_6", ""eprofile_dict.Add "EP_Link_Url_6", ""eprofile_dict.Add "EP_RCF_6", ""eprofile_dict.Add "EP_Toll_Free_6", ""eprofile_dict.Add "EP_Coupon_Offer_6", ""eprofile_dict.Add "EP_Coupon_Disclaimer_6", ""eprofile_dict.Add "EP_Coupon_Expiration_6", ""
eprofile_dict.Add "EP_Name_7", ""eprofile_dict.Add "EP_Address_Line1_7", ""eprofile_dict.Add "EP_Address_Line2_7", ""eprofile_dict.Add "EP_City_7", ""eprofile_dict.Add "EP_State_7", ""eprofile_dict.Add "EP_Zip_7", ""eprofile_dict.Add "EP_Phone_7", ""eprofile_dict.Add "EP_Fax_7", ""eprofile_dict.Add "EP_Email_7", ""eprofile_dict.Add "EP_Url_7", ""eprofile_dict.Add "EP_Contact_First_7", ""eprofile_dict.Add "EP_Contact_Last_7", ""eprofile_dict.Add "EP_Display_Url_7", ""eprofile_dict.Add "EP_Link_Url_7", ""eprofile_dict.Add "EP_RCF_7", ""eprofile_dict.Add "EP_Toll_Free_7", ""eprofile_dict.Add "EP_Coupon_Offer_7", ""eprofile_dict.Add "EP_Coupon_Disclaimer_7", ""eprofile_dict.Add "EP_Coupon_Expiration_7", ""
eprofile_dict.Add "EP_Name_8", ""eprofile_dict.Add "EP_Address_Line1_8", ""eprofile_dict.Add "EP_Address_Line2_8", ""eprofile_dict.Add "EP_City_8", ""eprofile_dict.Add "EP_State_8", ""eprofile_dict.Add "EP_Zip_8", ""eprofile_dict.Add "EP_Phone_8", ""eprofile_dict.Add "EP_Fax_8", ""eprofile_dict.Add "EP_Email_8", ""eprofile_dict.Add "EP_Url_8", ""eprofile_dict.Add "EP_Contact_First_8", ""eprofile_dict.Add "EP_Contact_Last_8", ""eprofile_dict.Add "EP_Display_Url_8", ""eprofile_dict.Add "EP_Link_Url_8", ""eprofile_dict.Add "EP_RCF_8", ""eprofile_dict.Add "EP_Toll_Free_8", ""
eprofile_dict.Add "EP_Coupon_Offer_8", ""eprofile_dict.Add "EP_Coupon_Disclaimer_8", ""eprofile_dict.Add "EP_Coupon_Expiration_8", ""
eprofile_dict.Add "EP_Name_9", ""eprofile_dict.Add "EP_Address_Line1_9", ""eprofile_dict.Add "EP_Address_Line2_9", ""eprofile_dict.Add "EP_City_9", ""eprofile_dict.Add "EP_State_9", ""eprofile_dict.Add "EP_Zip_9", ""eprofile_dict.Add "EP_Phone_9", ""eprofile_dict.Add "EP_Fax_9", ""eprofile_dict.Add "EP_Email_9", ""eprofile_dict.Add "EP_Url_9", ""eprofile_dict.Add "EP_Contact_First_9", ""eprofile_dict.Add "EP_Contact_Last_9", ""eprofile_dict.Add "EP_Display_Url_9", ""eprofile_dict.Add "EP_Link_Url_9", ""eprofile_dict.Add "EP_RCF_9", ""eprofile_dict.Add "EP_Toll_Free_9", ""eprofile_dict.Add "EP_Coupon_Offer_9", ""eprofile_dict.Add "EP_Coupon_Disclaimer_9", ""eprofile_dict.Add "EP_Coupon_Expiration_9", ""
eprofile_dict.Add "EP_Name_10", ""eprofile_dict.Add "EP_Address_Line1_10", ""eprofile_dict.Add "EP_Address_Line2_10", ""eprofile_dict.Add "EP_City_10", ""eprofile_dict.Add "EP_State_10", ""eprofile_dict.Add "EP_Zip_10", ""eprofile_dict.Add "EP_Phone_10", ""eprofile_dict.Add "EP_Fax_10", ""eprofile_dict.Add "EP_Email_10", ""eprofile_dict.Add "EP_Url_10", ""eprofile_dict.Add "EP_Contact_First_10", ""eprofile_dict.Add "EP_Contact_Last_10", ""eprofile_dict.Add "EP_Display_Url_10", ""eprofile_dict.Add "EP_Link_Url_10", ""eprofile_dict.Add "EP_RCF_10", ""eprofile_dict.Add "EP_Toll_Free_10", ""eprofile_dict.Add "EP_Coupon_Offer_10", ""eprofile_dict.Add "EP_Coupon_Disclaimer_10", ""eprofile_dict.Add "EP_Coupon_Expiration_10", ""
' Filename fragments for the config and data filePublic C_ConfigFilePattern Public C_DataFilePattern
Private test_namePrivate spreadsheet_rowPrivate allowed_errorsPrivate database_namePrivate company_name, company_name2Private contact_name, contact_salutation, contact_title Private address_line1, address_line2, city_codePrivate billing_phone_number, listing_phone_numberPrivate sales_repPrivate edit_fieldsPrivate tax_exempt, electronic_billingPrivate domain_name, email_address, website_address
Private eproof_addressPrivate book_code, book_year, sale_date, sub_canvass, sales_control_total, rate_band, source_code, book_countPrivate date_received, recorded_call_number, bundle_udac, bundle_coverage, bundle_discountPrivate sct_tax_rate, sct_deposit, sct_check_number, sct_discount, sct_trade_creditPrivate sct_art_charge, sct_pay_code, sct_coupon_codePrivate contract_number
Private calculated_total_ratePrivate line_itemPrivate calculated_udac_rate
Private monthly_udac_rates(10)
' Init_Test' Initializes a Test by setting up the log, output file, etc' Returns true if successful, false if notPublic Function Init_Test()
Init_Test = false ' Assume a failure
Dim name_parts, tmp_string
' Load the local user environment file if it exists fnLoadEnvData(C_UserEnvironment) 'Common_Function library--Line-14
'C_UserEnvironment = J:\Test_Automation_Shared\Test_Data\Diad_Test\Config\YBWVMKOPQ7C001\User_panwas01_env.xml
'OR'C_UserEnvironment = C:\Test_Automation\Test_Data\Diad_Test\Config\YBWVM
KOPQ7C001\User_panwas01_env.xml
' Determine if using the test name in the environment (mostly for debugging)
' If not, then the one from the environment will be usedtest_name = fnGetEnvVariable("DIAD_TEST_NAME") ' test_name = SmokeTest_
Contract_Enter_Decoupled--Common_Function Library-238If len(test_name) = 0 Then test_name = Environment.Value("TestName") ' t
est_name = SmokeTest_Contract_Enter_Decoupled
Randomize' Init the random #generator
MercuryTimers("elapsed_time").Start ' Start the elapsed test timer
StartReport() ' Start the HTML report file
' The test was renamed by the user env variable DIAD_TEST_NAMEIf test_name <> Environment.Value("TestName" ) Then
LogMessage gInfo, "Test renamed " & test_name, "The test name was over-ridden by env variable DIAD_TEST_NAME."
End If
If fnLoadConfig(C_ConfigFilePattern)= false then 'C_ConfigFilePattern = "diad_config.xls" --Loads the config file -- Comm
on_function Library-Line-629LogMessage gError, "Init Test", "Load config file returned an er
ror"
Exit Functionend if
spreadsheet_row = fnLoadData(C_DataFilePattern, test_name&".xls") 'Common_function Library-Line-741
'C_DataFilePattern = "contract_enter_decoupled.xls"'fnLoadData-- loads the datasheet from localIf spreadsheet_row = false Then
LogMessage gError, "Init Test", "Load data file returned an error"
Exit Functionend if
Init_Test = trueEnd Function ' Init_Test
' End_Test' Finishes up a Test by closing the log, output files, etc' Returns true if successful, false if notPublic Function End_Test() End_Test = false
' Stop the elapsed test timer and log the elspsed timeMercuryTimers("elapsed_time").StopLogMessage gInfo, "Performance", "Test " & test_name & " executed in " &
fnFormatSeconds(MercuryTimers("elapsed_time").Stop / 1000, C_ShowUnits)
TTclose()Cleanup_Test()EndReport()End_Test = true
End Function ' End_Test
' Cleanup_Test' This function is called wheneve a "LogMessage gAbort" entry is generated' right before the test exits. You can use it to do anything needed such as ' dump data to files prior to the test exiting, etc.'' For Contract Entry tests, dump the output files so I can see what data is in themPublic Function Cleanup_Test() On error goto 0 ' turn off on error resume next set in LogMessage Cleanup_Test = false
' Write the entered data to the output CSV files' fnWriteDictionaryFile only writes data if something was set in the dic
tionary' ======================================================================
===========fnWriteDictionaryFile test_name, "account", account_dict
fnWriteDictionaryFile test_name, "contract", contract_dictfnWriteDictionaryFile test_name, "eprofile", eprofile_dict
Cleanup_Test = trueEnd Function
' Create_Diad_Account' This function creates a new account, starting at the DIAD Main Menu' Returns account_id If successful, false If Not' =====================================================================================Private Function Create_Diad_Account()
Create_Diad_Account = false
Const event_name = "Create Account"
Dim account_id, cursor, tmp_string, buffer
LogMessage gInfo, event_name, "Creating new account " & company_name & " in database " & database_name
account_dict.Item("Database_Name") = database_name '--P
' Check test is on the correct pageScreenMatch "2. Account Finder", 30TTenter "2" & micReturn
' Make sure you are on the correct page ScreenMatch ">>> Account Finder <<<", 30TTenter billing_phone_number & micReturn '---entering Phone number - 610
9172013 and enterTTenter company_name & micReturn '----917 1hTTenter contact_name & micReturn '--enterTTenter micF11 '---F11 and goes to Account edit page
' make sure on the account edit pageScreenMatch ">>> ACCOUNT EDIT <<<", 30 '---Appering
' check to see If the Account was foundIf TTwaitfor("Opts", 1) Then
LogMessage gInfo, event_name, "An account already exists in database "& database_name & " for company " & company_name & ", skipping record."
Exit FunctionEnd If
' check to see If the Account Edit Page displayedScreenMatch ">>> ACCOUNT EDIT <<<", 30 '---appering
TTenter micReturn account_dict.Item("Company_Name") = company_name
TTenter company_name2 & micReturn account_dict.Item("Company_Name2")= company_name2
' Sort Name SpellingTTenter company_name & micReturn '--appering sort name spelling and cl
icking on enter
TTenter contact_name & micReturn '917 1haccount_dict.Item("Contact_Name") = contact_name
TTenter contact_title & micReturn '--entering owneraccount_dict.Item("Contact_Title") = contact_title
TTenter contact_salutation & micReturn '--nullaccount_dict.Item("Salutation") = contact_salutation
TTenter address_line1 & micReturn ' --4745 DIAD_Test Street account_dict.Item("Address_Line1") = address_line1
wait 1
TTenter address_line2 & micReturn '---nullaccount_dict.Item("Address_Line2") = address_line2 wait 0, 500 '--wait for 1/2 sec
TTenter city_code & micReturn '--KIOFPA account_dict.Item("City_Code") = city_code
wait 0 , 500
TTenter micReturn TTenter micReturnTTenter micReturnTTenter billing_phone_number & micReturn '--automatically value is refl
ecting account_dict.Item("Billing_Phone_Number") = billing_phone_number
TTenter listing_phone_number & micReturn '--'--automatically value is reflecting , billing_phone_nuber value is reflecting account_dict.Item("Listing_Phone_Number") = listing_phone_number
TTenter sales_rep & micReturn '--56992 account_dict.Item("Sales_Rep") = sales_rep
' wait to see If the Invalid Sales Rep msg displaysIf TTwaitfor("INVALID REP CODE", 3) Then '---sales_rep value is invalid
than it will give error msg lineLogMessage Fail, event_name, "Invalid sales rep id " & sales_r
ep TTenter micReturn TTenter C_DefaultSalesRep & micReturn
End If
' wait to see If the Tax Exempt needs to be keyedcursor = LocateCursor(C_DefaultCursor1, 0) '---checks the cursor placeIf cursor = "19,66" Then '--if cursor plce value is 19,66 than it is pla
ced at Tax Execmpt TTenter tax_exempt & micReturn account_dict.Item("Tax_Exempt") = tax_exemptcursor = LocateCursor(C_DefaultCursor1, 0) 'checking again wher
e is the cursor place after enterEnd If
If cursor = "22,66" Then TTenter micReturn ' SSNcursor = LocateCursor(C_DefaultCursor1, 0)
End If
TTenter electronic_billing & micReturn '--cursor at Electronic Billing --
account_dict.Item("Electronic_Billing") = electronic_billing
' wait to see If the Search Phone Page displaysIf TTwaitfor("Search Phone:", 2) Then
LogMessage gInfo, event_name, "Search phone page displayed"TTenter micReturn wait 1buffer = TTgetScreenAsString()
If instr(buffer, "Abort entry and use Existing Account") ThenTTenter "N" &micReturn
End IfIf instr(buffer, "Too many matches - ignoring") Then
TTenter micReturn End If
End If
If TTwaitfor("Create a workwith relationship", 2) ThenTTenter "N" & micReturn
End If
' wait to see If Is the information okay msg displayedScreenMatch "Is the information Okay/Update eProof", 30
' If fields need to be edited (Account #2), enter "N"If len(edit_fields) > 0 Then
Dim l, aTTenter "N" & micReturnFor each l in split(edit_fields, ";;")
a = split(l, "::")LogMessage gtrace, "Edit_Field", "Line: " & a(0) & ", va
lue " & a(1) ScreenMatch "Which field would you like to change", 30
TTenter a(0) & micReturnIf TTwaitfor("This phone number belongs to a Telco",1) T
henLogMessage gWarning, "Account Edit", "Message 'T
his phone number belongs to a Telco' displayed"TTenter micReturn
elsewait 0,250TTenter a(1) & micReturnaccount_dict.Item(field_names(a(0))) = a(1)
end ifnextTTenter micReturnIf TTwaitfor("Search Phone", 3) Then
TTenter micReturnwait 2buffer = TTgetScreenAsString()If instr(buffer, "Abort entry and use Existing Account")
ThenTTenter "N" &micReturn
End IfIf instr(buffer, "Too many matches - ignoring") Then
TTenter micReturn End If
End IfIf TTwaitfor("Create a workwith relationship", 1) Then
TTenter "N" & micReturnEnd If
End IfIf len(eproof_address) = 0 Then
TTenter "Y"&micReturnElse
TTenter "P" & micReturnEnd If
' wait for assigned customer id to display
ScreenMatch "Assigned customer ID", 30account_id = ScreenScrape("Assigned customer ID:", 0, 23, 29)LogMessage gPass, event_name, "Added account, id " & account_id &" to D
atabase " & database_name account_dict.Item("Account_Id") = account_id
' respond to the Enter prompt to get to the eProof Option PageTTenter micReturn
If len(eProof_address)> 0 ThenScreenMatch "Account eProof Options", 30TTenter micReturn ' This s
kips the Account Code LineTTenter "Y" & micReturn ' enable eproofsTTenter eproof_address & micReturn ' enter the addressScreenMatch "Is the information okay", 30TTenter "Y" & micReturn
End If
ScreenMatch "Do you have a Siebel ID", 30TTenter "N" & micReturn
ScreenMatch "Assignment Data", 30cursor = LocateCursor(C_DefaultCursor1, 0)If cursor = "8,24" Then
TTenter micReturn ' Assignment Typewait 0,500
End IfTTenter micReturn ' Zonewait 1TTenter micReturn ' Primary Headingwait 1TTenter micReturn ' Current Account Repwait 2ScreenMatch "Is the information okay", 30TTenter "Y" & micReturn
' make sure you are on the correct page Screenmatch ">>> Supplemental Account Information <<<", 30TTenter email_address & micReturnaccount_dict.Item("Email_Address") = email_address
TTenter website_address & micReturnaccount_dict.Item("Website_Address") = website_address
TTenter email_address & micReturnTTenter website_address & micReturnTTenter micReturn ' Co Name Ln1TTenter micReturn ' Co Name Ln2TTenter micReturn ' Contact Name TTenter micReturn ' SalutationTTenter micReturn ' TitleTTenter micReturn ' Address Ln 1TTenter micReturn ' Address Ln 2TTenter micReturn ' City CodeTTenter micReturn ' Zip CodeTTenter micReturn ' Seen At Phone
ScreenMatch "Is the information okay", 30 TTenter "Y" & micReturn
If TTwaitfor("Do you want to edit comment window", 2) ThenTTenter "N" & micReturn
End If
If TTwaitfor("Do you want to view customer leads", 2) ThenTTenter "N" & micReturn
End If
Create_Diad_Account = account_id '---created account id - 900074End Function
' Create_Diad_Contract' Inputs the initial contract information for all contracts' Returns true If successful, false If Not' ==============================================================================================Private Function Create_Diad_Contract(created_arg, account_arg ) ---(True,900074)
Create_Diad_Contract = false
Dim tmp_string, sanity_check, bufferDim displayed_account_nameDim displayed_billing_numberDim displayed_street_addressDim data_registration_id, cursor
' Script created the account, we should be at the ' New Contract Entry Page alreadyIf created_arg Then '---Created_arg = true
ScreenMatch "New Contract Entry" , 30TTenter micReturn
' sanity check the company name, phone &address' wait for the address to show up, then scrape everythingsanity_check = truedisplayed_street_address = ""While len(displayed_street_address) = 0
wait 0,500 'wait for 1/2 secbuffer = TTgetScreenAsArray()displayed_street_address = trim(mid(buffer(2), 40, 40))
Wenddisplayed_account_name = trim(mid(buffer(1), 40, 40))displayed_billing_number = trim(mid(buffer(2), 20, 13))
' check to see If the account Name and If the name displayed matches the name created
If trim(LCase(displayed_account_name)) = trim(LCase(account_dict.Item("Company_Name"))) Then
LogMessage gPass,"Displayed account name matches", "The account name displayed (" & displayed_account_name & ") matches the account name created (" & account_dict.Item("Company_Name") & ") ."
ElseLogMessage gFail, "Displayed account name does Not match
", "The account name displayed (" & displayed_account_name & ") does Not match the account name created (" & account_dict.Item("Company_Name") & ") ."
sanity_check = falseEnd If
' check to see If the Street Address created matches the Street Address displayed
If trim(LCase(displayed_street_address)) = trim(Lcase(account_dict.Item("Address_Line1"))) Then
LogMessage gPass, "Displayed street address matches", "The street address displayed (" & displayed_street_address & ") matches the street address created (" & account_dict.Item("Address_Line1") & ") ."
ElseLogMessage gFail, "Displayed street address does Not mat
ch", "The street address displayed (" & displayed_street_address & ") does Not match the street address created (" & account_dict.Item("Address_Line1") & ") ."
sanity_check = falseEnd If
' check to see If the Billing number created matches the billing number displayed
If fnFormatPhoneNumber(displayed_billing_number) = fnFormatPhoneNumber(account_dict.Item("Billing_Phone_Number")) Then
LogMessage gPass, "Displayed billing phone number matches", "The billing number displayed (" & displayed_billing_number & ") matches the billing number created (" & account_dict.Item("Billing_Phone_Number") & ") ."
ElseLogMessage gFail, "Displayed billing phone number does N
ot match", "The billing number displayed (" & displayed_billing_number & ") does Not match the billing number created (" & account_dict.Item("Billing_Phone_Number") & ") ."
sanity_check = falseEnd If
If Not sanity_check ThenLogMessage gFail, "Sanity check failed", "One or more Ac
count sanity checks failed."Exit function
End If
' Account taken from spreadsheetElse
ScreenMatch "6. Contract Entry - New" , 30TTenter "6" & micReturn
ScreenMatch "New Contract Entry" , 30TTenter account_arg & micReturn
End If
ScreenMatch "New Contract Entry" , 30
LogMessage gInfo, "Create Contract", "Creating contract for account "& account_arg
contract_dict.Item("Account_Id") = account_arg contract_dict.Item("Database_Name") = database_name
' Wait and see if any of the following messages appearedwait 3buffer = TTgetScreenAsString()If instr(buffer, "Out-of-Business flag is set") Then
LogMessage gFail, "Out of Business flag set", "The Out of business flag was set for account id " & account_arg
Exit FunctionEnd If
If instr(buffer, "Can't find that customer") ThenLogMessage gFail, "Account Not found", "Account Id " & account_a
rg & " was Not found in database " & database_nameExit Function
End If
' Accept the defaults from the account dataTTenter micReturn ' ContactTTenter micReturn ' TitleTTenter micReturn ' Salutation
' Book Code, sanity check we're at the book codecursor = LocateCursor(C_DefaultCursor1, 0)If cursor <> "10,19" Then
LogMessage gFail, "Contract Enter", "Not at Book code entry after accepting contact, title and salutation from account"
Exit functionEnd IfTTenter book_code & micReturn wait 2buffer = TTgetScreenAsString()If instr(buffer, "does Not exist") OR _ instr(buffer, "Can't find that book") _Then
LogMessage gFail, "Book code does Not exist", "The entered book code " & book_code & " does Not exist in database " & database_name
TTenter micReturnExit function
End Ifcontract_dict.Item("Book_Code") = book_code
' Book YearTTenter book_year & micReturn wait 2buffer = TTgetScreenAsString()If instr(buffer, "That Book/Year is Blocked") Then
LogMessage gFail, "Book/Year is blocked", "Book code " & book_code & ", year " & book_year & " is blocked in database " & database_name
Exit FunctionEnd Ifcontract_dict.Item("Book_Year") = book_year
' check to see If Final materials were due msg displayed If instr(buffer, "Warning: Final materials were due on") Then
LogMessage gWarning, "Final materials due", "The final materials were due warning was displayed for Book code " & book_code & ", year " & book_year & " in database " & database_name
TTenter micReturnEnd If
' check to see If Contract Entry/Change is Password Protected msg displayed
tmp_string = "The Contract Entry/Change is Password Protected" If TTwaitfor(tmp_string, 2) Then
LogMessage gFail, tmp_string, "Contract Entry/Change for Account " & account_arg & " is password protected."
Exit FunctionEnd If
' Sale Date
TTenter sale_date & micReturnIf TTwaitfor("Warning: End of Canvass was", 1) Then
LogMessage gWarning, "End of canvass", "End of Canvass warning was displayed for Book code " & book_code & ", year " & book_year &_
"Setting sale date to end of canvas date"
LogMessage gCapture, "End of canvass", "Screen captured"tmp_string = ScreenScrape("Warning: End of Canvass was", 0, 1,
80)tmp_string = split(tmp_string, " ")(5)TTenter micReturn & micUp & tmp_string & micReturn
End Ifcontract_dict.Item("Sale_Date") = sale_date
tmp_string = ScreenScrape("Sales rep code", 0, 21, 30)TTenter tmp_string & micReturn
If TTwaitfor("This Sales Rep was terminated", 2) ThenLogMessage gFail, "Sales rep terminated", "Sales Rep: " & tmp_s
tring & " was terminated. Using default Sales Rep: " & C_DefaultSalesRepTTenter micReturn & C_DefaultSalesRep & micReturn
End If contract_dict.Item("Sales_Rep") = tmp_string
' Sub-Canvasstmp_string = ScreenScrape("Sub-Canvass", 0, 19, 22)cursor = LocateCursor(C_DefaultCursor1, 0)If cursor = "14,19" Then
If len(sub_canvass)= 0 Thensub_canvass = tmp_string
End IfTTenter sub_canvass & micReturn contract_dict.Item("Sub_Canvass") = sub_canvass
' check to see If commissions Not set up msg displayedIf TTwaitfor("commissions Not set up for this book", 2)Then
LogMessage gFail, tmp_string, "Rep level commissions Not set for this book or year."
TTenter micReturn & micReturnExit Function
End If ' commissions Not set upEnd If
If TTwaitfor("Warning: Prior commission period", 1) ThenLogMessage gWarning, "Prior comissions warning", "The prior comi
ssions period for this book is closed or blocked"TTenter micReturn
End If
cursor = LocateCursor(C_DefaultCursor1, 0)If cursor = "15,26" Then
TTenter sales_control_total & micReturnIf TTwaitfor("Control total must be 0 for new web contracts", 2)
Thensales_control_total = 0LogMessage gWarning, "Control total must be 0", "The Co
ntrol total must be 0 for new web contracts. Entering '0'"TTenter micReturnTTenter sales_control_total & micReturn
End If
If TTwaitfor("Warning: Prior commission period", 2) ThenLogMessage gWarning, "Prior comissions warning", "The pr
ior comissions period for this book is closed or blocked"TTenter micReturn
End Ifcontract_dict.Item("Sales_Control_Total") = sales_control_total
End If
' Source Code cursor = LocateCursor(C_DefaultCursor1, 0)If cursor = "18,19" Then
TTenter source_code & micReturn wait 2buffer = TTgetScreenAsString()If instr(buffer, "INVALID SOURCE CODE") OR _ instr(buffer, "Source Code is Disabled") _Then
LogMessage gFail, "Source Code Invaild", "The source code " & source_code & " is invalid."
TTenter micReturn & micReturnExit Function
End If contract_dict.Item("Source_Code") = source_code
End If
If TTwaitfor("Customer Direct Payment Account Information", 3) Then
' create an 8 digit random number for Bank/Credit Card Account ID
tmp_string = fnRandomPadded(7) & "1"TTenter tmp_string & micReturn contract_dict.Item("DPay_Account_Id") = tmp_string
tmp_string = "This is the description."TTenter tmp_string & micReturn contract_dict.Item("DPay_Description") = tmp_string
' create a10 digit random number for the first data registration id
data_registration_id = fnRandomPadded(9) &"1"TTenter data_registration_id & micReturn
If TTwaitfor("Verify", 3) ThenTTenter data_registration_id & micReturn
End If contract_dict.Item("DPay_Registration_Id") = data_registration_i
d
ScreenMatch "Is the information okay", 30TTenter "Y" & micReturn
'ScreenMatch "This will make this a Pay Per Call contract" , 30'TTenter "Y" & micReturn
End If
' Number of bookscursor = LocateCursor(C_DefaultCursor1, 0)If cursor = "21,36" Then
TTenter book_count & micReturn wait 1
contract_dict.Item("Book_Count") = book_count End If
' Date Receivedcursor = LocateCursor(C_DefaultCursor1, 0)If cursor = "22,20" Then
TTenter date_received & micReturn contract_dict.Item("Date_Received") = date_received
End If
' Recorded Call Numbercursor = LocateCursor(C_DefaultCursor1, 0)If cursor = "22,61" Then
TTenter recorded_call_number & micReturnIf len(recorded_call_number) > 0 Then
wait 1buffer = TTgetScreenAsString()If instr(buffer, "belongs to customer") Then
LogMessage gWarning, " Recorded Call Number", _ "Recorded call number " &
recorded_call_number & " belongs to customer " &_ Screen
Scrape("belongs to customer",0, 53, 59) & ". " &_ "Using
empty string."recorded_call_number = ""TTenter micReturnTTenter recorded_call_number & micReturn
End If
If instr(buffer, "Invalid Call Reference Number") Then LogMessage gWarning, "Recorded Call Number", _ "Recorded call number " & r
ecorded_call_number & " is invalid." TTenter "Y" & micReturnEnd If
End Ifcontract_dict.Item("Recorded_Call_Number") = recorded_call_numbe
r end if
ScreenMatch "Is the information OK so far", 30TTenter "Y" & micReturn
Create_Diad_Contract = trueEnd Function ' Create_Diad_Contract
' Process_Sales_Control_Page' Process the Sales Control Total page' Return True If successful, false If Not' =================================================================================Private Function Process_Sales_Control_Page()
Process_Sales_Control_Page = False
Const event_name = "Sales Control Page"
Dim cursor, page_complete, coupon_codeDim ev_prefix, tmp_string, buffer
Dim sct_entered, sct_diad
page_complete = false
do While Not page_completecursor = LocateCursor(C_DefaultCursor1, 0 )
select case cursor' Sales Discount (none offered in Smoke Test at this tim
e)Case "5,40"
TTenter micReturn ' check to see If there is a Control Tot
al MismatchIf TTwaitfor("Control Total Mismatch", 2
) Thensct_entered = ScreenScrape("Sale
s Control Total", 0, 40, 48)sct_diad = ScreenScrape("Line
total", 0, 40, 48)LogMessage gWarning, event_name
& "Control total mismatch", "The Sales Control Total entered (" & sct_entered & ") " &_
"did Not match the one calculated by DIAD (" & sct_diad & ")."
End If
' Tax rateCase "7,40"
TTenter sct_tax_rate & micReturn contract_dict.Item("Tax_Rate") = sct_tax
_rate
' Deposit AppliedCase "9,40"
TTenter sct_deposit & micReturn contract_dict.Item("Deposit") = sct_depo
sit
' Check #Case "10,40"
TTenter sct_check_number & micReturn contract_dict.Item("Check_Number") = sct
_check_number
' Cash Discount Case "11,40"
TTenter sct_discount & micReturn contract_dict.Item("Discount") = sct_dis
count
' Trade Credit Discount Case "12,40"
TTenter sct_trade_credit & micReturn contract_dict.Item("Trade_Credit") = sct
_trade_credit
' Art Charge (Case "13,40"
TTenter sct_art_charge & micReturn contract_dict.Item("Art_Charge") = sct_a
rt_charge
' Pay codecase "14,40"
TTenter sct_pay_code & micReturn contract_dict.Item("Pay_Code") = sct_pay
_codewait 2buffer = TTgetScreenAsString()If instr(buffer, "Can't find that Pay Co
de") OR _ instr(buffer, "That Pay Code is disab
led") OR _ instr(buffer, "Data must be entered i
n this field") ThenLogMessage gFail, "Sales Control
Pay Code", "Missing or Bad Pay Code '" & sct_pay_code & "' entered."Exit Function
End If
' Send proof for new copy (Always in the smoke test)Case "15,40"
TTenter "Y" & micReturn If TTwaitfor("Press <ENTER>", 3) Then
TTenter "Y" & micReturn End If
' coupon code Case "16,23"
TTenter sct_coupon_code & micReturn wait 2buffer = TTgetScreenAsString()If instr(buffer, "That is Not a valid co
upon code") OR _ instr(buffer, "That coupon code has a
lready been used") OR _ instr(buffer, "Coupon code is Not val
id for contract signing date") _Then
LogMessage gWarning, "Invalid coupon code", "Coupon Code: " & sct_coupon_code & " is Not valid. Blanking out coupon code and continuing."
TTenter micReturn & micReturnEnd Ifcontract_dict.Item("Coupon_Code") = sct_
coupon_code
Case ElseIf TTwaitfor("Is the information OK?", 1) Then
TTenter "Y" & micReturnpage_complete = true
elseif TTwaitfor("Electronic Profile", 1) ThenCall CE_Electronic_Profiles()
ElseLogMessage gAbort, "Unknown Cursor " & c
ursor, "An Unknown cursor position was detected procesing the Sales Control Total page"
End If
end selectloopProcess_Sales_Control_Page = true
End Function
' Process_Print_Pages' After a contract has been entered, this code processes print page' requests that come up.' Note: contract_type is Not used at this time...' returns true' ======================================================================================Public function Process_Print_Pages()
Process_Print_Pages = false
Dim rc, buffer, tmp_string
' Process all non Webreach contract print pages' ========================================' Print Artwork Labels for nonIf Not TTwaitfor("Print Labels From Key", 2 ) Then
If TTwaitfor("Printing Artwork Labels", 5) ThenIf TTwaitfor("Set Label Printer to", 2) Then
TTenter micF11 End If
If TTwaitfor("Are you sure you want to abandon printing labels", 5) Then
TTenter "Y" & micReturn End If
If TTwaitfor("No device selected", 8) Then TTenter micReturn
End IfEnd If
End If
If TTwaitfor("Reprint Barcode Labels", 2) ThenTTenter "N"& micReturn
End If
' Print Artwork Labels for internet bundleIf Not TTwaitfor("Print Labels From Key", 2) Then
If TTwaitfor("Printing Artwork Labels", 8) ThenIf TTwaitfor("Set Label Printer to", 2) Then
TTenter micF11 End If
If TTwaitfor("Are you sure you want to abandon printing labels", 5) Then
TTenter "Y" & micReturn End If
If TTwaitfor("No device selected", 8) Then TTenter micReturn
End IfEnd If
End If
' Print labels from Key pageIf TTwaitfor("Print Labels From Key", 8) Then
TTenter micF11 If TTwaitfor("Is the information okay", 2) Then
TTenter "Y" & micReturn End If
If TTwaitfor("Set Label Printer to", 2) Then TTenter micF11
End If
If TTwaitfor("Are you sure you want to abandon printing labels", 5) Then
TTenter "Y" & micReturn End If
If TTwaitfor("No device selected", 1) Then TTenter micReturn
End IfEnd If
If TTwaitfor("Edit Printing (1) or Non-Printing (2) Comments", 2) Then TTenter micF11
End If
If TTwaitfor("Market Contract Edition Seniority Override",3) ThenTTenter micReturnTTenter "Y"&micReturn
End IfIf TTwaitfor("Edit product/option associations", 2)Then
TTenter "N" & micReturn End If
If TTwaitfor("Do you want to set up or review work-with data", 2) Then TTenter "N" & micReturn
End If
If TTwaitfor("Do you want to set or clear queries", 2) Then TTenter "N" & micReturn
End If
If TTwaitfor("Do you want to print the prooflist for this contract", 2) Then
TTenter "N" & micReturn End If
' approve print contractIf TTwaitfor("Do you want to approve this contract", 3) Then
TTenter "Y" & micReturn If TTwaitfor("has been approved", 10) Then
TTenter micReturn End If
End If
rc =TTwaitfor("Can't approve", 3)If rc Then
Do while (rc <> 0)TTenter micReturnrc = TTwaitfor("Can't approve", 3)
loop
End If
' approve Net contractIf TTwaitfor("Do you want to approve NET contract", 3) Then
' Get the net contract number' the split() pulls it from the line and the left() strips the "
?"buffer = TTGetScreenAsArray()tmp_string = split(buffer(23)," ")(7)contract_dict.Item("Contract_Number_Net") = left(tmp_string,len(
tmp_string)-1)TTenter "Y" & micReturn If TTwaitfor("has been approved", 10) Then
TTenter micReturn End If
End If
rc =TTwaitfor("Can't approve", 3)If rc Then
Do while (rc <> 0)TTenter micReturnrc = TTwaitfor("Can't approve", 3)
loopEnd If
If Not TTwaitfor("Is this a MediaPro proposal", 1) Then If TTwaitfor("Do you want to approve NET contract", 5)Then
TTenter "Y" & micReturn & micReturn End If
End If
ScreenMatch "Is this a MediaPro proposal" , 30 TTenter "N" & micReturn
Process_Print_Pages = trueEnd Function
' DIAD_Validate_Account' Validates a print/decoupled/bundled contract in DIAD' Returns true If successful, false If Not' It assumes validation will pass, Then checks everything and sets false If any one vailes' ==========================================================================Private Function DIAD_Validate_Account(account_arg)
DIAD_Validate_Account = true
Dim account
Set account = DIAD_Get_Account_Dictionary(database_name, account_arg)
If Not DIAD_Validate_Account_Item(account, "Account_Id") Then DIAD_Validate_Account = False
If Not DIAD_Validate_Account_Item(account, "Company_Name") Then DIAD_Validate_Account = False
If Not DIAD_Validate_Account_Item(account, "Company_Name2") Then DIAD_Validate_Account = False
If Not DIAD_Validate_Account_Item(account, "Contact_Name") Then DIAD_Validate_Account = False
If Not DIAD_Validate_Account_Item(account, "Contact_Title") Then DIAD_
Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "Salutation") Then D
IAD_Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "Address_Line1") Then DIAD_
Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "Address_Line2") Then DIAD_
Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "City_Code") Then D
IAD_Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "Billing_Phone_Number") Then
DIAD_Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "Listing_Phone_Number") Then
DIAD_Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "Sales_Rep") Then D
IAD_Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "Email_Address") Then DIAD_
Validate_Account = FalseIf Not DIAD_Validate_Account_Item(account, "Website_Address") Then DIAD_
Validate_Account = False
End Function ' DIAD_Validate_Account
' DIAD_Validate_Account_Item' Validates one Account item' Returns true If successful, false If Not' ==========================================================================Private Function DIAD_Validate_Account_Item(account_arg, item_arg)
DIAD_Validate_Account_Item = false
Dim entered_value, diad_value'account_dict.Item(item_arg) = 900074
entered_value = account_dict.Item(item_arg)
If len(entered_value) = 0 Then '---not equal to 0LogMessage gPass, "Validate Account: " & item_arg, "No input va
lue, so DIAD assumed ok.<br>Datasheet: " & entered_value & ", Diad: " & diad_value
elsediad_value = account_arg.Item(item_arg)'diad_value = 900074
If diad_value = entered_value Then '---both values are sameLogMessage gPass, "Validate Account: " & item_arg, "Inp
ut value == DIAD value.<br>Datasheet: " & entered_value & ", Diad: " & diad_value
ElseLogMessage gFail, "Validate Account: " & item_arg, "Inp
ut value <> DIAD value.<br>Datasheet: " & entered_value & ", Diad: " & diad_value
Exit functionEnd If
End IfDIAD_Validate_Account_Item = true
End Function
' DIAD_Validate_Contract_Item
' Validates a singlecontract item in DIAD' Returns true If successful, false If Not' It assumes validation will fail, and returns true If it does Not' ==========================================================================Private Function DIAD_Validate_Contract_Item(contract_arg, item_arg, dict_arg)
DIAD_Validate_Contract_Item = false
Dim entered_value, diad_value, diad_name
' entered_value is what was entered into DIADentered_value = contract_dict.Item(item_arg)If len(entered_value) = 0 Then
LogMessage gPass, "Validate Contract: " & item_arg, "No input value, DIAD value assumed ok.<br>Datafile: " & entered_value & ", Diad: " & diad_value
Elsediad_name = item_argIf len(dict_arg) > 0 Then diad_name = dict_arg
' Handle Sales Control Page variationsIf left(diad_name, 4) = "SCT_" Then
If ucase(right (entered_value, 1)) = "M" Thenentered_value = 12 * left(entered_value, len(ent
ered_value) - 1)End If
End If
If instr(diad_name, "SCT_") > 0 OR _ instr(diad_name, "rate") > 0 OR _ instr(diad_name, "Rate") > 0 _Then
diad_value = Ccur(contract_arg.Item(diad_name))entered_value = CCur(entered_value)
Elsediad_value = left(contract_arg.Item(diad_name), len(en
tered_value))End If
' Skip Dates that were entered as "T", assume they are correctIf instr(item_arg, "Date") >0 Then
If lcase(diad_value)= "t" ThenLogMessage gPass, "Validate Contract: " & item_a
rg, "Input value == 'T' for a date, DIAD value is assumed correct.<br>Datafile: " & entered_value & ", Diad: " & diad_value
End IfElse
If diad_value = entered_value ThenLogMessage gPass, "Validate Contract: " & item_a
rg, "Input value == DIAD value.<br>Datafile: " & entered_value & ", Diad: " & diad_value
ElseLogMessage gFail, "Validate Contract: " & item_a
rg,"Input value <> DIAD value<br>Datafile: " & entered_value & ", Diad: " & diad_value
Exit functionEnd If
End ifEnd If
DIAD_Validate_Contract_Item = true
End Function
' DIAD_Get_Account_Dictionary' Returns a dictionary object of the information for the given account_id' The function expects to start at the DIAD Directory Selection and returns there when done' =========================================================================public function DIAD_Get_Account_Dictionary(database_arg, account_arg)
DIAD_Get_Account_Dictionary = false
Dim d, bufferSet d = CreateObject("Scripting.Dictionary")
ScreenMatch "DIAD Directory Selection", 30TTenter database_arg & micReturn
ScreenMatch "DIAD Main Menu", 30TTenter "1" & micReturn TTenter "2" & micReturn ScreenMatch ">>> Account Finder <<<", 30
TTenter micReturn & micReturn & micReturn TTenter account_arg &micReturn TTenter micF11
TTenter "E1" & micReturn ScreenMatch ">>> ACCOUNT EDIT <<<", 30buffer = TTgetScreenAsArray()
' Add the account datad.Add "Account_Id", trim(mid(buffer(1), 26, 8))d.Add "Company_Name", trim(mid(buffer(2), 26, 65))d.Add "Company_Name2", trim(mid(buffer(3), 26, 65))d.Add "Company_Name_Sort", trim(mid(buffer(4), 26, 65))d.Add "Contact_Name", trim(mid(buffer(5), 26, 65))d.Add "Contact_Title", trim(mid(buffer(6), 12, 20))d.Add "Salutation", trim(mid(buffer(6), 53, 20))d.Add "Address_Line1", trim(mid(buffer(7), 26, 65)) d.Add "Address_Line2", trim(mid(buffer(8), 26, 65))d.Add "City_Code", trim(mid(buffer(9), 17, 10))d.Add "Billing_Phone_Number", fnFormatPhoneNumber(trim(mid(buffer(13),
17, 12)))d.Add "Listing_Phone_Number", fnFormatPhoneNumber(trim(mid(buffer(14),
17, 12)))d.Add "Sales_Rep", trim(mid(buffer(15), 22, 15))d.Add "Source_Code", trim(mid(buffer(16), 22, 15))d.Add "Delinquent", trim(mid(buffer(17), 22, 3))d.Add "Print_Statements", trim(mid(buffer(18), 30, 3))d.Add "Tax_Exempt", trim(mid(buffer(18), 66, 3))d.Add "Credit_Limits", trim(mid(buffer(19), 22, 15))d.Add "Books_Shipped", trim(mid(buffer(19), 66, 5))d.Add "Comments", trim(mid(buffer(20), 13, 80))d.Add "Prior_Id", trim(mid(buffer(21), 13, 24))d.Add "Ssn", trim(mid(buffer(21), 66, 12))d.Add "Statement_Group", trim(mid(buffer(22), 22, 8))d.Add "Electronic", trim(mid(buffer(22), 69, 3))Call TTEnter ("Y" & micReturn)' End of the first Screen
ScreenMatch ">>> Supplemental Account Information <<<", 30buffer = TTgetScreenAsArray()d.Add "Email_Address", trim(mid(buffer(6), 25, 80))d.Add "Website_Address", trim(mid(buffer(7), 23, 80))d.Add "Fax_Number", fnFormatPhoneNumber(trim(mid(buffer(8), 17, 12)))d.Add "Pub_Email_Address", trim(mid(buffer(8), 60,80))d.Add "Pub_Website_Address", trim(mid(buffer(9), 60, 80))d.Add "Seen_at_Phone", trim(mid(buffer(22), 19,12))
' finish up by navigating back to the main menuTTenter micF11 & micReturn TTenter micF11 If TTwaitfor("Do you want to edit comment window", 2) = true Then
TTenter "N" & micReturn End IfIf TTwaitfor("Comments exist", 2) = true Then
TTenter "N" & micReturn End IfLogMessage gInfo, "Get Account Dictionary", "Built dictionary for accoun
t " & account_arg
set DIAD_Get_Account_Dictionary = dSet d = Nothing
fnDiadNavigateToDirSelection()End Function ' DIAD_Get_Account_Dictionary
' DIAD_Get_Contract_Dictionary' Returns a dictionary object of the information for the given contract_id' The function expects to start at the DIAD Directory Selection and returns there when done' =========================================================================Public function DIAD_Get_Contract_Dictionary(database_arg, contract_arg) DIAD_Get_Contract_Dictionary = false
Dim d, buffer, get_web_fieldsDim idx, offset, tmp_stringSet d = CreateObject("Scripting.Dictionary")get_web_fields = false
ScreenMatch "DIAD Directory Selection", 30TTenter database_arg & micReturn
' At this point in the loop, the DIADMain Menu should be displayedScreenMatch "DIAD Main Menu", 30
TTenter "1" & micReturn TTenter "8" & micReturn
ScreenMatch ">>> Contract Change <<<", 30TTenter contract_arg &micReturn
wait 1buffer = TTgetScreenAsArray()
d.Add "Contract_Number", trim(mid(buffer(1), 22,10))d.Add "Book_Code", trim(mid(buffer(1), 41, 6))d.Add "Account_Id", trim(mid(buffer(2), 22, 10))
d.Add "Company_Name", trim(mid(buffer(2), 41, 40))d.Add "Billing_Phone_Number", fnFormatPhoneNumber(trim(mid(buffer(3), 22
, 12)))d.Add "Address_Line1", trim(mid(buffer(3), 41, 40))d.Add "Listing_Phone_Number", fnFormatPhoneNumber(trim(mid(buffer(4), 22
, 12)))d.Add "Address_Line2", trim(mid(buffer(4), 41, 40))d.Add "Sales_Rep", trim(mid(buffer(5), 22, 10))d.Add "Contact_Name", trim(mid(buffer(7), 19, 40))d.Add "Contact_Title", trim(mid(buffer(8), 19, 20))d.Add "Salutation", trim(mid(buffer(8), 60, 20))d.Add "Email_Address", trim(mid(buffer(9), 19, 60))d.Add "Rate_Band", trim(mid(buffer(11), 19, 5))d.Add "Sale_Date", trim(mid(buffer(12), 19, 10))d.Add "Source_Code", trim(mid(buffer(13), 19, 10))d.Add "Point_Of_Contact", trim(mid(buffer(14), 36, 40))d.Add "Client_Name", trim(mid(buffer(15), 36, 40))d.Add "Books_Shipped", trim(mid(buffer(16), 37, 3))d.Add "Date_Received", trim(mid(buffer(17), 21, 12))d.Add "Recorded_Call_Number", trim(mid(buffer(18), 28, 20))
' check to see If Final materials were due msg displayed buffer = TTgetScreenAsString()tmp_string = "Warning: Final Materials were due on"If instr(buffer, tmp_string) > 0 Then
LogMessage gWarning, "Final materials due", tmp_string&" was displayed for Book code/year "&book_code
TTenter micReturnEnd If
' check to see If Contract Entry/Change is Password Protected msg displayed
tmp_string = "The Contract Entry/Change is Password Protected" If instr(buffer,tmp_string) > 0 Then
LogMessage gFail, "Password Protected", tmp_string&" message was displayed for Book code/year "&book_code
Exit FunctionEnd If
tmp_string = "Warning: Prior commission period"If instr(buffer, tmp_string) Then
LogMessage gWarning, "Prior commission period", tmp_string&" was displayed for Book code/year "&book_code
TTenter micReturnEnd If
' Line ItemsTTenter "L" & micReturn
' PRINT / DECOUPLED CONTRACTIf TTwaitfor("Monthly Additional Feature", 2) = false Then
If instr(TTgetScreenAsString(), "Web Related Fields") > 0 Thenget_web_fields = true
End If
buffer = TTgetScreenAsArray()For idx = 1 to 10
If idx > 7 Then ' Get 8th - 10th itemTTenter micDwn
wait 0,500 buffer = TTgetScreenAsArray()ScreenMatch "LN Heading Code/Description", 30offset = 8
Elseoffset = idx + 1
End If
' Exit loop If heading is emptyIf len(trim(mid(buffer(offset), 4, 7)))= 0 Then
Exit forEnd If
d.Add "Heading_"&idx, trim(mid(buffer(offset), 4, 7))d.Add "Sbsct_"&idx, trim(mid(buffer(offset), 29, 5))d.Add "Udac_"&idx, trim(mid(buffer(offset), 35, 5))d.Add "Discount_"&idx, trim(mid(buffer(offset), 42, 2))d.Add "Udac_Rate_"&idx, trim(mid(buffer(offset), 45, 8))d.Add "Listing_"&idx, trim(mid(buffer(offset), 54, 2))d.Add "Anchor_"&idx, trim(mid(buffer(offset), 58, 2))d.Add "Seniority_"&idx, trim(mid(buffer(offset), 61, 9))d.Add "Art_Id_"&idx, trim(mid(buffer(offset), 72, 10))
If get_web_fields = true Thenoffset = offset +13d.Add "DC_Heading_"&idx, trim(mid(buffer(offset)
, 4, 7))d.Add "DC_Udac_"&idx, trim(mid(buffer(offset), 1
2, 5))d.Add "DC_Done_"&idx, trim(mid(buffer(offset), 1
9, 4))d.Add "DC_Months_Billed_"&idx, trim(mid(buffer(o
ffset), 24, 6))d.Add "DC_SalesRep_"&idx, trim(mid(buffer(offset
), 32, 7))d.Add "DC_SubCanvass_"&idx, trim(mid(buffer(offs
et), 40, 5))d.Add "DC_Duration_"&idx, trim(mid(buffer(offset
), 47, 3))d.Add "DC_Rate_"&idx, trim(mid(buffer(offset), 5
1, 7))d.Add "DC_SaleDate_"&idx, trim(mid(buffer(offset
), 60, 9))d.Add "DC_StartDate_"&idx, trim(mid(buffer(offse
t), 71, 9))End If
Next
' navigate to the SCT pageTTenter "U" & micReturn
If contract_dict.Item("Contract_Type") = "Bundle" ThenDo while TTwaitfor("Do you want to choose a different bu
ndle package", 12) = trueTTenter "N" & micReturn If TTwaitfor(">>> Contract Bundle Definition <<<
", 2) = true ThenTTenter micF11
End IfIf TTwaitfor("F=Fwrd B=Back Choice:", 2) = tr
ue ThenTTenter micF11
End IfIf TTwaitfor("Is the information okay?", 2) = tr
ue ThenTTenter "Y" & micReturn
End IfLoop
End IfIf TTwaitfor("Is the information okay?", 2) = true Then
TTenter "Y" & micReturn End If
ScreenMatch "Sales Control Total", 30buffer = TTgetScreenAsArray()
d.Add "SCT_Total_New", trim(mid(buffer(3), 41,10))d.Add "SCT_Total_Old", trim(mid(buffer(3), 54,10))d.Add "SCT_LineTotal_New", trim(mid(buffer(4), 41,10))d.Add "SCT_LineTotal_Old", trim(mid(buffer(4), 54,10))d.Add "SCT_Discount_New", trim(mid(buffer(5), 41,10))d.Add "SCT_Discount_Old", trim(mid(buffer(5), 54,10))d.Add "SCT_DiscountNet_New", trim(mid(buffer(6), 41,10))d.Add "SCT_DiscountNet_Old", trim(mid(buffer(6), 54,10))d.Add "SCT_Tax_New", trim(mid(buffer(7), 41,10))d.Add "SCT_Tax_Old", trim(mid(buffer(7), 54,10))d.Add "SCT_Total_Sale_New", trim(mid(buffer(8), 41,10))d.Add "SCT_Total_Sale_Old", trim(mid(buffer(8), 54,10))d.Add "SCT_Trade_Out_New", trim(mid(buffer(9), 41,10))d.Add "SCT_Trade_Out_Old", trim(mid(buffer(9), 54,10))
d.Add "SCT_Coupon_Code", trim(mid(buffer(10), 18, 20))d.Add "SCT_Coupon_New", trim(mid(buffer(10), 41,10))d.Add "SCT_Coupon_Old", trim(mid(buffer(10), 54,10))
d.Add "SCT_Pay_Code", trim(mid(buffer(12), 15, 4))
d.Add "SCT_Check_Number", trim(mid(buffer(14), 22,10))d.Add "SCT_Check_Amount", trim(mid(buffer(15), 22,10))d.Add "SCT_Diccount_Amount", trim(mid(buffer(16), 22,10))
' Return to Contract Change PageTTenter micF11 ScreenMatch "Are you sure you want to ABORT", 30TTenter "Y" & micReturn
' WEBREACH CONTRACTElse
buffer = TTgetScreenAsArray()d.Add "Contract_Type", "WebReach"d.Add "Heading_New", trim(mid(buffer(3), 17, 10))d.Add "Heading_Old", trim(mid(buffer(3), 30, 10))d.Add "Udac_New", trim(mid(buffer(4), 17, 10))d.Add "Udac_Old", trim(mid(buffer(4), 30, 10))d.Add "Duration_New", trim(mid(buffer(5), 17, 10))d.Add "Duration_", trim(mid(buffer(5), 30, 10))d.Add "Monthly_Rate_New", trim(mid(buffer(6), 17, 10))d.Add "Monthly_Rate_Old", trim(mid(buffer(6), 30, 10))d.Add "Start_Date_New", trim(mid(buffer(7), 17, 10))d.Add "Start_Date_Old", trim(mid(buffer(7), 30, 10))
d.Add "Status", trim(mid(buffer(7), 54, 10))
' Monthly featureFor idx = 1 to 6
offset = idx + 10If len(trim(mid(buffer(offset), 5,10))) = 0 Then
Exit forEnd Ifd.Add "FeatureRate_"&idx, trim(mid(buffer(offset
), 5,10))d.Add "Feature_"&idx, trim(mid(buffer(offset), 4
5,40))next
' Return to Contract Change pageTTenter micF11
End IfLogMessage gInfo, "Get Contract Dictionary", "Built dictionary for contr
act " & contract_arg
set DIAD_Get_Contract_Dictionary = dSet d = Nothing
fnDiadNavigateToDirSelection()End Function ' DIAD_Get_Contract_Dictionary
' CalculateTaxRate' For a given city code, calculate the tax rate' (based on steps in test 02005 Tax verification)' returns "false" if an error, or the tax rate to applyPrivate function Calculate_Tax_Rate(city_arg)
Calculate_Tax_Rate = false
Dim city_name, state_code, county_code, city_tax_rate, city_tax_codeDim state_tax_rate, county_tax_rate, county_state_codeDim total_tax_rate, buffer
total_tax_rate = 0
' Assume starting at the main menuScreenMatch "DIAD Main Menu", 30ScreenMatch "4. >> Table Maintenance", 30
' Get the City taxesTTenter "4" & micReturn
ScreenMatch "4a >> City Table - Update", 30
TTenter "4a" & micReturnScreenMatch "1. City Table - Create/Edit", 30
TTenter "1" & micReturnScreenMatch "1. City Code", 30TTenter city_arg & micReturn
wait 2buffer = TTgetScreenAsString()If instr(buffer, "| AKAs") > 0 Then
TTenter micReturnEnd If
city_name = ScreenScrape("City Name", 4, 16, 40)state_code = ScreenScrape("State Code", 6, 17, 20)county_code = ScreenScrape("County Code", 9, 18, 30)city_tax_rate = ScreenScrape("Tax Rate", 10, 28, 35)city_tax_code = ScreenScrape("Tax Code", 11, 15, 35)
LogMessage gTrace, "Calculate_Tax_Rate", "Calculating taxes for " & city_arg & "(" & city_name & ", " & state_code & ")"
LogMessage gTrace, "Calculate_Tax_Rate", "City Tax: " & city_tax_rateIf len(city_tax_rate)> 0 Then
total_tax_rate = total_tax_rate + city_tax_rateEnd If
TTenter micF11ScreenMatch "Is the information okay?", 30TTEnter "Y" & micReturn
' Return to the tables MenuTTenter micF11 &micF11
' Get the state taxesScreenMatch "TABLES MENU", 30ScreenMatch "4. >> Address Management Tables", 30
TTenter "4" & micReturnScreenMatch "61. >> County,State,and Country Menu", 30
TTenter "61" & micReturnScreenMatch "County State and Country Table Menu", 30ScreenMatch "2. States - Create/Edit", 30
TTenter "2" & micReturnScreenMatch "STATE TABLE", 30TTenter state_code & micReturn
state_tax_rate = ScreenScrape("Tax Rate", 13, 29, 45)LogMessage gTrace, "Calculate_Tax_Rate", "State Tax: " & state_tax_rateIf len(state_tax_rate) > 0 Then
total_tax_rate = total_tax_rate + state_tax_rateend if
TTenter micF11ScreenMatch "Is the information okay?", 30TTEnter "Y" & micReturn TTenter micF11
ScreenMatch "County State and Country Table Menu", 30ScreenMatch "1. Counties - Create/Edit", 30
TTenter "1" & micReturn ScreenMatch "County Table", 30
TTenter county_code & micReturn
county_state_code = ScreenScrape("State Code", 5, 17, 21)county_tax_rate = ScreenScrape("Tax Rate", 6, 28, 45)LogMessage gTrace, "Calculate_Tax_Rate", "County Tax: " & county_tax_rat
eIf len(county_tax_rate) > 0 Then
total_tax_rate = total_tax_rate + county_tax_rateend if
'Sanity check the state matches upIf county_state_code <> state_code Then
LogMessage gFail, "Tax Rate Lookup", "The state code for the city (" & state_code & ")did NOT match " &_
"the state code for the county (" & county_state_code & "). " &_
"This is very, very bad....."
Exit FunctionEnd If
TTenter micF11ScreenMatch "Is the information okay?", 30TTEnter "Y" & micReturn TTenter micF11
LogMessage gTrace, "Calculate_Tax_Rate", "Total Tax: " & total_tax_rateCalculate_Tax_Rate = total_tax_rate & "%"
End Function
' Calculate_Udac_Rate' Lookup the UDAC rate based on the UDAC's and Discount Code in the spreadsheet line' Returns the rate' =========================================================================Private Function Calculate_Udac_Rate(item_arg)
Calculate_Udac_Rate = -1
Const event_name = "Calculate Udac Rate"
Dim searchfor, searchfor2, search_flagDim start_offset, end_offsetDim temp_line, elapsed, sleepDim wrk_row_rate, full_priceDim cursor, multiplier, lockdownDim udac_discount, udac_code
udac_code = fnGetDsColumn("Udac_" & item_arg, C_DSinput, "")udac_discount = fnGetDsColumn("Discount_" & item_arg, C_DSinput, "")
wrk_row_rate = 0start_offset = 56end_offset = 66
' Determine where to look for the ratesIf len(udac_discount) < 5 Then
searchfor = fnRightPad(udac_discount, 5, " ") & "Y"searchfor2 = fnRightPad(udac_discount, 5, " ") & "N"
Elsesearchfor = " 1 " & udac_code & " "searchfor2=" 1 " & udac_code & " "
End If
' The first time thru, get to the rate tableif TTwaitfor( "DIAD Main Menu", 2) then
TTenter "4" & micReturn
ScreenMatch "TABLES MENU", 10TTenter "8" & micReturn
ScreenMatch "RATE TABLES", 10TTenter "1" & micReturn
End If
' Verify location, in spite of the fact I should be hereIf Not TTwaitfor("Rate Band Table", 10) then
LogMessage gFail, event_name, "Not on the Rate Band Table page. The test should be on the rate band page at this point in the test."
Exit functionEnd If
TTenter book_code & micReturn If TTwaitfor("Can't find that book",1) Then
LogMessage gFail, event_name, "Can't find book " & book_code & ". The book is Not in this DIAD database"
Exit functionEnd If
TTenter book_year & micReturn
' Enter the Rate Band , and wait for up to 100 seconds for it to become available
TTenter rate_band & micReturnIf TTwaitfor("This rate band is in use", 2) Then
elapsed = 0sleep = 10Do while(elapsed <= 100)
If TTwaitfor("This rate band is in use", 2) ThenExit Do
Elsewait(sleep)TTenter micReturn elapsed = elapsed +sleep
End IfLoopIf elapsed > 100 Then
LogMessage gFail, event_name, "Could not get rate band for book " & book_code & ", udac " & udac & ", discount " & udac_discount & " and rate band:" & rate_band
Exit functionEnd If
End If
If TTwaitfor("Copy this rate band from",2) ThenLogMessage gWarning, event_name, "Copy Rate Band prompt was unex
pected for book " & book_code & ", udac " & udac & ", discount " & udac_discount & " and rate band:" & rate_band
TTenter micReturn & micReturn End If
' Leave Description field "as is"TTenter micReturn
' Save the rate multipliermultiplier = ScreenScrape("Rate Multiplier", 0, 73,76)lockdown = ScreenScrape("Lockdown?", 0, 73, 76)cursor = LocateCursor(C_DefaultCursor1, 0)If cursor = "5,74" Then
TTenter multiplier & micReturn End If
' Leave Lockdown "as is"TTenter lockdown & micReturn
If TTwaitfor("Edit Rates",2) ThenTTenter "R" & micReturn
End If
If Not TTwaitfor("C#=Change",10) Then ' 08032010LogMessage gFail, event_name, "Could Not get UDAC rates
in Book: " & Book & ", Rate band:" & RatebandExit function
End If
TTenter "|" & micReturnIf Not TTwaitfor("Filter: *",2) Then
' check to see if the Please select R or D or F msg displayed
if TTwaitfor("Please select R or D or S or F", 2) ThenTTenter "R" & micReturn & "|" & micReturnwait 1
End If
' check to see if Enter: Y or N msg displayedif TTwaitfor("Enter: Y or N", 2) Then
TTenter micReturn & "N" & micReturn & "R" & micReturn & "|" & micReturn
wait 1End If
End If
' check to see if Filter: * displayedIf TTwaitfor("Filter: *", 2) Then
TTenter udac_code & micReturn End If
' If no udac_discount, get the rate off line 10' Otherwise, look for the rate matching the discountfull_price = ScreenScrape("Rate Band Table",10, start_offset, end_offset
)If len(udac_discount) = 0 then
wrk_row_rate = full_priceElse
search_flag = 0Do while(search_flag = 0)
if TTwaitfor("Enter: Y or N", 2) ThenTTenter micReturn & "N" & micReturn & "|" & mic
Return wait 1
' check to see if Filter: * displayedif TTwaitfor("Filter: *", 3) Then
TTenter udac_code & micReturn End If
End If
' check to see if discount code displayedtemp_line = ScreenScrape(searchfor, 0, start_offset, end
_offset)If temp_line <> false Then
wrk_row_rate = temp_lineExit do
Elsetemp_line = ScreenScrape(searchfor2, 0, start_of
fset, end_offset)If temp_line <> false Then
wrk_row_rate = temp_lineExit do
Else' move to the next screenTTenter "F" & micReturn
' check to see if 'No more pages displays
if TTwaitfor("No more pages", 2) ThenLogMessage gInfo, event_name, "
Rate for book : " & book_code & ", Rate band : " & rate_band & ", Udac: "& udac &", discount : " & udac_discount & " was not found, Using non-discounted rate."
wrk_row_rate = full_price' No rate
search_flag = 1 ' set search flag to break loop
TTenter micReturn & micF11
' setup to look for the next UDAC
if TTwaitfor("Edit Rates", 2) then ' 08032010
TTenter "R" & micReturn End If
End If End If
End IfLoop
End If
' Back to the rate band screen, ready for the next Book & UDACTTenter micF11 & micF11 & micF11 & "Y" & micReturn
Calculate_Udac_Rate = wrk_row_rateEnd Function ' Calculate_Udac_Rate
' CE_Electronic_Profiles' Process electronic profiles page for Contract Entry Script. after setting the appropriate offset from' the top of the screen' =========================================================================Public function CE_Electronic_Profiles()
CE_Electronic_Profiles = False
' The offset to the first electronic profile line is 7 when doing a contract entry
Const offset = 7
Dim line_number, idx, profile, page_complete
' Whenever a profile is updated, line #1 is higlighted' So I need to loop over &overpage_complete = false
' Only one UDAC was entered, so there will be only one profileIf TTwaitfor("copy a new profile, blank to create from scratch", 2) Then
TTenter micReturnProcess_One_Electronic_Profile("1")
elseDo while page_complete = false
For line_number = 1 to 8idx = ScreenScrape("A", line_number + offset, 1,
2) profile = ScreenScrape("A", line_number + offset
, 5, 9)
' If no line item, I'm doneIf len(idx) = 0 Then
page_complete = trueExit for
End If
' If there is an assigned profile, go to the next one
If len(profile) > 0 ThenTTenter micDwn
Else' Othewise, hit enter to editTTenter micReturn TTenter micCtrlDwn & "A" & "K" & micCtrl
Up &micReturn Process_One_Electronic_Profile(line_numb
er)Exit for
End IfNext
loopTTenter micF11
end if
If TTwaitfor("Conflicts must be resolved", 2) thenLogMessage gFail, "Conflicts must be resolved", "Process Electro
nic Profiles, Contract Line Conflicts detected." Exit function
end ifCE_Electronic_Profiles = true
End Function ' CE_Electronic_Profiles
' Process_One_Electronic_Profile - ' Process a single Electronic Profile ' Return true if it completes, it "fails" if Not
' =========================================================================public function Process_One_Electronic_Profile(line_arg)
Process_One_Electronic_Profile = false
Dim tmp_stringDim sc_msg, address_line2
' Nametmp_string = fnGetDsColumn("EP_Name_"& line_arg, C_DSprofiles, "")TTenter tmp_string & micReturn contract_dict.Item("EP_Name_"& line_arg) = tmp_string
address_line1 = fnGetDsColumn("EP_Address_Line1_" & line_arg, C_DSprofiles, "")
address_line2 = fnGetDsColumn("EP_Address_Line2_" & line_arg, C_DSprofiles, "")
if address_line2 = "CREATE" then address_line2 = address_line1 & " Line 2"
' Address 1Process_Electronic_Profile_Item "Address 1", fnGetDsColumn("EP_Address_L
ine1_" & line_arg, C_DSprofiles, "") Process_Electronic_Profile_Item "Address 2", address_line2 Process_Electronic_Profile_Item "City", fnGetDsColumn("EP_City_" &
line_arg, C_DSprofiles, "") Process_Electronic_Profile_Item "State", fnGetDsColumn("EP_State_" &
line_arg, C_DSprofiles, "") Process_Electronic_Profile_Item "Zip", fnGetDsColumn("EP_Zip_" & l
ine_arg, C_DSprofiles, "") Process_Electronic_Profile_Item "Phone", fnGetDsColumn("EP_Phone_" &
line_arg, C_DSprofiles, "") Process_Electronic_Profile_Item "Fax", fnGetDsColumn("EP_Fax_"
& line_arg, C_DSprofiles, "")Process_Electronic_Profile_Item "E-mail", fnGetDsColumn("EP_Email
_" & line_arg, C_DSprofiles, "") Process_Electronic_Profile_Item "URL", fnGetDsColumn("EP_Url_"
& line_arg, C_DSprofiles, "")Process_Electronic_Profile_Item "Contact First Name", fnGetDsColumn("EP_
Contact_First_" & line_arg, C_DSprofiles, "") Process_Electronic_Profile_Item "Contact Last Name", fnGetDsColumn("EP_
Contact_Last_" & line_arg, C_DSprofiles, "")
Process_Electronic_Profile_Item "Display URL", fnGetDsColumn("EP_Display_Url_" & line_arg, C_DSprofiles, "")
Process_Electronic_Profile_Item "Link URL", fnGetDsColumn("EP_Link_Url_" & line_arg, C_DSprofiles, "")
Process_Electronic_Profile_Item "RCF", fnGetDsColumn("EP_RCF_" & line_arg, C_DSprofiles, "")
Process_Electronic_Profile_Item "Toll Free", fnGetDsColumn("EP_Toll_Free_" & line_arg, C_DSprofiles, "")
Process_Electronic_Profile_Item "Coupon Offer", fnGetDsColumn("EP_Coupon_Offer_" & line_arg, C_DSprofiles, "")
Process_Electronic_Profile_Item "Coupon Disclaimer", fnGetDsColumn("EP_Coupon_Disclaimer_" & line_arg, C_DSprofiles, "")
Process_Electronic_Profile_Item "Coupon Expiration", fnGetDsColumn("EP_Coupon_Expiration_" & line_arg, C_DSprofiles, "")
' Choice
ScreenMatch "C#=Change F=Fwrd B=Back Choice:", 30TTenter micReturn
ScreenMatch "Is the information okay", 30TTenter "Y" & micReturn
if TTwaitfor("Press <ENTER>", 2) thenTTenter micReturn
End If
Process_One_Electronic_Profile = trueEnd Function ' Process_One_Electronic_Profile
' Process_Electronic_Profile_Item: ' Process a single Electronic Profile item, determining if it should be published ' or Not based on whether the character in column 28 of that line is blank.' This handles items input by the test or prefilled by the system' =========================================================================Public function Process_Electronic_Profile_Item(name_arg, value_arg)
Const field_column = 28Dim must_publish
must_publish = false
' See if If len(value_arg) = 0 Then
If len(ScreenScrape(name_arg, 0, field_column, field_column)) > 0 Then
must_publish = trueEnd IfTTenter micReturn
ElseTTenter micCtrlDwn & "K" & micCtrlUp & value_arg & micReturnwait 0,200must_publish = truecontract_dict.Item(name_arg) = value_arg
End IfIf must_publish Then
TTenter "Y" & micReturn End If
End Function ' Process_Electronic_Profile_Item