}
@Atomic
public static void createDEAGratuityPostingRule(PaymentPlanBean paymentPlanBean) {
check(AcademicPredicates.MANAGE_PAYMENTS);
CreateGratuityPostingRuleBean createGratuityPostingRuleBean = new CreateGratuityPostingRuleBean();
createGratuityPostingRuleBean.setExecutionYear(paymentPlanBean.getExecutionYear());
createGratuityPostingRuleBean.setDegreeCurricularPlans(paymentPlanBean.getDegreeCurricularPlans());
DateTime minStartDate = null;
for (InstallmentBean installmentBean : paymentPlanBean.getInstallments()) {
if (minStartDate == null) {
minStartDate = installmentBean.getStartDate().toDateMidnight().toDateTime();
continue;
}
if (installmentBean.getStartDate().toDateMidnight().toDateTime().isBefore(minStartDate)) {
minStartDate = installmentBean.getStartDate().toDateMidnight().toDateTime();
}
}
createGratuityPostingRuleBean.setStartDate(minStartDate);
createGratuityPostingRuleBean.setRule(GratuityWithPaymentPlanPR.class);
createGraduationGratuityPostingRule(createGratuityPostingRuleBean);
GratuityPaymentPlanManager.create(paymentPlanBean);
}