Package org.fenixedu.academic.util

Examples of org.fenixedu.academic.util.Money


        return result;
    }

    public Money calculateTotalAmount(final Event event, final DateTime when, final BigDecimal discountPercentage) {

        Money result = Money.ZERO;
        for (final Money amount : calculateInstallmentTotalAmounts(event, when, discountPercentage).values()) {
            result = result.add(amount);
        }

        return result;
    }
View Full Code Here


    public Money calculateRemainingAmountFor(final Installment installment, final Event event, final DateTime when,
            final BigDecimal discountPercentage) {

        final Map<Installment, Money> amountsByInstallment =
                calculateInstallmentRemainingAmounts(event, when, discountPercentage);
        final Money installmentAmount = amountsByInstallment.get(installment);

        return (installmentAmount != null) ? installmentAmount : Money.ZERO;
    }
View Full Code Here

                usedDiscountValue = true;
                this.discountValue = this.discountValue.subtract(installment.getAmount());
                return true;
            }

            Money installmentAmount =
                    installment.calculateAmount(this.event, this.currentTransactionDate, this.discountPercentage,
                            isToApplyPenalty(this.event, installment));

            if (hasDiscountValue()) {
                installmentAmount = installmentAmount.subtract(this.discountValue);
                this.discountedValue = this.discountValue;
            }

            if (hasMoneyFor(installmentAmount)) {
                this.amount = this.amount.subtract(installmentAmount);
View Full Code Here

            return subtractMoneyFor(installment);
        }

        public Money subtractRemainingFor(final Installment installment) {
            final Money result =
                    installment
                            .calculateAmount(this.event, this.when, this.discountPercentage,
                                    isToApplyPenalty(this.event, installment)).subtract(this.discountValue).subtract(this.amount);
            this.amount = this.discountValue = Money.ZERO;
            return result;
View Full Code Here

            this.amount = this.discountValue = Money.ZERO;
            return result;
        }

        public Money calculateTotalAmountFor(final Installment installment) {
            final Money result;
            if (subtractMoneyFor(installment)) {
                if (usedDiscountValue) {
                    result = Money.ZERO;
                } else {
                    result =
View Full Code Here

        }
    }

    @Override
    public List<EntryDTO> calculateEntries(Event event, DateTime when) {
        final Money totalAmountToPay = calculateTotalAmountToPay(event, when);
        return Collections.singletonList(new EntryDTO(getEntryType(), event, totalAmountToPay, Money.ZERO, totalAmountToPay,
                event.getDescriptionForEntryType(getEntryType()), totalAmountToPay));
    }
View Full Code Here

                serviceAgreementTemplate);
    }

    @Override
    public List<EntryDTO> calculateEntries(Event event, DateTime when) {
        final Money totalAmountToPay = calculateTotalAmountToPay(event, when);
        return Collections.singletonList(new EntryDTO(getEntryType(), event, totalAmountToPay, event.getPayedAmount(), event
                .calculateAmountToPay(when), event.getDescriptionForEntryType(getEntryType()), event.calculateAmountToPay(when)));
    }
View Full Code Here

    protected Money doCalculationForAmountToPay(Event event, DateTime when, boolean applyDiscount) {
        final ImprovementOfApprovedEnrolmentEvent improvementOfApprovedEnrolmentEvent =
                (ImprovementOfApprovedEnrolmentEvent) event;
        final boolean hasPenalty = hasPenalty(event, when);

        Money result = Money.ZERO;
        for (int i = 0; i < improvementOfApprovedEnrolmentEvent.getImprovementEnrolmentEvaluationsSet().size(); i++) {
            result = result.add(hasPenalty ? getFixedAmountPenalty() : getFixedAmount());
        }

        return result;
    }
View Full Code Here

        return (EnrolmentPeriodInImprovementOfApprovedEnrolment) enrolmentPeriodInImprovementOfApprovedEnrolment;
    }

    @Override
    public List<EntryDTO> calculateEntries(Event event, DateTime when) {
        final Money totalAmountToPay = calculateTotalAmountToPay(event, when);
        return Collections.singletonList(new EntryDTO(getEntryType(), event, totalAmountToPay, Money.ZERO, totalAmountToPay,
                event.getDescriptionForEntryType(getEntryType()), totalAmountToPay));
    }
View Full Code Here

    public Money getAmountForUnits(Integer numberOfUnits) {
        if (numberOfUnits <= 1) {
            return Money.ZERO;
        }

        Money totalAmountOfUnits = getAmountPerUnit().multiply(new BigDecimal(numberOfUnits - 1));

        if (this.getMaximumAmount().greaterThan(Money.ZERO)) {
            if (totalAmountOfUnits.greaterThan(this.getMaximumAmount())) {
                totalAmountOfUnits = this.getMaximumAmount();
            }
        }

        return totalAmountOfUnits;
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.util.Money

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.