18 package org.turro.financials.model.document.contract;
20 import java.util.Date;
21 import java.util.TreeSet;
22 import javax.persistence.NoResultException;
23 import org.turro.financials.db.FinancialsPU;
24 import org.turro.financials.entity.Contract;
25 import org.turro.financials.entity.Document;
26 import org.turro.financials.entity.RegisterView;
27 import org.turro.financials.model.AccountFormat;
28 import org.turro.jpa.Dao;
43 addAll(dao.getResultList(
44 "select doc from Document doc " +
45 "where doc.contract = ? " +
46 "and doc.forcedView = ? " +
47 "and doc.documentDate >= ? " +
48 "and doc.documentDate <= ?",
49 new Object[] { contract, view, from, to }));
51 addAll(dao.getResultList(
52 "select doc from Document doc " +
53 "where doc.contract = ? " +
54 "and doc.forcedView is null " +
55 "and doc.documentDate >= ? " +
56 "and doc.documentDate <= ?",
57 new Object[] { contract, from, to }));
67 "select sum(re.debit - re.credit) " +
68 "from RegisterEntry re " +
69 "join re.register r " +
71 "and r.registerDate < ? " +
72 (init !=
null ?
"and r.registerDate >= ? " :
"and ? is null ") +
81 new Object[] { view, from, init });
84 "select sum(re.debit - re.credit) " +
85 "from RegisterEntry re " +
86 "join re.register r " +
87 "where r.view.id = 1 " +
88 "and r.registerDate < ? " +
89 (init !=
null ?
"and r.registerDate >= ? " :
"and ? is null ") +
98 new Object[] { from, init });
100 if(o instanceof Double) {
102 return -((Double) o);
112 "select max(r.registerDate) from Register r " +
113 "where r.registerDate < ? " +
114 "and r.closing = TRUE " +
115 "and day(r.registerDate) = 1 " +
116 "and month(r.registerDate) = 1",
117 new Object[] { fromDate });
118 }
catch(NoResultException ex) {
ContractDefinition getContractDefinition()
void fillList(RegisterView view, Contract contract, Date from, Date to)
Date getInitialDate(Dao dao, Date fromDate)
double getInitialBalance(RegisterView view, Contract contract, Date from, Date to)
Object getSingleResult(WhereClause wc)