Пример #1
0
        public static void _SA_printTransaction(string sFileName, PAYMENT PaymentRecord)
        {
            // payment paid by cheque only

            if (Functions.GoodData(PaymentRecord))
            {
                if (PaymentRecord.GetType() != typeof(PAYMENT_CREDIT_CARD))
                {
                    PaymentsJournal._SA_Open(PaymentRecord);
                }
                Ranorex.Report.Info(String.Format("Printing payment {0} ", PaymentRecord.chequeNumber));
            }

            PaymentsJournal.repo.Print.Click();

            SimplyMessage._SA_HandleMessage(SimplyMessage.repo.Yes, SimplyMessage.sChqNumIsOutOfSequence);

            PrintToFileDialog.Print(sFileName);

            // Undo changes
            PaymentsJournal.ClickUndoChanges();

            SimplyMessage._SA_HandleMessage(SimplyMessage.repo.Yes, SimplyMessage.sDiscardJournalMsg);
        }
Пример #2
0
        public static void _SA_Delete(PAYMENT Payment)
        {
            // does one-step reversal by clicking on the reverse toolstrip button
            // the param has to be the type of PAYMENT, PAYMENT_OTHER, PAYMENT_CREDIT_CARD, or PAYMENT_REMIT
            string source;

            if (Functions.GoodData(Payment.chequeNumber))
            {
                source = Payment.chequeNumber;
            }
            else
            {
                source = Payment.source;
            }

            Ranorex.Report.Info(String.Format("Deleting the payment record {0} ", source));

            PaymentsJournal._SA_Open(Payment);                  // load the transaction for deletion

            PaymentsJournal.repo.Reverse.Click();

            // handle the conformation message
            SimplyMessage._SA_HandleMessage(SimplyMessage.repo.Yes, SimplyMessage.sReversePaymentMsg, true);
        }
Пример #3
0
        public static void Common_HeaderSetup(PAYMENT PaymentRecord, bool bEdit)
        {
            if (bEdit)
            {
                PaymentsJournal._SA_Open(PaymentRecord);
            }
            else
            {
                // Might not be needed any longer
//				if (PaymentRecord.GetType() == typeof(PAYMENT_CREDIT_CARD))	// can only select a credit card on the pay credit card bill window
//				{
//					PaymentsJournal.repo.VendorName2.Select(PaymentRecord.Vendor.name);
//				}
//				else
//				{
//					PaymentsJournal.repo.VendorName.TextValue = PaymentRecord.Vendor.name;
//					//PaymentsJournal.repo.VendorName.PressKeys("{Tab}");	// Must press tab, otherwise selecting the Paid By field may not work
//				}
                // open drop down to trigger outstanding invoices in grid
                PaymentsJournal.repo.VendorName2.Select(PaymentRecord.Vendor.name);
            }

            //  Validate if Add on the fly is present
            if (AddOnTheFly.repo.QuickAddInfo.Exists())
            {
                try
                {
                    Functions.Verify(true, false, "Add on fly message appears");
                }
                catch
                {
                    Ranorex.Report.Info("Add on the fly message not found");
                }
                AddOnTheFly.repo.QuickAdd.Click();
            }

            if (Functions.GoodData(PaymentRecord.paidBy) && (PaymentsJournal.repo.PaidBy.Enabled))
            {
                //Agent.SetOption(Options.PlaybackMode, ReplayMode.HighLevel);
                PaymentsJournal.repo.PaidBy.Select(PaymentRecord.paidBy);
                //PaymentsJournal.Instance.Window.TypeKeys("<Tab>");

                //// temporary workaround since selecting the combobox does not properly trigger the event
                //if (PaymentRecord.paidBy != "Cheque")
                //{
                //    if (PaymentsJournal.Instance.PaidBy.SelectedIndex != PaymentsJournal.Instance.PaidBy.ItemCount - 1)
                //    {
                //        PaymentsJournal.Instance.PaidBy.PressKeys("<Down>");
                //        PaymentsJournal.Instance.PaidBy.PressKeys("<UP>");
                //    }
                //    else
                //    {
                //        PaymentsJournal.Instance.PaidBy.PressKeys("<UP>");
                //        PaymentsJournal.Instance.PaidBy.PressKeys("<Down>");
                //    }
                //}
                //Agent.SetOption(Options.PlaybackMode, ReplayMode.LowLevel);
            }
            if (Functions.GoodData(PaymentRecord.paidFrom.acctNumber))
            {
                PaymentsJournal.repo.PaidFrom.Select(PaymentRecord.paidFrom.acctNumber);
            }
            if (PaymentsJournal.repo.ChequeNoInfo.Exists())
            {
                if (Functions.GoodData(PaymentRecord.chequeNumber))
                {
                    PaymentsJournal.repo.ChequeNo.TextValue = PaymentRecord.chequeNumber;
                }
                // else use the default cheque number
            }
            else if (PaymentsJournal.repo.DirectDepositNoInfo.Exists())
            {
                if (Functions.GoodData(PaymentRecord.directDepositNo))
                {
                    PaymentsJournal.repo.DirectDepositNo.TextValue = PaymentRecord.directDepositNo;
                }
            }
            else
            {
                PaymentsJournal.repo.Source.TextValue = PaymentRecord.source;
            }
            if (Functions.GoodData(PaymentRecord.TransDate))
            {
                PaymentsJournal.repo.PaymentDate.TextValue = PaymentRecord.TransDate;
            }
            if (Functions.GoodData(PaymentRecord.comment))
            {
                PaymentsJournal.repo.Comment.TextValue = PaymentRecord.comment;
            }
        }
