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 import java.util.LinkedHashMap;
20
21 import org.kuali.ole.coa.businessobject.Account;
22 import org.kuali.ole.coa.businessobject.BalanceType;
23 import org.kuali.ole.coa.businessobject.Chart;
24 import org.kuali.ole.coa.businessobject.ObjectCode;
25 import org.kuali.ole.coa.businessobject.ObjectType;
26 import org.kuali.ole.coa.businessobject.PriorYearAccount;
27 import org.kuali.ole.coa.businessobject.SubAccount;
28 import org.kuali.ole.coa.businessobject.SubObjectCode;
29 import org.kuali.ole.sys.OLEConstants;
30 import org.kuali.ole.sys.OLEPropertyConstants;
31 import org.kuali.ole.sys.businessobject.SystemOptions;
32 import org.kuali.rice.core.api.util.type.KualiDecimal;
33 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
34
35
36
37
38
39
40 public class Balance extends PersistableBusinessObjectBase {
41 static final long serialVersionUID = 6581797610149985575L;
42
43 private Integer universityFiscalYear;
44 private String chartOfAccountsCode;
45 private String accountNumber;
46 private String subAccountNumber;
47 private String objectCode;
48 private String subObjectCode;
49 private String balanceTypeCode;
50 private String objectTypeCode;
51 private KualiDecimal accountLineAnnualBalanceAmount;
52
53 private KualiDecimal beginningBalanceLineAmount;
54 private KualiDecimal contractsGrantsBeginningBalanceAmount;
55 private KualiDecimal month1Amount;
56 private KualiDecimal month2Amount;
57 private KualiDecimal month3Amount;
58 private KualiDecimal month4Amount;
59 private KualiDecimal month5Amount;
60 private KualiDecimal month6Amount;
61 private KualiDecimal month7Amount;
62 private KualiDecimal month8Amount;
63 private KualiDecimal month9Amount;
64 private KualiDecimal month10Amount;
65 private KualiDecimal month11Amount;
66 private KualiDecimal month12Amount;
67 private KualiDecimal month13Amount;
68 private Date timestamp;
69
70 private Chart chart;
71 private Account account;
72 private PriorYearAccount priorYearAccount;
73 private ObjectCode financialObject;
74 private SubObjectCode financialSubObject;
75 private SubAccount subAccount;
76 private BalanceType balanceType;
77 private ObjectType objectType;
78
79 private TransientBalanceInquiryAttributes dummyBusinessObject;
80 private SystemOptions option;
81
82
83
84
85 public SystemOptions getOption() {
86 return option;
87 }
88
89
90
91
92 public void setOption(SystemOptions opt) {
93 this.option = opt;
94 }
95
96 public Balance() {
97 accountLineAnnualBalanceAmount = KualiDecimal.ZERO;
98 beginningBalanceLineAmount = KualiDecimal.ZERO;
99 contractsGrantsBeginningBalanceAmount = KualiDecimal.ZERO;
100 month1Amount = KualiDecimal.ZERO;
101 month2Amount = KualiDecimal.ZERO;
102 month3Amount = KualiDecimal.ZERO;
103 month4Amount = KualiDecimal.ZERO;
104 month5Amount = KualiDecimal.ZERO;
105 month6Amount = KualiDecimal.ZERO;
106 month7Amount = KualiDecimal.ZERO;
107 month8Amount = KualiDecimal.ZERO;
108 month9Amount = KualiDecimal.ZERO;
109 month10Amount = KualiDecimal.ZERO;
110 month11Amount = KualiDecimal.ZERO;
111 month12Amount = KualiDecimal.ZERO;
112 month13Amount = KualiDecimal.ZERO;
113 this.dummyBusinessObject = new TransientBalanceInquiryAttributes();
114 }
115
116 public Balance(Transaction t) {
117 this();
118 setUniversityFiscalYear(t.getUniversityFiscalYear());
119 setChartOfAccountsCode(t.getChartOfAccountsCode());
120 setAccountNumber(t.getAccountNumber());
121 setSubAccountNumber(t.getSubAccountNumber());
122 setObjectCode(t.getFinancialObjectCode());
123 setSubObjectCode(t.getFinancialSubObjectCode());
124 setBalanceTypeCode(t.getFinancialBalanceTypeCode());
125 setObjectTypeCode(t.getFinancialObjectTypeCode());
126 }
127
128
129
130
131
132
133
134 public Balance(BalanceHistory balanceHistory) {
135 this();
136 this.setChartOfAccountsCode(balanceHistory.getChartOfAccountsCode());
137 this.setAccountNumber(balanceHistory.getAccountNumber());
138 this.setBalanceTypeCode(balanceHistory.getBalanceTypeCode());
139 this.setObjectCode(balanceHistory.getObjectCode());
140 this.setObjectTypeCode(balanceHistory.getObjectTypeCode());
141 this.setSubObjectCode(balanceHistory.getSubObjectCode());
142 this.setUniversityFiscalYear(balanceHistory.getUniversityFiscalYear());
143 this.setSubAccountNumber(balanceHistory.getSubAccountNumber());
144 }
145
146 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
147 LinkedHashMap map = new LinkedHashMap();
148 map.put(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, getUniversityFiscalYear());
149 map.put(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, getChartOfAccountsCode());
150 map.put(OLEPropertyConstants.ACCOUNT_NUMBER, getAccountNumber());
151 map.put(OLEPropertyConstants.SUB_ACCOUNT_NUMBER, getSubAccountNumber());
152 map.put(OLEPropertyConstants.OBJECT_CODE, getObjectCode());
153 map.put(OLEPropertyConstants.SUB_OBJECT_CODE, getSubObjectCode());
154 map.put(OLEPropertyConstants.BALANCE_TYPE_CODE, getBalanceTypeCode());
155 map.put(OLEPropertyConstants.OBJECT_TYPE_CODE, getObjectTypeCode());
156 return map;
157 }
158
159
160
161
162
163
164
165 public KualiDecimal getAmount(String period) {
166 if (OLEConstants.PERIOD_CODE_ANNUAL_BALANCE.equals(period)) {
167 return getAccountLineAnnualBalanceAmount();
168 }
169 else if (OLEConstants.PERIOD_CODE_BEGINNING_BALANCE.equals(period)) {
170 return getBeginningBalanceLineAmount();
171 }
172 else if (OLEConstants.PERIOD_CODE_CG_BEGINNING_BALANCE.equals(period)) {
173 return getContractsGrantsBeginningBalanceAmount();
174 }
175 else if (OLEConstants.MONTH1.equals(period)) {
176 return getMonth1Amount();
177 }
178 else if (OLEConstants.MONTH2.equals(period)) {
179 return getMonth2Amount();
180 }
181 else if (OLEConstants.MONTH3.equals(period)) {
182 return getMonth3Amount();
183 }
184 else if (OLEConstants.MONTH4.equals(period)) {
185 return getMonth4Amount();
186 }
187 else if (OLEConstants.MONTH5.equals(period)) {
188 return getMonth5Amount();
189 }
190 else if (OLEConstants.MONTH6.equals(period)) {
191 return getMonth6Amount();
192 }
193 else if (OLEConstants.MONTH7.equals(period)) {
194 return getMonth7Amount();
195 }
196 else if (OLEConstants.MONTH8.equals(period)) {
197 return getMonth8Amount();
198 }
199 else if (OLEConstants.MONTH9.equals(period)) {
200 return getMonth9Amount();
201 }
202 else if (OLEConstants.MONTH10.equals(period)) {
203 return getMonth10Amount();
204 }
205 else if (OLEConstants.MONTH11.equals(period)) {
206 return getMonth11Amount();
207 }
208 else if (OLEConstants.MONTH12.equals(period)) {
209 return getMonth12Amount();
210 }
211 else if (OLEConstants.MONTH13.equals(period)) {
212 return getMonth13Amount();
213 }
214 else {
215 return null;
216 }
217 }
218
219
220
221
222
223
224
225 public void addAmount(String period, KualiDecimal amount) {
226
227 if (OLEConstants.PERIOD_CODE_ANNUAL_BALANCE.equals(period)) {
228 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
229 }
230 else if (OLEConstants.PERIOD_CODE_BEGINNING_BALANCE.equals(period)) {
231 beginningBalanceLineAmount = beginningBalanceLineAmount.add(amount);
232 }
233 else if (OLEConstants.PERIOD_CODE_CG_BEGINNING_BALANCE.equals(period)) {
234 contractsGrantsBeginningBalanceAmount = contractsGrantsBeginningBalanceAmount.add(amount);
235 }
236 else if (OLEConstants.MONTH1.equals(period)) {
237 month1Amount = month1Amount.add(amount);
238 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
239 }
240 else if (OLEConstants.MONTH2.equals(period)) {
241 month2Amount = month2Amount.add(amount);
242 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
243 }
244 else if (OLEConstants.MONTH3.equals(period)) {
245 month3Amount = month3Amount.add(amount);
246 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
247 }
248 else if (OLEConstants.MONTH4.equals(period)) {
249 month4Amount = month4Amount.add(amount);
250 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
251 }
252 else if (OLEConstants.MONTH5.equals(period)) {
253 month5Amount = month5Amount.add(amount);
254 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
255 }
256 else if (OLEConstants.MONTH6.equals(period)) {
257 month6Amount = month6Amount.add(amount);
258 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
259 }
260 else if (OLEConstants.MONTH7.equals(period)) {
261 month7Amount = month7Amount.add(amount);
262 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
263 }
264 else if (OLEConstants.MONTH8.equals(period)) {
265 month8Amount = month8Amount.add(amount);
266 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
267 }
268 else if (OLEConstants.MONTH9.equals(period)) {
269 month9Amount = month9Amount.add(amount);
270 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
271 }
272 else if (OLEConstants.MONTH10.equals(period)) {
273 month10Amount = month10Amount.add(amount);
274 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
275 }
276 else if (OLEConstants.MONTH11.equals(period)) {
277 month11Amount = month11Amount.add(amount);
278 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
279 }
280 else if (OLEConstants.MONTH12.equals(period)) {
281 month12Amount = month12Amount.add(amount);
282 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
283 }
284 else if (OLEConstants.MONTH13.equals(period)) {
285 month13Amount = month13Amount.add(amount);
286 accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount.add(amount);
287 }
288 }
289
290
291
292
293 public KualiDecimal getAccountLineAnnualBalanceAmount() {
294 return accountLineAnnualBalanceAmount;
295 }
296
297
298
299
300 public void setAccountLineAnnualBalanceAmount(KualiDecimal accountLineAnnualBalanceAmount) {
301 this.accountLineAnnualBalanceAmount = accountLineAnnualBalanceAmount;
302 }
303
304
305
306
307 public String getAccountNumber() {
308 return accountNumber;
309 }
310
311
312
313
314 public void setAccountNumber(String accountNumber) {
315 this.accountNumber = accountNumber;
316 }
317
318
319
320
321 public String getBalanceTypeCode() {
322 return balanceTypeCode;
323 }
324
325
326
327
328 public void setBalanceTypeCode(String balanceTypeCode) {
329 this.balanceTypeCode = balanceTypeCode;
330 }
331
332
333
334
335 public KualiDecimal getBeginningBalanceLineAmount() {
336 return beginningBalanceLineAmount;
337 }
338
339
340
341
342 public void setBeginningBalanceLineAmount(KualiDecimal beginningBalanceLineAmount) {
343 this.beginningBalanceLineAmount = beginningBalanceLineAmount;
344 }
345
346
347
348
349 public String getChartOfAccountsCode() {
350 return chartOfAccountsCode;
351 }
352
353
354
355
356 public void setChartOfAccountsCode(String chartOfAccountsCode) {
357 this.chartOfAccountsCode = chartOfAccountsCode;
358 }
359
360
361
362
363 public KualiDecimal getContractsGrantsBeginningBalanceAmount() {
364 return contractsGrantsBeginningBalanceAmount;
365 }
366
367
368
369
370 public void setContractsGrantsBeginningBalanceAmount(KualiDecimal contractsGrantsBeginningBalanceAmount) {
371 this.contractsGrantsBeginningBalanceAmount = contractsGrantsBeginningBalanceAmount;
372 }
373
374
375
376
377 public KualiDecimal getMonth10Amount() {
378 return month10Amount;
379 }
380
381
382
383
384 public void setMonth10Amount(KualiDecimal month10Amount) {
385 this.month10Amount = month10Amount;
386 }
387
388
389
390
391 public KualiDecimal getMonth11Amount() {
392 return month11Amount;
393 }
394
395
396
397
398 public void setMonth11Amount(KualiDecimal month11Amount) {
399 this.month11Amount = month11Amount;
400 }
401
402
403
404
405 public KualiDecimal getMonth12Amount() {
406 return month12Amount;
407 }
408
409
410
411
412 public void setMonth12Amount(KualiDecimal month12Amount) {
413 this.month12Amount = month12Amount;
414 }
415
416
417
418
419 public KualiDecimal getMonth13Amount() {
420 return month13Amount;
421 }
422
423
424
425
426 public void setMonth13Amount(KualiDecimal month13Amount) {
427 this.month13Amount = month13Amount;
428 }
429
430
431
432
433 public KualiDecimal getMonth1Amount() {
434 return month1Amount;
435 }
436
437
438
439
440 public void setMonth1Amount(KualiDecimal month1Amount) {
441 this.month1Amount = month1Amount;
442 }
443
444
445
446
447 public KualiDecimal getMonth2Amount() {
448 return month2Amount;
449 }
450
451
452
453
454 public void setMonth2Amount(KualiDecimal month2Amount) {
455 this.month2Amount = month2Amount;
456 }
457
458
459
460
461 public KualiDecimal getMonth3Amount() {
462 return month3Amount;
463 }
464
465
466
467
468 public void setMonth3Amount(KualiDecimal month3Amount) {
469 this.month3Amount = month3Amount;
470 }
471
472
473
474
475 public KualiDecimal getMonth4Amount() {
476 return month4Amount;
477 }
478
479
480
481
482 public void setMonth4Amount(KualiDecimal month4Amount) {
483 this.month4Amount = month4Amount;
484 }
485
486
487
488
489 public KualiDecimal getMonth5Amount() {
490 return month5Amount;
491 }
492
493
494
495
496 public void setMonth5Amount(KualiDecimal month5Amount) {
497 this.month5Amount = month5Amount;
498 }
499
500
501
502
503 public KualiDecimal getMonth6Amount() {
504 return month6Amount;
505 }
506
507
508
509
510 public void setMonth6Amount(KualiDecimal month6Amount) {
511 this.month6Amount = month6Amount;
512 }
513
514
515
516
517 public KualiDecimal getMonth7Amount() {
518 return month7Amount;
519 }
520
521
522
523
524 public void setMonth7Amount(KualiDecimal month7Amount) {
525 this.month7Amount = month7Amount;
526 }
527
528
529
530
531 public KualiDecimal getMonth8Amount() {
532 return month8Amount;
533 }
534
535
536
537
538 public void setMonth8Amount(KualiDecimal month8Amount) {
539 this.month8Amount = month8Amount;
540 }
541
542
543
544
545 public KualiDecimal getMonth9Amount() {
546 return month9Amount;
547 }
548
549
550
551
552 public void setMonth9Amount(KualiDecimal month9Amount) {
553 this.month9Amount = month9Amount;
554 }
555
556
557
558
559 public String getObjectCode() {
560 return objectCode;
561 }
562
563
564
565
566 public void setObjectCode(String objectCode) {
567 this.objectCode = objectCode;
568 }
569
570
571
572
573 public String getObjectTypeCode() {
574 return objectTypeCode;
575 }
576
577
578
579
580 public void setObjectTypeCode(String objectTypeCode) {
581 this.objectTypeCode = objectTypeCode;
582 }
583
584
585
586
587 public String getSubAccountNumber() {
588 return subAccountNumber;
589 }
590
591
592
593
594 public void setSubAccountNumber(String subAccountNumber) {
595 this.subAccountNumber = subAccountNumber;
596 }
597
598
599
600
601 public String getSubObjectCode() {
602 return subObjectCode;
603 }
604
605
606
607
608 public void setSubObjectCode(String subObjectCode) {
609 this.subObjectCode = subObjectCode;
610 }
611
612
613
614
615 public Date getTimestamp() {
616 return timestamp;
617 }
618
619
620
621
622 public void setTimestamp(Date timestamp) {
623 this.timestamp = timestamp;
624 }
625
626
627
628
629 public Integer getUniversityFiscalYear() {
630 return universityFiscalYear;
631 }
632
633
634
635
636 public void setUniversityFiscalYear(Integer universityFiscalYear) {
637 this.universityFiscalYear = universityFiscalYear;
638 }
639
640
641
642
643
644
645 public Chart getChart() {
646 return chart;
647 }
648
649
650
651
652
653
654 public void setChart(Chart chart) {
655 this.chart = chart;
656 }
657
658
659
660
661
662
663 public Account getAccount() {
664 return account;
665 }
666
667
668
669
670
671
672 public void setAccount(Account account) {
673 this.account = account;
674 }
675
676
677
678
679
680
681 public TransientBalanceInquiryAttributes getDummyBusinessObject() {
682 return dummyBusinessObject;
683 }
684
685
686
687
688
689
690 public void setDummyBusinessObject(TransientBalanceInquiryAttributes dummyBusinessObject) {
691 this.dummyBusinessObject = dummyBusinessObject;
692 }
693
694
695
696
697
698
699 public ObjectCode getFinancialObject() {
700 return financialObject;
701 }
702
703
704
705
706
707
708 public void setFinancialObject(ObjectCode financialObject) {
709 this.financialObject = financialObject;
710 }
711
712
713
714
715
716
717 public BalanceType getBalanceType() {
718 return balanceType;
719 }
720
721
722
723
724
725
726 public void setBalanceType(BalanceType balanceType) {
727 this.balanceType = balanceType;
728 }
729
730
731
732
733
734
735 public SubObjectCode getFinancialSubObject() {
736 return financialSubObject;
737 }
738
739
740
741
742
743
744 public void setFinancialSubObject(SubObjectCode financialSubObject) {
745 this.financialSubObject = financialSubObject;
746 }
747
748
749
750
751
752
753 public SubAccount getSubAccount() {
754 return subAccount;
755 }
756
757
758
759
760
761
762 public void setSubAccount(SubAccount subAccount) {
763 this.subAccount = subAccount;
764 }
765
766
767
768
769
770
771 public ObjectType getObjectType() {
772 return objectType;
773 }
774
775
776
777
778
779
780 public void setObjectType(ObjectType objectType) {
781 this.objectType = objectType;
782 }
783
784
785
786
787
788
789 public PriorYearAccount getPriorYearAccount() {
790 return priorYearAccount;
791 }
792
793
794
795
796
797
798 public void setPriorYearAccount(PriorYearAccount priorYearAccount) {
799 this.priorYearAccount = priorYearAccount;
800 }
801
802 private String fundGroup;
803 private KualiDecimal yearBalance = KualiDecimal.ZERO;
804 private KualiDecimal yearToDayBalance = KualiDecimal.ZERO;
805
806
807
808
809
810 public String getFundGroup() {
811 return fundGroup;
812 }
813
814
815
816
817
818 public void setFundGroup(String fundGroup) {
819 this.fundGroup = fundGroup;
820 }
821
822
823
824
825
826 public KualiDecimal getYearBalance() {
827 return yearBalance;
828 }
829
830
831
832
833
834 public void setYearBalance(KualiDecimal yearBalance) {
835 this.yearBalance = yearBalance;
836 }
837
838
839
840
841
842 public KualiDecimal getYearToDayBalance() {
843 return yearToDayBalance;
844 }
845
846
847
848
849
850 public void setYearToDayBalance(KualiDecimal yearToDayBalance) {
851 this.yearToDayBalance = yearToDayBalance;
852 }
853
854
855 public KualiDecimal getCombinedBeginningBalanceAmount() {
856 KualiDecimal combinedBeginningBalanceAmount;
857 combinedBeginningBalanceAmount = KualiDecimal.ZERO;
858 combinedBeginningBalanceAmount = combinedBeginningBalanceAmount.add(getBeginningBalanceLineAmount());
859 combinedBeginningBalanceAmount = combinedBeginningBalanceAmount.add(getContractsGrantsBeginningBalanceAmount());
860 return combinedBeginningBalanceAmount;
861 }
862 }