Пример #1
0
        public bool GetAvgConvention(IBADeprScheduleItem schedule, ref string pVal)
        {
            string   tmp;
            DateTime PlacedInServiceDate;
            double   deprLife;
            bool     LowIncomeHousing;
            bool     PersonalProperty;
            bool     PublicUtility;

            deprLife            = schedule.DeprLife;
            LowIncomeHousing    = schedule.LowIncomeHousingFlag;
            PersonalProperty    = schedule.PersonalPropertyFlag;
            PublicUtility       = schedule.PublicUtilityFlag;
            PlacedInServiceDate = schedule.PlacedInServiceDate;

            if (PersonalProperty || PublicUtility)
            {
                tmp = "HYmb";
            }
            else if (deprLife < 17 || ((int)(deprLife + 0.01) == 18 && PlacedInServiceDate < new DateTime(1984, 6, 23)))
            {
                tmp = "FMmb";
            }
            else
            {
                tmp = "MMmb";
            }

            pVal = tmp;
            return(true);
        }
Пример #2
0
        public bool ComputeITCRecap(IBADeprScheduleItem schedule, IBACalendar calendar, DateTime RunDate,
                                    double ITCAmount, out double baseITCFactor, out double ITCFactor, out double TablePct, out double Recap, out double AddBack)
        {
            double RecapYTD;

            //RDBJ     double pct;

            baseITCFactor = 0;
            ITCFactor     = 0;
            TablePct      = 0;
            Recap         = 0;
            AddBack       = 0;

            if (schedule == null || calendar == null)
            {
                return(false);
            }

            if (schedule.BookType == BkTypeEnum.bpblBookTaxBook && ITCAmount >= 0.0)
            {
                baseITCFactor = schedule.CalculateITCBasisReductionFactor();
                ITCFactor     = baseITCFactor;
                //RDBJ         if ( FAILED(hr = GetBusinessUsePct(m_schedule, m_calendar, RunDate, &pct)) )
                //RDBJ             return hr;
                ITC_Recapture(schedule, calendar, ITCAmount, ITCFactor, out Recap, out RecapYTD, out AddBack, out TablePct);
                Round1Number(ref Recap);
                Round1Number(ref AddBack);
            }
            AddBack = Recap * ITCFactor;
            return(true);
        }
Пример #3
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            bool hr;

            if (schedule == null)
            {
                return(false);
            }

            DBPercent          = schedule.DeprPercent;
            YearElapsed        = 0;
            Life               = schedule.DeprLife;
            SalvageDeduction   = schedule.SalvageDeduction;
            AdjustedCost       = schedule.AdjustedCost;
            PostUsageDeduction = schedule.PostUsageDeduction;



            if (m_pObjSwitchMethod != null)
            {
                if (!(hr = m_pObjSwitchMethod.Initialize(schedule, convention)))
                {
                    return(hr);
                }
            }

            return(true);
        }
Пример #4
0
        public bool isMidQtrAsset(IBADeprScheduleItem schedule)
        {
            short  propType;
            string meth;
            double life;
            short  ddbPct;

            bool pVal = false;

            if (schedule == null)
            {
                return(false);
            }

            propType = schedule.PropertyType;
            meth     = schedule.DeprMethod;
            life     = schedule.DeprLife;
            ddbPct   = schedule.DeprPercent;

            switch (propType)
            {
            case (short)PropType.RealGeneral:
            case (short)PropType.RealListed:
            case (short)PropType.RealConservation:
            case (short)PropType.RealEnergy:
            case (short)PropType.RealFarms:
                if ((meth == "MF" && ddbPct == 100 && life == 5) ||
                    (meth == "AD" && life == 9))
                {
                    return(true);
                }
                if (string.Compare(meth, "MF") == 0)
                {
                    if ((int)(life) == 5 || (int)(life) == 10 || (int)(life) == 15 || (int)(life) == 20)
                    {
                        pVal = true;
                    }
                }
                return(pVal);

            //RDBJ         case LEASE:
            //RDBJ         case NON_CAPITAL:
            case (short)PropType.RealLowIncomeHousing:
            case (short)PropType.Amortizable:
            case (short)PropType.VintageAccount:
                return(pVal);

            default:
                break;
            }

            if (string.Compare(meth, "MF") == 0 ||
                string.Compare(meth, "MT") == 0 ||
                string.Compare(meth, "MAF") == 0)
            {
                pVal = true;
            }
            return(pVal);
        }
Пример #5
0
        public PeriodDeprItemDto CalculateDepreciation(DepreciableBookDto deprBook, DateTime runDate)
        {
            IBAPeriodDeprItem   pdItem           = GetPeriodDeprItem();
            IBADeprScheduleItem deprScheduleItem = transformDepreciableBookDtoToDeprScheduleItem(deprBook);

            IBAPeriodDetailDeprInfo periodDetails = _calcEngine.CalculateDepreciation(deprScheduleItem, ref pdItem, runDate);

            return(transformPeriodDeprItemToDto(periodDetails));
        }
Пример #6
0
        public bool GetAvgConvention(IBADeprScheduleItem schedule, ref string pVal)
        {
            string tmp;

            tmp = schedule.AvgConvention;
            if (tmp == "HY" || tmp == "MM" || tmp == "FM" || tmp == "MQ")
            {
                tmp += "mb";
            }
            pVal = tmp;
            return(true);
        }
Пример #7
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            short    deprPercent;
            long     tablePeriodCount;
            DateTime PlacedInServiceDate;
            double   deprLife;
            double   adjCost;
            double   PostUse;
            double   Salvage;

            if (schedule == null)
            {
                return(false);
            }

            m_Table             = null;
            deprPercent         = schedule.DeprPercent;
            deprLife            = schedule.DeprLife;
            Salvage             = schedule.SalvageDeduction;
            adjCost             = schedule.AdjustedCost;
            PostUse             = schedule.PostUsageDeduction;
            PlacedInServiceDate = schedule.PlacedInServiceDate;
            m_Table             = schedule.GetCustomDepreciationTable;

            DBPercent          = deprPercent;
            YearElapsed        = 0;
            Life               = deprLife;
            SalvageDeduction   = Salvage;
            AdjustedCost       = adjCost;
            PostUsageDeduction = PostUse;

            //
            // Load the appropriate table into the interface
            //
            tablePeriodCount = m_Table.PeriodCount;
            //
            // Now we need to determine the period that the asset was placed in service.
            // This will be used to look up the appropriate information in the table.
            //
            if (tablePeriodCount == 1)
            {
                m_sPlacedInServicePeriod = 1;
            }
            else
            {
                throw new Exception("Invalid ACRS table definition.");
            }
            //
            // All done
            //
            return(true);
        }
