Beispiel #1
0
        public bool ProcessACEForYear(short iFYNum, IBADeprMethod pObjDeprMethod, double dActualPriorAccum, CalcEngine calcEngine, IBAAvgConvention pObjAvgConvetion, double dYearElapsed, out IBADeprMethod outMethod)
        {
            bool hr;

            outMethod = null;

            if (m_pObjSchedule == null || m_pObjCalendar == null)
            {
                throw new Exception("Error in ProcessACEForYear.");
            }

            if (outMethod != null)
            {
                outMethod = null;
            }
            if (pObjDeprMethod == null || calcEngine == null || pObjAvgConvetion == null)
            {
                throw new Exception("Error in ProcessACEForYear.");
            }

            outMethod = pObjDeprMethod;

            if (m_bUseACEHandling && iFYNum == m_iAceTransitionYear + 1)
            {
                double  ACEBasis;
                double  ACELife;
                double  basis;
                double  yearElapsed = 0;
                double  ADSLife;
                string  deprmethod;
                decimal curTmp;
                short   yearNum = 0;

                basis      = pObjDeprMethod.Basis;
                ACELife    = pObjDeprMethod.Life;
                deprmethod = m_pObjSchedule.DeprMethod;
                ADSLife    = m_pObjSchedule.ADSLife;

                ACEBasis = basis - dActualPriorAccum;
                if (String.Compare(deprmethod, "MT") == 0 ||
                    String.Compare(deprmethod, "MF") == 0 ||
                    String.Compare(deprmethod, "MAT") == 0 ||
                    String.Compare(deprmethod, "MAF") == 0 ||
                    String.Compare(deprmethod, "MST") == 0 ||
                    String.Compare(deprmethod, "MSF") == 0 ||
                    String.Compare(deprmethod, "AT") == 0 ||
                    String.Compare(deprmethod, "AST") == 0 ||
                    String.Compare(deprmethod, "ASF") == 0)
                {
                    if (m_pObjACEInfo == null)
                    {
                        ACELife  = m_curACELife;
                        ACEBasis = m_curACEBasis;
                    }
                    else
                    {
                        if (m_PISDate >= m_dtACEStart)
                        {
                            ACEBasis = basis;
                        }
                        else
                        {
                            ACEBasis = basis - dActualPriorAccum;
                            ACELife  = ADSLife - yearElapsed;
                        }
                        CurrencyHelper.DoubleToCurrency(ACEBasis, out curTmp);
                        m_pObjACEInfo.ACELife  = ACELife;
                        m_pObjACEInfo.ACEBasis = curTmp;
                    }
                    //
                    // Now we need to create the RV method and initialize it.
                    //
                    outMethod    = null;
                    dYearElapsed = yearElapsed;
                    if (!(hr = calcEngine.CreateDeprMethod("RV", false, out outMethod)) ||
                        !(hr = calcEngine.InitializeDeprMethod(m_pObjSchedule, pObjAvgConvetion, outMethod)))
                    {
                        return(hr);
                    }
                    outMethod.Life             = ACELife + m_dACETransitionYearElapsed;
                    outMethod.SalvageDeduction = 0;
                    outMethod.YearElapsed      = dYearElapsed;
                    outMethod.YearNum          = yearNum;
                    outMethod.PriorAccum       = dActualPriorAccum;
                }
                else
                {
                }
            }

            return(true);
        }