Beispiel #1
0
        /// <summary>
        /// if withExchangeRatesGLM is false, it
        /// will only set the correct values for realPeriod and realYear,
        /// </summary>
        /// <returns></returns>
        public TFinancialPeriod(TDataBase databaseConnection, int period, int year, TParameterList parameters, int column)
        {
            diffPeriod               = 0;
            FCurrentFinancialYear    = parameters.Get("param_current_financial_year_i", column).ToInt();
            FNumberAccountingPeriods = parameters.Get("param_number_of_accounting_periods_i", column).ToInt();
            FCurrentPeriod           = parameters.Get("param_current_period_i", column).ToInt();
            FNumberForwardingPeriods = parameters.Get("param_number_fwd_posting_periods_i", column).ToInt();
            Int32        glmSequenceNumber = parameters.Get("glm_sequence_i", column).ToInt();
            LedgerStatus myLedgerStatus    = new LedgerStatus();

            realGlmSequence = myLedgerStatus.GlmSequencesCache.GetGlmSequence(glmSequenceNumber);

            if ((realGlmSequence != null) && (realGlmSequence.year != year))
            {
                realGlmSequence = myLedgerStatus.GlmSequencesCache.GetOtherYearGlmSequence(databaseConnection, realGlmSequence, year);
            }

            if (parameters.Exists("param_diff_period_i", column, -1))
            {
                diffPeriod = parameters.Get("param_diff_period_i", column).ToInt();
            }

            MainConstructor(databaseConnection,
                            period,
                            year,
                            diffPeriod,
                            FCurrentFinancialYear,
                            FCurrentPeriod,
                            FNumberAccountingPeriods,
                            FNumberForwardingPeriods,
                            realGlmSequence,
                            myLedgerStatus);
        }
Beispiel #2
0
        /// <summary>
        /// called by the constructors
        /// </summary>
        /// <param name="databaseConnection"></param>
        /// <param name="period"></param>
        /// <param name="year">the selected year that the report should be on</param>
        /// <param name="diffPeriod"></param>
        /// <param name="ACurrentFinancialYear"></param>
        /// <param name="ACurrentPeriod"></param>
        /// <param name="ANumberAccountingPeriods"></param>
        /// <param name="ANumberForwardingPeriods"></param>
        /// <param name="glmSequence">in relation to year, not currentFinancialYear</param>
        /// <param name="myLedgerStatus"></param>
        public void MainConstructor(TDataBase databaseConnection,
                                    int period,
                                    int year,
                                    int diffPeriod,
                                    System.Int32 ACurrentFinancialYear,
                                    System.Int32 ACurrentPeriod,
                                    System.Int32 ANumberAccountingPeriods,
                                    System.Int32 ANumberForwardingPeriods,
                                    TGlmSequence glmSequence,
                                    LedgerStatus myLedgerStatus)
        {
            this.diffPeriod          = diffPeriod;
            FCurrentFinancialYear    = ACurrentFinancialYear;
            FNumberAccountingPeriods = ANumberAccountingPeriods;
            FCurrentPeriod           = ACurrentPeriod;
            FNumberForwardingPeriods = ANumberForwardingPeriods;
            realPeriod = period + diffPeriod;
            realYear   = year;

            if (glmSequence == null)
            {
                realGlmSequence = null;
            }
            else
            {
                realGlmSequence = myLedgerStatus.GlmSequencesCache.GetOtherYearGlmSequence(databaseConnection, glmSequence, realYear);
            }

            // the period is in the last year
            // this treatment only applies to situations with different financial years.
            // in a financial year equals to the glm year, the period 0 represents the start balance
            if ((diffPeriod == 0) && (realPeriod == 0))
            {
                // leave it, period 0 represents the start balance
            }
            else if (realPeriod < 1)
            {
                realPeriod      = FNumberAccountingPeriods + realPeriod;
                realYear        = realYear - 1;
                realGlmSequence = myLedgerStatus.GlmSequencesCache.GetOtherYearGlmSequence(databaseConnection, realGlmSequence, realYear);
            }

            // forwarding periods are only allowed in the current year
            if ((realPeriod > FNumberAccountingPeriods) && (realYear != FCurrentFinancialYear))
            {
                realPeriod      = realPeriod - FNumberAccountingPeriods;
                realYear        = realYear + 1;
                realGlmSequence = myLedgerStatus.GlmSequencesCache.GetOtherYearGlmSequence(databaseConnection, realGlmSequence, realYear);
            }

            if (realGlmSequence != null)
            {
                exchangeRateToIntl = myLedgerStatus.ExchangeRateCache.GetCorporateExchangeRate(databaseConnection,
                                                                                               realGlmSequence.ledger_number,
                                                                                               realYear,
                                                                                               realPeriod,
                                                                                               FCurrentFinancialYear);
            }
        }
Beispiel #3
0
        /// the given period should not be changed with diffPeriod
        public TFinancialPeriod(TDataBase databaseConnection, int realPeriod, int year, TParameterList parameters, int column, bool real)
        {
            diffPeriod               = 0;
            FCurrentFinancialYear    = parameters.Get("param_current_financial_year_i", column).ToInt();
            FNumberAccountingPeriods = parameters.Get("param_number_of_accounting_periods_i", column).ToInt();
            FCurrentPeriod           = parameters.Get("param_current_period_i", column).ToInt();
            FNumberForwardingPeriods = parameters.Get("param_number_of_accounting_periods_i", column).ToInt();
            Int32        glmSequenceNumber = parameters.Get("glm_sequence_i", column).ToInt();
            LedgerStatus myLedgerStatus    = new LedgerStatus();

            realGlmSequence = myLedgerStatus.GlmSequencesCache.GetGlmSequence(glmSequenceNumber);
            MainConstructor(databaseConnection,
                            realPeriod,
                            year,
                            diffPeriod,
                            FCurrentFinancialYear,
                            FCurrentPeriod,
                            FNumberAccountingPeriods,
                            FNumberForwardingPeriods,
                            realGlmSequence,
                            myLedgerStatus);
        }
Beispiel #4
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="databaseConnection"></param>
        /// <param name="period"></param>
        /// <param name="year"></param>
        /// <param name="diffPeriod"></param>
        /// <param name="ACurrentFinancialYear"></param>
        /// <param name="ACurrentPeriod"></param>
        /// <param name="ANumberAccountingPeriods"></param>
        /// <param name="ANumberForwardingPeriods"></param>
        /// <param name="glmSequence"></param>
        public TFinancialPeriod(TDataBase databaseConnection,
                                int period,
                                int year,
                                int diffPeriod,
                                System.Int32 ACurrentFinancialYear,
                                System.Int32 ACurrentPeriod,
                                System.Int32 ANumberAccountingPeriods,
                                System.Int32 ANumberForwardingPeriods,
                                TGlmSequence glmSequence)
        {
            LedgerStatus myLedgerStatus = new LedgerStatus();

            MainConstructor(databaseConnection,
                            period,
                            year,
                            diffPeriod,
                            ACurrentFinancialYear,
                            ACurrentPeriod,
                            ANumberAccountingPeriods,
                            ANumberForwardingPeriods,
                            glmSequence,
                            myLedgerStatus);
        }