Exemple #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;

            Settings._SA_Get_AllPayableSettings();

            // Setup a new account
            GL_ACCOUNT newAccount = new GL_ACCOUNT();


            if (this._varAccount == "")
            {
                newAccount.acctNumber = "590" + StringFunctions.RandStr("9(1)") + " " + StringFunctions.RandStr("A(9)");                        // the db is setup to use 4 digits accounts

                GeneralLedger._SA_Create(newAccount);
                GeneralLedger._SA_Close();
            }
            else
            {
                newAccount.acctNumber = this._varAccount;
            }

            // Post an entry in GJ
            GENERAL_JOURNAL genJournal = new GENERAL_JOURNAL();
            GL_ACCOUNT      account2   = new GL_ACCOUNT();
            GJ_ROW          row        = new GJ_ROW();
            GJ_ROW          row2       = new GJ_ROW();

            string amount = Functions.RandCashAmount();

            row.Account  = newAccount;
            row.debitAmt = amount;
            genJournal.GridRows.Add(row);

            // Using the currency account will need foreign currency setup
            row2.Account   = Variables.globalSettings.PayableSettings.CurrencyAccounts[0].BankAccount;
            row2.creditAmt = amount;
            genJournal.GridRows.Add(row2);

            genJournal.source = StringFunctions.RandStr("A(8)");

            // to be continued
            GeneralJournal._SA_Create(genJournal);
            GeneralJournal._SA_Close();
        }
Exemple #2
0
        public static GENERAL_JOURNAL _SA_Read(string sIDToRead) //  method will read all fields and store the data in a RECEIPT record
        {
            GENERAL_JOURNAL GJE = new GENERAL_JOURNAL();

            if (Functions.GoodData(sIDToRead))
            {
                GJE.source = sIDToRead;
                if (GeneralJournal.repo.Source.TextValue != GJE.source)
                {
                    GeneralJournal._SA_Open(GJE);
                }
            }

            GJE.journalDate = GeneralJournal.repo.JournalDate.TextValue;
            GJE.comment     = GeneralJournal.repo.Comment.TextValue;
            if (GeneralJournal.repo.SelfInfo.Exists())
            {
                GJE.currCode = GeneralJournal.repo.CurrencyCode.SelectedItem.Text;
            }

            GJE.GridRows.Clear();
            List <List <string> > lsContents = GeneralJournal.repo.DetailsContainer.GetContents();

            //if (Functions.GoodData (lsContents))   NC - no longer need to check since the lsContents.Count sort of does the same thing
            //{
            for (int x = 0; x < lsContents.Count; x++)
            {
                // check for blank line
                if (lsContents[x][0] != "")
                {
                    GJ_ROW GR = new GJ_ROW();

                    GR.Account.acctNumber = lsContents[x][0];

                    if (lsContents[x][1].Trim() == "--")
                    {
                        GR.debitAmt = "0";
                    }
                    else
                    {
                        GR.debitAmt = lsContents[x][1];
                    }

                    if (lsContents[x][2].Trim() == "--")
                    {
                        GR.creditAmt = "0";
                    }
                    else
                    {
                        GR.creditAmt = lsContents[x][2];
                    }

                    GR.lineComment = lsContents[x][3];

                    GJE.GridRows.Add(GR);
                }
            }
            //}


            // Get project allocations
            // Move to first cell
            GeneralJournal.repo.DetailsContainer.ClickFirstCell();

            if (Functions.GoodData(GJE.GridRows))
            {
                for (int x = 0; x < GJE.GridRows.Count; x++)
                {
                    if (GeneralJournal.repo.AllocateToProject.Enabled)
                    {
                        GJE.GridRows[x].Projects.Clear();
                        GeneralJournal.repo.AllocateToProject.Click();

                        if (ProjectAllocationDialog.repo.SelfInfo.Exists())
                        {
                            //List<List<string>> lsContents = ProjectAllocationDialog.repo.DataGrid.GetContents();

                            //if (Functions.GoodData (lsContents))
                            //{
                            //    for (int y = 0; y < lsContents.Count; y++)
                            //    {
                            //        if (Functions.GetField.Trim(' '), 1)) == "")
                            //        {
                            //            break;
                            //        }
                            //        else
                            //        {
                            //            PROJECT_ALLOCATION PA = new PROJECT_ALLOCATION();
                            //            PA.Project.name = Functions.Functions.GetField (lsContents[y], "	", 1);
                            //            if(Functions.GetField.Trim(' '), 2)) == "--")
                            //            {
                            //                PA.Amount = "0";
                            //            }
                            //            else
                            //            {
                            //                PA.Amount = Functions.Functions.GetField (lsContents[y], "	", 2);
                            //            }
                            //            if(Functions.GetField.Trim(' '), 3)) == "--")
                            //            {
                            //                PA.Percent = "0";
                            //            }
                            //            else
                            //            {
                            //                PA.Percent = Functions.Functions.GetField (lsContents[y], "	", 3);
                            //            }
                            //            GJE.GridRows[x].Projects.Add(PA);
                            //        }
                            //    }

                            GJE.GridRows[x].Projects = ProjectAllocationDialog._SA_GetProjectAllocationDetails();
                        }
                        ProjectAllocationDialog.repo.Cancel.Click();
                    }
                    GeneralJournal.repo.DetailsContainer.PressKeys("<Down>");
                }
            }

            return(GJE);
        }