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