public ManagementFeeComponent(IGeneralOperationsBooking parentBooking, BookingComponentTypes bookingComponentType, int period, FeeType mgtFeeType, DateTime creationDate) : base(parentBooking, bookingComponentType, creationDate) { this.Period = period; this.MgtFeeType = mgtFeeType; }
/// <summary> /// Constructor of ManagementPeriodUnitFee object /// </summary> /// <param name="calculatedAmount">The (total) value calculated</param> /// <param name="prevCalcAmount">The value already charged</param> /// <param name="feeType">The type of MgtFee</param> public ManagementPeriodUnitFee(IManagementPeriodUnit parent, FeeType feeType, Money amount, IFeeCalcVersion calcSource) { this.Parent = parent; this.FeeType = feeType; this.Amount = amount; if (calcSource != null) calcSourceKey = calcSource.Key; }
/// <summary> /// Calculate kickback on a unit /// </summary> /// <param name="session">The dal session.</param> /// <param name="unit">The unit for which the fee is calculated.</param> /// <param name="feeTypeKickBack">FeeType of type KickBack.</param> /// <param name="message">returns stuff when fu</param> /// <returns></returns> public static bool CalculateKickBackOnUnit(IDalSession session, IManagementPeriodUnit unit, FeeType feeTypeKickBack, out string message) { bool success = false; message = ""; if (unit.Account != null && unit.Account.AccountType == AccountTypes.Customer) { ICustomerAccount account = (ICustomerAccount)unit.Account; if (account.UseKickback) { IRemisierHistory remisierHistory = account.CurrentRemisierDetails; if (remisierHistory != null && remisierHistory.KickBack > 0) { if (feeTypeKickBack == null) feeTypeKickBack = (FeeType)session.GetObjectInstance(typeof(FeeType), (int)FeeTypes.KickbackFee); if (unit.AverageHoldings != null && unit.AverageHoldings.Count > 0) { Money totalKickBackFee = null; foreach (IAverageHolding holding in unit.AverageHoldings) { Money avgAmount = holding.AverageValue; if (avgAmount != null && avgAmount.IsNotZero) { Money kickbackFee = avgAmount * ((remisierHistory.KickBack / 100M) * (unit.Days / 365M) * feeTypeKickBack.FeeTypeSign); if (kickbackFee != null && kickbackFee.IsNotZero) { totalKickBackFee += kickbackFee; holding.FeeItems.AddFeeItem(feeTypeKickBack, kickbackFee, unit, null, remisierHistory.KickBack); unit.FeesCalculated = FeesCalculatedStates.Yes; unit.Message = ""; } } } if (unit.FeesCalculated != FeesCalculatedStates.Yes && (totalKickBackFee == null || totalKickBackFee.IsZero)) { unit.FeesCalculated = FeesCalculatedStates.Irrelevant; unit.Message = "Calculated kickback amount is either zero or too small"; } success = true; } } else message = "No kickback percentage found"; } else { unit.FeesCalculated = FeesCalculatedStates.Irrelevant; success = true; } } return success; }
/// <summary> /// Constructor of AverageHoldingFee object /// </summary> /// <param name="parent">The holding this fee item belongs to</param> /// <param name="unit">The holding this fee item belongs to</param> /// <param name="feeType">The type of MgtFee</param> /// <param name="calculatedAmount">The (total) value calculated</param> /// <param name="prevCalcAmount">The value already charged</param> /// <param name="calcSource">The source of the calculation</param> /// <param name="feePercentageUsed">The fee Percentage Used in the calculation</param> public AverageHoldingFee(IAverageHolding parent, IManagementPeriodUnit unit, FeeType feeType, Money calculatedAmount, Money prevCalcAmount, IFeeCalcVersion calcSource, decimal feePercentageUsed) { this.Parent = parent; this.Unit = unit; this.FeeType = feeType; this.Amount = calculatedAmount - prevCalcAmount; this.CalculatedAmount = calculatedAmount; this.FeePercentageUsed = feePercentageUsed; if (calcSource != null) { this.calcSource = calcSource; calcSourceKey = calcSource.Key; } }
private bool calculateKickBackOnUnit(IDalSession session, IManagementPeriodUnit unit, out string message) { if (this.feeTypeKickBack == null) this.feeTypeKickBack = (FeeType)session.GetObjectInstance(typeof(FeeType), (int)FeeTypes.KickbackFee); return FeeFactory.CalculateKickBackOnUnit(session, unit, this.feeTypeKickBack, out message); }
/// <summary> /// Constructor of AverageHoldingFee object /// </summary> /// <param name="parent">The holding this fee item belongs to</param> /// <param name="unit">The holding this fee item belongs to</param> /// <param name="feeType">The type of MgtFee</param> /// <param name="calculatedAmount">The (total) value calculated</param> /// <param name="calcSource">The source of the calculation</param> /// <param name="feePercentageUsed">The fee Percentage Used in the calculation</param> public AverageHoldingFee(IAverageHolding parent, IManagementPeriodUnit unit, FeeType feeType, Money calculatedAmount, IFeeCalcVersion calcSource, decimal feePercentageUsed) : this(parent, unit, feeType, calculatedAmount, null, calcSource, feePercentageUsed) { }
public ManagementFeeComponent(IGeneralOperationsBooking parentBooking, BookingComponentTypes bookingComponentType, int period, FeeType mgtFeeType) : this(parentBooking, bookingComponentType, period, mgtFeeType, DateTime.Now) { }
/// <summary> /// Constructor of MgtFeeBreakupLine object /// </summary> /// <param name="feeItem">A fee item that is generated for an averageholding</param> public MgtFeeBreakupLine(FeeType mgtFeeType, IAverageHoldingFee feeItem) { this.MgtFeeType = mgtFeeType; FeeItems.Add(feeItem); }
///// <summary> ///// Constructor of MgtFeeBreakupLine object ///// </summary> ///// <param name="feeType">The type of MgtFee</param> ///// <param name="amount">The (total) value calculated</param> //public MgtFeeBreakupLine(FeeTypes feeType, Money amount) //{ // this.feeType = feeType; // this.Amount = amount; //} /// <summary> /// Constructor of MgtFeeBreakupLine object /// </summary> /// <param name="mgtFeeType">The type of MgtFee</param> /// <param name="amount">The (total) value calculated</param> public MgtFeeBreakupLine(FeeType mgtFeeType, Money amount) { this.mgtFeeType = mgtFeeType; this.Amount = amount; }
protected void getPreviousCalculatedFeeRecursively(IAverageHolding holding, FeeType feeType, ref Money prevCalcFee) { if (holding != null) { if (holding.PreviousHolding != null) getPreviousCalculatedFeeRecursively(holding.PreviousHolding, feeType, ref prevCalcFee); if (holding != null && holding.FeeItems != null && holding.FeeItems.Count > 0) { foreach (IAverageHoldingFee feeItem in holding.FeeItems) { if (!feeItem.IsIgnored && feeItem.FeeType.Equals(feeType)) prevCalcFee += feeItem.Amount; } } } }
/// <summary> /// This method returns the amount that has been charged in the specific feetype so far /// </summary> /// <param name="feeType">The relevant feetype</param> /// <returns>the amount</returns> public Money GetPreviousCalculatedFee(FeeType feeType) { Money prevCalcFee = null; getPreviousCalculatedFeeRecursively(PreviousHolding, feeType, ref prevCalcFee); return prevCalcFee; }