ustify"> java.io. Serializable; java.util. Date;
javax.annotation. PostConstruct; javax.enterprise.context. SessionScoped; javax.inject. Named;
ru.ulstu.secretary.utils. DateUtil;
@ Named
@ SessionScopedclass DateBacking implements Serializable {
static final long serialVersionUID=- 7664901585738595118L;
Date date;
@ PostConstructvoid init () {= DateUtil.getToday ();
}
Date getDate () {date;
}
void setDate (Date date) {.date=date;
}
}. javaru.ulstu.secretary.grid;
java.util. Calendar; java.util. GregorianCalendar;
javax.faces.view. ViewScoped; javax.inject. Named;
ru.ulstu.secretary.entity. Debt; ru.ulstu.secretary.entity. Repay; ru.ulstu.secretary.utils. DateUtil;
@ Named
@ ViewScopedclass DebtBacking extends GridBacking lt; Debt gt; {
static final long serialVersionUID=714120325390373523L;
Debt debt;
@ OverrideDebt getNewBlank () {debt=new Debt () ;. setDate (DateUtil.getToday ()); debt;
}
@ OverrideClass lt; Debt gt; getType () {Debt.class;
}
@ Overridevoid save () throws Exception {calendar=new GregorianCalendar () ;. setTime (getBlank (). getDate ()); (true) {.add (getBlank (). getUnit (). getCode (), 1); (calendar.getTime (). after (getBlank (). getDeadline ())) {;
} repay=new Repay () ;. setDate (calendar.getTime ()) ;. setCategory (getBlank (). getCategory ()) ;. setBalance (-getBlank (). getRepay ()) ; (). getRepays (). add (repay);
}=getBlank () ;. save ();
}
Debt getDebt () {debt;
}
void setDebt (Debt debt) {.debt=debt;
}
}. javaru.ulstu.secretary.grid;
java.util. Collection;
javax.faces.view. ViewScoped; javax.inject. Inject; javax.inject. Named;
ru.ulstu.secretary.db. ActionByDateService; ru.ulstu.secretary.db. PayByDateService; ru.ulstu.secretary.entity. Pay;
@ Named
@ ViewScopedclass DiaryPayBacking extends GridBacking lt; Pay gt; {
static final long serialVersionUID=- 3370333139341916306L;
@ InjectDateBacking dateBacking;
@ InjectActionByDateService actionByDateService;
@ InjectPayByDateService payByDateService;
@ OverrideClass lt; Pay gt; getType () {Pay.class;
}
@ OverridePay getNewBlank () {pay=new Pay () ;. setDate (dateBacking.getDate ()); pay;
}
@ OverrideCollection lt; Pay gt; getList () {payByDateService.getList (dateBacking.getDate ());
}
double getBalance () {actionByDateService.getList (dateBacking.getDate ()). stream (). mapToDouble (task - gt; task.getBalance ()). sum ();
}
}. javaru.ulstu.secretary.grid;
java.util. Collection;
javax.faces.view. ViewScoped; javax.inject. Inject; javax.inject. Named;
ru.ulstu.secretary.db. RepayByDateService; ru.ulstu.secretary.entity. Repay;
@ Named
@ ViewScopedclass DiaryRepayBacking extends GridBacking lt; Repay gt; {
static final long serialVersionUID=8966176107954231754L;
@ InjectDateBacking dateBacking;
@ InjectRepayByDateService repayByDateService;
@ OverrideClass lt; Repay gt; getType () {Repay.class;
}
Collection lt; Repay gt; getList () {repayByDateService.getList (dateBacking.getDate ());
}
}. javaru.ulstu.secretary.grid;
java.io. Serializable; java.util. Collection;
javax.annotation. PostConstruct; javax.inject. Inject;
import ru.ulstu.secretary.db. EntitySer...