Пример #8
0
        private IBADeprScheduleItem transformDepreciableBookDtoToDeprScheduleItem(DepreciableBookDto deprBook)
        {
            IBADeprScheduleItem deprScheduleItem = GetDeprScheduleItem();

            deprScheduleItem.PropertyType        = (short)PropertyTypeCode.translateShortNameToType(deprBook.PropertyType).Type;
            deprScheduleItem.PlacedInServiceDate = deprBook.PlaceInServiceDate;
            deprScheduleItem.AcquisitionValue    = deprBook.AcquiredValue;
            deprScheduleItem.DeprMethod          = deprBook.DepreciateMethod;
            deprScheduleItem.DeprPercent         = deprBook.DepreciatePercent;
            deprScheduleItem.DeprLife            = deprBook.EstimatedLife;

            return(deprScheduleItem);
        }
Пример #9
0
        public List <PeriodDeprItemDto> CalculateMonthlyProjection(DepreciableBookDto deprBook, DateTime startDate, DateTime endDate)
        {
            IBAPeriodDeprItem              pdItem           = GetPeriodDeprItem();
            IBADeprScheduleItem            deprScheduleItem = transformDepreciableBookDtoToDeprScheduleItem(deprBook);
            List <IBAPeriodDetailDeprInfo> objPDItems       = null;

            bool isCalculateProjectionSuccess = _calcEngine.CalculateMonthlyProjection(deprScheduleItem, ref pdItem, startDate, endDate, out objPDItems);

            if (isCalculateProjectionSuccess)
            {
                return(objPDItems.Select(item => transformPeriodDeprItemToDto(item)).ToList());
            }

            return(null);
        }
Пример #10
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            if (schedule == null)
            {
                return(false);
            }

            DBPercent          = schedule.DeprPercent;
            YearElapsed        = 0;
            Life               = schedule.DeprLife;
            SalvageDeduction   = schedule.SalvageDeduction;
            AdjustedCost       = schedule.AdjustedCost;
            PostUsageDeduction = schedule.PostUsageDeduction;

            return(true);
        }
Пример #11
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            IBACalendar   pObjCalendar;
            IBAFiscalYear pObjIFY;
            IBACalcPeriod pObjIPd;
            DateTime      dtFYStartDate;
            DateTime      dtPeriodStart;
            DateTime      dtPeriodEnd;
            DateTime      dtPISDate;

            if (schedule == null)
            {
                return(false);
            }

            pObjCalendar = schedule.Calendar;
            dtPISDate    = schedule.PlacedInServiceDate;
            if (pObjCalendar.GetFiscalYear(dtPISDate, out pObjIFY))
            {
                dtFYStartDate = pObjIFY.YRStartDate;
                if (pObjCalendar.GetPeriod(dtFYStartDate, out pObjIPd))
                {
                    dtPeriodStart = pObjIPd.PeriodStart;
                    dtPeriodEnd   = pObjIPd.PeriodEnd;
                    if (dtPeriodStart <= dtPISDate && dtPISDate <= dtPeriodEnd)
                    {
                        m_PisFys = true;
                    }
                }
            }

            DBPercent          = schedule.DeprPercent;
            YearElapsed        = 0;
            Life               = schedule.DeprLife;
            SalvageDeduction   = schedule.SalvageDeduction;
            AdjustedCost       = schedule.AdjustedCost;
            PostUsageDeduction = schedule.PostUsageDeduction;
            m_VintageAccount   = schedule.VintageAccountFlag;

            return(true);
        }
Пример #12
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            DateTime PlacedInServiceDate;
            bool     LowIncomeHousing;
            bool     PersonalProperty;
            bool     PublicUtility;
            bool     OutsideUS;

            if (schedule == null)
            {
                return(false);
            }

            DBPercent          = schedule.DeprPercent;
            YearElapsed        = 0;
            Life               = schedule.DeprLife;
            SalvageDeduction   = schedule.SalvageDeduction;
            AdjustedCost       = schedule.AdjustedCost;
            PostUsageDeduction = schedule.PostUsageDeduction;

            LowIncomeHousing    = schedule.LowIncomeHousingFlag;
            PersonalProperty    = schedule.PersonalPropertyFlag;
            PublicUtility       = schedule.PublicUtilityFlag;
            OutsideUS           = schedule.UsedOutsideTheUS;
            PlacedInServiceDate = schedule.PlacedInServiceDate;

            m_disposalOverride    = DISPOSALOVERRIDETYPE.disposaloverride_Normal;
            m_bUseFirstYearFactor = false;

            if (LowIncomeHousing)
            {
                // nothing special here
            }
            else if ((PersonalProperty || PublicUtility))
            {
                m_disposalOverride    = DISPOSALOVERRIDETYPE.disposaloverride_NoneInYear;
                m_bUseFirstYearFactor = true;
            }

            return(true);
        }
Пример #13
0
        public short FindSwitchYearNumber(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            DateTime      dtPISDate;
            DateTime      dtDeemedEnd;
            DateTime      dtYrStart;
            DateTime      dtYrEnd;
            short         iFYNum;
            short         iStartYearNum;
            IBAFiscalYear pObjFY;
            bool          bShortYear;
            IBACalendar   Calendar;

            dtPISDate   = schedule.PlacedInServiceDate;
            Calendar    = schedule.Calendar;
            dtDeemedEnd = convention.DeemedEndDate;
            Calendar.GetFiscalYear(dtPISDate, out pObjFY);
            iStartYearNum = pObjFY.FYNum;
            dtYrStart     = pObjFY.YRStartDate;
            dtYrEnd       = pObjFY.YREndDate;

            do
            {
                bShortYear = pObjFY.IsShortYear;
                iFYNum     = pObjFY.FYNum;
                if (bShortYear)
                {
                    return((short)(iFYNum - iStartYearNum + 1));
                }
                else
                {
                    pObjFY = null;
                    Calendar.GetFiscalYear(dtYrEnd.AddDays(+1), out pObjFY);
                    dtYrStart = pObjFY.YRStartDate;
                    dtYrEnd   = pObjFY.YREndDate;
                }
            } while (!bShortYear && dtYrStart <= dtDeemedEnd);

            return(32767);
        }
Пример #14
0
 public bool GetAvgConvention(IBADeprScheduleItem schedule, ref string pVal)
 {
     return(false);
 }
