Beispiel #1
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);
        }
        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);
        }
Beispiel #3
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);
        }