18 package org.turro.financials.treasury.settlement;
20 import java.util.Date;
21 import java.util.List;
22 import java.util.TreeSet;
23 import org.amic.util.date.CheckDate;
24 import org.turro.financials.db.FinancialsPU;
25 import org.turro.financials.entity.Account;
26 import org.turro.financials.entity.Contract;
27 import org.turro.financials.entity.RegisterView;
28 import org.turro.financials.menu.FinancialsMenu;
29 import org.turro.financials.model.register.RegisterGenerator;
30 import org.turro.financials.model.register.ViewWrapper;
31 import org.turro.i18n.I_;
32 import org.turro.jpa.Dao;
41 CREDITOR_EXP =
"475%",
43 ON_ACCOUNT_EXP =
"473%";
46 private Date date, settlementDate;
58 return settlementDate;
62 this.settlementDate = settlementDate;
72 private void fillData() {
74 List<Object[]> list = (List<Object[]>)
getDao().getResultList(
75 "select a.id, a.description, sum(e.debit), sum(e.credit) from RegisterEntry e " +
76 "join e.register r " +
78 "where r.registerDate <= ? " +
80 "and r.view.id = 1 " +
88 "group by a.id, a.description",
89 new Object[] { date, CREDITOR_EXP });
90 for(Object[] objs : list) {
91 SettlementEntry se =
new SettlementEntry((String) objs[0], (String) objs[1]);
92 double debit = (Double) (objs[2] ==
null ? 0.0 : objs[2]),
93 credit = (Double) (objs[3] ==
null ? 0.0 : objs[3]);
94 se.setAmount(-(debit - credit));
97 list = (List<Object[]>)
getDao().getResultList(
98 "select a.id, a.description, sum(e.debit), sum(e.credit) from RegisterEntry e " +
99 "join e.register r " +
100 "join e.account a " +
101 "where r.registerDate <= ? " +
103 "and r.view.id = 1 " +
105 "and (a.id like ? or a.id like ?)" +
111 "group by a.id, a.description",
112 new Object[] { date, DEBTOR_EXP, ON_ACCOUNT_EXP });
113 for(Object[] objs : list) {
114 SettlementEntry se =
new SettlementEntry((String) objs[0], (String) objs[1]);
115 double debit = (Double) (objs[2] ==
null ? 0.0 : objs[2]),
116 credit = (Double) (objs[3] ==
null ? 0.0 : objs[3]);
117 se.setAmount((debit - credit));
123 return new CheckDate(date).setMonth(1).setDay(1).getDate();
165 acc.
setId(
"4751000000");
167 }
else if(total > 0.0) {
169 acc.
setId(
"4730000000");
181 acc.
setId(
"4751000000");
183 }
else if(total > 0.0) {
185 acc.
setId(
"4730000000");
203 }
else if(total > 0.0) {
void setView(RegisterView view)
void setRegisterDate(Date registerDate)
void addAccount(Account account, String concept, double balance)
static RegisterView getFormalView()
void setSettlementDate(Date settlementDate)
double getCreditorTotal()
void generateRegister(Contract store)
static String get(String msg)