Пример #15
0
        bool ITC_Recapture(IBADeprScheduleItem schedule, IBACalendar calendar, double ITCAmount, double ITCFactor, out double Recap, out double RecapYTD, out double Addbak, out double tablePct)
        {
            double[] table_ptr;
            double[] table1 = new double[] { 100, 100, 100, 0, 0, 0, 0 };
            double[] table2 = new double[] { 100, 100, 100, 50, 50, 0, 0 };
            double[] table3 = new double[] { 100, 100, 100, 66.6, 66.6, 33.3, 33.3 };
            double[] table4 = new double[] { 100, 66, 33, 0, 0, 0, 0 };
            double[] table5 = new double[] { 100, 80, 60, 40, 20, 0, 0 };
            bool     hr;
            string   meth;
            double   estLife;

            Recap    = 0;
            RecapYTD = 0;
            Addbak   = 0;
            tablePct = 0;
            if (schedule == null || calendar == null)
            {
                return(false);
            }

            meth    = schedule.DeprMethod;
            estLife = schedule.DeprLife;

            if (string.Compare(meth, "MF") == 0 ||
                string.Compare(meth, "MT") == 0 ||
                string.Compare(meth, "MAF") == 0 ||
                string.Compare(meth, "MAT") == 0 ||
                string.Compare(meth, "MSF") == 0 ||
                string.Compare(meth, "MST") == 0 ||
                string.Compare(meth, "AT") == 0 ||
                string.Compare(meth, "AST") == 0 ||
                string.Compare(meth, "ASF") == 0 ||
                string.Compare(meth, "~FAS~OC") == 0)
            {
                if (((decimal)(estLife) - 3) == 0)
                {
                    table_ptr = table4;
                }
                else
                {
                    table_ptr = table5;
                }
            }
            else
            {
                if (((decimal)(estLife) - 3) >= 0 && ((decimal)(estLife) - 5) < 0)
                {
                    table_ptr = table1;
                }
                else if (((decimal)(estLife) - 5) >= 0 && ((decimal)(estLife) - 7) < 0)
                {
                    table_ptr = table2;
                }
                else
                {
                    table_ptr = table3;
                }
            }
            /* find when this asset is disposed use for index into recap tables or 0 if out of range */

            long yearCount;

            if (!(YearDisposed(schedule, calendar, true, out yearCount)))
            {
                yearCount = 0;
            }

            if (yearCount > 6)
            {
                tablePct = 0;
            }
            else
            {
                tablePct = table_ptr[yearCount];
            }

            RecapYTD = ITCAmount * (tablePct / 100);
            Recap    = RecapYTD;
            Addbak   = Recap * ITCFactor;
            return(true);
        }
Пример #16
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            BAUSDeprTable obj;
            IBACalendar   Calendar;
            IBAFiscalYear FY;
            string        AvgConvention;
            short         deprPercent;
            long          tablePeriodCount;
            DateTime      PlacedInServiceDate;
            double        deprLife;
            double        adjCost;
            double        PostUse;
            double        Salvage;
            bool          LowIncomeHousing;
            bool          PersonalProperty;
            bool          PublicUtility;
            bool          OutsideUS;

            LIFEIDTABLE[] ATLives = new LIFEIDTABLE[]
            { new LIFEIDTABLE(3, 1), new LIFEIDTABLE(5, 2), new LIFEIDTABLE(10, 3), new LIFEIDTABLE(15, 5), new LIFEIDTABLE(18, 7), new LIFEIDTABLE(19, 8) };

            LIFEIDTABLE[] HY100 = new LIFEIDTABLE[] {
                new LIFEIDTABLE(30, 104), new LIFEIDTABLE(36, 105), new LIFEIDTABLE(42, 106), new LIFEIDTABLE(48, 107), new LIFEIDTABLE(60, 108), new LIFEIDTABLE(72, 109), new LIFEIDTABLE(78, 110),
                new LIFEIDTABLE(84, 111), new LIFEIDTABLE(90, 112), new LIFEIDTABLE(96, 113), new LIFEIDTABLE(102, 114), new LIFEIDTABLE(108, 115), new LIFEIDTABLE(114, 116), new LIFEIDTABLE(120, 117),
                new LIFEIDTABLE(126, 118), new LIFEIDTABLE(132, 119), new LIFEIDTABLE(138, 120), new LIFEIDTABLE(144, 121), new LIFEIDTABLE(150, 122), new LIFEIDTABLE(156, 123), new LIFEIDTABLE(162, 124),
                new LIFEIDTABLE(168, 125), new LIFEIDTABLE(180, 126), new LIFEIDTABLE(192, 127), new LIFEIDTABLE(198, 128), new LIFEIDTABLE(204, 129), new LIFEIDTABLE(216, 130), new LIFEIDTABLE(228, 131),
                new LIFEIDTABLE(240, 132), new LIFEIDTABLE(264, 133), new LIFEIDTABLE(300, 134), new LIFEIDTABLE(318, 135), new LIFEIDTABLE(336, 136), new LIFEIDTABLE(360, 137), new LIFEIDTABLE(420, 138),
                new LIFEIDTABLE(540, 139), new LIFEIDTABLE(600, 140)
            };

            if (schedule == null)
            {
                return(false);
            }

            m_Table             = null;
            deprPercent         = schedule.DeprPercent;
            deprLife            = schedule.DeprLife;
            Salvage             = schedule.SalvageDeduction;
            adjCost             = schedule.AdjustedCost;
            PostUse             = schedule.PostUsageDeduction;
            PlacedInServiceDate = schedule.PlacedInServiceDate;
            AvgConvention       = schedule.AvgConvention;
            LowIncomeHousing    = schedule.LowIncomeHousingFlag;
            PersonalProperty    = schedule.PersonalPropertyFlag;
            PublicUtility       = schedule.PublicUtilityFlag;
            OutsideUS           = schedule.UsedOutsideTheUS;

            DBPercent          = deprPercent;
            YearElapsed        = 0;
            Life               = deprLife;
            SalvageDeduction   = Salvage;
            AdjustedCost       = adjCost;
            PostUsageDeduction = PostUse;

            m_tableId          = 0;
            m_disposalOverride = DISPOSALOVERRIDETYPE.disposaloverride_Normal;

            if (OutsideUS)
            {
                if (LowIncomeHousing)
                {
                    if (PlacedInServiceDate > new DateTime(1985, 8, 5) && PlacedInServiceDate < new DateTime(1987, 1, 1))
                    {
                        m_tableId = 102;
                    }
                }
                if ((int)(deprLife) == 35 && string.Compare(AvgConvention, "MM") == 0 && deprPercent == 150)
                {
                    if (PlacedInServiceDate < new DateTime(1984, 6, 23))
                    {
                        m_tableId = 141;
                    }
                    else if (PlacedInServiceDate > new DateTime(1984, 6, 22) && PlacedInServiceDate < new DateTime(1985, 5, 9))
                    {
                        m_tableId = 103;
                    }
                    else if (PlacedInServiceDate > new DateTime(1985, 8, 5) && PlacedInServiceDate < new DateTime(1987, 1, 1))
                    {
                        m_tableId = 101;
                    }
                }
                else if (string.Compare(AvgConvention, "HY") == 0)
                {
                    m_tableId = FindID((short)((deprLife * 12) + 0.01), HY100, 39);
                }
            }
            else
            {
                if (LowIncomeHousing)
                {
                    if (PlacedInServiceDate < new DateTime(1985, 5, 9))
                    {
                        m_tableId = 9;
                    }
                    else
                    {
                        m_tableId = 10;
                    }
                }
                else if ((int)(deprLife) == 15 && (PersonalProperty || PublicUtility))
                {
                    m_disposalOverride = DISPOSALOVERRIDETYPE.disposaloverride_NoneInYear;
                    m_tableId          = 4;
                }
                else if ((int)(deprLife) == 18 && PlacedInServiceDate < new DateTime(1984, 6, 23))
                {
                    m_tableId = 6;
                }
                else
                {
                    m_tableId = FindID((short)(deprLife), ATLives, 6);
                }
            }

            //
            // We could not find the table number, so return with error.
            //
            if (m_tableId == 0)
            {
                throw new Exception("Unable to determine ACRS Table Number.");
            }

            if ((PersonalProperty || PublicUtility))
            {
                m_disposalOverride = DISPOSALOVERRIDETYPE.disposaloverride_NoneInYear;
            }
            //
            // Load the table interface
            //
            //if ( FAILED(hr = CComObject<CBAUSDeprTable>::CreateInstance(&obj)) ||
            //     FAILED(hr = obj->QueryInterface(IID_IBADeprTable, (void**)&m_Table)) )
            //{
            //    delete obj;
            //    return hr;
            //}
            obj     = new BAUSDeprTable();
            m_Table = (IBADeprTable)obj;

            //
            // Load the appropriate table into the interface
            //
            if (m_tableId < 100)
            {
                obj.LoadTable(m_acrsTable, m_tableId);
                tablePeriodCount = m_Table.PeriodCount;
            }
            else
            {
                obj.LoadTable(m_acrsNonUSTable, m_tableId);
                tablePeriodCount = m_Table.PeriodCount;
            }

            //
            // Now we need to determine the period that the asset was placed in service.
            // This will be used to look up the appropriate information in the table.
            //
            if (tablePeriodCount == 1)
            {
                m_sPlacedInServicePeriod = 1;
            }
            else
            {
                if (tablePeriodCount == 12)
                {
                    DateTime yearEnd;
                    int      monthCount;

                    Calendar = schedule.Calendar;
                    Calendar.GetFiscalYear(PlacedInServiceDate, out FY);
                    yearEnd = FY.YREndDate;

                    if (yearEnd.Day < 8)
                    {
                        // If the day is less than 8, then we need to "TRUE" it up to the proper month
                        yearEnd = yearEnd.AddDays(-yearEnd.Day);
                    }
                    if (PlacedInServiceDate.Year < yearEnd.Year)
                    {
                        monthCount = yearEnd.Month - PlacedInServiceDate.Month + 13;
                    }
                    else
                    {
                        monthCount = yearEnd.Month - PlacedInServiceDate.Month + 1;
                    }
                    if (monthCount > 12)
                    {
                        monthCount = 12;
                    }
                    if (monthCount < 1)
                    {
                        monthCount = 1;
                    }
                    m_sPlacedInServicePeriod = (short)(13 - monthCount);
                }
                else
                {
                    throw new Exception("Invalid ACRS table definition.");
                }
            }
            //
            // All done
            //
            return(true);
        }
