(function () {
var appId = $.context.getCurrentApplicationId();
//表单名称
var formName = "部门系数管理";
//控件值键对
var conditionMap = new Packages.java.util.HashMap();
var aggregates = $.form.getDocumentsByCondition(appId, formName, conditionMap);
for (var i = 0; i < aggregates.size(); i++) {
var aggregate = aggregates.get(i);
var count1 = aggregate.getElementByName("单位系数").getDoubleValue();
var count2 = aggregate.getElementByName("部门奖金系数").getDoubleValue();
var count4 = aggregate.getElementByName("上月部门剩余奖金").getFloatValue();
var count5 = (count2 / 100).toFixed(4);
//表单名称
var formName1 = "员工基本信息";
//控件值键对
var conditionMap1 = new Packages.java.util.HashMap();
conditionMap1.put("部门", aggregate.getId());
var subDocuments = $.form.getDocumentsByCondition(appId, formName1, conditionMap1);
var number = 0;
var nub = 0;
for (var j = 0; j < subDocuments.size(); j++) {
var subDocument = subDocuments.get(j);
var rank = subDocument.getElementByName("职级1").getValue();
var count3 = subDocument.getElementByName("绩效工资基数").getFloatValue();
if (rank != "部门正职" && rank != "部门副职") {
number = number + count3;
nub = nub + 1;
}
}
aggregate.addElement("本月部门奖金", number * count1 * count5);
aggregate.addElement("部门人数", nub);
aggregate.addElement("部门总金额", number * count1 * count5 + count4);
$.form.saveFormDocument(aggregate, appId);
}
})()
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!