(function() {
var applicationId = $.context.getCurrentApplicationId();
var currentDocument = $.context.getCurrentDocument();
var subDocuments = currentDocument.getElementByName("评分明细").getSubDocuments();
var dertnuber = currentDocument.getElementByName("部门人数").getValue();
var d = currentDocument.getElementByName("部门总奖金").getValue();
var defen = currentDocument.getElementByName("部门得分").getDoubleValue();
currentDocument.addElement("数字", subDocuments.size());
// $.form.saveFormDocument(currentDocument, applicationId);
if (dertnuber == subDocuments.size()) {
}
else {
var message = $.validate.create();
message.addError("本部门还有员工没有自评,不能提交");
//返回默认校验信息集合
return message;
} //$.form.saveFormDocument(currentDocument, applicationId);
var a = 0;
for (var j = 0; j < subDocuments.size(); j++) {
var subDocument = subDocuments.get(j);
var score = subDocument.getElementByName("领导总评分").getValue();
var factor = subDocument.getElementByName("单位奖金系数").getFloatValue();
var coefficient = subDocument.getElementByName("部门奖金系数").getFloatValue();
var achievements = subDocument.getElementByName("绩效金额").getFloatValue();
var x = (coefficient / 100).toFixed(4);
//var userId = subDocument.getElementByName("员工姓名").getValue();
// var identity = subDocument.getElementByName("身份证号").getValue();
var c = score * factor * x * achievements * 0.01;
a = a + c;
if (defen < score) {
var message = $.validate.create();
message.addError("员工得分最高分不能超过部门得分,请修改评分");
//返回默认校验信息集合
return message;
}
}
//currentDocument.addElement("部门剩余金额", Math.round((d-a), 0));
currentDocument.addElement("部门剩余金额", Math.round((d - a), 2));
//$.form.saveFormDocument(currentDocument, applicationId);
})()
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!