Beispiel #1
0
        private List<SavingEvent> _calculateWithdrawFees(DateTime pDate, User pUser, SavingEvent pSavingEvent, bool pIsDesactivateFees)
        {
            List<SavingEvent> events = new List<SavingEvent>();

            OCurrency fees;
            OCurrency interestsToPost = this.ChartOfAccounts.GetAccountByNumber(OAccounts.ACCOUNT_PAYABLE_INTERESTS_ON_TERM_DEPOSIT,
                    this.Product == null || this.Product.Currency == null ? 1 : this.Product.Currency.Id, this, OBookingDirections.Both).Balance;

            if (interestsToPost > 0)
            {
                SavingInterestsPostingEvent interestsPostingEvent = new SavingInterestsPostingEvent()
                {
                    Date = pDate,
                    Amount = interestsToPost,
                    User = _user,
                    Cancelable = true,
                    Description = string.Format("Posting interests for period : {0:d} to {1:d}", this.GetLastPostingDate(), pDate),
                    ProductType = typeof(TermDepositProduct)
                };

                events.Add(interestsPostingEvent);
                _events.Add(interestsPostingEvent);
            }

            if (!pIsDesactivateFees)
            {
                if (Product.WithdrawalFeesType == OTermDepositFeesType.OnInterests)
                {
                    fees = interestsToPost * WithdrawalFees;
                }
                else
                {
                    fees = pSavingEvent.Amount * WithdrawalFees;
                }

                ((ISavingsFees)pSavingEvent).Fee = fees;
            }

            return events;
        }
Beispiel #2
0
        public SavingEvent _AddSavingEvent(SavingEvent e)
        {
            SavingEvent savEvent = EvaluateSavingsEvent(e);
            if (savEvent != null)
            {
                _events.Add(e);
            }

            return savEvent;
        }
Beispiel #3
0
        protected SavingEvent EvaluateSavingsEvent(SavingEvent e)
        {
            if (e is SavingInterestsAccrualEvent || e is SavingInterestsPostingEvent)
            {
                if (e.Amount > 0)
                {
                    e.Amount = Product.Currency.UseCents
                                   ? Math.Round(e.Amount.Value, 2, MidpointRounding.AwayFromZero)
                                   : Math.Round(e.Amount.Value, 0, MidpointRounding.AwayFromZero);
                    if (e.Amount > 0)
                        return e;
                }
            }

            if(e is SavingAgioEvent || e is SavingManagementFeeEvent)
            {
                if (e.Fee > 0)
                {
                    e.Fee = Product.Currency.UseCents ? Math.Round(e.Fee.Value, 2, MidpointRounding.AwayFromZero) :
                        Math.Round(e.Fee.Value, 0, MidpointRounding.AwayFromZero);
                    if (e.Fee > 0)
                        return e;
                }
            }

            //return filteredEvents;
            return null;
        }
Beispiel #4
0
 public void CancelEvent(SavingEvent pSavingEvent)
 {
     pSavingEvent.Deleted = true;
 }