1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.businessobject;
17
18 import java.sql.Date;
19
20 import org.kuali.ole.sys.OLEConstants;
21 import org.kuali.rice.core.api.util.type.KualiDecimal;
22 import org.kuali.rice.krad.util.ObjectUtils;
23
24
25
26
27 public class AccountBalanceHistory extends AccountBalance {
28
29
30
31
32 public AccountBalanceHistory() {
33 super();
34 this.setCurrentBudgetLineBalanceAmount(KualiDecimal.ZERO);
35 this.setAccountLineActualsBalanceAmount(KualiDecimal.ZERO);
36 this.setAccountLineEncumbranceBalanceAmount(KualiDecimal.ZERO);
37 }
38
39
40
41
42
43
44 public AccountBalanceHistory(OriginEntryInformation originEntry) {
45 this();
46 this.setChartOfAccountsCode(originEntry.getChartOfAccountsCode());
47 this.setAccountNumber(originEntry.getAccountNumber());
48 this.setObjectCode(originEntry.getFinancialObjectCode());
49 this.setSubObjectCode(originEntry.getFinancialSubObjectCode());
50 this.setUniversityFiscalYear(originEntry.getUniversityFiscalYear());
51 this.setSubAccountNumber(originEntry.getSubAccountNumber());
52 }
53
54
55
56
57
58 public boolean addAmount(OriginEntryFull originEntryFull) {
59 if (originEntryFull.getFinancialBalanceTypeCode().equals(originEntryFull.getOption().getBudgetCheckingBalanceTypeCd())) {
60 this.setCurrentBudgetLineBalanceAmount(this.getCurrentBudgetLineBalanceAmount().add(originEntryFull.getTransactionLedgerEntryAmount()));
61 }
62 else if (originEntryFull.getFinancialBalanceTypeCode().equals(originEntryFull.getOption().getActualFinancialBalanceTypeCd())) {
63 if (originEntryFull.getObjectType().getFinObjectTypeDebitcreditCd().equals(originEntryFull.getTransactionDebitCreditCode()) || ((!originEntryFull.getBalanceType().isFinancialOffsetGenerationIndicator()) && OLEConstants.GL_BUDGET_CODE.equals(originEntryFull.getTransactionDebitCreditCode()))) {
64 this.setAccountLineActualsBalanceAmount(this.getAccountLineActualsBalanceAmount().add(originEntryFull.getTransactionLedgerEntryAmount()));
65 }
66 else {
67 this.setAccountLineActualsBalanceAmount(this.getAccountLineActualsBalanceAmount().subtract(originEntryFull.getTransactionLedgerEntryAmount()));
68 }
69 }
70 else if (originEntryFull.getFinancialBalanceTypeCode().equals(originEntryFull.getOption().getExtrnlEncumFinBalanceTypCd()) || originEntryFull.getFinancialBalanceTypeCode().equals(originEntryFull.getOption().getIntrnlEncumFinBalanceTypCd()) || originEntryFull.getFinancialBalanceTypeCode().equals(originEntryFull.getOption().getPreencumbranceFinBalTypeCd()) || originEntryFull.getFinancialBalanceTypeCode().equals(originEntryFull.getOption().getCostShareEncumbranceBalanceTypeCd())) {
71 if (originEntryFull.getObjectType().getFinObjectTypeDebitcreditCd().equals(originEntryFull.getTransactionDebitCreditCode()) || ((!originEntryFull.getBalanceType().isFinancialOffsetGenerationIndicator()) && OLEConstants.GL_BUDGET_CODE.equals(originEntryFull.getTransactionDebitCreditCode()))) {
72 this.setAccountLineEncumbranceBalanceAmount(this.getAccountLineEncumbranceBalanceAmount().add(originEntryFull.getTransactionLedgerEntryAmount()));
73 }
74 else {
75 this.setAccountLineEncumbranceBalanceAmount(this.getAccountLineEncumbranceBalanceAmount().subtract(originEntryFull.getTransactionLedgerEntryAmount()));
76 }
77 }
78 else {
79 return false;
80 }
81 return true;
82 }
83
84
85
86
87
88 public boolean compareAmounts(AccountBalance accountBalance) {
89 if (ObjectUtils.isNotNull(accountBalance)
90 && accountBalance.getCurrentBudgetLineBalanceAmount().equals(this.getCurrentBudgetLineBalanceAmount())
91 && accountBalance.getAccountLineActualsBalanceAmount().equals(this.getAccountLineActualsBalanceAmount())
92 && accountBalance.getAccountLineEncumbranceBalanceAmount().equals(this.getAccountLineEncumbranceBalanceAmount())) {
93 return true;
94 }
95
96 return false;
97 }
98
99
100
101
102
103 @Override
104 public Date getTimestamp() {
105 throw new UnsupportedOperationException();
106 }
107
108
109
110
111
112 @Override
113 public void setTimestamp(Date timestamp) {
114 throw new UnsupportedOperationException();
115 }
116 }