Пример #17
0
        public void FlipSign(ref IBADeprScheduleItem m_schedule, ref IBAPeriodDeprItem m_begin)
        {
            decimal cy;
            double  dbl;

            //
            // First process the depr schedule item.
            //
            dbl = m_schedule.SalvageDeduction;
            dbl = -dbl;
            m_schedule.SalvageDeduction = dbl;
            cy = m_schedule.ACEBasis;
            cy = -cy;
            m_schedule.ACEBasis = cy;
            dbl = m_schedule.BasisAdjustment;
            dbl = -dbl;
            m_schedule.BasisAdjustment = dbl;
            dbl = m_schedule.Section179;
            dbl = -dbl;
            m_schedule.Section179 = dbl;
            dbl = m_schedule.Section179A;
            dbl = -dbl;
            m_schedule.Section179A = dbl;
            dbl = m_schedule.ElectricCar;
            dbl = -dbl;
            m_schedule.ElectricCar = dbl;
            dbl = m_schedule.ITCBasisReduction;
            dbl = -dbl;
            m_schedule.ITCBasisReduction = dbl;
            dbl = m_schedule.BonusAmount;
            dbl = -dbl;
            m_schedule.BonusAmount = dbl;
            dbl = m_schedule.AcquisitionValue;
            dbl = -dbl;
            m_schedule.AcquisitionValue = dbl;
            dbl = m_schedule.ReplacementValueBasis;
            dbl = -dbl;
            m_schedule.ReplacementValueBasis = dbl;
            dbl = m_schedule.ITCAmount;
            dbl = -dbl;
            m_schedule.ITCAmount = dbl;
            dbl = m_schedule.ITCReduce;
            dbl = -dbl;
            m_schedule.ITCReduce = dbl;
            //
            // Now process the begin period depr item.
            //
            if (m_begin == null)
            {
                return;
            }

            cy = m_begin.BeginYearAccum;
            cy = -cy;
            m_begin.BeginYearAccum = cy;
            cy = m_begin.BeginYTDExpense;
            cy = -cy;
            m_begin.BeginYTDExpense = cy;
            cy = m_begin.DeprAmount;
            cy = -cy;
            m_begin.DeprAmount = cy;
            cy = m_begin.AdjustAmount;
            cy = -cy;
            m_begin.AdjustAmount = cy;
            cy = m_begin.Section179Change;
            cy = -cy;
            m_begin.Section179Change = cy;
            cy = m_begin.CalcOverride;
            cy = -cy;
            m_begin.CalcOverride = cy;
            cy = m_begin.EndDateBeginYearAccum;
            cy = -cy;
            m_begin.EndDateBeginYearAccum = cy;
            cy = m_begin.EndDateDeferredAccum;
            cy = -cy;
            m_begin.EndDateDeferredAccum = cy;
            cy = m_begin.EndDateYTDDeferred;
            cy = -cy;
            m_begin.EndDateYTDDeferred = cy;
            cy = m_begin.EndDatePersonalUseAccum;
            cy = -cy;
            m_begin.EndDatePersonalUseAccum = cy;
            cy = m_begin.EndDateYTDPersonalUse;
            cy = -cy;
            m_begin.EndDateYTDPersonalUse = cy;
            //cy = m_begin.NetBookValue;
            //cy = -cy;
            //m_begin.NetBookValue = cy;
            //cy = m_begin.CostBasis;
            //cy = -cy;
            //m_begin.CostBasis = cy;
        }
Пример #18
0
 public void CalculateBonus168KAmountTest()
 {
     IBADeprScheduleItem schedule    = GetDeprScheduleItem();
     double calculateBonus168KAmount = _calcEngine.CalculateBonus168KAmount(schedule);
 }
