示例#1
0
  public LocalDate getFirstInstallmentPaymentLocalDate() {
    if (!getRegistration().hasToPayGratuityOrInsurance()) {
      return null;
    }

    GratuityEventWithPaymentPlan gratuityEventWithPaymentPlan =
        getStudentCurricularPlan()
            .getGratuityEvent(getForExecutionYear(), GratuityEventWithPaymentPlan.class);

    Installment firstInstallment = gratuityEventWithPaymentPlan.getInstallments().iterator().next();

    /*
     * iterate the non adjusting accounting transactions until its paid
     */
    Money paidForFirstInstallment = Money.ZERO;
    for (AccountingTransaction accountingTransaction :
        gratuityEventWithPaymentPlan.getNonAdjustingTransactions()) {
      paidForFirstInstallment =
          paidForFirstInstallment.add(accountingTransaction.getAmountWithAdjustment());

      if (paidForFirstInstallment.greaterOrEqualThan(firstInstallment.getAmount())) {
        return accountingTransaction.getWhenRegistered().toLocalDate();
      }
    }

    return firstInstallment.getEndDate().toLocalDate();
  }
示例#2
0
文件: Entry.java 项目: Kayvlim/fenix
  private Money getTotalAdjustedAmount() {
    Money result = Money.ZERO;
    for (final AccountingTransaction transaction :
        getAccountingTransaction().getAdjustmentTransactionsSet()) {
      result = result.add(transaction.getEntryFor(getAccount()).getOriginalAmount());
    }

    return result;
  }
示例#3
0
  @Override
  protected Money subtractFromExemptions(
      Event event, DateTime when, boolean applyDiscount, Money amountToPay) {

    if (event instanceof AcademicEvent) {
      final AcademicEvent requestEvent = (AcademicEvent) event;
      if (requestEvent.hasAcademicEventExemption()) {
        amountToPay = amountToPay.subtract(requestEvent.getAcademicEventExemption().getValue());
      }

      return amountToPay.isPositive() ? amountToPay : Money.ZERO;
    }

    return amountToPay;
  }
示例#4
0
 private void checkBudget(MicroPaymentEvent event, Money amountToPay) {
   Money totalCredit = calculateBalance(event);
   if (amountToPay.greaterThan(totalCredit)) {
     throw new DomainException(
         "error.accounting.AccountingTransaction.amount.to.spend.exceeds.account");
   }
 }
 private void checkParameters(Money pastAdministrativeOfficeFeeAndInsuranceAmount) {
   if (pastAdministrativeOfficeFeeAndInsuranceAmount == null
       || pastAdministrativeOfficeFeeAndInsuranceAmount.isZero()) {
     throw new DomainException(
         "error.net.sourceforge.fenixedu.domain.accounting.events.PastAdministrativeOfficeFeeAndInsuranceEvent.pastAdministrativeOfficeFeeAndInsuranceAmount.cannot.be.null.and.must.be.greather.than.zero");
   }
 }
示例#6
0
 protected void checkIfCanAddAmount(Money amountToPay, final Event event, final DateTime when) {
   if (amountToPay.compareTo(calculateTotalAmountToPay(event, when)) < 0) {
     throw new DomainExceptionWithLabelFormatter(
         "error.accounting.postingRules.FixedAmountPR.amount.being.payed.must.match.amount.to.pay",
         event.getDescriptionForEntryType(getEntryType()));
   }
 }
 private void checkIfCanAddAmount(
     final Money amountToPay, final Event event, final DateTime when) {
   if (amountToPay.compareTo(calculateTotalAmountToPay(event, when)) < 0) {
     throw new DomainExceptionWithLabelFormatter(
         "error.DegreeChangeIndividualCandidacyPR.amount.being.payed.must.match.amount.to.pay",
         event.getDescriptionForEntryType(getEntryType()));
   }
 }
示例#8
0
文件: Entry.java 项目: Kayvlim/fenix
 public boolean canApplyReimbursement(final Money amountToReimburse) {
   return canApplyAdjustment(amountToReimburse.negate());
 }