/// <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> /// 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; } }
public IFeeCalcVersion[] FindCalculations(IManagementPeriodUnit unit) { IFeeCalcVersion[] calculations = null; Dictionary<FeeTypes, List<IFeeRule>> rulesDictionary = new Dictionary<FeeTypes, List<IFeeRule>>(); IModelHistory modelHistory = null; if (unit.IsPeriodEnd) modelHistory = unit.Account.ModelPortfolioChanges.GetItemByDate(unit.EndDate); else modelHistory = unit.Account.ModelPortfolioChanges.GetItemByDate(Util.GetLastDayOfMonth(unit.Period)); if (modelHistory != null && modelHistory.ModelPortfolio != null) { unit.ModelPortfolio = modelHistory.ModelPortfolio; unit.IsExecOnlyCustomer = modelHistory.IsExecOnlyCustomer; } // First reset the weights back to 0 foreach (IFeeRule rule in rules) { rule.Weight = 0; } // Calculate the weight foreach (IFeeRule rule in rules) { if (rule.CalculateWeight(unit)) { FeeTypes key = rule.FeeCalculation.FeeType.Key; if (!rulesDictionary.ContainsKey(key)) rulesDictionary.Add(key, new List<IFeeRule>()); rulesDictionary[key].Add(rule); } } if (rulesDictionary.Count > 0) { calculations = new IFeeCalcVersion[rulesDictionary.Keys.Count]; int i = 0; foreach (FeeTypes key in rulesDictionary.Keys) { rulesDictionary[key].Sort(new FeeRule.MySorter(FeeRule.MySorter.SortOrder.Descending)); calculations[i] = rulesDictionary[key][0].FeeCalculation.Versions.GetItemByPeriod(unit.Period); i++; } } return calculations; }
/// <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 bool Deactivate() //{ // bool retVal = false; // if (Parent.Transaction == null) // { // // allow Kickback to be overwritten // if (FeeType.Key == FeeTypes.KickbackFee || FeeType.Key == FeeTypes.DiscountKickbackFee) // return false; // else // throw new ApplicationException(string.Format("The holding {0} is not created properly, contact your system administrator.", Parent.Key.ToString())); // } // if (!(Parent.Transaction == null || (Parent.Transaction != null && Parent.Transaction.StornoTransaction != null))) // throw new ApplicationException(string.Format("The holding {0} is already used in a previous management fee calculation.", Parent.Key.ToString())); // else if (Parent.Transaction.StornoTransaction != null) // { // stornoTransaction = Parent.Transaction.StornoTransaction; // retVal = true; // } // return retVal; //} public void Edit(Money calculatedAmount, IFeeCalcVersion calcSource) { this.Amount = calculatedAmount; this.CalculatedAmount = calculatedAmount; if (calcSource != null) { this.calcSource = calcSource; calcSourceKey = calcSource.Key; } IsEditted = true; }
public void Edit(Money amount, IFeeCalcVersion calcSource) { this.Amount = amount; if (calcSource != null) calcSourceKey = calcSource.Key; }