Пример #19
0
        public bool ComputeFullCostBasis(IBADeprScheduleItem schedule, IBACalendar cal, bool AceFlag, bool ForMidQtr, out bool InLastQtr, out double Basis)
        {
            bool          hr;
            double        ITCReductionAmount;
            bool          basisIsReduced;
            double        finalBasis;
            double        costBasis;
            bool          isMidQtr;
            DateTime      PIS = schedule.PlacedInServiceDate;
            IBAFiscalYear FY;
            DateTime      start, end;

            Basis     = 0;
            InLastQtr = false;
            if (schedule == null || cal == null)
            {
                return(false);
            }

            InLastQtr = false;
            Basis     = 0;

            if (!(hr = CalculateBasis(schedule, AceFlag, out ITCReductionAmount, out basisIsReduced, out finalBasis, out costBasis)) ||
                !(hr = cal.GetFiscalYear(PIS, out FY)))
            {
                return(hr);
            }
            isMidQtr = isMidQtrAsset(schedule);
            start    = FY.YRStartDate;
            end      = FY.YREndDate;

            if (ForMidQtr)
            {
                Basis     = costBasis;
                InLastQtr = false;

                if (isMidQtr)
                {
                    long dayCount;
                    long RemDays;
                    long QuarterDays;

                    dayCount    = (long)((end - start).TotalDays);
                    RemDays     = (int)(dayCount - ((dayCount / 4) * 4));
                    QuarterDays = (int)(dayCount / 4);

                    if (RemDays == 2 || RemDays == 3)
                    {
                        QuarterDays++;
                    }
                    if (PIS >= end.AddDays(-QuarterDays + 1))
                    {
                        InLastQtr = true;
                    }
                }
                else
                {
                    Basis = 0.0;
                }
            }
            else
            {
                Basis     = costBasis;
                InLastQtr = false;
            }

            schedule.ITCBasisReduction = ITCReductionAmount;


            return(true);
        }
Пример #20
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            BAUSDeprTable obj;
            IBACalendar   Calendar;
            IBAFiscalYear FY;
            short         deprPercent;
            long          tablePeriodCount;
            DateTime      PlacedInServiceDate;
            double        deprLife;
            double        adjCost;
            double        PostUse;
            double        Salvage;
            bool          LowIncomeHousing;
            bool          PersonalProperty;
            bool          PublicUtility;
            bool          OutsideUS;

            LIFEIDTABLE[] ATSLlih  = new LIFEIDTABLE[] { new LIFEIDTABLE(15, 11), new LIFEIDTABLE(35, 15), new LIFEIDTABLE(45, 16) };
            LIFEIDTABLE[] ATSLPers = new LIFEIDTABLE[] {
                new LIFEIDTABLE(3, 17), new LIFEIDTABLE(5, 18), new LIFEIDTABLE(10, 19), new LIFEIDTABLE(12, 20),
                new LIFEIDTABLE(15, 21), new LIFEIDTABLE(25, 22), new LIFEIDTABLE(35, 23), new LIFEIDTABLE(45, 24)
            };

            if (schedule == null)
            {
                return(false);
            }

            m_Table             = null;
            deprPercent         = schedule.DeprPercent;
            deprLife            = schedule.DeprLife;
            Salvage             = schedule.SalvageDeduction;
            adjCost             = schedule.AdjustedCost;
            PostUse             = schedule.PostUsageDeduction;
            PlacedInServiceDate = schedule.PlacedInServiceDate;
            LowIncomeHousing    = schedule.LowIncomeHousingFlag;
            PersonalProperty    = schedule.PersonalPropertyFlag;
            PublicUtility       = schedule.PublicUtilityFlag;
            OutsideUS           = schedule.UsedOutsideTheUS;

            DBPercent          = deprPercent;
            YearElapsed        = 0;
            Life               = deprLife;
            SalvageDeduction   = Salvage;
            AdjustedCost       = adjCost;
            PostUsageDeduction = PostUse;

            m_tableId             = 0;
            m_disposalOverride    = DISPOSALOVERRIDETYPE.disposaloverride_Normal;
            m_bUseFirstYearFactor = false;

            //RDBJ	if ( OutsideUS )
            //RDBJ	{
            //RDBJ		// Currently we are not supporting outside the US so return an error
            //RDBJ		return Error("Property predominantly outside the US is currently not supported.");
            //RDBJ	}
            //RDBJ	else
            {
                if (LowIncomeHousing)
                {
                    if ((int)(deprLife + 0.01) == 35 && PlacedInServiceDate > new DateTime(1985, 5, 8))
                    {
                        m_tableId = 14;
                    }
                    else
                    {
                        m_tableId = FindID((short)(deprLife + 0.01), ATSLlih, 3);
                    }
                }
                else if ((PersonalProperty || PublicUtility))
                {
                    m_tableId             = FindID((short)(deprLife + 0.01), ATSLPers, 8);
                    m_disposalOverride    = DISPOSALOVERRIDETYPE.disposaloverride_NoneInYear;
                    m_bUseFirstYearFactor = true;
                }
                else if ((int)(deprLife + 0.01) == 18)
                {
                    if (PlacedInServiceDate < new DateTime(1984, 6, 23))
                    {
                        m_tableId = 26;
                    }
                    else
                    {
                        m_tableId = 27;
                    }
                }
                else if ((int)(deprLife + 0.01) == 19)
                {
                    m_tableId = 28;
                }
                else if ((int)(deprLife + 0.01) == 35)
                {
                    if (PlacedInServiceDate > new DateTime(1985, 5, 8))
                    {
                        m_tableId = 29;
                    }
                    else if (PlacedInServiceDate > new DateTime(1984, 6, 22))
                    {
                        m_tableId = 30;
                    }
                    else
                    {
                        m_tableId = 15;
                    }
                }
                else if ((int)(deprLife + 0.01) == 45)
                {
                    if (PlacedInServiceDate > new DateTime(1984, 6, 22))
                    {
                        m_tableId = 31;
                    }
                    else
                    {
                        m_tableId = 16;
                    }
                }
                else if ((int)(deprLife + 0.01) == 15)
                {
                    m_tableId = 25;
                }

                //
                // We could not find the table number, so return with error.
                //
                if (m_tableId == 0)
                {
                    throw new Exception("Unable to determine ACRS Table Number.");
                }
            }

            obj     = new BAUSDeprTable();
            m_Table = (IBADeprTable)obj;
            //
            // Load the appropriate table into the interface
            //
            obj.LoadTable(m_acrsTable, m_tableId);
            tablePeriodCount = m_Table.PeriodCount;
            //
            // Now we need to determine the period that the asset was placed in service.
            // This will be used to look up the appropriate information in the table.
            //
            if (tablePeriodCount == 1)
            {
                m_sPlacedInServicePeriod = 1;
            }
            else
            {
                if (tablePeriodCount == 12)
                {
                    DateTime yearEnd;
                    int      monthCount;

                    Calendar = schedule.Calendar;
                    Calendar.GetFiscalYear(PlacedInServiceDate, out FY);
                    yearEnd = FY.YREndDate;
                    if (yearEnd.Day < 8)
                    {
                        // If the day is less than 8, then we need to "TRUE" it up to the proper month
                        yearEnd = yearEnd.AddDays(-yearEnd.Day);
                    }
                    if (PlacedInServiceDate.Year < yearEnd.Year)
                    {
                        monthCount = yearEnd.Month - PlacedInServiceDate.Month + 13;
                    }
                    else
                    {
                        monthCount = yearEnd.Month - PlacedInServiceDate.Month + 1;
                    }
                    if (monthCount > 12)
                    {
                        monthCount = 12;
                    }
                    m_sPlacedInServicePeriod = (short)(13 - monthCount);
                }
                else
                {
                    throw new Exception("Invalid Alternate ACRS table definition.");
                }
            }
            //
            // All done
            //
            return(true);
        }
