付款申请单 候补发票
This commit is contained in:
parent
aeaa780f5f
commit
07e0a66d1c
|
@ -47,11 +47,53 @@ public class SupplementInvoiceBillPlugin extends PaymentApplyEditUI {
|
||||||
if(StringUtil.equals("supplementinvoice", key)) {//候补发票
|
if(StringUtil.equals("supplementinvoice", key)) {//候补发票
|
||||||
log.info("SupplementInvoiceBillPlugin:点击候补发票");
|
log.info("SupplementInvoiceBillPlugin:点击候补发票");
|
||||||
this.beforeNewSubEntry1(args);
|
this.beforeNewSubEntry1(args);
|
||||||
|
}else if(StringUtil.equals("savesupplement", key)) {
|
||||||
|
log.info("SupplementInvoiceBillPlugin:点击后补保存");
|
||||||
|
this.unapplyInvoftaxamtRevise(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unapplyInvoftaxamtRevise(BeforeDoOperationEventArgs args) {
|
||||||
|
int rowIndex = this.getModel().getEntryCurrentRowIndex("entryentity");
|
||||||
|
DynamicObject rowEntity = this.getModel().getEntryRowEntity("entryentity", rowIndex);//获取对应行的单据体
|
||||||
|
BigDecimal applyoftaxamount = rowEntity.getBigDecimal("thisapplyoftax");//获取单据体对应的 本次申请金额⑫
|
||||||
|
BigDecimal totalAmount = this.getSum1("subentryentity", "applyinvoftaxamt");//算出子单据申请金额总和
|
||||||
|
if(applyoftaxamount.compareTo(totalAmount)!=0){
|
||||||
|
this.getView().showTipNotification(
|
||||||
|
"合同付款信息的 本次申请金额\n" +
|
||||||
|
" 不等于 合同进项发票的 本次申请金额总和 ,请重写填写合同进项发票的申请金额",10000);
|
||||||
|
args.setCancel(true);
|
||||||
|
}else {
|
||||||
|
int rowCount = this.getModel().getEntryRowCount("sentimentality");//获取子单据体分录行数
|
||||||
|
DynamicObject[] invArr = new DynamicObject[rowCount];//用于存储发票
|
||||||
|
|
||||||
|
DynamicObjectCollection subentryentitys = rowEntity.getDynamicObjectCollection("subentryentity");
|
||||||
|
for (int i = 0; i < subentryentitys.size(); i++) {
|
||||||
|
Object pkValue = subentryentitys.get(i).getPkValue();
|
||||||
|
log.info("SupplementInvoiceBillPlugin:获取第"+(i+1)+"行主键值"+pkValue.toString());
|
||||||
|
DynamicObject invoice = BusinessDataServiceHelper.loadSingle(pkValue, "ec_in_invoice");
|
||||||
|
log.info("SupplementInvoiceBillPlugin:数据库搜索进项发票"+invoice.getPkValue().toString());
|
||||||
|
BigDecimal applyinvoftaxamt = (BigDecimal)this.getModel().getValue("applyinvoftaxamt", i);//获取申请金额
|
||||||
|
log.info("SupplementInvoiceBillPlugin:本次申请金额"+applyinvoftaxamt);
|
||||||
|
BigDecimal unapplyinvoftaxamt = (BigDecimal)this.getModel().getValue("unapplyinvoftaxamt", i);//获取未申请金额
|
||||||
|
log.info("SupplementInvoiceBillPlugin:未申请金额="+unapplyinvoftaxamt);
|
||||||
|
unapplyinvoftaxamt = unapplyinvoftaxamt.subtract(applyinvoftaxamt);//未申请金额-申请金额
|
||||||
|
log.info("SupplementInvoiceBillPlugin:未申请金额-申请金额="+unapplyinvoftaxamt);
|
||||||
|
if(unapplyinvoftaxamt.compareTo(BigDecimal.ZERO)>=0){
|
||||||
|
this.getModel().setValue("unapplyinvoftaxamt", unapplyinvoftaxamt,i);
|
||||||
|
invoice.set("unapplyamount",unapplyinvoftaxamt);
|
||||||
|
invArr[i] = invoice;
|
||||||
|
}else {
|
||||||
|
this.getView().showTipNotification("合同进项发票信息第"+(i+1)+"行的 本次申请金额不能大于未申请含税金额。",5000);
|
||||||
|
args.setCancel(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
SaveServiceHelper.save(invArr);//发票保存
|
||||||
|
log.info("SupplementInvoiceBillPlugin:发票保存");
|
||||||
|
this.getView().showTipNotification("保存成功");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue