예제 #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;
  }