Пример #21
0
        public bool CalculateBasis(IBADeprScheduleItem schedule, bool AceFlag, out double ITCReductionAmount, out bool basisIsReduced, out double finalBasis, out double pVal)
        {
            double     cyITCAmount;
            double     bonus;
            bool       bonusFlag;
            bool       hr;
            string     meth;
            short      propType;
            double     adjValue;
            double     salvage;
            BkTypeEnum bookType;
            double     s179;

            ITCReductionAmount = 0;
            pVal           = 0;
            basisIsReduced = false;
            finalBasis     = 0;

            if (schedule == null)
            {
                return(false);
            }

            bonusFlag = schedule.BonusFlag;
            bonus     = schedule.BonusAmount;
            meth      = schedule.DeprMethod;
            propType  = (short)schedule.PropertyType;
            adjValue  = schedule.AdjustedCost;
            salvage   = schedule.SalvageDeduction;
            bookType  = schedule.BookType;
            s179      = schedule.Section179;

            if (string.Compare(meth, "~FAS~OC") == 0)
            {
                bonusFlag = false;
                bonus     = 0;
            }
            ITCReductionAmount = 0;
            cyITCAmount        = schedule.CalculateITCBasisReductionAmount(AceFlag);
            ITCReductionAmount = (double)(cyITCAmount);

            /* COST BASE = (ACQ VAL * BUS % USE)  -  SECT 179  - ITC RED AMT */
            /* ADJUST THE COSTBASE VALUE FOR METHODS S,H,Y,X AND CUSTOM CODES. KAZEMI */

            if (string.Compare(meth, "SL") == 0 ||
                string.Compare(meth, "SYD") == 0 ||
                string.Compare(meth, "RV") == 0)
            {
                if (propType == (short)PropType.VintageAccount)
                {
                    pVal = adjValue - ITCReductionAmount - bonus;
                }
                else
                {
                    pVal = adjValue - ITCReductionAmount - salvage - bonus - s179; //added s179 for 30% handling
                }
                /* reset for switch for ace */
                //if(intarray[DEPRMETH] == RV_FULLMONTH&&realarray[SECTN179]&&intarray[BOOKNUM]==ACEBOOKNUM)
                //  realarray[COSTBASE] = (realarray[ACQVALUE] * (intarray[PRCNTBUS]/100.0)) - realarray[SECTN179] -  realarray[ITCRAMT];
                //  AJB - 05/20/91
                if (string.Compare(meth, "RV") == 0 && AceFlag && bookType == BkTypeEnum.bpblBookACEBook)
                {
                    pVal = adjValue - s179 - ITCReductionAmount - bonus;
                }
            }
            else
            {
                if (IsCustomMethod(meth))
                {
                    pVal = adjValue - ITCReductionAmount - salvage - s179 - bonus;
                }
                else
                {
                    pVal = adjValue - s179 - ITCReductionAmount - bonus;
                }
            }

            /* DETERMINE IF THERE HAS BEEN A COST BASIS REDUCTION  */
            /* ACQ VALUE <> COST BASIS                             */

            basisIsReduced = false;

            if (pVal != adjValue - bonus)
            {
                basisIsReduced = true;
            }

            finalBasis = pVal;

            if (bookType == BkTypeEnum.bpblBookEandPBook)
            {
                finalBasis += s179;
            }
            return(true);
        }
Пример #22
0
 public bool GetAvgConvention(IBADeprScheduleItem schedule, ref string pVal)
 {
     pVal = "FM";
     return(true);
 }
Пример #23
0
 bool YearDisposed(IBADeprScheduleItem deprScheduleItem, IBACalendar calendar, bool UseITCRules, out long pVal)
 {
     pVal = 0;
     return(true);
 }
