18 package org.turro.financials.model.contract;
20 import java.util.Date;
21 import org.turro.financials.db.FinancialsPU;
22 import org.turro.financials.entity.Contract;
23 import org.turro.financials.entity.MajorAccount;
24 import org.turro.financials.model.AccountFormat;
25 import org.turro.financials.model.business.CompanyWrapper;
26 import org.turro.jpa.Dao;
27 import org.turro.util.CompareUtil;
36 private Double balance, effects;
39 this.contract = contract;
64 return (balance ==
null || balance == 0.0) &&
65 (effects ==
null || effects == 0.0);
68 private void loadStatus() {
72 "select sum(re.debit - re.credit) from RegisterEntry re " +
73 "join re.register r " +
74 "where re.account.id = ? " +
75 "and r.registerDate >= ?",
80 effects = (Double) dao.getSingleResult(
81 "select sum(re.debit - re.credit) from RegisterEntry re " +
82 "join re.register r " +
83 "where re.account.id = ? " +
84 "and r.registerDate >= ?",
89 if(
"40".equals(getMajor()) ||
"41".equals(getMajor())) {
90 balance = balance ==
null ? null : -balance;
91 effects = effects ==
null ? null : -effects;
97 int result = CompareUtil.compare(getMajor(), o.
getMajor());
99 result = CompareUtil.compare(contract.
getName(), o.contract.
getName());
102 result = CompareUtil.compare(contract.
getId(), o.contract.
getId());
ContractDefinition getContractDefinition()
static MajorAccount getMajor(String account)
static Date getCompanyClosingDate()
int compareTo(PortfolioStatus o)
PortfolioStatus(Contract contract)
Object getSingleResult(WhereClause wc)