Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        protected SavingInterestsPostingEvent _PostPayableInterests(DateTime pDate, User pUser)
        {
            OCurrency interestsToPost;

            if (this is Saving)
                interestsToPost = ChartOfAccounts.GetAccountByNumber(OAccounts.ACCOUNT_PAYABLE_INTERESTS_ON_SAVINGS_BOOKS,
                                    Product == null || Product.Currency == null ? 1 : Product.Currency.Id, this, OBookingDirections.Both).Balance;
            else
                interestsToPost = ChartOfAccounts.GetAccountByNumber(OAccounts.ACCOUNT_PAYABLE_INTERESTS_ON_TERM_DEPOSIT,
                                   Product == null || Product.Currency == null ? 1 : Product.Currency.Id, this, OBookingDirections.Both).Balance;

            if (interestsToPost > 0)
            {
                SavingInterestsPostingEvent postingEvent = new SavingInterestsPostingEvent()
                {
                    Date = pDate,
                    Amount = interestsToPost,
                    User = pUser,
                    Cancelable = true,
                    Description = string.Format("Posting interests for period : {0:d} to {1:d}", GetLastPostingDate(), pDate),
                    ProductType = Product.GetType()
                };

                _events.Add(postingEvent);
                return postingEvent;
            }

            return null;
        }