Пример #24
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            BAUSDeprTable obj;
            IBACalendar   Calendar;
            IBAFiscalYear FY;
            string        AvgConvention;
            short         deprPercent;
            long          tablePeriodCount;
            DateTime      PlacedInServiceDate;
            double        deprLife;
            double        adjCost;
            double        PostUse;
            double        Salvage;

            // life id pairs are a life in years (year only) followed by the table id.
            LIFEIDTABLE[] MM100 = new LIFEIDTABLE[] { new LIFEIDTABLE(27, 1), new LIFEIDTABLE(31, 2), new LIFEIDTABLE(39, 3), new LIFEIDTABLE(40, 179) };
            LIFEIDTABLE[] HY100 = new LIFEIDTABLE[] {
                new LIFEIDTABLE(30, 101), new LIFEIDTABLE(36, 102), new LIFEIDTABLE(42, 103), new LIFEIDTABLE(48, 104), new LIFEIDTABLE(60, 105), new LIFEIDTABLE(72, 106), new LIFEIDTABLE(78, 107),
                new LIFEIDTABLE(84, 108), new LIFEIDTABLE(90, 109), new LIFEIDTABLE(96, 110), new LIFEIDTABLE(102, 111), new LIFEIDTABLE(108, 112), new LIFEIDTABLE(114, 113), new LIFEIDTABLE(120, 114),
                new LIFEIDTABLE(126, 115), new LIFEIDTABLE(132, 116), new LIFEIDTABLE(138, 117), new LIFEIDTABLE(144, 118), new LIFEIDTABLE(150, 119), new LIFEIDTABLE(156, 120), new LIFEIDTABLE(162, 121),
                new LIFEIDTABLE(168, 122), new LIFEIDTABLE(180, 123), new LIFEIDTABLE(192, 124), new LIFEIDTABLE(198, 125), new LIFEIDTABLE(204, 126), new LIFEIDTABLE(216, 127), new LIFEIDTABLE(228, 128),
                new LIFEIDTABLE(240, 129), new LIFEIDTABLE(264, 130), new LIFEIDTABLE(288, 131), new LIFEIDTABLE(300, 132), new LIFEIDTABLE(318, 133), new LIFEIDTABLE(336, 134), new LIFEIDTABLE(360, 135),
                new LIFEIDTABLE(420, 136), new LIFEIDTABLE(480, 137), new LIFEIDTABLE(540, 138), new LIFEIDTABLE(600, 139)
            };

            LIFEIDTABLE[] MQ100 = new LIFEIDTABLE[] {
                new LIFEIDTABLE(30, 140), new LIFEIDTABLE(36, 141), new LIFEIDTABLE(42, 142), new LIFEIDTABLE(48, 143), new LIFEIDTABLE(60, 144), new LIFEIDTABLE(72, 145), new LIFEIDTABLE(78, 146),
                new LIFEIDTABLE(84, 147), new LIFEIDTABLE(90, 148), new LIFEIDTABLE(96, 149), new LIFEIDTABLE(102, 150), new LIFEIDTABLE(108, 151), new LIFEIDTABLE(114, 152), new LIFEIDTABLE(120, 153),
                new LIFEIDTABLE(126, 154), new LIFEIDTABLE(132, 155), new LIFEIDTABLE(138, 156), new LIFEIDTABLE(144, 157), new LIFEIDTABLE(150, 158), new LIFEIDTABLE(156, 159), new LIFEIDTABLE(162, 160),
                new LIFEIDTABLE(168, 161), new LIFEIDTABLE(180, 162), new LIFEIDTABLE(192, 163), new LIFEIDTABLE(198, 164), new LIFEIDTABLE(204, 165), new LIFEIDTABLE(216, 166), new LIFEIDTABLE(228, 167),
                new LIFEIDTABLE(240, 168), new LIFEIDTABLE(264, 169), new LIFEIDTABLE(288, 170), new LIFEIDTABLE(300, 171), new LIFEIDTABLE(318, 172), new LIFEIDTABLE(336, 173), new LIFEIDTABLE(360, 174),
                new LIFEIDTABLE(420, 175), new LIFEIDTABLE(480, 176), new LIFEIDTABLE(540, 177), new LIFEIDTABLE(600, 178)
            };

            if (schedule == null)
            {
                return(false);
            }

            m_Table             = null;
            deprPercent         = schedule.DeprPercent;
            deprLife            = schedule.DeprLife;
            Salvage             = schedule.SalvageDeduction;
            adjCost             = schedule.AdjustedCost;
            PostUse             = schedule.PostUsageDeduction;
            PlacedInServiceDate = schedule.PlacedInServiceDate;
            AvgConvention       = schedule.AvgConvention;

            DBPercent          = deprPercent;
            YearElapsed        = 0;
            Life               = deprLife;
            SalvageDeduction   = Salvage;
            AdjustedCost       = adjCost;
            PostUsageDeduction = PostUse;

            m_tableId = 0;
            int    len = AvgConvention.Length;
            string tmp = AvgConvention;

            if (tmp == AvgConvention)
            {
                m_tableId = FindID((short)(deprLife + 0.01), MM100, 4);
            }

            if (string.Compare(AvgConvention, "MM") == 0 || string.Compare(AvgConvention, "MMM") == 0)
            {
                m_tableId = FindID((short)(deprLife + 0.01), MM100, 4);
            }
            else if (string.Compare(AvgConvention, "HY") == 0)
            {
                m_tableId = FindID((short)((deprLife * 12) + 0.01), HY100, 39);
            }
            else if (string.Compare(AvgConvention, "MQ") == 0)
            {
                m_tableId = FindID((short)((deprLife * 12) + 0.01), MQ100, 39);
            }

            if (m_tableId == 0)
            {
                throw new Exception("Invalid table information");
            }
            //
            // Load the table interface
            //
            obj     = new BAUSDeprTable();
            m_Table = (IBADeprTable)obj;

            //
            // Load the appropriate table into the interface
            //
            obj.LoadTable(m_altMacrsTable, m_tableId);
            tablePeriodCount = m_Table.PeriodCount;

            //
            // Now we need to determine the period that the asset was placed in service.
            // This will be used to look up the appropriate information in the table.
            //
            if (tablePeriodCount == 1)
            {
                m_sPlacedInServicePeriod = 1;
            }
            else
            {
                if (tablePeriodCount == 4)
                {
                    m_sPlacedInServicePeriod = convention.DetermineTablePeriod;
                }
                else if (tablePeriodCount == 12 && deprPercent == 100 &&
                         (string.Compare(AvgConvention, "MM") == 0 || string.Compare(AvgConvention, "MMM") == 0))
                {
                    DateTime yearEnd;
                    int      monthCount;

                    Calendar = schedule.Calendar;
                    Calendar.GetFiscalYear(PlacedInServiceDate, out FY);
                    yearEnd = FY.YREndDate;

                    if (yearEnd.Day < 8)
                    {
                        // If the day is less than 8, then we need to "TRUE" it up to the proper month
                        yearEnd = yearEnd.AddDays(-yearEnd.Day);
                    }
                    if (PlacedInServiceDate.Year < yearEnd.Year)
                    {
                        monthCount = yearEnd.Month - PlacedInServiceDate.Month + 13;
                    }
                    else
                    {
                        monthCount = yearEnd.Month - PlacedInServiceDate.Month + 1;
                    }
                    if (monthCount > 12)
                    {
                        monthCount = 12;
                    }
                    m_sPlacedInServicePeriod = (short)(13 - monthCount);
                }
                else
                {
                    throw new Exception("Invalid MACRS table definition.");
                }
            }
            m_iSwitchYearNum = FindSwitchYearNumber(schedule, convention);
            //
            // All done
            //
            if (m_pObjSwitchMethod != null)
            {
                m_pObjSwitchMethod.Initialize(schedule, convention);
                m_pObjSwitchMethod.SalvageDeduction = 0;
            }

            return(true);
        }
