Ejemplo n.º 1
0
        public static OCurrency FeesBasedOnInitialAmount(Loan pContract, DateTime pDate, int pInstallmentNumber, bool pForClosure,
            ApplicationSettings pGeneralSettings, NonWorkingDateSingleton pNonWorkingDate)
        {
            if (pContract.NonRepaymentPenalties.InitialAmount != 0)
            {
                int pastDueDays = pForClosure ? pContract.CalculatePastDueForClosure(pDate) : pContract.CalculatePastDueSinceLastRepayment(pDate);
                pastDueDays = _CalculatePastDueWithGeneralParameterForRepayment(pastDueDays, pGeneralSettings);
                if (pContract.GracePeriodOfLateFees >= pastDueDays)
                {
                    pastDueDays = 0;
                }
                OCurrency fees = pContract.Amount * Convert.ToDecimal(pContract.NonRepaymentPenalties.InitialAmount) * (double)pastDueDays;

                OCurrency amount = pContract.UseCents ? Math.Round(fees.Value, 2, MidpointRounding.AwayFromZero) : Math.Round(fees.Value, 0, MidpointRounding.AwayFromZero);

                if (pContract.WrittenOff && pGeneralSettings.IsStopWriteOffPenalty)
                    amount = 0;
                return amount;
            }
            return 0;
        }
        public static OCurrency FeesBasedOnInitialAmount(Loan pContract, DateTime pDate, int pInstallmentNumber, bool pForClosure,
                                                         ApplicationSettings pGeneralSettings, NonWorkingDateSingleton pNonWorkingDate)
        {
            if (pContract.NonRepaymentPenalties.InitialAmount != 0)
            {
                int pastDueDays = pForClosure ? pContract.CalculatePastDueForClosure(pDate) : pContract.CalculatePastDueSinceLastRepayment(pDate);
                pastDueDays = _CalculatePastDueWithGeneralParameterForRepayment(pastDueDays, pGeneralSettings);
                if (pContract.GracePeriodOfLateFees >= pastDueDays)
                {
                    pastDueDays = 0;
                }
                OCurrency fees = pContract.Amount * Convert.ToDecimal(pContract.NonRepaymentPenalties.InitialAmount) * (double)pastDueDays;

                OCurrency amount = pContract.UseCents ? Math.Round(fees.Value, 2, MidpointRounding.AwayFromZero) : Math.Round(fees.Value, 0, MidpointRounding.AwayFromZero);

                if (pContract.WrittenOff && pGeneralSettings.IsStopWriteOffPenalty)
                {
                    amount = 0;
                }
                return(amount);
            }
            return(0);
        }