/// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            // Create a vendor
            VENDOR ven = new VENDOR();

            if (this.varItem == "")
            {
                ven.name = "Vend" + StringFunctions.RandStr("X(8)");

                PayablesLedger._SA_Create(ven);
                PayablesLedger._SA_Close();
            }
            else
            {
                ven.name = this.varVendor;
            }

            // Create an item
            ITEM item = new ITEM();

            item.ItemPrices.Add(new ITEM_PRICE("Canadian Dollars"));
            item.ItemPrices[0].priceList           = "Regular";
            item.ItemPrices[0].pricePerSellingUnit = Functions.RandCashAmount();


            if (this.varItem == "")
            {
                item.invOrServNumber = StringFunctions.RandStr("A(9)");

                InventoryServicesLedger._SA_Create(item);
                InventoryServicesLedger._SA_Close();
            }
            else
            {
                item.invOrServNumber = this.varItem;
            }


            // Create an Invoice
            PURCHASE_INVOICE pi = new PURCHASE_INVOICE();

            pi.Vendor = ven;
            ROW r = new ROW();

            r.Item             = item;
            r.quantityReceived = Functions.RandCashAmount(2);
            r.price            = Functions.RandCashAmount();

            pi.GridRows.Add(r);

            if (this.varPInvoice == "")
            {
                pi.transNumber = StringFunctions.RandStr("9(8)");
                PurchasesJournal._SA_Create(pi);
                System.Threading.Thread.Sleep(2000);
                PurchasesJournal._SA_Close();
            }
            else
            {
                pi.transNumber = this.varPInvoice;
            }

            // Adjust the invoice

            pi.GridRows[0].quantityReceived = Functions.RandCashAmount(2);
            PurchasesJournal._SA_Create(pi, true, true);
            PurchasesJournal._SA_Close();
        }
Пример #2
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            string sT5018Summary = @"C:\Users\Public\Documents\Simply Accounting\2018\Data\Summary of Contract Payments.pdf";// @"C:\Users\_sabvt\Documents\Simply Accounting\DATA\Summary of Contract Payments.pdf";

            string sInstallPath = Simply._SA_GetProgramPath();
            string sDllPath     = string.Format(@"{0}acPDFCreatorLib.Net.dll", sInstallPath);

            // Check Sage 50 pdf engine dll is installed before starting test case
            if (Functions.VerifyFileExists(sDllPath))
            {
                // Remove existing pdf file
                Functions.RemoveExistingFile(sT5018Summary);

                // Create a T5018 vendor
                VENDOR tvendor = new VENDOR();

                tvendor.name = StringFunctions.RandStr("A(9)");
                tvendor.includeFilingT5018CheckBox = true;
                PayablesLedger._SA_Create(tvendor);
                PayablesLedger._SA_Close();

                // Create an item
                ITEM       item      = new ITEM();
                ITEM_PRICE itemPrice = new ITEM_PRICE();
                itemPrice.currency            = "Canadian Dollars";
                itemPrice.priceList           = "Regular";
                itemPrice.pricePerSellingUnit = Functions.RandCashAmount();
                item.ItemPrices.Add(itemPrice);


                if (this.varItem == "")
                {
                    item.invOrServNumber = StringFunctions.RandStr("A(9)");

                    InventoryServicesLedger._SA_Create(item);
                    InventoryServicesLedger._SA_Close();
                }
                else
                {
                    item.invOrServNumber = this.varItem;
                }

                // Create purchase invoice using T5018 vendor
                PURCHASE_INVOICE purInv = new PURCHASE_INVOICE();
                purInv.Vendor      = tvendor;
                purInv.transNumber = StringFunctions.RandStr("9(8)");

                ROW firstRow = new ROW();
                firstRow.Item.invOrServNumber = item.invOrServNumber;
                firstRow.quantityReceived     = Functions.RandCashAmount(2);
                firstRow.price = Functions.RandCashAmount();
                purInv.GridRows.Add(firstRow);

                PurchasesJournal._SA_Create(purInv);
                PurchasesJournal._SA_Close();

                // Print T5018 summary to a file
                string sCraNumber = "403381601RZ0001";
                Simply._Print_T5018Summary(sCraNumber);


                // Verify printed file
                if (!Functions.VerifyFileExists(sT5018Summary))
                {
                    Functions.Verify(false, true, "Printed T5018 form found");
                }
            }
            else
            {
                Functions.Verify(false, true, "PDF engine dll file found");
            }

            // Wait 5 seconds before moving on to next testcase
            Thread.Sleep(5000);
        }