Пример #4
0
        public static PAYMENT_REMIT _SA_ReadPayment_Remit(PAYMENT_REMIT PaymentToRead) //  method will read all fields and store the data in a PAYMENT_REMIT record
        {
            PAYMENT_REMIT P = new PAYMENT_REMIT();

            if (Functions.GoodData(PaymentToRead))
            {
                PaymentsJournal._SA_Open(PaymentToRead);
            }

            P.Vendor.name = PaymentsJournal.repo.VendorName.TextValue;
            if (PaymentsJournal.repo.PaidFromInfo.Exists())
            {
                P.paidFrom.acctNumber = PaymentsJournal.repo.PaidFrom.SelectedItemText;
            }
            P.chequeNumber = PaymentsJournal.repo.ChequeNo.TextValue;
            P.TransDate    = PaymentsJournal.repo.PaymentDate.TextValue;
            P.comment      = PaymentsJournal.repo.Comment.TextValue;
            P.reference    = PaymentsJournal.repo.Reference.TextValue;

            PaymentsJournal.repo.FrequencyButton.Click();
            P.remitFrequency = SelectRemittingFrequency.repo.Frequency.SelectedItemText;
            SelectRemittingFrequency.repo.Cancel.Click();

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

            if (lsContents.Count > 0)
            {
                int x;
                for (x = 0; x < lsContents.Count; x++)
                {
                    PAY_REMIT_ROW PR = new PAY_REMIT_ROW();
                    PR.remitName = ConvertFunctions.BlankStringToNULL(lsContents[x][0]);
                    //if (PR.remitName == "")
                    //{
                    //    PR.remitName = null;
                    //}
                    PR.amountOwing = ConvertFunctions.BlankStringToNULL(lsContents[x][1]);
                    //if (PR.amountOwing == "")
                    //{
                    //    PR.amountOwing = null;
                    //}
                    PR.adjustAccount = ConvertFunctions.BlankStringToNULL(lsContents[x][2]);
                    //if (PR.adjustAccount == "")
                    //{
                    //    PR.adjustAccount = null;
                    //}
                    PR.adjustment = ConvertFunctions.BlankStringToNULL(lsContents[x][3]);
                    //if (PR.adjustment == "")
                    //{
                    //    PR.adjustment = null;
                    //}
                    PR.amount = ConvertFunctions.BlankStringToNULL(lsContents[x][4]);
                    //if (PR.amount == "")
                    //{
                    //    PR.amount = null;
                    //}
                    P.GridRows.Add(PR);
                }
            }
            return(P);
        }
