/// <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; // Remove existing print file string printedInvoice = @"C:\Users\Public\Documents\Simply Accounting\2018\Data\Invoice.pdf"; // @"C:\Users\_sabvt\Documents\Simply Accounting\DATA\Invoice.pdf"; Functions.RemoveExistingFile(printedInvoice); // Create a customer CUSTOMER cus = new CUSTOMER(); if (this.varCustomer == "") { cus.name = "cust" + StringFunctions.RandStr("X(8)"); ReceivablesLedger._SA_Create(cus); ReceivablesLedger._SA_Close(); } else { cus.name = this.varCustomer; } // 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 an invoice and print a Simply form SALES_INVOICE salesInv = new SALES_INVOICE(); salesInv.Customer = cus; ROW firstRow = new ROW(); firstRow.Item.invOrServNumber = item.invOrServNumber; firstRow.quantityShipped = Functions.RandCashAmount(2); salesInv.GridRows.Add(firstRow); SalesJournal._SA_Create(salesInv, false); // Print. Install, then setup pdf printer to be default printer first SalesJournal._SA_PrintToFile(printedInvoice); // wait for file to be created Thread.Sleep(13000); // undo and close journal SalesJournal.UndoChanges(); SalesJournal._SA_Close(); // Verify file has been printed if (!Functions.VerifyFileExists(printedInvoice)) { Functions.Verify(false, true, "Printed Simply form found"); } }