Example #1
0
        public PAYMENT_PURCH _SA_ReadPayment(PAYMENT_PURCH PaymentToRead)         //  method will read all fields and store the data in a PAYMENT record
        {
            PAYMENT_PURCH P = new PAYMENT_PURCH();

            if (Functions.GoodData(PaymentToRead))              // else we assume you are on the correct payment
            {
                PaymentsJournal._SA_Open(PaymentToRead);
            }

            P.Vendor.name = PaymentsJournal.repo.VendorName.TextValue;
            P.paidBy      = PaymentsJournal.repo.PaidBy.SelectedItem.ToString();
            if (PaymentsJournal.repo.PaidFromInfo.Exists())
            {
                P.paidFrom.acctNumber = PaymentsJournal.repo.PaidFrom.SelectedItemText;
            }
            if (PaymentsJournal.repo.ChequeNoInfo.Exists())
            {
                P.chequeNumber = PaymentsJournal.repo.ChequeNo.TextValue;
            }
            else if (PaymentsJournal.repo.DirectDepositNoInfo.Exists())
            {
                P.directDepositNo = PaymentsJournal.repo.DirectDepositNo.TextValue;
            }
            else
            {
                P.source = PaymentsJournal.repo.Source.TextValue;
            }
            P.TransDate = PaymentsJournal.repo.PaymentDate.TextValue;
            P.comment   = PaymentsJournal.repo.Comment.TextValue;

            if (PaymentsJournal.repo.PrepaymentReferenceNoInfo.Exists())
            {
                P.PrePayRefNumber = PaymentsJournal.repo.PrepaymentReferenceNo.TextValue;
            }
            if (PaymentsJournal.repo.PrepaymentAmountInfo.Exists())
            {
                P.PrePayAmount = PaymentsJournal.repo.PrepaymentAmount.TextValue;
            }
            if (PaymentsJournal.repo.ExchangeRateInfo.Exists())
            {
                P.exchangeRate = PaymentsJournal.repo.ExchangeRate.TextValue;
            }

            List <List <string> > lsContents = PaymentsJournal.repo.TransContainer.GetContents();

            if (lsContents.Count > 0)
            {
                bool bPrepayment = false;

                for (int x = 0; x < lsContents.Count; x++)
                {
                    PAY_ROW PR = new PAY_ROW();
                    if (lsContents[x][1].ToUpper().Trim() == "PREPAYMENTS")
                    {
                        bPrepayment = true;                             // only set this true once...from here out it is true
                    }
                    else
                    {
                        if (bPrepayment)
                        {
                            PAYMENT_PURCH preP = new PAYMENT_PURCH();
                            preP.PrePayRefNumber = lsContents[x][1];
                            PR.PrePayment        = preP;
                        }
                        else
                        {
                            PR.Invoice.transNumber = lsContents[x][1];
                        }
                        PR.discountTaken = lsContents[x][5];
                        PR.Amount        = lsContents[x][6];
                        P.GridRows.Add(PR);
                    }
                }
            }
            return(P);
        }
Example #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;

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

            if (this.varVendor == "")
            {
                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.Item.invOrServNumber = item.invOrServNumber;
            r.quantityReceived     = Functions.RandCashAmount(2);
            // need a pause to create a different random number..
            System.Threading.Thread.Sleep(1000);
            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;
            }

            // Create a payment
            PAYMENT_PURCH payment = new PAYMENT_PURCH();

            payment.Vendor = ven;
            PAY_ROW row1 = new PAY_ROW();

            row1.Invoice = pi;
            payment.GridRows.Add(row1);

            PaymentsJournal._SA_CreatePayment(payment);
            System.Threading.Thread.Sleep(1000);
            PaymentsJournal._SA_Close();
        }