1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.leave.payout.web;
17
18 import java.math.BigDecimal;
19 import java.util.Date;
20
21 import javax.servlet.http.HttpServletRequest;
22
23 import org.apache.commons.lang.StringUtils;
24 import org.joda.time.LocalDate;
25 import org.kuali.kpme.core.accrualcategory.AccrualCategory;
26 import org.kuali.kpme.core.earncode.EarnCode;
27 import org.kuali.kpme.core.service.HrServiceLocator;
28 import org.kuali.kpme.core.util.HrConstants;
29 import org.kuali.kpme.tklm.leave.payout.LeavePayout;
30 import org.kuali.rice.kns.util.ActionFormUtilMap;
31 import org.kuali.rice.kns.util.WebUtils;
32 import org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase;
33
34 public class LeavePayoutForm extends KualiTransactionalDocumentFormBase {
35
36
37
38
39 private static final long serialVersionUID = 1L;
40 private LeavePayout leavePayout;
41 private String leavePayoutId;
42 private String accrualCategoryRule;
43 private String principalId;
44 private String earnCode;
45 private String fromAccrualCategory;
46 private BigDecimal payoutAmount;
47 private BigDecimal forfeitedAmount;
48 private Date effectiveDate;
49 private String leaveCalendarDocumentId;
50 private String type;
51 private boolean onLeaveApproval;
52 private boolean timesheet;
53
54 public Date getEffectiveDate() {
55 return effectiveDate;
56 }
57
58 public void setEffectiveDate(Date effectiveDate) {
59 this.effectiveDate = effectiveDate;
60 }
61
62 public String getPrincipalId() {
63 return principalId;
64 }
65
66 public void setPrincipalId(String principalId) {
67 this.principalId = principalId;
68 }
69
70 public String getEarnCode() {
71 return earnCode;
72 }
73
74 public void setEarnCode(String earnCode) {
75 this.earnCode = earnCode;
76 }
77
78 public String getFromAccrualCategory() {
79 return fromAccrualCategory;
80 }
81
82 public void setFromAccrualCategory(String fromAccrualCategory) {
83 this.fromAccrualCategory = fromAccrualCategory;
84 }
85
86 public BigDecimal getPayoutAmount() {
87 return payoutAmount;
88 }
89
90 public void setPayoutAmount(BigDecimal payoutAmount) {
91 this.payoutAmount = payoutAmount;
92 }
93
94 public BigDecimal getForfeitedAmount() {
95 return forfeitedAmount;
96 }
97
98 public void setForfeitedAmount(BigDecimal forfeitedAmount) {
99 this.forfeitedAmount = forfeitedAmount;
100 }
101
102 public String getLeavePayoutId() {
103 return leavePayoutId;
104 }
105
106 public void setLeavePayoutId(String leavePayoutId) {
107 this.leavePayoutId = leavePayoutId;
108 }
109
110 public String getAccrualCategoryRule() {
111 return accrualCategoryRule;
112 }
113
114 public void setAccrualCategoryRule(String accrualCategoryRule) {
115 this.accrualCategoryRule = accrualCategoryRule;
116 }
117
118 public EarnCode getPayoutEarnCodeObj() {
119 return HrServiceLocator.getEarnCodeService().getEarnCode(earnCode, LocalDate.fromDateFields(effectiveDate));
120 }
121
122 public AccrualCategory getDebitedAccrualCategory() {
123 return HrServiceLocator.getAccrualCategoryService().getAccrualCategory(fromAccrualCategory, LocalDate.fromDateFields(effectiveDate));
124 }
125
126 @Override
127 public String getBackLocation() {
128 return "LeaveCalendarSubmit.do?methodToCall=approveLeaveCalendar";
129 }
130
131 @Override
132 public void populate(HttpServletRequest request) {
133 super.populate(request);
134 ((ActionFormUtilMap) getActionFormUtilMap()).setCacheValueFinderResults(false);
135
136 if (this.getMethodToCall() == null || StringUtils.isEmpty(this.getMethodToCall())) {
137 setMethodToCall(WebUtils.parseMethodToCall(this, request));
138 }
139 }
140
141 @Override
142 public void addRequiredNonEditableProperties() {
143 super.addRequiredNonEditableProperties();
144 }
145
146 public LeavePayout getLeavePayout() {
147 return leavePayout;
148 }
149
150 public void setLeavePayout(LeavePayout leavePayout) {
151 this.leavePayout = leavePayout;
152 }
153
154 public String getLeaveCalendarDocumentId() {
155 return leaveCalendarDocumentId;
156 }
157
158 public void setLeaveCalendarDocumentId(String leaveCalendarDocId) {
159 this.leaveCalendarDocumentId = leaveCalendarDocId;
160 }
161
162 public String getType() {
163 return type;
164 }
165
166 public void setType(String type) {
167 this.type = type;
168 }
169
170 public boolean isOnLeaveApproval() {
171 if(StringUtils.equals(type, HrConstants.MAX_BAL_ACTION_FREQ.LEAVE_APPROVE))
172 return true;
173 else
174 return false;
175
176
177 }
178
179 public void setOnLeaveApproval(boolean onLeaveApproval) {
180 this.onLeaveApproval = onLeaveApproval;
181 }
182
183 public void isTimesheet(boolean b) {
184 timesheet = true;
185 }
186
187
188 }