1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.timesummary;
17
18 import java.io.Serializable;
19 import java.math.BigDecimal;
20 import java.util.HashMap;
21 import java.util.Map;
22
23 import org.kuali.kpme.core.util.HrConstants;
24 import org.kuali.kpme.tklm.api.time.timesummary.AssignmentRowContract;
25
26 public class AssignmentRow implements Serializable, AssignmentRowContract {
27
28 private static final long serialVersionUID = 5550424832906084957L;
29
30 private String descr;
31 private String assignmentKey;
32 private String cssClass;
33
34 private EarnCodeSection earnCodeSection;
35 private BigDecimal periodTotal = BigDecimal.ZERO;
36
37 private Map<Integer,AssignmentColumn> assignmentColumns = new HashMap<Integer, AssignmentColumn>();
38
39 public String getDescr() {
40 return descr;
41 }
42
43 public void setDescr(String descr) {
44 this.descr = descr;
45 }
46
47 public String getAssignmentKey() {
48 return assignmentKey;
49 }
50
51 public void setAssignmentKey(String assignmentKey) {
52 this.assignmentKey = assignmentKey;
53 }
54
55 public String getCssClass() {
56 return cssClass;
57 }
58
59 public void setCssClass(String cssClass) {
60 this.cssClass = cssClass;
61 }
62
63 public EarnCodeSection getEarnCodeSection() {
64 return earnCodeSection;
65 }
66
67 public void setEarnCodeSection(EarnCodeSection earnCodeSection) {
68 this.earnCodeSection = earnCodeSection;
69 }
70
71 public BigDecimal getPeriodTotal() {
72 return periodTotal;
73 }
74
75 public void setPeriodTotal(BigDecimal periodTotal) {
76 this.periodTotal = periodTotal;
77 }
78
79 public Map<Integer, AssignmentColumn> getAssignmentColumns() {
80 return assignmentColumns;
81 }
82
83 public void setAssignmentColumns(
84 Map<Integer, AssignmentColumn> assignmentColumns) {
85 this.assignmentColumns = assignmentColumns;
86 }
87
88 public void addAssignmentColumn(Integer index, AssignmentColumn assignmentColumn) {
89 this.assignmentColumns.put(index,assignmentColumn);
90 }
91
92 public void addToAmount(int index, BigDecimal amount) {
93 if (amount != null) {
94 if (0 <= index && index <= getAssignmentColumns().size()) {
95 AssignmentColumn assignmentColumn = getAssignmentColumns().get(index);
96 BigDecimal newAmount = assignmentColumn.getAmount().add(amount, HrConstants.MATH_CONTEXT);
97 assignmentColumn.setAmount(newAmount);
98 }
99 }
100 }
101
102 public void addToTotal(int index, BigDecimal total) {
103 if (total != null) {
104 if (0 <= index && index <= getAssignmentColumns().size()) {
105 AssignmentColumn assignmentColumn = getAssignmentColumns().get(index);
106 BigDecimal newTotal = assignmentColumn.getTotal().add(total, HrConstants.MATH_CONTEXT);
107 assignmentColumn.setTotal(newTotal);
108 getEarnCodeSection().addToTotal(index-1, total);
109 periodTotal = periodTotal.add(total);
110 }
111 }
112 }
113
114 public void addWeeklyTotal(int index, int weekSize) {
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142 }
143
144 }