Exemplo n.º 1
0
        /// <summary>
        /// Go to period 1 of next year.
        /// </summary>
        public override void SetNextPeriod()
        {
            // Set to the first month of the "next year".
            FledgerInfo.ProvisionalYearEndFlag = false;
            FledgerInfo.CurrentPeriod = 1;
            FledgerInfo.CurrentFinancialYear = FledgerInfo.CurrentFinancialYear + 1;
            TCacheableTablesManager.GCacheableTablesManager.MarkCachedTableNeedsRefreshing(
                TCacheableFinanceTablesEnum.AccountingPeriodList.ToString());
            TCacheableTablesManager.GCacheableTablesManager.MarkCachedTableNeedsRefreshing(
                TCacheableFinanceTablesEnum.LedgerDetails.ToString());

            TAccountPeriodToNewYear accountPeriodOperator = new TAccountPeriodToNewYear(FledgerInfo.LedgerNumber);
            accountPeriodOperator.IsInInfoMode = false;
            accountPeriodOperator.RunOperation();
        }
Exemplo n.º 2
0
        public void Test_TAccountPeriodToNewYear()
        {
            // create new ledger which is in year 2010
            int intLedgerNumber2010 = CommonNUnitFunctions.CreateNewLedger(new DateTime(2010, 1, 1));

            // We are in 2010 and this and 2011 is not a leap year
            TVerificationResultCollection verificationResult = new TVerificationResultCollection();
            TAccountPeriodToNewYear accountPeriodToNewYear = new TAccountPeriodToNewYear(intLedgerNumber2010);

            accountPeriodToNewYear.VerificationResultCollection = verificationResult;
            accountPeriodToNewYear.IsInInfoMode = false;

            // RunEndOfPeriodOperation ...
            accountPeriodToNewYear.RunOperation();

            TAccountPeriodInfo accountPeriodInfo = new TAccountPeriodInfo(intLedgerNumber2010);
            accountPeriodInfo.AccountingPeriodNumber = 2;
            Assert.AreEqual(2011, accountPeriodInfo.PeriodStartDate.Year, "Test of the year");
            Assert.AreEqual(28, accountPeriodInfo.PeriodEndDate.Day, "Test of the Feb. 28th");

            // Switch to 2012 - this is a leap year ...
            accountPeriodToNewYear = new TAccountPeriodToNewYear(intLedgerNumber2010);
            accountPeriodToNewYear.IsInInfoMode = false;
            accountPeriodToNewYear.RunOperation();

            accountPeriodInfo = new TAccountPeriodInfo(intLedgerNumber2010);
            accountPeriodInfo.AccountingPeriodNumber = 2;
            Assert.AreEqual(29, accountPeriodInfo.PeriodEndDate.Day, "Test of the Feb. 29th");
        }