001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.integration.ld;
017
018 import java.util.Collection;
019 import java.util.List;
020 import java.util.Map;
021 import java.util.Set;
022
023 import org.kuali.kfs.coa.businessobject.ObjectCode;
024 import org.kuali.rice.kew.exception.WorkflowException;
025 import org.kuali.rice.kns.util.KualiDecimal;
026
027 /**
028 * This interface is exposing the service methods that may be used by the modules outside of labor
029 */
030 public interface LaborModuleService {
031
032 /**
033 * find the employees who were paid based on a set of specified pay type within the given report periods. Here, a pay type can
034 * be determined by earn code and pay group.
035 *
036 * @param payPeriods the given pay periods
037 * @param balanceTypes the specified balance type codes
038 * @param earnCodePayGroupMap the combination of earn codes and pay groups, where pay group is the key and earn code set is the
039 * value
040 * @return the employees who were paid based on a set of specified pay type within the given report periods
041 */
042 public List<String> findEmployeesWithPayType(Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap);
043
044 /**
045 * determine whether the given employee was paid based on a set of specified pay type within the given report periods. Here, a
046 * pay type can be determined by earn code and pay group.
047 *
048 * @param emplid the given employee id
049 * @param payPeriods the given pay periods
050 * @param balanceTypes the specified balance type codes
051 * @param earnCodePayGroupMap the combination of earn codes and pay groups, where pay group is the key and earn code set is the
052 * value
053 * @return true if the given employee was paid based on a set of specified pay type within the given report periods; otherwise,
054 * false
055 */
056 public boolean isEmployeeWithPayType(String emplid, Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap);
057
058 /**
059 * find all ledger balances matching the given criteria within the given fiscal years
060 *
061 * @param fieldValues the given field values
062 * @param excludedFieldValues the given field values that must not be matched
063 * @param fiscalYears the given fiscal years
064 * @param balanceTypeList the given balance type code list
065 * @param positionObjectGroupCodes the specified position obejct group codes
066 * @return all ledger balances matching the given criteria within the given fiscal years
067 */
068 public Collection<LaborLedgerBalance> findLedgerBalances(Map<String, List<String>> fieldValues, Map<String, List<String>> excludedFieldValues, Set<Integer> fiscalYears, List<String> balanceTypes, List<String> positionObjectGroupCodes);
069
070 /**
071 * calculate the fringe benefit amount for the given labor object and salary amount
072 *
073 * @param laborLedgerObject the given labor object
074 * @param salaryAmount the given salary amount
075 * @return the fringe benefit amount for the given labor object and salary amount
076 */
077 public KualiDecimal calculateFringeBenefitFromLaborObject(LaborLedgerObject laborLedgerObject, KualiDecimal salaryAmount);
078
079 /**
080 * calculate the fringe benefit amount for the given object code and salary amount
081 *
082 * @param fiscalYear the year for object code record
083 * @param chartCode the chart for object code record
084 * @param objectCode the object code
085 * @param salaryAmount amount to calculate benefits for
086 * @return the fringe benefit amount
087 */
088 public KualiDecimal calculateFringeBenefit(Integer fiscalYear, String chartCode, String objectCode, KualiDecimal salaryAmount);
089
090 /**
091 * create and approve a salary expense transfer document generated from the given accounting lines
092 *
093 * @param documentDescription the description about the generated document
094 * @param explanation the explanation for the document
095 * @param annotation the annotation as acknowledgement
096 * @param adHocRecipients the given ad-hoc recipients who will be acknowledged about the document
097 * @param sourceAccoutingLines the given source accounting lines used to populate document
098 * @param targetAccoutingLines the given target accounting lines used to populate document
099 * @throws WorkflowException occurs if the document is failed to be routed for approval
100 */
101 public void createAndBlankApproveSalaryExpenseTransferDocument(String documentDescription, String explanation, String annotation, List<String> adHocRecipients, List<LaborLedgerExpenseTransferAccountingLine> sourceAccoutingLines, List<LaborLedgerExpenseTransferAccountingLine> targetAccoutingLines) throws WorkflowException;
102
103 /**
104 * get the document numbers of the pending salary expense transfer documents for the given employee
105 *
106 * @param emplid the given employee id
107 * @return the document numbers of the pending salary expense transfer documents for the given employee
108 */
109 public int countPendingSalaryExpenseTransfer(String emplid);
110
111 /**
112 * retrieves a specific LaborLedgerObject from the database using primary key
113 *
114 * @param fiscalYear the given fiscal year
115 * @param chartOfAccountsCode the given chart of accounts code
116 * @param objectCode the given object code
117 * @return a labor object retrieved based on the given information
118 */
119 public LaborLedgerObject retrieveLaborLedgerObject(Integer fiscalYear, String chartOfAccountsCode, String objectCode);
120
121 /**
122 * retrieves a specific LaborLedgerObject based on the information of the given financial object
123 *
124 * @param financialObject the given financial object
125 * @return a labor object retrieved based on the given information
126 */
127 public LaborLedgerObject retrieveLaborLedgerObject(ObjectCode financialObject);
128
129 /**
130 * Retrieves LaborLedgerPositionObjectBenefits for a LaborLedgerObject key
131 *
132 * @param fiscalYear the given fiscal year
133 * @param chartOfAccountsCode the given chart of accounts code
134 * @param objectCode the given object code
135 * @return a labor position object benefit retrieved based on the given information
136 */
137 public List<LaborLedgerPositionObjectBenefit> retrieveLaborPositionObjectBenefits(Integer fiscalYear, String chartOfAccountsCode, String objectCode);
138
139 /**
140 * Does the given account have any labor ledger entries? It is necessary to check this before closing an account.
141 *
142 * @param account the given account
143 * @return true if there is a pending entry for the given account; otherwise, return false
144 */
145 public boolean hasPendingLaborLedgerEntry(String chartOfAccountsCode, String accountNumber);
146
147 /**
148 * Determines whether the given set of accounting lines have object codes that receieve fringe benefits
149 *
150 * @param fiscalYear the fiscal year of the document
151 * @param chartOfAccountsCode chart of accounts code to check
152 * @param financialObjectCode financialObjectCode to check
153 * @return true if the lines include lines with labor object codes, false otherwise
154 */
155 public boolean hasFringeBenefitProducingObjectCodes(Integer fiscalYear, String chartOfAccountsCode, String financialObjectCode);
156
157 /**
158 * Counts the number of entries in a group
159 *
160 * @param the id of an origin entry group
161 * @return the count of the entries in that group
162 */
163 //public Integer getLaborOriginEntryGroupCount(Integer groupId);
164
165 /**
166 * Determines where a Labor Ledger postion object group with the given code actually exists.
167 *
168 * @param positionObjectGroupCode the code of the position object group to check for existence
169 * @return true if the position object group exists, false otherwise
170 */
171 public boolean doesLaborLedgerPositionObjectGroupExist(String positionObjectGroupCode);
172 }