对公报销冲销计算更新及对公报销推付款转换付款明细逻辑更新
This commit is contained in:
parent
38efdbd6ad
commit
15ce2d2b04
|
@ -35,59 +35,23 @@ public class ConvertBillPlugln extends AbstractConvertPlugIn implements Plugin {
|
|||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(sourceBillPK, getSrcMainType().getName());
|
||||
DynamicObjectCollection accountentry = dynamicObject.getDynamicObjectCollection("accountentry");
|
||||
BigDecimal orireceiveamount = accountentry.get(0).getBigDecimal("orireceiveamount"); //实付金额
|
||||
|
||||
DynamicObjectCollection writeoffmoney = dynamicObject.getDynamicObjectCollection("writeoffmoney"); //预付
|
||||
DynamicObjectCollection expenseentryentity = dynamicObject.getDynamicObjectCollection("expenseentryentity"); //预付
|
||||
|
||||
BigDecimal yuf = BigDecimal.ZERO; //预付金额
|
||||
for(int i=0;i<writeoffmoney.size();i++){
|
||||
DynamicObject enry = writeoffmoney.get(i);
|
||||
BigDecimal loanamount = enry.getBigDecimal("loanamount");
|
||||
yuf = yuf.add(loanamount);
|
||||
}
|
||||
if(yuf.compareTo(BigDecimal.ZERO) ==0){
|
||||
return;
|
||||
}
|
||||
|
||||
BigDecimal feiy = BigDecimal.ZERO; //报销金额的合计
|
||||
|
||||
|
||||
for(int i=0;i<expenseentryentity.size();i++){
|
||||
DynamicObject enry = expenseentryentity.get(i);
|
||||
BigDecimal loanamount = enry.getBigDecimal("expenseamount");
|
||||
feiy = feiy.add(loanamount);
|
||||
}
|
||||
|
||||
// BigDecimal proportion = yuf.divide(feiy, 4, 4); // 预付/报销金额 = 已付比例
|
||||
// BigDecimal supro = one.subtract(proportion); // 1-已付比例 = 未付比例
|
||||
|
||||
DynamicObjectCollection expenseentryentity = dynamicObject.getDynamicObjectCollection("expenseentryentity"); //费用明细
|
||||
BigDecimal sfTatalo = BigDecimal.ZERO;
|
||||
BigDecimal zft = BigDecimal.ZERO;
|
||||
|
||||
for(int i=0;i<expenseentryentity.size();i++){
|
||||
|
||||
DynamicObject enry = expenseentryentity.get(i);
|
||||
BigDecimal loanamount = enry.getBigDecimal("expenseamount"); //报销金额
|
||||
BigDecimal supro = loanamount.divide(feiy,4,4);
|
||||
BigDecimal multiply = orireceiveamount.multiply(supro);
|
||||
|
||||
if(i==expenseentryentity.size()-1){
|
||||
multiply = orireceiveamount.subtract(zft);
|
||||
}
|
||||
|
||||
zft =zft.add(multiply);
|
||||
BigDecimal loanamount = enry.getBigDecimal("shkd_verification"); //冲销后金额
|
||||
DynamicObjectCollection entry = contract.getDynamicObjectCollection("entry");
|
||||
entry.get(i).set("e_actamt",multiply); //付款单实付
|
||||
entry.get(i).set("e_payableamt",multiply); //应付
|
||||
entry.get(i).set("e_payablelocamt", multiply);
|
||||
|
||||
entry.get(i).set("e_unsettledlocalamt", multiply);
|
||||
entry.get(i).set("e_unlockamt", multiply);
|
||||
entry.get(i).set("e_unsettledamt", multiply);
|
||||
entry.get(i).set("e_actamt",loanamount); //付款单实付
|
||||
entry.get(i).set("e_payableamt",loanamount); //应付
|
||||
entry.get(i).set("e_payablelocamt", loanamount);
|
||||
entry.get(i).set("e_unsettledlocalamt", loanamount);
|
||||
entry.get(i).set("e_unlockamt", loanamount);
|
||||
entry.get(i).set("e_unsettledamt", loanamount);
|
||||
// entry.get(i).set("e_payableamt", multiply);
|
||||
// entry.get(i).set("e_payablelocamt", multiply);
|
||||
entry.get(i).set("e_localamt", multiply);
|
||||
|
||||
sfTatalo = sfTatalo.add(multiply);
|
||||
entry.get(i).set("e_localamt", loanamount);
|
||||
sfTatalo = sfTatalo.add(loanamount);
|
||||
}
|
||||
|
||||
DynamicObjectCollection entry = contract.getDynamicObjectCollection("entry");
|
||||
|
|
|
@ -138,6 +138,20 @@ public class GenerateSKClickPlugln extends AbstractBillPlugIn implements Plugin
|
|||
}
|
||||
}
|
||||
this.getView().updateView("expenseentryentity");
|
||||
}else {// 若单据类型为薪酬付款时,当存在预付时,为全预付;报销金额被全冲销,冲销后金额为0;反之冲销后金额为报销金额本身
|
||||
DynamicObjectCollection writeoffmoney = this.getModel().getEntryEntity("writeoffmoney");//获取冲借款分录
|
||||
DynamicObjectCollection expenseentryentity = this.getModel().getEntryEntity("expenseentryentity");//获取费用明细分录
|
||||
if (writeoffmoney.size() > 0){
|
||||
for (DynamicObject dynamicObject : expenseentryentity) {
|
||||
dynamicObject.set("shkd_verification",BigDecimal.ZERO);
|
||||
}
|
||||
}else {
|
||||
for (DynamicObject dynamicObject : expenseentryentity) {
|
||||
BigDecimal expenseamount = dynamicObject.getBigDecimal("expenseamount");
|
||||
dynamicObject.set("shkd_verification",expenseamount);
|
||||
}
|
||||
}
|
||||
this.getView().updateView("expenseentryentity");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue