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