Пример #25
0
        public bool Initialize(IBADeprScheduleItem schedule, IBAAvgConvention convention)
        {
            bool          hr;
            BAUSDeprTable obj;
            IBACalendar   Calendar;
            IBAFiscalYear FY;
            string        AvgConvention;
            short         deprPercent;
            long          tablePeriodCount;
            DateTime      PlacedInServiceDate;
            double        deprLife;
            double        adjCost;
            double        PostUse;
            double        Salvage;

            // life id pairs are a life in years (year only) followed by the table id.
            LIFEIDTABLE[] HY200 = new LIFEIDTABLE[]
            { new LIFEIDTABLE(3, 1), new LIFEIDTABLE(5, 2), new LIFEIDTABLE(7, 3), new LIFEIDTABLE(10, 4), new LIFEIDTABLE(15, 101), new LIFEIDTABLE(20, 102) };
            LIFEIDTABLE[] MQ200 = new LIFEIDTABLE[]
            { new LIFEIDTABLE(3, 5), new LIFEIDTABLE(5, 8), new LIFEIDTABLE(7, 11), new LIFEIDTABLE(10, 13), new LIFEIDTABLE(15, 103), new LIFEIDTABLE(16, 104) };
            LIFEIDTABLE[] MM100 = new LIFEIDTABLE[]
            { new LIFEIDTABLE(27, 29), new LIFEIDTABLE(31, 30), new LIFEIDTABLE(39, 31) };
            LIFEIDTABLE[] HY150 = new LIFEIDTABLE[] {
                new LIFEIDTABLE(30, 105), new LIFEIDTABLE(36, 19), new LIFEIDTABLE(42, 106), new LIFEIDTABLE(48, 20), new LIFEIDTABLE(60, 21), new LIFEIDTABLE(72, 22), new LIFEIDTABLE(78, 107),
                new LIFEIDTABLE(84, 23), new LIFEIDTABLE(90, 108), new LIFEIDTABLE(96, 109), new LIFEIDTABLE(102, 110), new LIFEIDTABLE(108, 111), new LIFEIDTABLE(114, 112), new LIFEIDTABLE(120, 24),
                new LIFEIDTABLE(126, 113), new LIFEIDTABLE(132, 114), new LIFEIDTABLE(138, 115), new LIFEIDTABLE(144, 25), new LIFEIDTABLE(150, 116), new LIFEIDTABLE(156, 117), new LIFEIDTABLE(162, 118),
                new LIFEIDTABLE(168, 119), new LIFEIDTABLE(180, 26), new LIFEIDTABLE(192, 120), new LIFEIDTABLE(198, 121), new LIFEIDTABLE(204, 122), new LIFEIDTABLE(216, 123), new LIFEIDTABLE(228, 124),
                new LIFEIDTABLE(240, 27), new LIFEIDTABLE(264, 125), new LIFEIDTABLE(288, 126), new LIFEIDTABLE(300, 127), new LIFEIDTABLE(318, 128), new LIFEIDTABLE(336, 129), new LIFEIDTABLE(360, 130),
                new LIFEIDTABLE(420, 131), new LIFEIDTABLE(480, 28), new LIFEIDTABLE(540, 132), new LIFEIDTABLE(600, 133)
            };

            LIFEIDTABLE[] MQ150 = new LIFEIDTABLE[] {
                new LIFEIDTABLE(30, 134), new LIFEIDTABLE(36, 6), new LIFEIDTABLE(42, 135), new LIFEIDTABLE(48, 7), new LIFEIDTABLE(60, 9), new LIFEIDTABLE(72, 10), new LIFEIDTABLE(78, 136),
                new LIFEIDTABLE(84, 12), new LIFEIDTABLE(90, 137), new LIFEIDTABLE(96, 138), new LIFEIDTABLE(102, 139), new LIFEIDTABLE(108, 140), new LIFEIDTABLE(114, 141), new LIFEIDTABLE(120, 14),
                new LIFEIDTABLE(126, 142), new LIFEIDTABLE(132, 143), new LIFEIDTABLE(138, 144), new LIFEIDTABLE(144, 15), new LIFEIDTABLE(150, 145), new LIFEIDTABLE(156, 146), new LIFEIDTABLE(162, 147),
                new LIFEIDTABLE(168, 148), new LIFEIDTABLE(180, 16), new LIFEIDTABLE(192, 149), new LIFEIDTABLE(198, 150), new LIFEIDTABLE(204, 151), new LIFEIDTABLE(216, 152), new LIFEIDTABLE(228, 153),
                new LIFEIDTABLE(240, 17), new LIFEIDTABLE(264, 154), new LIFEIDTABLE(288, 155), new LIFEIDTABLE(300, 156), new LIFEIDTABLE(318, 157), new LIFEIDTABLE(336, 158), new LIFEIDTABLE(360, 159),
                new LIFEIDTABLE(420, 160), new LIFEIDTABLE(480, 18), new LIFEIDTABLE(540, 161), new LIFEIDTABLE(600, 162)
            };

            if (schedule == null)
            {
                return(false);
            }

            m_Table             = null;
            deprPercent         = schedule.DeprPercent;
            deprLife            = schedule.DeprLife;
            Salvage             = schedule.SalvageDeduction;
            adjCost             = schedule.AdjustedCost;
            PostUse             = schedule.PostUsageDeduction;
            PlacedInServiceDate = schedule.PlacedInServiceDate;
            AvgConvention       = schedule.AvgConvention;

            DBPercent          = deprPercent;
            YearElapsed        = 0;
            Life               = deprLife;
            SalvageDeduction   = Salvage;
            AdjustedCost       = adjCost;
            PostUsageDeduction = PostUse;

            //
            // Now we need to determine the ACRS table number and load the table into the system.
            //
            m_tableId = 0;

            if (deprPercent == 200)
            {
                if (string.Compare(AvgConvention, "MQ") != 0)    // is not mid quarter
                {
                    m_tableId = FindID((short)(deprLife + 0.01), HY200, 6);
                }
                else
                {
                    m_tableId = FindID((short)(deprLife + 0.01), MQ200, 6);
                }
            }
            else if (deprPercent == 150)
            {
                if (string.Compare(AvgConvention, "MQ") != 0)    // is not mid quarter
                {
                    m_tableId = FindID((short)(deprLife * 12 + 0.01), HY150, 39);
                }
                else
                {
                    m_tableId = FindID((short)(deprLife * 12 + 0.01), MQ150, 39);
                }
            }
            else if (deprPercent == 100)
            {
                if (string.Compare(AvgConvention, "MM") == 0 || string.Compare(AvgConvention, "MMM") == 0)
                {
                    m_tableId = FindID((short)(deprLife + 0.01), MM100, 3);
                }
            }

            if (m_tableId == 0)
            {
                return(true);
            }
            //
            // Load the table interface
            //
            //if ( FAILED(hr = CComObject<CBAUSDeprTable>::CreateInstance(&obj)) ||
            //     FAILED(hr = obj->QueryInterface(IID_IBADeprTable, (void**)&m_Table)) )
            //{
            //    delete obj;
            //    return hr;
            //}
            obj     = new BAUSDeprTable();
            m_Table = (IBADeprTable)obj;
            //
            // Load the appropriate table into the interface
            //
            if (m_tableId < 100)
            {
                obj.LoadTable(m_macrsTable, m_tableId);
                tablePeriodCount = m_Table.PeriodCount;
            }
            else
            {
                obj.LoadTable(m_apolloMacrsTable, m_tableId);
                tablePeriodCount = m_Table.PeriodCount;
            }
            //
            // Now we need to determine the period that the asset was placed in service.
            // This will be used to look up the appropriate information in the table.
            //
            if (tablePeriodCount == 1)
            {
                m_sPlacedInServicePeriod = 1;
            }
            else
            {
                if (tablePeriodCount == 4)
                {
                    m_sPlacedInServicePeriod = convention.DetermineTablePeriod;
                }
                else if (tablePeriodCount == 12 && deprPercent == 100 &&
                         (string.Compare(AvgConvention, "MM") == 0 || string.Compare(AvgConvention, "MMM") == 0))
                {
                    DateTime yearEnd;
                    int      monthCount;

                    Calendar = schedule.Calendar;
                    Calendar.GetFiscalYear(PlacedInServiceDate, out FY);
                    yearEnd = FY.YREndDate;

                    if (yearEnd.Day < 8)
                    {
                        // If the day is less than 8, then we need to "TRUE" it up to the proper month
                        yearEnd = yearEnd.AddDays(-yearEnd.Day);
                        if (PlacedInServiceDate > yearEnd)                              // KENT
                        {
                            PlacedInServiceDate = yearEnd;
                        }
                    }
                    if (PlacedInServiceDate.Year < yearEnd.Year)
                    {
                        monthCount = yearEnd.Month - PlacedInServiceDate.Month + 13;
                    }
                    else
                    {
                        monthCount = yearEnd.Month - PlacedInServiceDate.Month + 1;
                    }
                    if (monthCount > 12)
                    {
                        monthCount = 12;
                    }
                    m_sPlacedInServicePeriod = (short)(13 - monthCount);
                }
                else
                {
                    throw new Exception("Invalid MACRS table definition.");
                }
            }
            m_iSwitchYearNum = FindSwitchYearNumber(schedule, convention);

            if (m_pObjSwitchMethod != null)
            {
                m_pObjSwitchMethod.Initialize(schedule, convention);
                m_pObjSwitchMethod.SalvageDeduction = 0;
            }

            //
            // All done
            //
            return(true);
        }