[费用报销]工作流根据费用类型判断是否超预算
金蝶云社区-云社区用户62395050
云社区用户62395050
0人赞赏了该文章 4,627次浏览 未经作者许可,禁止转载编辑于2014年02月08日 11:15:06

//得到当前单据信息,判断费用报销单是否超预算
//注意:需要在流程变量中定义:isPass (boolean) 用于后续判断;AuditMessage (字符串)可用于输出
//获取分录
com.kingdee.eas.cp.bc.BizAccountBillEntryCollection oebec = com.kingdee.eas.cp.bc.BizAccountBillEntryFactory.getLocalInstance(__bosContext).getBizAccountBillEntryCollection("where bill='"+id+"'");
//获取预算
com.kingdee.eas.ma.budget.IBudgetCtrlFacade ibf = com.kingdee.eas.ma.budget.BudgetCtrlFacadeFactory.getLocalInstance(__bosContext);
com.kingdee.eas.ma.budget.BgCtrlResultCollection bcr = new com.kingdee.eas.ma.budget.BgCtrlResultCollection();
//取预算控制策略
bcr = ibf.getBudget(id);
isPass = true;
//循环预算方案
if(bcr.size()>0 && bcr.get(0).getBalance()!=null){
for(int i=0;i //取预算余额
java.math.BigDecimal yue = bcr.get(i).getBalance();
//2015-3-11 15:48:08 更新内容
if(yue==null){
break;//根据控制策略没有找到预算余额,跳出for循环
}

//取预算项目
java.lang.String ExpenseType = bcr.get(i).getBillItemNumber();
//循环分录
for(int m=0;m oebe = oebec.get(m);
//取分录的申请金额
java.math.BigDecimal amount = oebe.getAmount();
com.kingdee.bos.util.BOSUuid feeTypeuuid = oebe.getExpenseType().getId();
com.kingdee.eas.cp.bc.IExpenseType iet = com.kingdee.eas.cp.bc.ExpenseTypeFactory.getLocalInstance(__bosContext);
com.kingdee.eas.cp.bc.ExpenseTypeInfo eti = iet.getExpenseTypeInfo(new com.kingdee.bos.dao.ormapping.ObjectUuidPK(feeTypeuuid));
java.lang.String feeType = eti.getNumber();

//2015-3-11 15:48:23 更新内容
if(AuditMessage==null)
AuditMessage="\n第"+(i+1)+"次循环;"+"预算余额:"+yue.intValue()+"申请金额:"+amount.intValue();
else
AuditMessage=AuditMessage+"\n第"+(i+1)+"次循环;"+"预算余额:"+yue.intValue()+"申请金额:"+amount.intValue();

//判断:如果费用类型一致并且,申请金额大于预算余额则isPass = false
if(feeType.equals(ExpenseType) && ((amount.intValue()-yue.intValue())>0)){
isPass = false;
break;//跳出for循环 也就是只要有其中一条分录出现为空
}
}
}
}

if(isPass){
AuditMessage = "请审批费用报销单"+number+"!";
}else{
AuditMessage = "请审批超预算费用报销单"+number+"!!!";
}

不同的单据 不同类
序时簿 单据编辑界面 实体 表格 WEB页面序时薄 WEB页面编辑页面
AccountBillListUI
//审核通过的单据 进行反审核返还预算
//费用申请单
OtherExpenseReqListUI OtherExpenseEditUI OtherExpenseBill T_BC_OtherExpenseBill OtherExpenseBillListBean OtherExpenseBillEditBean
//借款单 floanstate N P Y
LoanReqListUI DailyLoanBillEditUI DailyLoanBill T_BC_DailyLoanBill DailyLoanBillListBean DailyLoanBillEditBean
famountbalance 末还款金额
//费用报销单 ExpenseAccountEditUI
BizExpenseAccountListUI BizAccountEditUI BizAccountBill T_BC_BizAccountBill BizAccountBillListBean BizAccountBillEditBean
//出差申请单
EvectionReqBillListUI EvectionReqBillEditUI EvectionReqBill T_BC_EvectionReqBill EvectionReqBillListBean EvectionReqBillEditBean
//出差借款单
EvectionLoanBillListUI EvectionLoanBillEditUI EvectionLoanBill T_BC_EvectionLoanBill EvectionLoanBillListBean EvectionLoanBillEditBean
// 物品采购费用报销单
DailyExpenseAccountListUI DailyAccountEditUI DailyPurchaseAccountBill T_BC_DailyPurchaseAccountBill

//差旅费报销单
TravelExpenseAccountListUI TravelAccountEditUI TravelAccountBill T_BC_TravelAccountBill TravelAccountBillListBean TravelAccountBillEditBean