package nc.ui.examine.employee.ace.handler;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pubapp.uif2app.event.IAppEventHandler;
import nc.ui.pubapp.uif2app.event.card.CardBodyAfterEditEvent;
import nc.vo.examine.employee.SonVO;
import nc.vo.pub.lang.UFDouble;
//表体编辑后事件类
public class BodyAfterEditHandler implements IAppEventHandler<CardBodyAfterEditEvent>{
@Override
public void handleAppEvent(CardBodyAfterEditEvent e) {
// TODO 自动生成的方法存根
//BillCardPanel 面板
BillCardPanel billCardPanel = e.getBillCardPanel();
//key 关键字
String key = e.getKey();
int row = e.getRow();
//如果你编辑的这个属性字段为岗位等级
if(key.equals("job_grade")){
//获取字段的值
String jobGradeValue = e.getValue().toString();
//A:1 B:2 C:3 D:4
if(jobGradeValue.equals("1")){
//第一个为要附的值,第二个表体下标,第三个为要修改的表字段
billCardPanel.setBodyValueAt(500.00,row, "job_subsidy");
}else if(jobGradeValue.equals("2")){
billCardPanel.setBodyValueAt(400.00,row, "job_subsidy");
}else if(jobGradeValue.equals("3")){
billCardPanel.setBodyValueAt(300.00,row, "job_subsidy");
}else if(jobGradeValue.equals("4")){
billCardPanel.setBodyValueAt(200.00,row, "job_subsidy");
}
}
if(key.equals("leave_days")){
//获取页面字段值 参数1:表体下标,参数2:字段名
UFDouble jobSalaryValue = (UFDouble) billCardPanel.getBodyValueAt(row, "job_salary");
UFDouble jobSubsidyValue = (UFDouble) billCardPanel.getBodyValueAt(row, "job_subsidy");
UFDouble leaveDaysValue = (UFDouble) billCardPanel.getBodyValueAt(row, "leave_days");
// 实发工资计算逻辑: 实发资 = 岗位资 + 岗位补助 - (请假天数* 100)
UFDouble netPayroll = jobSalaryValue.add(jobSubsidyValue).sub(leaveDaysValue.multiply(100));
billCardPanel.setBodyValueAt(netPayroll,row, "net_payroll");
}
}
}