|
@@ -14,7 +14,7 @@ import java.util.*;
|
|
|
/**
|
|
|
* @author cjz
|
|
|
* @date 2024/9/12 11:12
|
|
|
- * @description:薪酬计提提交后自动审核,保存前计算汇总分离
|
|
|
+ * @description:薪酬计提提交后自动审核,保存前计算汇总分录
|
|
|
*/
|
|
|
public class SubAndAudFormPlugin extends AbstractListPlugin implements Plugin {
|
|
|
|
|
@@ -166,8 +166,8 @@ public class SubAndAudFormPlugin extends AbstractListPlugin implements Plugin {
|
|
|
//当前单据分录类型
|
|
|
String nckd_entrytype=dynamicObject.getString("nckd_entrytype");
|
|
|
|
|
|
- //计算汇总分录
|
|
|
- if ("save".equals(source.getOperateKey())){
|
|
|
+ //保存前,计算汇总分录
|
|
|
+ if ("save".equals(source.getOperateKey())||"countall".equals(source.getOperateKey())){
|
|
|
//先清空汇总分录分录
|
|
|
this.getModel().deleteEntryData("nckd_allentry");
|
|
|
//分录类型为通用薪酬一般员工
|
|
@@ -194,6 +194,7 @@ public class SubAndAudFormPlugin extends AbstractListPlugin implements Plugin {
|
|
|
String allentrtlist="nckd_allearlytired";
|
|
|
countEntry(dynamicObject,entrylist,propername,dep,allentrtlist);
|
|
|
}
|
|
|
+ //分录类型为通用薪酬退休
|
|
|
if ("C".equals(nckd_entrytype)) {
|
|
|
//字段标识
|
|
|
String entrylist="nckd_retired";
|
|
@@ -205,6 +206,7 @@ public class SubAndAudFormPlugin extends AbstractListPlugin implements Plugin {
|
|
|
String allentrtlist="nckd_allretired";
|
|
|
countEntry(dynamicObject,entrylist,propername,dep,allentrtlist);
|
|
|
}
|
|
|
+ //分录类型为人力薪酬(一般员工)
|
|
|
if ("D".equals(nckd_entrytype)) {
|
|
|
//字段标识
|
|
|
String entrylist="nckd_pay";
|
|
@@ -216,6 +218,7 @@ public class SubAndAudFormPlugin extends AbstractListPlugin implements Plugin {
|
|
|
String allentrtlist="nckd_allpay";
|
|
|
countEntry(dynamicObject,entrylist,propername,dep,allentrtlist);
|
|
|
}
|
|
|
+ //分录类型为人力薪酬(内退)
|
|
|
if ("E".equals(nckd_entrytype)) {
|
|
|
//字段标识
|
|
|
String entrylist="nckd_payretird";
|
|
@@ -257,43 +260,38 @@ public class SubAndAudFormPlugin extends AbstractListPlugin implements Plugin {
|
|
|
}
|
|
|
|
|
|
//几个不同部门则循环几次
|
|
|
- for (int j=0;j<depList.size();j++)
|
|
|
- {
|
|
|
- DynamicObject bumen=depList.get(j);
|
|
|
+ for (DynamicObject bumen : depList) {
|
|
|
//某部门总数据
|
|
|
- List<BigDecimal> sumNum=new ArrayList<>();
|
|
|
+ List<BigDecimal> sumNum = new ArrayList<>();
|
|
|
//汇总表部门list初始化
|
|
|
- for (int b=0;b<nckd_generalemployees.size();b++) {
|
|
|
+ for (int b = 0; b < nckd_generalemployees.size(); b++) {
|
|
|
sumNum.add(new BigDecimal("0.0"));
|
|
|
}
|
|
|
//计算一个部门汇总
|
|
|
- for (int i=0;i<staffentry.size();i++)
|
|
|
- {
|
|
|
+ for (DynamicObject object : staffentry) {
|
|
|
//获取所在部门
|
|
|
- DynamicObject department=staffentry.get(i).getDynamicObject(dep);
|
|
|
+ DynamicObject department = object.getDynamicObject(dep);
|
|
|
//相同部门则累加金额数据
|
|
|
if (department.equals(bumen)) {
|
|
|
- for (int a=0;a<nckd_generalemployees.size();a++)
|
|
|
- {
|
|
|
- BigDecimal cell=sumNum.get(a);
|
|
|
+ for (int a = 0; a < nckd_generalemployees.size(); a++) {
|
|
|
+ BigDecimal cell = sumNum.get(a);
|
|
|
//字段标识
|
|
|
- String entry=nckd_generalemployees.get(a);
|
|
|
+ String entry = nckd_generalemployees.get(a);
|
|
|
//i行的a列数据
|
|
|
- BigDecimal num=staffentry.get(i).getBigDecimal(entry);
|
|
|
- cell=cell.add(num);
|
|
|
- sumNum.set(a,cell);
|
|
|
+ BigDecimal num = object.getBigDecimal(entry);
|
|
|
+ cell = cell.add(num);
|
|
|
+ sumNum.set(a, cell);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//创建新的分录行
|
|
|
int rowIndex = this.getModel().createNewEntryRow(nckd_allentry);
|
|
|
//设置部门
|
|
|
- this.getModel().setValue("nckd_all_department",depList.get(j),rowIndex);
|
|
|
- for (int c=0;c<sumNum.size();c++) {
|
|
|
- this.getModel().setValue(entryList(allentrtlist).get(c),sumNum.get(c),rowIndex);
|
|
|
+ this.getModel().setValue("nckd_all_department", bumen, rowIndex);
|
|
|
+ for (int c = 0; c < sumNum.size(); c++) {
|
|
|
+ this.getModel().setValue(entryList(allentrtlist).get(c), sumNum.get(c), rowIndex);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|