Ejemplo n.º 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();
  }
Ejemplo n.º 2
0
  private Money getTotalAdjustedAmount() {
    Money result = Money.ZERO;
    for (final AccountingTransaction transaction :
        getAccountingTransaction().getAdjustmentTransactionsSet()) {
      result = result.add(transaction.getEntryFor(getAccount()).getOriginalAmount());
    }

    return result;
  }