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 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();
        }