1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.kuali.kfs.gl.businessobject;
20
21 import org.kuali.kfs.sys.KFSConstants;
22 import org.kuali.rice.core.api.util.type.KualiDecimal;
23 import org.kuali.rice.krad.bo.BusinessObject;
24
25
26
27
28 public class LedgerEntryForReporting implements BusinessObject{
29
30 private String balanceType;
31 private String originCode;
32 private Integer fiscalYear;
33 private String period;
34 private int recordCount;
35 private KualiDecimal debitAmount;
36 private int debitCount;
37 private KualiDecimal creditAmount;
38 private int creditCount;
39 private KualiDecimal noDCAmount;
40 private int noDCCount;
41
42
43
44
45 public LedgerEntryForReporting() {
46 this(null, null, null, null);
47 }
48
49
50
51
52
53
54
55
56
57 public LedgerEntryForReporting(Integer fiscalYear, String period, String balanceType, String originCode) {
58 this.fiscalYear = fiscalYear;
59 this.period = period;
60 this.balanceType = balanceType;
61 this.originCode = originCode;
62
63 this.creditAmount = KualiDecimal.ZERO;
64 this.debitAmount = KualiDecimal.ZERO;
65 this.noDCAmount = KualiDecimal.ZERO;
66 }
67
68
69
70
71
72
73 public void add(LedgerEntryForReporting addend) {
74 this.creditAmount = this.creditAmount.add(addend.getCreditAmount());
75 this.creditCount += addend.getCreditCount();
76
77 this.debitAmount = this.debitAmount.add(addend.getDebitAmount());
78 this.debitCount += addend.getDebitCount();
79
80 this.noDCAmount = this.noDCAmount.add(addend.getNoDCAmount());
81 this.noDCCount += addend.getNoDCCount();
82
83 this.recordCount = this.creditCount + this.debitCount + this.noDCCount;
84 }
85
86
87
88
89
90
91
92 public static LedgerEntryForReporting buildLedgerEntry(Object[] entrySummary) {
93
94 Object oFiscalYear = entrySummary[0];
95 Object oPeriodCode = entrySummary[1];
96 Object oBalanceType = entrySummary[2];
97 Object oOriginCode = entrySummary[3];
98 Object oDebitCreditCode = entrySummary[4];
99 Object oAmount = entrySummary[5];
100 Object oCount = entrySummary[6];
101
102 Integer fiscalYear = oFiscalYear != null ? new Integer(oFiscalYear.toString()) : null;
103 String periodCode = oPeriodCode != null ? oPeriodCode.toString() : " ";
104 String balanceType = oBalanceType != null ? oBalanceType.toString() : " ";
105 String originCode = oOriginCode != null ? oOriginCode.toString() : " ";
106 String debitCreditCode = oDebitCreditCode != null ? oDebitCreditCode.toString() : " ";
107 KualiDecimal amount = oAmount != null ? new KualiDecimal(oAmount.toString()) : KualiDecimal.ZERO;
108 int count = oCount != null ? Integer.parseInt(oCount.toString()) : 0;
109
110
111 LedgerEntryForReporting ledgerEntry = new LedgerEntryForReporting(fiscalYear, periodCode, balanceType, originCode);
112 if (KFSConstants.GL_CREDIT_CODE.equals(debitCreditCode)) {
113 ledgerEntry.setCreditAmount(amount);
114 ledgerEntry.setCreditCount(count);
115 }
116 else if (KFSConstants.GL_DEBIT_CODE.equals(debitCreditCode)) {
117 ledgerEntry.setDebitAmount(amount);
118 ledgerEntry.setDebitCount(count);
119 }
120 else {
121 ledgerEntry.setNoDCAmount(amount);
122 ledgerEntry.setNoDCCount(count);
123 }
124 ledgerEntry.setRecordCount(count);
125
126 return ledgerEntry;
127 }
128
129
130
131
132
133
134 public String getBalanceType() {
135 return balanceType;
136 }
137
138
139
140
141
142
143 public void setBalanceType(String balanceType) {
144 this.balanceType = balanceType;
145 }
146
147
148
149
150
151
152 public KualiDecimal getCreditAmount() {
153 return creditAmount;
154 }
155
156
157
158
159
160
161 public void setCreditAmount(KualiDecimal creditAmount) {
162 this.creditAmount = creditAmount;
163 }
164
165
166
167
168
169
170 public int getCreditCount() {
171 return creditCount;
172 }
173
174
175
176
177
178
179 public void setCreditCount(int creditCount) {
180 this.creditCount = creditCount;
181 }
182
183
184
185
186
187
188 public KualiDecimal getDebitAmount() {
189 return debitAmount;
190 }
191
192
193
194
195
196
197 public void setDebitAmount(KualiDecimal debitAmount) {
198 this.debitAmount = debitAmount;
199 }
200
201
202
203
204
205
206 public int getDebitCount() {
207 return debitCount;
208 }
209
210
211
212
213
214
215 public void setDebitCount(int debitCount) {
216 this.debitCount = debitCount;
217 }
218
219
220
221
222
223
224 public Integer getFiscalYear() {
225 return fiscalYear;
226 }
227
228
229
230
231
232
233 public void setFiscalYear(Integer fiscalYear) {
234 this.fiscalYear = fiscalYear;
235 }
236
237
238
239
240
241
242 public KualiDecimal getNoDCAmount() {
243 return noDCAmount;
244 }
245
246
247
248
249
250
251 public void setNoDCAmount(KualiDecimal noDCAmount) {
252 this.noDCAmount = noDCAmount;
253 }
254
255
256
257
258
259
260 public int getNoDCCount() {
261 return noDCCount;
262 }
263
264
265
266
267
268
269 public void setNoDCCount(int noDCCount) {
270 this.noDCCount = noDCCount;
271 }
272
273
274
275
276
277
278 public String getOriginCode() {
279 return originCode;
280 }
281
282
283
284
285
286
287 public void setOriginCode(String originCode) {
288 this.originCode = originCode;
289 }
290
291
292
293
294
295
296 public String getPeriod() {
297 return period;
298 }
299
300
301
302
303
304
305 public void setPeriod(String period) {
306 this.period = period;
307 }
308
309
310
311
312
313
314 public int getRecordCount() {
315 return recordCount;
316 }
317
318
319
320
321
322
323 public void setRecordCount(int recordCount) {
324 this.recordCount = recordCount;
325 }
326
327
328
329
330 public String toString() {
331 StringBuffer ledgerEntryDescription = new StringBuffer();
332
333 ledgerEntryDescription.append(fiscalYear + "\t");
334 ledgerEntryDescription.append(period + "\t");
335 ledgerEntryDescription.append(balanceType + "\t");
336 ledgerEntryDescription.append(originCode + "\t");
337 ledgerEntryDescription.append(recordCount + "\t");
338
339 ledgerEntryDescription.append(debitAmount + "\t\t");
340 ledgerEntryDescription.append(debitCount + "\t");
341
342 ledgerEntryDescription.append(creditAmount + "\t\t");
343 ledgerEntryDescription.append(creditCount + "\t");
344
345 ledgerEntryDescription.append(noDCAmount + "\t\t");
346 ledgerEntryDescription.append(noDCCount + "\t");
347
348 return ledgerEntryDescription.toString();
349 }
350
351 public void prepareForWorkflow() {}
352 public void refresh() { }
353 }