public void ATC7145_AXShellEntityinAX()
        {
            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RT", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickGeneralLedgerTab();
            homePage.ClickConsolidateLink();
            homePage.ClickConsolidateOnlineLink();

            ConsolidateOnlinePage consolidateOnlinePage = new ConsolidateOnlinePage();
            //consolidateOnlinePage.SetFromValue("1/07/2014");
            //consolidateOnlinePage.SetToValue("30/06/2015");

            consolidateOnlinePage.ClickFinancialdimensionsTab();
            consolidateOnlinePage.ClickLegalentitiesTab();
            consolidateOnlinePage.ClickDescriptionTab();

            consolidateOnlinePage.ClickEliminationTab();

            consolidateOnlinePage.ClickCriteriaTab();
            consolidateOnlinePage.ClickOKButton();

            //consolidation process no errors. there are errors at the moment
            try
            {
                InfoLogPage infoLogPage = new InfoLogPage();
                Assert.IsFalse(infoLogPage.GetControlExists("One or more critical STOP errors have occurred. Use the error messages below to guide you or call your administrator.", "Client"));
            }
            catch
            {}
        }
        public void ATC_TopUpTestDatab()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "TopUp_TestData")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string filelocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
            string paymentreference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string tenancyRequestReference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickCashandBankManagementTab();
            homePage.ClickBankStatementsLink();

            homePage.ClickImportStatementButton();
            BAI2FileImportPage bai2FileImportPage = new BAI2FileImportPage();
            bai2FileImportPage.SetStatmentFormatText("CBA BAI2");
            bai2FileImportPage.SetImportFileFolderCheckBox(false);
            bai2FileImportPage.SetFileNamelocationText(filelocation);
            bai2FileImportPage.SetReconcileImportCheckBox(true);
            bai2FileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string bvdTreeItem = infoLogPage.GetTreeItemName("Journal BDV","Posting");
            string BVD = bvdTreeItem.Substring(8, 9);

            Assert.IsTrue(infoLogPage.GetTreeItemExists("1 files have been imported in total.", "Posting"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            homePage = new Homepage();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            //CRM Outbound Messages
            homePage.ClickSystemLink();
            homePage.ClickOutboundCRMMessagesLink();
            OutboundCRMMessagePage outboundCRMMessagePage = new OutboundCRMMessagePage();
            table = new Table(outboundCRMMessagePage.GetNotificationTable());
            table.FilterCellValue("Payment reference");
            outboundCRMMessagePage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Payment reference", paymentreference);
            filterPage.ClickOkButton();
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value = table.GetCellValue("Payment reference", paymentreference, "Bond");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC85893_AX7098EFTReceiptRecordEFTreceiptfrombankstatementitem()
        {
            //Create Bank Statement file with invalid reference
            string filelocation = Utils.BAI2FileCreator.bAI2InvalidRefFileCreator();
            string paymentreference = filelocation.Substring(filelocation.Length - 12, 8);
            string initialContribution = "500.00";

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickCashandBankManagementTab();
            homePage.ClickBankStatementsLink();

            homePage.ClickImportStatementButton();
            BAI2FileImportPage bai2FileImportPage = new BAI2FileImportPage();
            bai2FileImportPage.SetStatmentFormatText("CBA BAI2");
            bai2FileImportPage.SetImportFileFolderCheckBox(false);
            bai2FileImportPage.SetFileNamelocationText(filelocation);
            bai2FileImportPage.SetReconcileImportCheckBox(true);
            bai2FileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string bvdTreeItem = infoLogPage.GetTreeItemName("Journal BDV", "Posting");
            string BVD = bvdTreeItem.Substring(8, 9);

            Assert.IsTrue(infoLogPage.GetTreeItemExists("1 files have been imported in total.", "Posting"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            homePage.ClickBackNavButton();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            homePage.ClickReceiptJournalsLink();

            BondReceiptJournalPage bondReceiptJournalPage = new BondReceiptJournalPage();
            bondReceiptJournalPage.SetShowAllText("All");

            Keyboard.SendKeys("{ENTER}");

            table = new Table(bondReceiptJournalPage.GetBondReceiptTable());
            table.FilterCellValue("Bond journal");
            bondReceiptJournalPage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Bond journal",BVD);
            filterPage.ClickOkButton();

            //StringAssert.Contains(table.GetCellValue("Bond journal", BVD, "Description"), RTB);
            table.ClickCellValue("Bond journal", BVD, "Bond journal");

            bondReceiptJournalPage.ClickLinesMenuItem();

            BondReceiptJournalLinesPage bondReceiptJournalLines = new BondReceiptJournalLinesPage();
            table = new Table(bondReceiptJournalLines.GetBondReceiptJournalLinesTable());
            StringAssert.Contains(table.GetCellValue("Payment reference", paymentreference, "Allocated amount"), "0.00");
            StringAssert.Contains(table.GetCellValue("Payment reference", paymentreference, "Amount"), initialContribution);

            bondReceiptJournalLines.ClickInquiryButton();
            bondReceiptJournalLines.ClickBondTransactionsMenuItem();

            BondTransactionsPage bondTransactionsPage = new BondTransactionsPage();
            table = new Table(bondTransactionsPage.GetBondTransactionTable());

            StringAssert.Contains(table.GetCellContainsValue("Bond client", "[UNKNOWN]", "Amount"), initialContribution);
            StringAssert.Contains(table.GetCellValue("Type", "Receipt", "Amount"), initialContribution);
            StringAssert.Contains(table.GetCellValue("Type", "Receipt allocation", "Amount"), "-" + initialContribution);

            bondTransactionsPage.ClickCloseButton();
            bondReceiptJournalLines.ClickCloseButton();
            bondReceiptJournalPage.ClickCloseButton();
        }
        public void ATC85892d_AX7098EFTReceiptRecordEFTreceiptfrombankstatementitem()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value == 858923)
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string filelocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
            string paymentreference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string batchRequestReference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string initialContribution = Convert.ToDouble(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value).ToString("N2");

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickCashandBankManagementTab();
            homePage.ClickBankStatementsLink();

            homePage.ClickImportStatementButton();
            BAI2FileImportPage bai2FileImportPage = new BAI2FileImportPage();
            bai2FileImportPage.SetStatmentFormatText("CBA BAI2");
            bai2FileImportPage.SetImportFileFolderCheckBox(false);
            bai2FileImportPage.SetFileNamelocationText(filelocation);
            bai2FileImportPage.SetReconcileImportCheckBox(true);
            bai2FileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string bvdTreeItem = infoLogPage.GetTreeItemName("Journal BDV", "Posting");
            string BVD = bvdTreeItem.Substring(8, 9);

            Assert.IsTrue(infoLogPage.GetTreeItemExists("1 files have been imported in total.", "Posting"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            homePage.ClickReceiptJournalsLink();

            BondReceiptJournalPage bondReceiptJournalPage = new BondReceiptJournalPage();
            bondReceiptJournalPage.SetShowAllText("All");
            Keyboard.SendKeys("{ENTER}");

            table = new Table(bondReceiptJournalPage.GetBondReceiptTable());
            table.FilterCellValue("Bond journal");
            bondReceiptJournalPage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Bond journal", BVD);
            filterPage.ClickOkButton();

            //StringAssert.Contains(table.GetCellValue("Bond journal", BVD, "Description"), RTB);
            table.ClickCellValue("Bond journal", BVD, "Bond journal");

            bondReceiptJournalPage.ClickLinesMenuItem();

            BondReceiptJournalLinesPage bondReceiptJournalLines = new BondReceiptJournalLinesPage();
            table = new Table(bondReceiptJournalLines.GetBondReceiptJournalLinesTable());
            StringAssert.Contains(table.GetCellValue("Payment reference", paymentreference, "Allocated amount"), initialContribution);

            bondReceiptJournalLines.ClickInquiryButton();
            bondReceiptJournalLines.ClickBondTransactionsMenuItem();

            BondTransactionsPage bondTransactionsPage = new BondTransactionsPage();
            table = new Table(bondTransactionsPage.GetBondTransactionTable());

            //Add tenancy requests
            //Get specific row for the data
            int TR1Row = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value == 858921)
                {
                    TR1Row = i;
                    break;
                }
            }
            string TR1reference = MyRange.Cells[TR1Row, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string TR1managingParty = MyRange.Cells[TR1Row, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string TR1initialContribution = Convert.ToDouble(MyRange.Cells[TR1Row, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value).ToString("N2");
            //Get specific row for the data
            int TR2Row = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value == 858922)
                {
                    TR2Row = i;
                    break;
                }
            }
            string TR2reference = MyRange.Cells[TR2Row, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string TR2managingParty = MyRange.Cells[TR2Row, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string TR2initialContribution = Convert.ToDouble(MyRange.Cells[TR2Row, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value).ToString("N2");

            StringAssert.Contains(table.GetCellContainsValue("Bond client", TR1managingParty, "Bond request"), TR1reference);
            StringAssert.Contains(table.GetCellContainsValue("Bond client", TR1managingParty, "Amount"), TR1initialContribution);
            StringAssert.Contains(table.GetCellContainsValue("Bond client", TR2managingParty, "Bond request"), TR2reference);
            StringAssert.Contains(table.GetCellContainsValue("Bond client", TR2managingParty, "Amount"), TR2initialContribution);

            StringAssert.Contains(table.GetCellValue("Type", "Receipt", "Amount"), initialContribution);

            bondTransactionsPage.ClickCloseButton();
            bondReceiptJournalLines.ClickCloseButton();
            bondReceiptJournalPage.ClickCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC4477_AX2849DuplicateControlandArchivingBankStatementfile()
        {
            //Create Bank Statement file with invalid reference
            string filelocation;
            Random random = new Random();
            int randomNum;
            randomNum = random.Next(30000000, 39999999);
            string dateValue;

            dateValue = DateTime.Today.ToString("yyMMdd");
            string timeValue;
            timeValue = DateTime.Now.ToString("HHmm");
            filelocation = Utils.BAI2FileCreator.bAI2UnknownCreator(randomNum, "100", dateValue, timeValue);
            string fileName;
            fileName = filelocation.Substring(filelocation.Length - 35);

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickCashandBankManagementTab();
            homePage.ClickBankStatementsLink();

            homePage.ClickImportStatementButton();
            BAI2FileImportPage bai2FileImportPage = new BAI2FileImportPage();
            bai2FileImportPage.SetStatmentFormatText("CBA BAI2");
            bai2FileImportPage.SetImportFileFolderCheckBox(false);
            bai2FileImportPage.SetFileNamelocationText(filelocation);
            bai2FileImportPage.SetReconcileImportCheckBox(true);
            bai2FileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string bvdTreeItem = infoLogPage.GetTreeItemName("Journal BDV", "Posting");
            string BVD = bvdTreeItem.Substring(8, 9);

            Assert.IsTrue(infoLogPage.GetTreeItemExists("1 files have been imported in total.", "Posting"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            filelocation = Utils.BAI2FileCreator.bAI2UnknownCreator(randomNum, "100", dateValue, timeValue);

            homePage.ClickImportStatementButton();
            bai2FileImportPage = new BAI2FileImportPage();
            bai2FileImportPage.SetStatmentFormatText("CBA BAI2");
            bai2FileImportPage.SetImportFileFolderCheckBox(false);
            bai2FileImportPage.SetFileNamelocationText(filelocation);
            bai2FileImportPage.SetReconcileImportCheckBox(true);
            bai2FileImportPage.ClickOKButton();

            //Need to get message of duplicate error
            infoLogPage = new InfoLogPage();
            string DuplicateMessageTreeItem;
            DuplicateMessageTreeItem = infoLogPage.GetTreeItemName("Duplicate file", "Message (");
            string ErrorMessageTreeItem;
            ErrorMessageTreeItem = infoLogPage.GetTreeItemName("Error importing bank statement file ", "Message (");
            StringAssert.Contains(ErrorMessageTreeItem, fileName);
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            homePage.ClickBackNavButton();
            homePage.ClickHomeTab();
            homePage.ClickCashandBankManagementTab();
            homePage.ClickBankStatementFileImportExceptionLink();

            BSFileImportExceptionPage bsFileImportExceptionPage = new BSFileImportExceptionPage();
            table = new Table(bsFileImportExceptionPage.GetBSFileTable());
            table.FilterCellValue("File name");
            bsFileImportExceptionPage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("File name", "*" + fileName);
            filterPage.ClickOkButton();
            StringAssert.Contains(filelocation, table.GetCellContainsValue("File name", fileName, "File name"));
            bsFileImportExceptionPage.ClickShowLogButton();

            //Need to get message of duplicate error
            infoLogPage = new InfoLogPage();
            DuplicateMessageTreeItem = infoLogPage.GetTreeItemName("Duplicate file", "Message (");
            ErrorMessageTreeItem = infoLogPage.GetTreeItemName("Error importing bank statement file ", "Message (");
            StringAssert.Contains(ErrorMessageTreeItem, fileName);
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bsFileImportExceptionPage.ClickCloseButton();
        }
        public void ATC7081b_AXEFTreceiptforSingleBond()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "7081")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string filelocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
            string paymentreference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string tenancyRequestReference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string contributor = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC1")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();
            string combinedContribution = ((double)Int32.Parse((MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value * 2).ToString())).ToString("C");
            string initialContribAmount = ((double)Int32.Parse(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString())).ToString("C");
            string amountPaidLodgement = ((double)Int32.Parse(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString())).ToString("C");

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickCashandBankManagementTab();
            homePage.ClickBankStatementsLink();

            homePage.ClickImportStatementButton();
            BAI2FileImportPage bai2FileImportPage = new BAI2FileImportPage();
            bai2FileImportPage.SetStatmentFormatText("CBA BAI2");
            bai2FileImportPage.SetImportFileFolderCheckBox(false);
            bai2FileImportPage.SetFileNamelocationText(filelocation);
            bai2FileImportPage.SetReconcileImportCheckBox(true);
            bai2FileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string bvdTreeItem = infoLogPage.GetTreeItemName("Journal BDV", "Posting");
            string BVD = bvdTreeItem.Substring(8, 9);
            //Assert.IsTrue(infoLogPage.GetTreeItemExists("1 files have been imported in total.", "Posting"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            homePage.ClickBackNavButton();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            homePage.ClickCRMOutboundNotificationsLink();
            OutboundCRMIntegrationPage crmOutboundIntegrationPage = new OutboundCRMIntegrationPage();
            crmOutboundIntegrationPage.ClickOKButton();

            homePage.ClickReceiptJournalsLink();
            BondReceiptJournalPage bondReceiptJournalPage = new BondReceiptJournalPage();
            bondReceiptJournalPage.SetShowAllText("All");
            Keyboard.SendKeys("{ENTER}");

            table = new Table(bondReceiptJournalPage.GetBondReceiptTable());
            table.FilterCellValue("Bond journal");
            bondReceiptJournalPage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Bond journal",BVD);
            filterPage.ClickOkButton();

               // StringAssert.Contains(table.GetCellValue("Bond journal", BVD, "Description"), RTB);
            table.ClickCellValue("Bond journal", BVD, "Bond journal");

            bondReceiptJournalPage.ClickLinesMenuItem();

            BondReceiptJournalLinesPage bondReceiptJournalLines = new BondReceiptJournalLinesPage();
            bondReceiptJournalLines.ClickInquiryButton();

            bondReceiptJournalLines.ClickBondTransactionsMenuItem();

            BondTransactionsPage bondTransactionsPage = new BondTransactionsPage();
            table = new Table(bondTransactionsPage.GetBondTransactionTable());

            StringAssert.Contains(table.GetCellContainsValue("Bond client", managingParty, "Bond request"), tenancyRequestReference);
            StringAssert.Contains(initialContribAmount, table.GetCellContainsValue("Bond client", managingParty, "Amount"));
            //StringAssert.Contains(table.GetCellContainsValue("Bond client", "BLAIR TEST", "Bond client"), "C23");
            StringAssert.Contains(table.GetCellContainsValue("Bond client", contributor, "Bond request"), tenancyRequestReference);
            StringAssert.Contains(initialContribAmount, table.GetCellContainsValue("Bond client", contributor, "Amount"));
            //            StringAssert.Contains(table.GetCellContainsValue("Bond client", "BRIAN JOHN GILLAN", "Bond client"), "C31");
            StringAssert.Contains(table.GetCellValue("Amount", combinedContribution.Substring(1), "Bond client"), "Bond Receipts Client Account");

            bondTransactionsPage.ClickCloseButton();
            bondReceiptJournalLines.ClickCloseButton();
            bondReceiptJournalPage.ClickCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC7125b_AXTESTINGEndtoEndSingleFormBPayAXSuccess()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "7125")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string referenceNumber = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string tenancyrequest = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string fileLocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();

            Homepage homePage = new Homepage();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();
            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink();

            BPayFilePage bpayFile = new BPayFilePage();
            bpayFile.ClickImportMenuItem();

            BPayFileImportPage bpayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bpayFileImportPage.GetWindowExistStatus());
            bpayFileImportPage.SetMoveFileCheckBox(true);

            bpayFileImportPage.SetProcessFileCheckBox(true);

            bpayFileImportPage.SetImportPathText("");
            bpayFileImportPage.SetFileNameEdit(fileLocation);
            bpayFileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            //check that file imported successful
            Assert.IsTrue(infoLogPage.GetTreeItemNOTExists("Cannot create a record in", "Importing BPAY file"));

            string rtbTreeItem = infoLogPage.GetTreeItemName("Processing BPAY file RTB-", "Importing BPAY file");
            string RTB = rtbTreeItem.Substring(21, 10);
            string bvdTreeItem = infoLogPage.GetTreeItemName("Posting journal BDV", "Importing BPAY file");
            string BVD = bvdTreeItem.Substring(16, 9);
            //Assert.IsTrue(infoLogPage.GetTreeItemExists("1 file(s) were processed","Importing BPAY file"));

            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bpayFile.ClickCloseButton();

            homePage.ClickCRMOutboundNotificationsLink();
            OutboundCRMIntegrationPage outboundCRMIntegrationPage = new OutboundCRMIntegrationPage();
            outboundCRMIntegrationPage.ClickOKButton();

            //CRM Outbound Messages
            homePage.ClickSystemLink();
            homePage.ClickOutboundCRMMessagesLink();
            OutboundCRMMessagePage outboundCRMMessagePage = new OutboundCRMMessagePage();
            Table table = new Table(outboundCRMMessagePage.GetNotificationTable());
            table.FilterCellValue("Payment reference");
            outboundCRMMessagePage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Payment reference", referenceNumber);
            filterPage.ClickOkButton();

            StringAssert.Contains(table.GetCellValue("Payment reference", referenceNumber, "Bond request"), tenancyrequest);
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value = table.GetCellValue("Payment reference", referenceNumber, "Bond");

            outboundCRMMessagePage.ClickCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC7121b_AXDuplicateBPAYpayment()
        {
            #region Start Up Excel
            //MyApp = new Excel.Application();
            //MyApp.Visible = false;
            //MyBook = MyApp.Workbooks.Open(DatasourceDir + "\\TenancyRequests.xlsx");
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "7121")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string referenceNumber = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string tenancyrequest = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string fileLocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
            string fileLocation2 = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC1")].Value.ToString();

            Homepage homePage = new Homepage();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();
            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink(); ;

            BPayFilePage bPayFilePage = new BPayFilePage();

            //import 1st file
            bPayFilePage.ClickImportMenuItem();
            BPayFileImportPage bPayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bPayFileImportPage.GetWindowExistStatus());
            bPayFileImportPage.SetMoveFileCheckBox(true);
            bPayFileImportPage.SetProcessFileCheckBox(true);
            bPayFileImportPage.SetImportPathEdit("");
            bPayFileImportPage.SetFileNameEdit(fileLocation);
            bPayFileImportPage.ClickOKButton();
            InfoLogPage infoLogPage = new InfoLogPage();
            //check that file imported successful
            Assert.IsTrue(infoLogPage.GetTreeItemExists("File imported with identifier", "Importing BPAY file"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            //import 2nd file
            bPayFilePage.ClickImportMenuItem();
            bPayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bPayFileImportPage.GetWindowExistStatus());
            bPayFileImportPage.SetMoveFileCheckBox(true);
            bPayFileImportPage.SetProcessFileCheckBox(true);
            bPayFileImportPage.SetImportPathEdit("");
            bPayFileImportPage.SetFileNameEdit(fileLocation2);
            bPayFileImportPage.ClickOKButton();
            infoLogPage = new InfoLogPage();

            //check that file imported successful
            Assert.IsTrue(infoLogPage.GetTreeItemExists("File imported with identifier", "Importing BPAY file"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            bPayFilePage.ClickCloseButton();

            //Navigate to Outbound CRM and click ok
            homePage.ClickCRMOutboundNotificationsLink();
            OutboundCRMIntegrationPage outBoundCRMIntegration = new OutboundCRMIntegrationPage();
            Assert.IsTrue(outBoundCRMIntegration.GetWindowExistStatus());
            outBoundCRMIntegration.ClickOKButton();

            //Navigate to Payments/BPay file exceptions
            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileExceptionLink();
            //Order by created date

            //Confirm customer referance number exists
            BPayFileExceptionsPage bPayFileExceptionPage = new BPayFileExceptionsPage();

            Table table = new Table(bPayFileExceptionPage.GetFileExceptionTable());
            table.FilterCellValue("Customer reference number");
            bPayFileExceptionPage.ClickFilterMenuItem();

            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Customer reference number", referenceNumber);
            filterPage.ClickOkButton();
            StringAssert.Contains(table.GetCellValue("Customer reference number", referenceNumber, "Rejection reason"), "Duplicate CRN");
            bPayFileExceptionPage.ClickCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC7124_AXFinancialPostingsforBPAYpaymentsnumberGL()
        {
            string dateValue = DateTime.Today.AddDays(-1).ToString("yyyyMMdd");
            string transDesc = "BPAY " + DateTime.Today.AddDays(-1).ToString("d/MM/yyyy");
            Random random = new Random();
            int randomNum = random.Next(1000, 9999);
            string fileLocation = Utils.BPayFileCreator.bPayUnknownClientFileCreator(dateValue, randomNum);
            string referenceNumber = Utils.BPayFileReaderClass.GetPaymentReference1File(fileLocation);

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink(); ;

            BPayFilePage bPayFilePage = new BPayFilePage();
            bPayFilePage.ClickImportMenuItem();

            BPayFileImportPage bPayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bPayFileImportPage.GetWindowExistStatus());
            bPayFileImportPage.SetMoveFileCheckBox(true);
            bPayFileImportPage.SetProcessFileCheckBox(true);
            //bPayFileImportPage.SetImportPathEdit(@"P:\Dynamics AX\Bank files\Bpay\Paul");
            bPayFileImportPage.SetImportPathEdit("");
            bPayFileImportPage.SetFileNameEdit(fileLocation);
            bPayFileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string rtbTreeItem = infoLogPage.GetTreeItemName("Processing BPAY file RTB-", "Importing BPAY file");
            string RTB = rtbTreeItem.Substring(21, 10);
            string bvdTreeItem = infoLogPage.GetTreeItemName("Posting journal BDV", "Importing BPAY file");
            string BVD = bvdTreeItem.Substring(16, 9);

            Assert.IsTrue(infoLogPage.GetTreeItemExists("1 file(s) were processed", "Importing BPAY file"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bPayFilePage.ClickCloseButton();

            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            homePage.ClickReceiptJournalsLink();

            BondReceiptJournalPage bondReceiptJournalPage = new BondReceiptJournalPage();
            bondReceiptJournalPage.SetShowAllText("All");
            Keyboard.SendKeys("{ENTER}");
            table = new Table(bondReceiptJournalPage.GetBondReceiptTable());

            table.FilterCellValue("Bond journal");

            bondReceiptJournalPage.ClickFilterMenuItem();

            FilterPage filterPage = new FilterPage();

            filterPage.SetFilterText("Bond journal", BVD);
            filterPage.ClickOkButton();

            StringAssert.Contains(table.GetCellValue("Bond journal", BVD, "Description"), RTB);
            table.ClickCellValue("Bond journal", BVD, "Bond journal");

            bondReceiptJournalPage.ClickLinesMenuItem();

            BondReceiptJournalLinesPage bondReceiptJournalLines = new BondReceiptJournalLinesPage();
            bondReceiptJournalLines.ClickInquiryButton();

            bondReceiptJournalLines.ClickVoucherTransactionsMenuItem();

            VoucherTransactionsPage voucherTransactionsPage = new VoucherTransactionsPage();
            table = new Table(voucherTransactionsPage.GetVoucherTransactionTable());

            StringAssert.Contains(table.GetCellValue("Ledger account", "11330", "Amount"), "700.00");
            table.ClickCellValue("Ledger account", "11330", "Ledger account");
            StringAssert.Contains(voucherTransactionsPage.GetDescriptionText(), transDesc);
            StringAssert.Contains(voucherTransactionsPage.GetAccountNameText(), "Cash at Bank - Rental Bond BPAY Account");

            StringAssert.Contains(table.GetCellValue("Ledger account", "32130", "Amount"), "700.00");
            table.ClickCellValue("Ledger account", "32130", "Ledger account");
            StringAssert.Contains(voucherTransactionsPage.GetDescriptionText(), referenceNumber);
            StringAssert.Contains(voucherTransactionsPage.GetAccountNameText(), "Rental bonds - Receipts unallocated");

            voucherTransactionsPage.ClickCloseButton();
            bondReceiptJournalLines.ClickCloseButton();
            bondReceiptJournalPage.ClickCloseButton();
        }
        public void ATC7120b_AXAC1Fileformatverification()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "7120")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string filelocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
            string paymentreference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string tenancyRequestReference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();

            Homepage homePage = new Homepage();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();
            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink();

            BPayFilePage bpayFile = new BPayFilePage();
            bpayFile.ClickImportMenuItem();

            BPayFileImportPage bpayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bpayFileImportPage.GetWindowExistStatus());
            bpayFileImportPage.SetMoveFileCheckBox(true);

            bpayFileImportPage.SetProcessFileCheckBox(true);
            bpayFileImportPage.SetImportPathText("");
            bpayFileImportPage.SetFileNameEdit(filelocation);
            bpayFileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            //check that file imported successful
            //Assert.IsTrue(infoLogPage.GetTreeItemNOTExists("Cannot create a record in", "Importing BPAY file"));
            Assert.IsTrue(infoLogPage.GetTreeItemExists("Posting journal BDV", "Importing BPAY file"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bpayFile.ClickCloseButton();

            homePage.ClickCRMOutboundNotificationsLink();
            OutboundCRMIntegrationPage outboundCRMIntegrationPage = new OutboundCRMIntegrationPage();
            outboundCRMIntegrationPage.ClickOKButton();

            //CRM Outbound Messages
            homePage.ClickSystemLink();
            homePage.ClickOutboundCRMMessagesLink();
            OutboundCRMMessagePage outboundCRMMessagePage = new OutboundCRMMessagePage();
            Table table = new Table(outboundCRMMessagePage.GetNotificationTable());
            table.FilterCellValue("Payment reference");
            outboundCRMMessagePage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Payment reference", paymentreference);
            filterPage.ClickOkButton();

            StringAssert.Contains(table.GetCellValue("Payment reference", paymentreference, "Bond Balance"), initialContribution);

            ////Navigate to Payments/BPay file exceptions
            //homePage.ClickPaymentsLink();
            //homePage.ClickBPayFileExceptionLink();

            ////Order by created date

            ////Confirm customer referance number exists
            //BPayFileExceptionsPage bPayFileExceptionPage = new BPayFileExceptionsPage();

            //Table table = new Table(bPayFileExceptionPage.GetFileExceptionTable());

            //table.FilterCellValue("Customer reference number");

            //bPayFileExceptionPage.ClickFilterMenuItem();

            //FilterPage filterPage = new FilterPage();
            //filterPage.SetCustomerReferenceNumberText(paymentreference);
            //filterPage.ClickOkButton();

            //StringAssert.Contains(table.GetCellValue("Customer reference number", paymentreference, "Rejection reason"), "Invalid CRN");
            //bPayFileExceptionPage.ClickCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC4467_AX1817DuplicateControlandArchivingBPayfile()
        {
            string dateValue = DateTime.Today.AddDays(-1).ToString("yyyyMMdd");
            string transDesc = "BPAY " + DateTime.Today.AddDays(-1).ToString("d/MM/yyyy");
            Random random = new Random();
            int randomNum = random.Next(1000, 9999);
            string fileLocation;
            fileLocation = Utils.BPayFileCreator.bPayUnknownClientFileCreator(dateValue, randomNum);
            string fileName;
            fileName = fileLocation.Substring(fileLocation.Length - 33);
            string referenceNumber = Utils.BPayFileReaderClass.GetPaymentReference1File(fileLocation);

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink();

            BPayFilePage bPayFilePage = new BPayFilePage();
            bPayFilePage.ClickImportMenuItem();

            BPayFileImportPage bPayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bPayFileImportPage.GetWindowExistStatus());
            bPayFileImportPage.SetMoveFileCheckBox(true);
            bPayFileImportPage.SetProcessFileCheckBox(true);
            bPayFileImportPage.SetImportPathEdit("");
            bPayFileImportPage.SetFileNameEdit(fileLocation);
            bPayFileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string rtbTreeItem;
            rtbTreeItem = infoLogPage.GetTreeItemName("Processing BPAY file RTB-", "Importing BPAY file");
            string RTB;
            RTB = rtbTreeItem.Substring(21, 10);
            string bvdTreeItem;
            bvdTreeItem = infoLogPage.GetTreeItemName("Posting journal BDV", "Importing BPAY file");
            string BVD;
            BVD = bvdTreeItem.Substring(16, 9);

            Assert.IsTrue(infoLogPage.GetTreeItemExists("1 file(s) were processed", "Importing BPAY file"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bPayFilePage.ClickCloseButton();

            homePage.ClickHomeTab();
            homePage.ClickCashandBankManagementTab();
            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink();

            table = new Table(bPayFilePage.GetBPayFileTable());
            table.FilterCellValue("BPAY file identifier");
            bPayFilePage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("BPAY file identifier",RTB);
            filterPage.ClickOkButton();
            StringAssert.Contains(fileLocation, table.GetCellValue("BPAY file identifier", RTB, "File name"));

            //Import second duplicate file
            fileLocation = Utils.BPayFileCreator.bPayUnknownClientFileCreator(dateValue, randomNum);
            bPayFilePage.ClickImportMenuItem();
            bPayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bPayFileImportPage.GetWindowExistStatus());
            bPayFileImportPage.SetMoveFileCheckBox(true);
            bPayFileImportPage.SetProcessFileCheckBox(true);
            bPayFileImportPage.SetImportPathEdit("");
            bPayFileImportPage.SetFileNameEdit(fileLocation);
            bPayFileImportPage.ClickOKButton();

            infoLogPage = new InfoLogPage();
            string ImportErrorTreeItem = infoLogPage.GetTreeItemName("was already imported on", "Importing BPAY file");
            string MovedFileMessageTreeItem = infoLogPage.GetTreeItemName("has been moved to sub-folder 'Error'", "Importing BPAY file");

            StringAssert.Contains(ImportErrorTreeItem, fileName);
            StringAssert.Contains(MovedFileMessageTreeItem, fileName);

            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bPayFilePage.ClickCloseButton();
        }
        public void ATC6904b_AXTopupExcessBondValidation()
        {
            #region Start Up Excel
             MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
             MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
             MyRange = MySheet.UsedRange;

             //Get specific row for the data
             int testDataRows = MyRange.Rows.Count;
             int MyRow = 0;
             for (int i = 2; i <= testDataRows; i++)
             {
                 if (MyRange.Cells[i, 1].Value.ToString() == "Topup_6904")
                 {
                     MyRow = i;
                     break;
                 }
             }
             #endregion

             string filelocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
             string paymentreference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
             string tenancyRequestReference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
             string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
             string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();

             Homepage homePage = new Homepage();

             homePage.ClickCompanyButton();
             SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
             Table table = new Table(selectCompanyPage.GetCompanyListTable());
             table.ClickCellValue("Company", "RTB", "Company");
             selectCompanyPage.ClickOkButton();

             homePage.ClickHomeTab();
             homePage.ClickBondManagementTab();
             homePage.ClickPaymentsLink();
             homePage.ClickBPayFileLink();

             BPayFilePage bpayFile = new BPayFilePage();
             bpayFile.ClickImportMenuItem();

             BPayFileImportPage bpayFileImportPage = new BPayFileImportPage();
             Assert.IsTrue(bpayFileImportPage.GetWindowExistStatus());
             bpayFileImportPage.SetMoveFileCheckBox(true);

             bpayFileImportPage.SetProcessFileCheckBox(true);
             bpayFileImportPage.SetImportPathText("");
             bpayFileImportPage.SetFileNameEdit(filelocation);
             bpayFileImportPage.ClickOKButton();

             InfoLogPage infoLogPage = new InfoLogPage();
             //check that file imported successful
             Assert.IsTrue(infoLogPage.GetTreeItemExists("File imported with identifier", "Importing BPAY file"));

             infoLogPage.ClickClearButton();
             infoLogPage.ClickCloseButton();
             bpayFile.ClickCloseButton();

             homePage.ClickCRMOutboundNotificationsLink();
             OutboundCRMIntegrationPage outboundCRMIntegrationPage = new OutboundCRMIntegrationPage();
             outboundCRMIntegrationPage.ClickOKButton();

             //CRM Outbound Messages
             homePage.ClickSystemLink();
             homePage.ClickOutboundCRMMessagesLink();
             OutboundCRMMessagePage outboundCRMMessagePage = new OutboundCRMMessagePage();
             table = new Table(outboundCRMMessagePage.GetNotificationTable());
             table.FilterCellValue("Payment reference");
             outboundCRMMessagePage.ClickFilterMenuItem();
             FilterPage filterPage = new FilterPage();
             filterPage.SetFilterText("Payment reference", paymentreference);
             filterPage.ClickOkButton();

             StringAssert.Contains(table.GetCellValue("Payment reference", paymentreference, "Bond Balance"), initialContribution);
             MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value = table.GetCellValue("Payment reference", paymentreference, "Bond");

             #region Shut down Excel
             MyBook.Save();
             MyBook.Close();
             MyApp.Quit();
             #endregion
        }
        public void ATC6740_AXPostBPAYpaymentswithunknownreferencenumber()
        {
            string dateValue = DateTime.Today.AddDays(-1).ToString("yyyyMMdd");
            string transDesc = "BPAY " + DateTime.Today.AddDays(-1).ToString("d/MM/yyyy");
            Random random = new Random();
            int randomNum = random.Next(1000, 9999);
            string fileLocation = Utils.BPayFileCreator.bPayUnknownClientFileCreator(dateValue, randomNum);
            string referenceNumber = Utils.BPayFileReaderClass.GetPaymentReference1File(fileLocation).ToString();

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink(); ;

            BPayFilePage bPayFilePage = new BPayFilePage();
            bPayFilePage.ClickImportMenuItem();

            BPayFileImportPage bPayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bPayFileImportPage.GetWindowExistStatus());
            bPayFileImportPage.SetMoveFileCheckBox(true);
            bPayFileImportPage.SetProcessFileCheckBox(true);
            //bPayFileImportPage.SetImportPathEdit(@"P:\Dynamics AX\Bank files\Bpay\Paul");
            bPayFileImportPage.SetImportPathEdit("");
            bPayFileImportPage.SetFileNameEdit(fileLocation);
            bPayFileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string rtbTreeItem = infoLogPage.GetTreeItemName("Processing BPAY file RTB-", "Importing BPAY file");
            string RTB = rtbTreeItem.Substring(21, 10);
            string bvdTreeItem = infoLogPage.GetTreeItemName("Posting journal BDV", "Importing BPAY file");
            string BVD = bvdTreeItem.Substring(16, 9);
            Assert.IsTrue(infoLogPage.GetTreeItemExists("BPAY exception 'Invalid CRN' has been recorded for this line", "Importing BPAY file"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bPayFilePage.ClickCloseButton();

            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            homePage.ClickCRMOutboundNotificationsLink();
            OutboundCRMIntegrationPage outboundCRMIntegrationPage = new OutboundCRMIntegrationPage();
            outboundCRMIntegrationPage.ClickOKButton();

            //Navigate to Payments/BPay file exceptions
            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileExceptionLink();

            //Confirm customer referance number exists
            BPayFileExceptionsPage bPayFileExceptionPage = new BPayFileExceptionsPage();

            table = new Table(bPayFileExceptionPage.GetFileExceptionTable());
            table.FilterCellValue("Customer reference number");
            bPayFileExceptionPage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Customer reference number", referenceNumber);
            filterPage.ClickOkButton();

            StringAssert.Contains(table.GetCellValue("Customer reference number", referenceNumber, "Rejection reason"), "Invalid CRN");
            bPayFileExceptionPage.ClickCloseButton();
        }
        public void ATC7131_AXTaxPosting()
        {
            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTA", "Company");
            selectCompanyPage.ClickOkButton();

            //Input journal
            homePage.ClickHomeTab();
            homePage.ClickGeneralLedgerTab();

            homePage.ClickSalesTaxLink();
            homePage.ClickLedgerPostingGroupsLink();

            LedgerPostingGroupsPage ledgerPostingsGroupsPage = new LedgerPostingGroupsPage();

            ledgerPostingsGroupsPage.ClickCloseButton();

            homePage.ClickGeneralLedgerTab();
            homePage.ClickGeneralJournalLink();

            GeneralJournalPage generalJournalPage = new GeneralJournalPage();
            generalJournalPage.ClickNewMenuItem();
            generalJournalPage.SetNameValue("GL");
            //generalJournalPage.SetDescriptionValue("General Journal RTA");
            generalJournalPage.ClickLinesMenuItem();

            JournalVoucherPage journalVoucherPage = new JournalVoucherPage();
            table = new Table(journalVoucherPage.GetJournalValueTable());
            table.ClickCellValue("Account type", "Ledger", "Account");
            journalVoucherPage.SetAccountSeg1Value("74533");
            journalVoucherPage.SetAccountSeg2Value("10");
            journalVoucherPage.SetAccountSeg3Value("1010");

            table.ClickCellValue("Account type", "Ledger", "Debit");

            journalVoucherPage.SetDebitValue("500");
            table.ClickCellValue("Account type", "Ledger", "Offset account");
            journalVoucherPage.SetAccountSeg1Value("15350");
            //Ily
            journalVoucherPage.SetSalesTaxGroupValue("ACQ");
            journalVoucherPage.SetItemGSTGroupValue("GST");
            StringAssert.Contains(journalVoucherPage.GetCalculatedSalesTaxAmountText(), "45.45");

            //Validate approval
            journalVoucherPage.ClickApprovalItemMenuButton();
            journalVoucherPage.ClickReportAsReadyItemMenuItem();
            journalVoucherPage.ClickApprovalItemMenuButton();
            journalVoucherPage.ClickApproveItemMenuItem();

            journalVoucherPage.ClickPostMenuButton();
            journalVoucherPage.ClickPostItemMenuItem();

            InfoLogPage infoLog = new InfoLogPage();
            //Needs to be fixed
            Assert.IsTrue(infoLog.GetTreeItemExists("Number of vouchers posted to the journal:", ""));
            infoLog.ClickCloseButton();

            journalVoucherPage.ClickInquiriesMenuButton();
            journalVoucherPage.ClickVoucherItemMenuItem();

            VoucherTransactionsPage voucherTransactionsPage = new VoucherTransactionsPage();
            journalVoucherPage.ClickCloseButton();
            generalJournalPage.ClickCloseButton();

            //Input journal
            homePage.ClickGeneralLedgerTab();
            homePage.ClickGeneralJournalLink();

            generalJournalPage = new GeneralJournalPage();
            generalJournalPage.ClickNewMenuItem();
            generalJournalPage.SetNameValue("GL");
            //generalJournalPage.SetDescriptionValue("General Journal RTA");
            generalJournalPage.ClickLinesMenuItem();

            journalVoucherPage = new JournalVoucherPage();
            table = new Table(journalVoucherPage.GetJournalValueTable());
            table.ClickCellValue("Account type", "Ledger", "Account");
            journalVoucherPage.SetAccountSeg1Value("74960");
            journalVoucherPage.SetAccountSeg2Value("10");
            journalVoucherPage.SetAccountSeg3Value("1010");

            table.ClickCellValue("Account type", "Ledger", "Debit");

            journalVoucherPage.SetDebitValue("500");
            table.ClickCellValue("Account type", "Ledger", "Offset account");
            journalVoucherPage.SetAccountSeg1Value("15350");

            journalVoucherPage.SetSalesTaxGroupValue("ACQ");
            journalVoucherPage.SetItemGSTGroupValue("INPUT");
            StringAssert.Contains(journalVoucherPage.GetCalculatedSalesTaxAmountText(), "45.45");

            //Validate approval
            journalVoucherPage.ClickApprovalItemMenuButton();
            journalVoucherPage.ClickReportAsReadyItemMenuItem();
            journalVoucherPage.ClickApprovalItemMenuButton();
            journalVoucherPage.ClickApproveItemMenuItem();

            journalVoucherPage.ClickPostMenuButton();
            journalVoucherPage.ClickPostItemMenuItem();

            infoLog = new InfoLogPage();
            //Needs to be fixed
            Assert.IsTrue(infoLog.GetTreeItemExists("Number of vouchers posted to the journal:", ""));
            infoLog.ClickCloseButton();

            journalVoucherPage.ClickCloseButton();
            generalJournalPage.ClickCloseButton();
        }
        public void ATC7292_AXValidateTotalAccountsNoentry()
        {
            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTA", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickGeneralLedgerTab();
            homePage.ClickGeneralJournalLink();

            GeneralJournalPage generalJournalPage = new GeneralJournalPage();
            generalJournalPage.ClickNewMenuItem();
            generalJournalPage.SetNameValue("GL");
            generalJournalPage.SetDescriptionValue("General Journal RTA");

            generalJournalPage.ClickLinesMenuItem();
            JournalVoucherPage journalVoucherPage = new JournalVoucherPage();
            table = new Table(journalVoucherPage.GetJournalValueTable());
            table.ClickCellValue("Account type", "Ledger", "Account");

            journalVoucherPage.SetAccountSeg1Value("11300");

            InfoLogPage infoLogPage = new InfoLogPage();
            infoLogPage.GetTreeItemName("Value 11300 is not allowed for manual entry", "Message");
            infoLogPage.ClickCloseButton();

            journalVoucherPage.SetAccountSeg1Value("71000");

            infoLogPage = new InfoLogPage();
            infoLogPage.GetTreeItemName("Value 71000 is not allowed for manual entry", "Message");
            infoLogPage.ClickCloseButton();

            journalVoucherPage.SetAccountSeg1Value("11520");
            table.ClickCellValue("Account type", "Ledger", "Offset account");
            journalVoucherPage.SetAccountSeg1Value("11540");
            table.ClickCellValue("Account type", "Ledger", "Debit");
            journalVoucherPage.SetDebitValue("1000");

            journalVoucherPage.ClickApprovalItemMenuButton();
            journalVoucherPage.ClickReportAsReadyItemMenuItem();
            journalVoucherPage.ClickApprovalItemMenuButton();
            journalVoucherPage.ClickApproveItemMenuItem();

            journalVoucherPage.ClickPostMenuButton();
            journalVoucherPage.ClickPostItemMenuItem();

            infoLogPage = new InfoLogPage();
            infoLogPage.GetTreeItemName("Number of vouchers posted to the journal: 1", "Message");
            infoLogPage.ClickCloseButton();
            journalVoucherPage.ClickCloseButton();
            generalJournalPage.ClickCloseButton();
        }
        public void ATC7143_AXAPRecordofInvoices1expenseaccount()
        {
            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTA", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickAccountPayableTab();

            //Choose vendor
            homePage.ClickVendorsLink();

            homePage.ClickHomeTab();
            homePage.ClickAccountPayableTab();
            homePage.ClickVendorsSetupLink();

            homePage.ClickGeneralLedgerTab();
            homePage.ClickSalesTaxLink();
            homePage.ClickLedgerPostingGroupsLink();

            LedgerPostingGroupsPage ledgerPostingsGroupsPage = new LedgerPostingGroupsPage();
            ledgerPostingsGroupsPage.ClickCloseButton();

            homePage.ClickGeneralJournalLink();
            GeneralJournalPage generalJournalPage = new GeneralJournalPage();
            generalJournalPage.ClickNewMenuItem();
            generalJournalPage.SetNameValue("GL");
            //generalJournalPage.SetDescriptionValue("General Journal RTA");
            generalJournalPage.ClickLinesMenuItem();

            JournalVoucherPage journalVoucherPage = new JournalVoucherPage();
            table = new Table(journalVoucherPage.GetJournalValueTable());
            table.ClickCellValue("Account type", "Ledger", "Account");
            journalVoucherPage.SetAccountSeg1Value("74533");
            journalVoucherPage.SetAccountSeg2Value("10");
            journalVoucherPage.SetAccountSeg3Value("1010");

            table.ClickCellValue("Account type", "Ledger", "Debit");

            journalVoucherPage.SetDebitValue("500");
            table.ClickCellValue("Account type", "Ledger", "Offset account");
            journalVoucherPage.SetAccountSeg1Value("15350");
            journalVoucherPage.SetSalesTaxGroupValue("ACQ");
            journalVoucherPage.SetItemGSTGroupValue("GST");
            StringAssert.Contains(journalVoucherPage.GetCalculatedSalesTaxAmountText(), "45.45");

            //Validate approval
            journalVoucherPage.ClickApprovalItemMenuButton();
            journalVoucherPage.ClickReportAsReadyItemMenuItem();
            journalVoucherPage.ClickApprovalItemMenuButton();
            journalVoucherPage.ClickApproveItemMenuItem();

            journalVoucherPage.ClickPostMenuButton();
            journalVoucherPage.ClickPostItemMenuItem();

            InfoLogPage infoLogPage = new InfoLogPage();
            Assert.IsTrue(infoLogPage.GetTreeItemExists("Number of vouchers posted to the journal: 1", "Message"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            journalVoucherPage.ClickCloseButton();
            generalJournalPage.ClickCloseButton();
        }