Exemplo n.º 1
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;

            // Create a customer
            CUSTOMER cus = new CUSTOMER();

            cus.name = "cust" + StringFunctions.RandStr("X(8)");
            //cus.name = "International Oil";

            ReceivablesLedger._SA_Create(cus);
            ReceivablesLedger._SA_Close();

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

            item.invOrServNumber = StringFunctions.RandStr("A(9)");
            //item.invOrServNumber = "C1020";
            item.ItemPrices.Add(new ITEM_PRICE("Canadian Dollars"));
            item.ItemPrices[0].priceList           = "Regular";
            item.ItemPrices[0].pricePerSellingUnit = Functions.RandCashAmount();

            InventoryServicesLedger._SA_Create(item);
            InventoryServicesLedger._SA_Close();

            // Create an Invoice
            SALES_INVOICE sale = new SALES_INVOICE();

            sale.Customer    = cus;
            sale.transNumber = StringFunctions.RandStr("9(8)");

            ROW r = new ROW();

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

            sale.GridRows.Add(r);

            SalesJournal._SA_Create(sale);
            System.Threading.Thread.Sleep(2000);
            SalesJournal._SA_Close();

//            // tmp
//            CUSTOMER cus = new CUSTOMER();
//            cus.name = "custYXTngnQw";
//            ITEM item = new ITEM();
//            item.invOrServNumber = "aqlUMddep";
//            SALES_INVOICE sale = new SALES_INVOICE();
//            sale.Customer = cus;
//            sale.transNumber = "15883414";
//
            // Create an receipt
            RECEIPT receipt = new RECEIPT();

            receipt.Customer = cus;
            RECEIPT_ROW row1 = new RECEIPT_ROW();

            row1.Invoice = sale;
            receipt.GridRows.Add(row1);

            ReceiptsJournal._SA_Create(receipt);
            System.Threading.Thread.Sleep(1000);
            ReceiptsJournal._SA_Close();
        }
        public static RECEIPT _SA_Read(RECEIPT ReceiptRecord) //  method will read all fields and store the data in a RECEIPT record
        {
            RECEIPT Rec = new RECEIPT();

            if (Functions.GoodData(ReceiptRecord))
            {
                ReceiptsJournal._SA_Open(ReceiptRecord);
            }

            Rec.paidBy = ReceiptsJournal.repo.PaidBy.SelectedItemText;
            if (ReceiptsJournal.repo.DepositToInfo.Exists())
            {
                Rec.DepositAccount.acctNumber = ReceiptsJournal.repo.DepositTo.SelectedItemText;
            }
            if (ReceiptsJournal.repo.ChequeNumberInfo.Exists())
            {
                {
                    Rec.chequeNumber = ReceiptsJournal.repo.ChequeNumber.TextValue;
                }
            }
            Rec.Customer.name = ReceiptsJournal.repo.CustomerName.SelectedItemText;
            Rec.transDate     = ReceiptsJournal.repo.ReceiptDate.TextValue;

            if (ReceiptsJournal.repo.ReceiptNumberInfo.Exists())
            {
                Rec.transNumber = ReceiptsJournal.repo.ReceiptNumber.TextValue;
            }
            if (ReceiptsJournal.repo.PadNumberInfo.Exists())
            {
                Rec.padNumber = ReceiptsJournal.repo.PadNumber.TextValue;
            }

            Rec.GridRows.Clear();
            List <List <string> > lsContents = ReceiptsJournal.repo.TransContainer.GetContents();  // a blank row is added at the end of the list

            if (Functions.GoodData(lsContents))
            {
                bool bDepositLineFound = false;
                for (int x = 0; x < lsContents.Count; x++)
                {
                    RECEIPT_ROW RR      = new RECEIPT_ROW();
                    string      sRefNum = ConvertFunctions.BlankStringToNULL(lsContents[x][1]);
                    if (Functions.GoodData(sRefNum))    // to avoid adding a blank row
                    {
                        if (sRefNum == "Deposits")
                        {
                            bDepositLineFound = true;
                        }
                        else
                        {
                            if (bDepositLineFound)      // deposit row
                            {
                                RR.DepositReceipt.depositRefNum = sRefNum;
                            }
                            else        // invoice row
                            {
                                RR.Invoice.transNumber = sRefNum;
                            }
                            RR.discountTaken = ConvertFunctions.BlankStringToNULL(lsContents[x][5]);
                            RR.Amount        = ConvertFunctions.BlankStringToNULL(lsContents[x][6]);
                        }
                        Rec.GridRows.Add(RR);
                    }
                }
            }

            Rec.depositRefNum = ReceiptsJournal.repo.DepositReferenceNo.TextValue;
            Rec.depositAmount = ReceiptsJournal.repo.DepositAmount.TextValue;
            if (ReceiptsJournal.repo.ExchangeRateInfo.Exists())
            {
                Rec.exchangeRate = ReceiptsJournal.repo.ExchangeRate.TextValue;
            }
            Rec.comment = ReceiptsJournal.repo.Comment.TextValue;

            return(Rec);
        }
Exemplo n.º 3
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;

            // 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 to be used in invoice
            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
            SALES_INVOICE sale = new SALES_INVOICE();

            sale.Customer = cus;

            ROW r = new ROW();

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

            sale.GridRows.Add(r);

            if (this.varSInvoice == "")
            {
                SalesJournal._SA_Create(sale);
                System.Threading.Thread.Sleep(1000);
                SalesJournal._SA_Close();
            }
            else
            {
                sale.transNumber = this.varSInvoice;
            }

            // Create a receipt
            RECEIPT receipt = new RECEIPT();

            receipt.Customer = cus;
            RECEIPT_ROW receiptRow = new RECEIPT_ROW();

            receiptRow.Invoice = sale;
            receipt.GridRows.Add(receiptRow);

            ReceiptsJournal._SA_Create(receipt);
            System.Threading.Thread.Sleep(1000);
            ReceiptsJournal._SA_Close();
        }