Пример #5
0
        public static PAYMENT_OTHER _SA_ReadPayment_Other(PAYMENT_OTHER PaymentToRead) //  method will read all fields and store the data in a PAYMENT_OTHER record
        {
            PAYMENT_OTHER P = new PAYMENT_OTHER();

            if (Functions.GoodData(PaymentToRead))
            {
                PaymentsJournal._SA_Open(PaymentToRead);
            }

            P.Vendor.name = PaymentsJournal.repo.VendorName.TextValue;
            P.paidBy      = PaymentsJournal.repo.PaidBy.SelectedItem.Text;

            if (PaymentsJournal.repo.PaidFromInfo.Exists())
            {
                P.paidFrom.acctNumber = PaymentsJournal.repo.PaidFrom.SelectedItemText;
            }
            if (PaymentsJournal.repo.ChequeNoInfo.Exists())
            {
                P.chequeNumber = PaymentsJournal.repo.ChequeNo.TextValue;
            }
            else
            {
                P.source = PaymentsJournal.repo.Source.TextValue;
            }
            P.TransDate = PaymentsJournal.repo.PaymentDate.TextValue;
            P.comment   = PaymentsJournal.repo.Comment.TextValue;
            P.reference = PaymentsJournal.repo.Reference.TextValue;

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

            if (lsContents.Count > 0)
            {
                for (int x = 0; x < lsContents.Count; x++)
                {
                    PAY_OTHER_ROW PR = new PAY_OTHER_ROW();
                    PR.account.acctNumber = lsContents[x][0];
                    PR.description        = lsContents[x][1];
                    PR.amount             = lsContents[x][2];
                    PR.taxCode.code       = lsContents[x][3];

                    // read project allocation info
                    if (lsContents[x][4] == "true")
                    {
                        // bring up the allocation dialog
                        PaymentsJournal.repo.TransContainer.ClickFirstCell();                           //Click ();
                        PaymentsJournal.repo.TransContainer.PressKeys("{Up " + lsContents.Count + "}"); // get to top of grid
                        PaymentsJournal.repo.TransContainer.PressKeys("{Down " + (x - 1) + "}");        // get to top of grid
                        PaymentsJournal.repo.Self.PressKeys("{Ctrl+Shift+A}");

                        // read allocation details (shouldn't we use the common function here?)
//                        if (s_desktop.Exists(ProjectAllocationDialog.PROJECTALLOCATIONDIALOG_LOC))
//                        {
//                            //List<PROJECT_ALLOCATION> PA = new List<PROJECT_ALLOCATION>() { };
//
//                            //List<string[]> containerLine = ProjectAllocationDialog.Instance.AllocationContainer.GetContents().ToList();
//                            //// Enter first field if not blank
//                            //if (containerLine[0][0] != "")
//                            //{
//                            //    while ((containerLine[0][0].Trim() != "") && (containerLine.Count >= 4))
//                            //    {
//                            //        PROJECT_ALLOCATION TempProj = new PROJECT_ALLOCATION();
//                            //        // assign recordset
//                            //        TempProj.Project.name = ConvertFunctions.CommaToText(containerLine[x][0]);
//                            //        TempProj.Amount = ConvertFunctions.CommaToText(containerLine[x][1]);
//                            //        TempProj.Percent = ConvertFunctions.CommaToText(containerLine[x][2]);
//                            //        PA.Add(TempProj);
//
//                            //        //int i;
//                            //        if (containerLine.Count > 4)
//                            //        {
//                            //            for (int i = 1; i < 4; i++)
//                            //            {
//                            //                containerLine.RemoveAt(1);
//                            //            }
//                            //        }
//                            //        else
//                            //        {
//                            //            containerLine.RemoveAt(1);
//                            //        }
//                            //    }
//                            //}
//                            //P.GridRows[x].Projects = PA;
//
//                            P.GridRows[x].Projects = ProjectAllocationDialog.Instance._SA_GetProjectAllocationDetails();
//                            ProjectAllocationDialog.Instance.Cancel.Click();
//                        }
                    }
                    P.GridRows.Add(PR);
                }
            }

            return(P);
        }
Пример #6
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);
        }