예제 #1
0
 public ManagementFeeComponent(IGeneralOperationsBooking parentBooking, BookingComponentTypes bookingComponentType,
     int period, FeeType mgtFeeType, DateTime creationDate)
     : base(parentBooking, bookingComponentType, creationDate)
 {
     this.Period = period;
     this.MgtFeeType = mgtFeeType;
 }
예제 #2
0
        /// <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;
        }
예제 #3
0
파일: FeeFactory.cs 프로젝트: kiquenet/B4F
        /// <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;
        }
예제 #4
0
        /// <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;
            }
        }
예제 #5
0
 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);
 }
예제 #6
0
 /// <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)
 {
 }
예제 #7
0
 public ManagementFeeComponent(IGeneralOperationsBooking parentBooking, BookingComponentTypes bookingComponentType, 
     int period, FeeType mgtFeeType)
     : this(parentBooking, bookingComponentType, period, mgtFeeType, DateTime.Now)
 {
 }
예제 #8
0
 /// <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);
 }
예제 #9
0
 ///// <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;
 }
예제 #10
0
        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;
                    }
                }
            }
        }
예제 #11
0
 /// <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;
 }