예제 #1
0
        void CheckGLMPeriodEntry(int ALedgerNumber, int AYear, int APeriodNr, string AAccount,
            decimal cc1Base,
            decimal cc2Base,
            decimal cc3Base)
        {
            TGlmInfo glmInfo = new TGlmInfo(ALedgerNumber, AYear, AAccount);

            glmInfo.Reset();
            int intCnt = 0;
            bool blnFnd1 = false;
            bool blnFnd2 = false;
            bool blnFnd3 = false;

            TCacheable cache = new Ict.Petra.Server.MFinance.Cacheable.TCacheable();
            Type dummy;
            ACostCentreTable costcentres = (ACostCentreTable)cache.GetCacheableTable(TCacheableFinanceTablesEnum.CostCentreList,
                string.Empty,
                false,
                ALedgerNumber,
                out dummy);

            while (glmInfo.MoveNext())
            {
//              TLogging.Log("glmInfo.CostCentreCode: " + glmInfo.CostCentreCode);

                TGlmpInfo glmpInfo = new TGlmpInfo(ALedgerNumber);
                glmpInfo.LoadBySequence(glmInfo.GlmSequence, APeriodNr);

                Assert.AreEqual(true,
                    glmpInfo.RowExists,
                    "we cannot find a glm period record for " + glmInfo.AccountCode + " / " + glmInfo.CostCentreCode);

                if (glmInfo.CostCentreCode.Equals("4301"))
                {
                    Assert.AreEqual(cc1Base, glmpInfo.ActualBase);
                    blnFnd1 = true;
                }

                if (glmInfo.CostCentreCode.Equals("4302"))
                {
                    Assert.AreEqual(cc2Base, glmpInfo.ActualBase);
                    blnFnd2 = true;
                }

                if (glmInfo.CostCentreCode.Equals("4303"))
                {
                    Assert.AreEqual(cc3Base, glmpInfo.ActualBase);
                    blnFnd3 = true;
                }

                if (((ACostCentreRow)costcentres.Rows.Find(new object[] { ALedgerNumber, glmInfo.CostCentreCode })).PostingCostCentreFlag)
                {
                    ++intCnt;
                }
            }

            Assert.AreEqual(3, intCnt, "3 posting cost centres ...");
            Assert.IsTrue(blnFnd1);
            Assert.IsTrue(blnFnd2);
            Assert.IsTrue(blnFnd3);
        }
예제 #2
0
        private void CheckForSuspenseAccountsZero()
        {
            if (FledgerInfo.CurrentPeriod == FledgerInfo.NumberOfAccountingPeriods)
            {
                // This means: The last accounting period of the year is running!

                if (getSuspenseAccountInfo == null)
                {
                    getSuspenseAccountInfo =
                        new GetSuspenseAccountInfo(FledgerInfo.LedgerNumber);
                }

                if (getSuspenseAccountInfo.RowCount > 0)
                {
                    ASuspenseAccountRow aSuspenseAccountRow;

                    for (int i = 0; i < getSuspenseAccountInfo.RowCount; ++i)
                    {
                        aSuspenseAccountRow = getSuspenseAccountInfo.Row(i);
                        TGet_GLM_Info get_GLM_Info = new TGet_GLM_Info(FledgerInfo.LedgerNumber,
                            aSuspenseAccountRow.SuspenseAccountCode,
                            FledgerInfo.CurrentFinancialYear);

                        if (get_GLM_Info.GLMExists)
                        {
                            TGlmpInfo get_GLMp_Info = new TGlmpInfo(FledgerInfo.LedgerNumber);
                            get_GLMp_Info.LoadBySequence(get_GLM_Info.Sequence, FledgerInfo.CurrentPeriod);

                            if (get_GLMp_Info.RowExists && (get_GLMp_Info.ActualBase != 0))
                            {
                                TVerificationResult tvr = new TVerificationResult(
                                    Catalog.GetString("Non Zero Suspense Account found"),
                                    String.Format(Catalog.GetString("Suspense account {0} has the balance value {1}. It is required to be zero."),
                                        getSuspenseAccountInfo.ToString(),
                                        get_GLMp_Info.ActualBase), "",
                                    TPeriodEndErrorAndStatusCodes.PEEC_07.ToString(), TResultSeverity.Resv_Critical);
                                FverificationResults.Add(tvr);

                                FHasCriticalErrors = true;
                                FverificationResults.Add(tvr);
                            }
                        }
                    }
                }
            }
        } // CheckFor SuspenseAccountsZero