public bool Clone(out IBACalendar pVal) { BAFASCalendar obj = new BAFASCalendar(); IBACycleObject cycleObj = new BAFASCycleObject(); IBAPersistXML persist = new XMLPersistance(); long cycleCount; int posi; pVal = new BAFASCalendar(); if (pVal == null) { return(false); } cycleCount = m_FYList.Count; for (posi = 0; posi < cycleCount; posi++) { cycleObj = m_FYList[posi]; IBACalendarManager pDesCalMan = (IBACalendarManager)pVal; pDesCalMan.AddCycleEntry(cycleObj.EffectiveDate, cycleObj.CycleType, cycleObj.FYEndMonth, cycleObj.DateOfWeek, cycleObj.YearEndElect, cycleObj.PDCounting); } return(true); }
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); }
public bool Initialize(IBACalendar calendar, DateTime PlacedInService, double Life) { int iYear; int iMonth; int iDay; IBAFiscalYear FY; bool hr; short iFYNum; DateTime dtStartDate; if (calendar == null || PlacedInService <= DateTime.MinValue || Life <= 0) { return(false); } m_pObjCalendar = null; m_pObjCalendar = calendar; m_dtPISDate = PlacedInService; m_dblLife = Life; if (m_pMonthlyYear == null) { m_pMonthlyYear = new MonthlyYear(); } if (!(hr = m_pObjCalendar.GetFiscalYear(m_dtPISDate, out FY))) { return(hr); } iFYNum = FY.FYNum; dtStartDate = FY.YRStartDate; m_pMonthlyYear.FiscalYearInfo = FY; m_pMonthlyYear.DeemedFYDates(); //calc the start date m_dtStartDate = m_pMonthlyYear.GetFullMonthDate(m_dtPISDate); //calc the end date iYear = m_dtStartDate.Year + (int)(Life); iMonth = m_dtStartDate.Month + (int)((Life - (int)(Life)) * 12); iDay = m_dtStartDate.Day; // adjust for special start of business case where deemed start is before start of bus. if (iFYNum == 1 && m_dtStartDate < dtStartDate) { m_dtStartDate = dtStartDate; } //deemed end date if (iMonth > 12) { iMonth -= 12; iYear++; } m_dtEndDate = new DateTime(iYear, iMonth, iDay).AddDays(-1); return(true); }
public bool Initialize(IBACalendar calendar, DateTime PlacedInService, double Life) { int iYear; int iMonth; int iDay; IBACalcPeriod pObjPeriod; IBAFiscalYear FY; bool hr; DateTime dtTmpEndDate; DateTime dtTmpStartDate; if (calendar == null || PlacedInService <= DateTime.MinValue || Life <= 0) { return(false); } m_pObjCalendar = null; m_pObjCalendar = calendar; m_dtPISDate = PlacedInService; m_dblLife = Life; if (!(hr = m_pObjCalendar.GetFiscalYear(m_dtPISDate, out FY)) || !(hr = FY.GetPeriod(m_dtPISDate, out pObjPeriod))) { return(hr); } dtTmpStartDate = FY.YRStartDate; dtTmpEndDate = FY.YREndDate; //calc the deemed start date m_iPdNum = pObjPeriod.PeriodNum; //deemed start date m_dtStartDate = pObjPeriod.PeriodStart; //used the deemed start date to calc deemed end date iYear = m_dtStartDate.Year + (int)(Life); iMonth = m_dtStartDate.Month + (int)((Life - (int)(Life)) * 12); iDay = m_dtStartDate.Day; //deemed end date if (iMonth > 12) { iMonth -= 12; iYear++; } m_dtEndDate = new DateTime(iYear, iMonth, iDay).AddDays(-10); pObjPeriod = null; FY = null; if (!(hr = m_pObjCalendar.GetFiscalYear(m_dtEndDate, out FY)) || !(hr = FY.GetPeriod(m_dtEndDate, out pObjPeriod))) { return(hr); } m_dtEndDate = pObjPeriod.PeriodEnd; return(true); }
public bool Initialize(IBACalendar calendar, DateTime PlacedInService, double Life) { int iYear; int iMonth; int iDay; DateTime dtSDate; DateTime dtEDate; IBAFiscalYear FY; bool hr; if (calendar == null || PlacedInService <= DateTime.MinValue || Life < 1) { return(false); } m_pObjCalendar = null; m_pObjCalendar = calendar; m_dtPISDate = PlacedInService; m_dblLife = Life; m_pObjCalendar.GetFiscalYear(m_dtPISDate, out FY); dtSDate = FY.YRStartDate; dtEDate = FY.YREndDate; if (m_pMonthlyYear == null) { m_pMonthlyYear = new MonthlyYear(); } m_pMonthlyYear.FiscalYearInfo = FY; m_pMonthlyYear.DeemedFYDates(); //calc the deemed start date FY.GetMidYearDate(out m_dtStartDate); //calc the deemed end date iYear = m_dtStartDate.Year + ((int)(m_dblLife)); iMonth = m_dtStartDate.Month + Convert.ToInt32((m_dblLife - ((int)(m_dblLife))) * 12); iDay = m_dtStartDate.Day; //deemed end date if (iMonth > 12) { iMonth -= 12; iYear++; } m_dtEndDate = new DateTime(iYear, iMonth, iDay).AddDays(-1); // m_dtStartDate = m_dtPISDate; return(true); }
public bool Initialize(IBACalendar calendar, DateTime PlacedInService, double Life) { int iYear; int iMonth; int iDay; IBAFiscalYear FY; bool hr; DateTime dtTmpEndDate; DateTime dtTmpStartDate; if (calendar == null || PlacedInService <= DateTime.MinValue || Life <= 0) { return(false); } m_pObjCalendar = null; m_pObjCalendar = calendar; m_dtPISDate = PlacedInService; m_dblLife = Life; if (!(hr = m_pObjCalendar.GetFiscalYear(m_dtPISDate, out FY))) { return(hr); } dtTmpStartDate = FY.YRStartDate; dtTmpEndDate = FY.YREndDate; //deemed start date if (!(hr = FY.GetMidPeriodDate(m_dtPISDate, out m_dtStartDate))) { return(hr); } //use the deemed start date to calculate the deemed end date iYear = m_dtStartDate.Year + (int)(m_dblLife); iMonth = m_dtStartDate.Month + (int)((m_dblLife - (int)(m_dblLife)) * 12); iDay = m_dtStartDate.Day; //deemed end date if (iMonth > 12) { iMonth -= 12; iYear++; } m_dtEndDate = new DateTime(iYear, iMonth, iDay).AddDays(-1); // m_dtStartDate = m_dtPISDate; return(true); }
public bool Initialize(IBACalendar calendar, DateTime PlacedInService, double Life) { int iYear; int iMonth; int iDay; DateTime dtTmpEndDate; DateTime dtTmpStartDate; DateTime dtMidDate; IBAFiscalYear FY; if (calendar == null || PlacedInService <= DateTime.MinValue || Life < 1) { return(false); } m_pObjCalendar = null; m_pObjCalendar = calendar; m_dtPISDate = PlacedInService; m_dblLife = Life; m_pObjCalendar.GetFiscalYear(m_dtPISDate, out FY); dtTmpStartDate = FY.YRStartDate; dtTmpEndDate = FY.YREndDate; FY.GetMidYearDate(out dtMidDate); //if in the first half get full year else move to next year if (m_dtPISDate < dtMidDate) { m_dtStartDate = dtTmpStartDate; m_bFirstHalf = true; } else { m_dtStartDate = dtTmpEndDate.AddDays(+1); m_bFirstHalf = false; } //calc the deemed end date iYear = m_dtStartDate.Year + ((int)(m_dblLife)); iMonth = m_dtStartDate.Month + ((int)((m_dblLife - ((int)(m_dblLife))) * 12)); iDay = m_dtStartDate.Day; if (iMonth > 12) { iMonth -= 12; iYear++; } m_dtEndDate = new DateTime(iYear, iMonth, iDay).AddDays(-1); return(true); }
public bool Initialize(IBACalendar calendar, DateTime PlacedInService, double Life) { int iYear; int iMonth; int iDay; IBAFiscalYear pObjIFY; bool hr; if (calendar == null || PlacedInService <= DateTime.MinValue || Life <= 1) { return(false); } m_pObjCalendar = null; m_pObjCalendar = calendar; m_dtPISDate = PlacedInService; m_dblLife = Life; if (m_pMonthlyYear == null) { m_pMonthlyYear = new MonthlyYear(); } m_pObjCalendar.GetFiscalYear(m_dtPISDate, out pObjIFY); m_pMonthlyYear.FiscalYearInfo = (pObjIFY); m_pMonthlyYear.DeemedFYDates(); //calc the start date m_dtStartDate = m_pMonthlyYear.GetMidQuarterDate(m_dtPISDate); m_qtrNumber = m_pMonthlyYear.GetMidQuarterNumber(m_dtPISDate); //calc the deemed end date iYear = (m_dtStartDate.Year) + (int)(m_dblLife); iMonth = (m_dtStartDate.Month) + (int)((m_dblLife - (int)(m_dblLife)) * 12); iDay = (m_dtStartDate.Day); //deemed end date if (iMonth > 12) { iMonth -= 12; iYear++; } m_dtEndDate = new DateTime(iYear, iMonth, iDay).AddDays(-1); return(true); }
bool YearDisposed(IBADeprScheduleItem deprScheduleItem, IBACalendar calendar, bool UseITCRules, out long pVal) { pVal = 0; return(true); }
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); }
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); }
public bool Initialize(IBACalendar calendar, DateTime PlacedInService, double Life) { int iYear = 0; int iMonth = 0; int iDay = 0; DateTime dtSDate; DateTime dtEDate; IBAFiscalYear FY; short iFYNum; if (calendar == null || PlacedInService <= DateTime.MinValue || Life < 1) { return(false); } m_pObjCalendar = null; m_pObjCalendar = calendar; m_dtPISDate = PlacedInService; m_dblLife = Life; m_pObjCalendar.GetFiscalYear(m_dtPISDate, out FY); dtSDate = FY.YRStartDate; dtEDate = FY.YREndDate; iFYNum = FY.FYNum; if (m_pMonthlyYear == null) { m_pMonthlyYear = new MonthlyYear(); } // // Take the first day of the year and make it the deemed start date. // But first true it up to a month start. // m_dtStartDate = dtSDate; if (dtSDate.Day > 7) { iYear = m_dtStartDate.Year; iMonth = m_dtStartDate.Month; if (iMonth > 11) { iMonth = 1; iYear = iYear + 1; } else { iMonth++; } m_dtStartDate = new DateTime(iYear, iMonth, 1); } else { m_dtStartDate = new DateTime(m_dtStartDate.Year, m_dtStartDate.Month, 1); } //calc the deemed end date iYear = m_dtStartDate.Year + ((int)(m_dblLife)); iMonth = m_dtStartDate.Month + ((int)(m_dblLife - (int)(m_dblLife)) * 12); iDay = m_dtStartDate.Day; // adjust for special start of business case where deemed start is before start of bus. if (iFYNum == 1 && m_dtStartDate < dtSDate) { m_dtStartDate = dtSDate; } m_dtEndDate = new DateTime(iYear, iMonth, iDay).AddDays(-1); return(true); }
public bool Initialize(IBACalendar calendar, DateTime PlacedInService, double Life) { int iYear; int iMonth; int iDay; IBACalcPeriod pObjPeriod; IBAFiscalYear FY; bool hr; DateTime dtTmpEndDate; DateTime dtTmpStartDate; DateTime dtMidDate; bool bFirstHalf = false; if (calendar == null || PlacedInService <= DateTime.MinValue || Life <= 0) { return(false); } m_pObjCalendar = null; m_pObjCalendar = calendar; m_dtPISDate = PlacedInService; m_dblLife = Life; m_pObjCalendar.GetFiscalYear(m_dtPISDate, out FY); dtTmpStartDate = FY.YRStartDate; dtTmpEndDate = FY.YREndDate; FY.GetPeriod(m_dtPISDate, out pObjPeriod); FY.GetMidPeriodDate(m_dtPISDate, out dtMidDate); //determine the pis in fisrt or second half of a month if (m_dtPISDate < dtMidDate) { bFirstHalf = true; } //calc the deemed start date if (bFirstHalf) { //place in first half(full month) m_dtStartDate = pObjPeriod.PeriodStart; } else { //place in second half(next month) m_dtStartDate = pObjPeriod.PeriodEnd; m_dtStartDate = m_dtStartDate.AddDays(1); } //calc the deemed end date iYear = (m_dtStartDate.Year) + (int)(m_dblLife); iMonth = (m_dtStartDate.Month) + (int)((m_dblLife - (int)(m_dblLife)) * 12); iDay = (m_dtStartDate.Day); //the deemed end date if (iMonth > 12) { iMonth -= 12; iYear++; } m_dtEndDate = new DateTime(iYear, iMonth, iDay).AddDays(-1); // m_dtStartDate = m_dtPISDate; return(true); }