1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.batch.service.impl;
17
18 import java.util.Iterator;
19
20 import org.kuali.ole.gl.businessobject.OriginEntryFull;
21 import org.kuali.ole.sys.OLEConstants;
22 import org.kuali.rice.core.api.util.type.KualiDecimal;
23
24
25
26
27
28
29 public class OriginEntryTotals {
30
31 protected KualiDecimal creditAmount;
32 protected KualiDecimal debitAmount;
33 protected KualiDecimal otherAmount;
34 protected int numCreditEntries;
35 protected int numDebitEntries;
36 protected int numOtherEntries;
37
38 public OriginEntryTotals() {
39 creditAmount = KualiDecimal.ZERO;
40 debitAmount = KualiDecimal.ZERO;
41 otherAmount = KualiDecimal.ZERO;
42 numCreditEntries = 0;
43 numDebitEntries = 0;
44 numOtherEntries = 0;
45 }
46
47
48
49
50
51
52 public KualiDecimal getCreditAmount() {
53 return creditAmount;
54 }
55
56
57
58
59
60
61 public void setCreditAmount(KualiDecimal creditAmount) {
62 this.creditAmount = creditAmount;
63 }
64
65
66
67
68
69
70 public KualiDecimal getDebitAmount() {
71 return debitAmount;
72 }
73
74
75
76
77
78
79 public void setDebitAmount(KualiDecimal debitAmount) {
80 this.debitAmount = debitAmount;
81 }
82
83
84
85
86
87
88 public int getNumCreditEntries() {
89 return numCreditEntries;
90 }
91
92
93
94
95
96
97 public void setNumCreditEntries(int numCreditEntries) {
98 this.numCreditEntries = numCreditEntries;
99 }
100
101
102
103
104
105
106 public int getNumDebitEntries() {
107 return numDebitEntries;
108 }
109
110
111
112
113
114
115 public void setNumDebitEntries(int numDebitEntries) {
116 this.numDebitEntries = numDebitEntries;
117 }
118
119
120
121
122
123
124 public int getNumOtherEntries() {
125 return numOtherEntries;
126 }
127
128
129
130
131
132
133 public void setNumOtherEntries(int numOtherEntries) {
134 this.numOtherEntries = numOtherEntries;
135 }
136
137
138
139
140
141
142 public KualiDecimal getOtherAmount() {
143 return otherAmount;
144 }
145
146
147
148
149
150
151 public void setOtherAmount(KualiDecimal otherAmount) {
152 this.otherAmount = otherAmount;
153 }
154
155
156
157
158
159
160
161 public void addToTotals(Iterator<OriginEntryFull> entries) {
162 while (entries.hasNext()) {
163 OriginEntryFull originEntry = entries.next();
164 if (OLEConstants.GL_CREDIT_CODE.equals(originEntry.getTransactionDebitCreditCode())) {
165 creditAmount = creditAmount.add(originEntry.getTransactionLedgerEntryAmount());
166 numCreditEntries++;
167 }
168 else if (OLEConstants.GL_DEBIT_CODE.equals(originEntry.getTransactionDebitCreditCode())) {
169 debitAmount = debitAmount.add(originEntry.getTransactionLedgerEntryAmount());
170 numDebitEntries++;
171 }
172 else {
173 otherAmount = otherAmount.add(originEntry.getTransactionLedgerEntryAmount());
174 numOtherEntries++;
175 ;
176 }
177 }
178 }
179
180
181
182
183
184
185
186 public void addToTotals(OriginEntryFull originEntry) {
187 if (OLEConstants.GL_CREDIT_CODE.equals(originEntry.getTransactionDebitCreditCode())) {
188 creditAmount = creditAmount.add(originEntry.getTransactionLedgerEntryAmount());
189 numCreditEntries++;
190 }
191 else if (OLEConstants.GL_DEBIT_CODE.equals(originEntry.getTransactionDebitCreditCode())) {
192 debitAmount = debitAmount.add(originEntry.getTransactionLedgerEntryAmount());
193 numDebitEntries++;
194 }
195 else {
196 otherAmount = otherAmount.add(originEntry.getTransactionLedgerEntryAmount());
197 numOtherEntries++;
198 }
199 }
200
201
202
203
204
205
206 public void incorporateTotals(OriginEntryTotals anotherTotals) {
207 creditAmount = creditAmount.add(anotherTotals.creditAmount);
208 debitAmount = debitAmount.add(anotherTotals.debitAmount);
209 otherAmount = otherAmount.add(anotherTotals.otherAmount);
210 numCreditEntries += anotherTotals.numCreditEntries;
211 numDebitEntries += anotherTotals.numDebitEntries;
212 numOtherEntries += anotherTotals.numOtherEntries;
213 }
214 }