示例#1
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);
        }
示例#2
0
 public static void _SA_MatchDefaultsPayment_Other(PAYMENT_OTHER PaymentRecord)
 {
     //need to fill this in
 }
示例#3
0
 public static void _SA_CreatePayment_Other(PAYMENT_OTHER PaymentRecord, bool bSave, bool bEdit)
 {
     _SA_CreatePayment_Other(PaymentRecord, bSave, bEdit, false);
 }
示例#4
0
        public static void _SA_CreatePayment_Other(PAYMENT_OTHER PaymentRecord, bool bSave, bool bEdit, bool bRecur)
        {
            bool bCheckGlobalProject = false;

            if (!PaymentsJournal.repo.SelfInfo.Exists())
            {
                PaymentsJournal._SA_Invoke();
            }

            string source;                                      // to be used in print statements

            if (Functions.GoodData(PaymentRecord.chequeNumber)) // paid by cheque
            {
                source = PaymentRecord.chequeNumber;
            }
            else
            {
                source = PaymentRecord.source;
            }

            if (!bEdit)
            {
                if (!bRecur)
                {
                    Ranorex.Report.Info(String.Format("Creating Other Payment {0} ", source));
                }
                //else is recurring entry and the message will be printed later.
            }
            else
            {
                Ranorex.Report.Info(String.Format("Adjusting Other Payment {0} ", source));
            }

            PaymentsJournal.repo.Transaction.Select("Make Other Payment");

            Common_HeaderSetup(PaymentRecord, bEdit);

            if (Functions.GoodData(PaymentRecord.reference))
            {
                PaymentsJournal.repo.Reference.TextValue = PaymentRecord.reference;
            }

            PaymentsJournal.repo.TransContainer.ClickFirstCell();
            PaymentsJournal.repo.TransContainer.PressKeys("{Tab}");                               // go to the Description field first
            PaymentsJournal.repo.TransContainer.PressKeys("{LShiftKey down}{Tab}{LShiftKey up}"); // then come back to the Account field to activate the cell


            for (int x = 0; x < PaymentRecord.GridRows.Count; x++)
            {
                if (Functions.GoodData(PaymentRecord.GridRows[x]))
                {
                    if (Functions.GoodData(PaymentRecord.GridRows[x].account.acctNumber))
                    {
                        PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[x].account.acctNumber);
                        PaymentsJournal.repo.TransContainer.MoveRight();          // tab to the Description field
                    }
                    else                                                          // pick a random account
                    {
                        PaymentsJournal.repo.TransContainer.PressKeys("<Enter>"); // press enter to bring up the select GL account window
                        PaymentRecord.GridRows[x].account.acctNumber = SelectAccountDialog.repo.AccountName.RandPick(true);
                        // the focus is set to descirption field automatically so no need to tab again
                    }
                    if (Functions.GoodData(PaymentRecord.GridRows[x].description))
                    {
                        PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[x].description);
                    }
                    PaymentsJournal.repo.TransContainer.MoveRight();
                    PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[x].amount);
                    PaymentsJournal.repo.TransContainer.MoveRight();
                    if (Functions.GoodData(PaymentRecord.GridRows[x].taxCode.code))
                    {
                        PaymentsJournal.repo.TransContainer.SetText(PaymentRecord.GridRows[x].taxCode.code);
                    }

                    if (PaymentRecord.GridRows[x].Projects.Count != 0)  // enter project allocation if provided
                    {
                        // get global settings if haven't alreayd
                        if (!bCheckGlobalProject)
                        {
                            Settings._SA_Get_AllProjectSettings();
                            // PaymentsJournal.repo.Window.SetActive();
                            bCheckGlobalProject = true;
                        }

                        PaymentsJournal.repo.AllocateToProjects.Click();
                        if (ProjectAllocationDialog.repo.SelfInfo.Exists())
                        {
                            ProjectAllocationDialog._SA_EnterProjectAllocationDetails(PaymentRecord.GridRows[x].Projects);
                        }
                    }

                    PaymentsJournal.repo.TransContainer.PressKeys("{Tab}");     // move to the next row
                }
            }

            // Recurring entry not ready
//			if (bRecur && !bSave)	// store recurring
//			{
//				Trace.WriteLine("Storing the recurring entry " + PaymentRecord.recurringName + ", " + PaymentRecord.recurringFrequency + "");
//				PaymentsJournal.repo.PressKeys("{Ctrl+t}");
//				StoreRecurringDialog.Instance._SA_DoStoreRecurring(PaymentRecord.recurringName, PaymentRecord.recurringFrequency);
//				// discard the transaction
//				PaymentsJournal.ClickUndoChanges();
//			}

            if (bSave)
            {
                PaymentsJournal.repo.Post.Click();
            }
        }
示例#5
0
 public static void _SA_CreatePayment_Other(PAYMENT_OTHER PaymentRecord)
 {
     _SA_CreatePayment_Other(PaymentRecord, true, false, false);
 }