1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.fp.businessobject;
17
18 import java.util.Map;
19
20 import org.kuali.ole.sys.businessobject.AccountingLine;
21 import org.kuali.rice.core.api.util.type.KualiDecimal;
22 import org.kuali.rice.core.api.util.type.KualiInteger;
23
24
25
26
27
28 public class BudgetAdjustmentAccountingLineUtil {
29
30
31
32
33
34 public static void init(BudgetAdjustmentAccountingLine accountingLine) {
35 accountingLine.setCurrentBudgetAdjustmentAmount(KualiDecimal.ZERO);
36 accountingLine.setBaseBudgetAdjustmentAmount(KualiInteger.ZERO);
37 accountingLine.setFinancialDocumentMonth1LineAmount(KualiDecimal.ZERO);
38 accountingLine.setFinancialDocumentMonth2LineAmount(KualiDecimal.ZERO);
39 accountingLine.setFinancialDocumentMonth3LineAmount(KualiDecimal.ZERO);
40 accountingLine.setFinancialDocumentMonth4LineAmount(KualiDecimal.ZERO);
41 accountingLine.setFinancialDocumentMonth5LineAmount(KualiDecimal.ZERO);
42 accountingLine.setFinancialDocumentMonth6LineAmount(KualiDecimal.ZERO);
43 accountingLine.setFinancialDocumentMonth7LineAmount(KualiDecimal.ZERO);
44 accountingLine.setFinancialDocumentMonth8LineAmount(KualiDecimal.ZERO);
45 accountingLine.setFinancialDocumentMonth9LineAmount(KualiDecimal.ZERO);
46 accountingLine.setFinancialDocumentMonth10LineAmount(KualiDecimal.ZERO);
47 accountingLine.setFinancialDocumentMonth11LineAmount(KualiDecimal.ZERO);
48 accountingLine.setFinancialDocumentMonth12LineAmount(KualiDecimal.ZERO);
49 accountingLine.setFringeBenefitIndicator(false);
50 }
51
52
53
54
55
56
57
58
59 public static Map appendToValuesMap(Map simpleValues, BudgetAdjustmentAccountingLine accountingLine) {
60 simpleValues.put("currentBudgetAdjustmentAmount", accountingLine.getCurrentBudgetAdjustmentAmount());
61 simpleValues.put("baseBudgetAdjustmentAmount", accountingLine.getBaseBudgetAdjustmentAmount());
62 simpleValues.put("financialDocumentMonth1LineAmount", accountingLine.getFinancialDocumentMonth1LineAmount());
63 simpleValues.put("financialDocumentMonth2LineAmount", accountingLine.getFinancialDocumentMonth2LineAmount());
64 simpleValues.put("financialDocumentMonth3LineAmount", accountingLine.getFinancialDocumentMonth3LineAmount());
65 simpleValues.put("financialDocumentMonth4LineAmount", accountingLine.getFinancialDocumentMonth4LineAmount());
66 simpleValues.put("financialDocumentMonth5LineAmount", accountingLine.getFinancialDocumentMonth5LineAmount());
67 simpleValues.put("financialDocumentMonth6LineAmount", accountingLine.getFinancialDocumentMonth6LineAmount());
68 simpleValues.put("financialDocumentMonth7LineAmount", accountingLine.getFinancialDocumentMonth7LineAmount());
69 simpleValues.put("financialDocumentMonth8LineAmount", accountingLine.getFinancialDocumentMonth8LineAmount());
70 simpleValues.put("financialDocumentMonth9LineAmount", accountingLine.getFinancialDocumentMonth9LineAmount());
71 simpleValues.put("financialDocumentMonth10LineAmount", accountingLine.getFinancialDocumentMonth10LineAmount());
72 simpleValues.put("financialDocumentMonth11LineAmount", accountingLine.getFinancialDocumentMonth11LineAmount());
73 simpleValues.put("financialDocumentMonth12LineAmount", accountingLine.getFinancialDocumentMonth12LineAmount());
74
75 return simpleValues;
76 }
77
78
79
80
81
82
83
84 public static void copyFrom(BudgetAdjustmentAccountingLine toLine, AccountingLine other) {
85 if (BudgetAdjustmentAccountingLine.class.isAssignableFrom(other.getClass())) {
86 BudgetAdjustmentAccountingLine fromLine = (BudgetAdjustmentAccountingLine) other;
87 if (toLine != fromLine) {
88 toLine.setCurrentBudgetAdjustmentAmount(fromLine.getCurrentBudgetAdjustmentAmount());
89 toLine.setBaseBudgetAdjustmentAmount(fromLine.getBaseBudgetAdjustmentAmount());
90 toLine.setFinancialDocumentMonth1LineAmount(fromLine.getFinancialDocumentMonth1LineAmount());
91 toLine.setFinancialDocumentMonth2LineAmount(fromLine.getFinancialDocumentMonth2LineAmount());
92 toLine.setFinancialDocumentMonth3LineAmount(fromLine.getFinancialDocumentMonth3LineAmount());
93 toLine.setFinancialDocumentMonth4LineAmount(fromLine.getFinancialDocumentMonth4LineAmount());
94 toLine.setFinancialDocumentMonth5LineAmount(fromLine.getFinancialDocumentMonth5LineAmount());
95 toLine.setFinancialDocumentMonth6LineAmount(fromLine.getFinancialDocumentMonth6LineAmount());
96 toLine.setFinancialDocumentMonth7LineAmount(fromLine.getFinancialDocumentMonth7LineAmount());
97 toLine.setFinancialDocumentMonth8LineAmount(fromLine.getFinancialDocumentMonth8LineAmount());
98 toLine.setFinancialDocumentMonth9LineAmount(fromLine.getFinancialDocumentMonth9LineAmount());
99 toLine.setFinancialDocumentMonth10LineAmount(fromLine.getFinancialDocumentMonth10LineAmount());
100 toLine.setFinancialDocumentMonth11LineAmount(fromLine.getFinancialDocumentMonth11LineAmount());
101 toLine.setFinancialDocumentMonth12LineAmount(fromLine.getFinancialDocumentMonth12LineAmount());
102 toLine.setFringeBenefitIndicator(fromLine.isFringeBenefitIndicator());
103 }
104 }
105 }
106
107
108
109
110
111
112 public static KualiDecimal getMonthlyLinesTotal(BudgetAdjustmentAccountingLine accountingLine) {
113 KualiDecimal total = KualiDecimal.ZERO;
114 if (accountingLine.getFinancialDocumentMonth1LineAmount() != null) {
115 total = total.add(accountingLine.getFinancialDocumentMonth1LineAmount());
116 }
117 if (accountingLine.getFinancialDocumentMonth2LineAmount() != null) {
118 total = total.add(accountingLine.getFinancialDocumentMonth2LineAmount());
119 }
120 if (accountingLine.getFinancialDocumentMonth3LineAmount() != null) {
121 total = total.add(accountingLine.getFinancialDocumentMonth3LineAmount());
122 }
123 if (accountingLine.getFinancialDocumentMonth4LineAmount() != null) {
124 total = total.add(accountingLine.getFinancialDocumentMonth4LineAmount());
125 }
126 if (accountingLine.getFinancialDocumentMonth5LineAmount() != null) {
127 total = total.add(accountingLine.getFinancialDocumentMonth5LineAmount());
128 }
129 if (accountingLine.getFinancialDocumentMonth6LineAmount() != null) {
130 total = total.add(accountingLine.getFinancialDocumentMonth6LineAmount());
131 }
132 if (accountingLine.getFinancialDocumentMonth7LineAmount() != null) {
133 total = total.add(accountingLine.getFinancialDocumentMonth7LineAmount());
134 }
135 if (accountingLine.getFinancialDocumentMonth8LineAmount() != null) {
136 total = total.add(accountingLine.getFinancialDocumentMonth8LineAmount());
137 }
138 if (accountingLine.getFinancialDocumentMonth9LineAmount() != null) {
139 total = total.add(accountingLine.getFinancialDocumentMonth9LineAmount());
140 }
141 if (accountingLine.getFinancialDocumentMonth10LineAmount() != null) {
142 total = total.add(accountingLine.getFinancialDocumentMonth10LineAmount());
143 }
144 if (accountingLine.getFinancialDocumentMonth11LineAmount() != null) {
145 total = total.add(accountingLine.getFinancialDocumentMonth11LineAmount());
146 }
147 if (accountingLine.getFinancialDocumentMonth12LineAmount() != null) {
148 total = total.add(accountingLine.getFinancialDocumentMonth12LineAmount());
149 }
150 return total;
151 }
152
153 }