付款申请单 候补发票
This commit is contained in:
parent
7a2564db6a
commit
bb309726b6
|
@ -7,6 +7,7 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.resource.ResManager;
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
import kd.bos.entity.datamodel.ListSelectedRow;
|
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.form.CloseCallBack;
|
import kd.bos.form.CloseCallBack;
|
||||||
import kd.bos.form.ShowFormHelper;
|
import kd.bos.form.ShowFormHelper;
|
||||||
|
@ -64,49 +65,43 @@ public class SupplementInvoiceBillPlugin extends PaymentApplyEditUI {
|
||||||
}
|
}
|
||||||
int rowIndex = this.getModel().getEntryCurrentRowIndex("entryentity");
|
int rowIndex = this.getModel().getEntryCurrentRowIndex("entryentity");
|
||||||
DynamicObject rowEntity = this.getModel().getEntryRowEntity("entryentity", rowIndex);//获取对应行的单据体
|
DynamicObject rowEntity = this.getModel().getEntryRowEntity("entryentity", rowIndex);//获取对应行的单据体
|
||||||
BigDecimal applyoftaxamount = rowEntity.getBigDecimal("thisapplyoftax");//获取单据体对应的 本次申请金额⑫
|
// BigDecimal applyoftaxamount = rowEntity.getBigDecimal("thisapplyoftax");//获取单据体对应的 本次申请金额⑫
|
||||||
BigDecimal totalAmount = this.getSum1("subentryentity", "applyinvoftaxamt");//算出子单据申请金额总和
|
// BigDecimal totalAmount = this.getSum1("subentryentity", "applyinvoftaxamt");//算出子单据申请金额总和
|
||||||
if(applyoftaxamount.compareTo(totalAmount)!=0){
|
// if(applyoftaxamount.compareTo(totalAmount)!=0){
|
||||||
this.getView().showTipNotification(
|
// this.getView().showTipNotification(
|
||||||
"合同付款信息的 本次申请金额\n" +
|
// "合同付款信息的 本次申请金额\n" +
|
||||||
" 不等于 合同进项发票的 本次申请金额总和 ,请重写填写合同进项发票的申请金额",5000);
|
// " 不等于 合同进项发票的 本次申请金额总和 ,请重写填写合同进项发票的申请金额");
|
||||||
this.getView().showTipNotification("发票保存失败!",5000);
|
// this.getView().showTipNotification("发票保存失败!");
|
||||||
args.setCancel(true);
|
// args.setCancel(true);
|
||||||
}else {
|
// }
|
||||||
// int rowCount = this.getModel().getEntryRowCount("subentryentity");//获取子单据体分录行数
|
// DynamicObject[] invArr = new DynamicObject[rowCount];//用于存储发票
|
||||||
DynamicObject[] invArr = new DynamicObject[rowCount];//用于存储发票
|
|
||||||
|
|
||||||
DynamicObjectCollection subentryentitys = rowEntity.getDynamicObjectCollection("subentryentity");
|
DynamicObjectCollection subentryentitys = rowEntity.getDynamicObjectCollection("subentryentity");
|
||||||
for (int i = 0; i < subentryentitys.size(); i++) {
|
for (int i = 0; i < subentryentitys.size(); i++) {
|
||||||
Object invoiceNum = subentryentitys.get(i).get("invoice");
|
Object invoiceNum = subentryentitys.get(i).get("invoice");
|
||||||
if(invoiceNum!=null){
|
if(invoiceNum!=null){
|
||||||
DynamicObject invObj = (DynamicObject)invoiceNum;
|
DynamicObject invObj = (DynamicObject)invoiceNum;
|
||||||
log.info("SupplementInvoiceBillPlugin:获取第"+(i+1)+"行发票号"+invObj.getLong("id"));
|
log.info("SupplementInvoiceBillPlugin:获取第"+(i+1)+"行发票号"+invObj.getLong("id"));
|
||||||
DynamicObject invoice = BusinessDataServiceHelper.loadSingle(invObj.getLong("id"), "ec_in_invoice");
|
DynamicObject invoice = BusinessDataServiceHelper.loadSingle(invObj.getLong("id"), "ec_in_invoice");
|
||||||
log.info("SupplementInvoiceBillPlugin:数据库搜索进项发票"+invoice.getPkValue().toString());
|
log.info("SupplementInvoiceBillPlugin:数据库搜索进项发票"+invoice.getPkValue().toString());
|
||||||
BigDecimal applyinvoftaxamt = (BigDecimal)this.getModel().getValue("applyinvoftaxamt", i);//获取申请金额
|
// BigDecimal applyinvoftaxamt = (BigDecimal)this.getModel().getValue("applyinvoftaxamt", i);//获取申请金额
|
||||||
log.info("SupplementInvoiceBillPlugin:本次申请金额"+applyinvoftaxamt);
|
// log.info("SupplementInvoiceBillPlugin:本次申请金额"+applyinvoftaxamt);
|
||||||
BigDecimal unapplyinvoftaxamt = (BigDecimal)this.getModel().getValue("unapplyinvoftaxamt", i);//获取未申请金额
|
BigDecimal unapplyinvoftaxamt = (BigDecimal)this.getModel().getValue("unapplyinvoftaxamt", i);//获取未申请金额
|
||||||
log.info("SupplementInvoiceBillPlugin:未申请金额="+unapplyinvoftaxamt);
|
log.info("SupplementInvoiceBillPlugin:未申请金额="+unapplyinvoftaxamt);
|
||||||
unapplyinvoftaxamt = unapplyinvoftaxamt.subtract(applyinvoftaxamt);//未申请金额-申请金额
|
// unapplyinvoftaxamt = unapplyinvoftaxamt.subtract(applyinvoftaxamt);//未申请金额-申请金额
|
||||||
log.info("SupplementInvoiceBillPlugin:未申请金额-申请金额="+unapplyinvoftaxamt);
|
// log.info("SupplementInvoiceBillPlugin:未申请金额-申请金额="+unapplyinvoftaxamt);
|
||||||
if(unapplyinvoftaxamt.compareTo(BigDecimal.ZERO)>=0){
|
if(unapplyinvoftaxamt.compareTo(BigDecimal.ZERO)>=0){
|
||||||
this.getModel().setValue("unapplyinvoftaxamt", unapplyinvoftaxamt,i);
|
// this.getModel().setValue("unapplyinvoftaxamt", unapplyinvoftaxamt,i);
|
||||||
invoice.set("unapplyamount",unapplyinvoftaxamt);
|
invoice.set("unapplyamount",unapplyinvoftaxamt);
|
||||||
invArr[i] = invoice;
|
// invArr[i] = invoice;
|
||||||
SaveServiceHelper.save(new DynamicObject[]{invoice});
|
SaveServiceHelper.save(new DynamicObject[]{invoice});
|
||||||
this.getView().showSuccessNotification("第"+(i+1)+"行发票保存成功",1000);
|
this.getView().showSuccessNotification("第"+(i+1)+"行发票保存成功");
|
||||||
}else {
|
}else {
|
||||||
this.getView().showTipNotification("合同进项发票信息第"+(i+1)+"行的 本次申请金额不能大于未申请含税金额。",5000);
|
this.getView().showTipNotification("合同进项发票信息第"+(i+1)+"行的 本次申请金额不能大于未申请含税金额。");
|
||||||
this.getView().showTipNotification("发票保存失败!",5000);
|
this.getView().showTipNotification("发票保存失败!");
|
||||||
args.setCancel(true);
|
args.setCancel(true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -125,15 +120,16 @@ public class SupplementInvoiceBillPlugin extends PaymentApplyEditUI {
|
||||||
// int rowIndex = e.getChangeSet()[0].getRowIndex();
|
// int rowIndex = e.getChangeSet()[0].getRowIndex();
|
||||||
log.info("SupplementInvoiceBillPlugin:发生变动的字段:"+key);
|
log.info("SupplementInvoiceBillPlugin:发生变动的字段:"+key);
|
||||||
if(StringUtil.equals("applyinvoftaxamt", key)) {
|
if(StringUtil.equals("applyinvoftaxamt", key)) {
|
||||||
log.info("SupplementInvoiceBillPlugin:发票申请金额发生变动,与合同的申请金额进行比较");
|
log.info("SupplementInvoiceBillPlugin:发票申请金额发生变动,与未申请金额进行比较");
|
||||||
this.compareApplyInvoftaxamt1();
|
this.compareApplyInvoftaxamt1(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compareApplyInvoftaxamt1() {
|
private void compareApplyInvoftaxamt1(PropertyChangedArgs e) {
|
||||||
|
this.subtractUnapplyAmount(e);
|
||||||
int rowIndex = this.getModel().getEntryCurrentRowIndex("entryentity");
|
int rowIndex = this.getModel().getEntryCurrentRowIndex("entryentity");
|
||||||
DynamicObject rowEntity = this.getModel().getEntryRowEntity("entryentity", rowIndex);//获取对应行的单据体
|
DynamicObject rowEntity = this.getModel().getEntryRowEntity("entryentity", rowIndex);//获取对应行的单据体
|
||||||
BigDecimal applyoftaxamount = rowEntity.getBigDecimal("thisapplyoftax");//获取单据体对应的 本次申请金额⑫
|
BigDecimal applyoftaxamount = rowEntity.getBigDecimal("thisapplyoftax");//获取单据体对应的 本次申请金额⑫
|
||||||
|
@ -141,7 +137,26 @@ public class SupplementInvoiceBillPlugin extends PaymentApplyEditUI {
|
||||||
if(applyoftaxamount.compareTo(totalAmount)!=0){
|
if(applyoftaxamount.compareTo(totalAmount)!=0){
|
||||||
this.getView().showTipNotification(
|
this.getView().showTipNotification(
|
||||||
"合同付款信息的 本次申请金额\n" +
|
"合同付款信息的 本次申请金额\n" +
|
||||||
" 不等于 合同进项发票的 本次申请金额总和 ,请重写填写合同进项发票的申请金额",10000);
|
" 不等于 合同进项发票的 本次申请金额总和 ,请重写填写合同进项发票的申请金额");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void subtractUnapplyAmount(PropertyChangedArgs e) {
|
||||||
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
|
int rowIndex = changeData.getRowIndex();
|
||||||
|
BigDecimal oldValue = (BigDecimal)changeData.getOldValue();
|
||||||
|
log.info("SupplementInvoiceBillPlugin:申请金额旧值:"+oldValue);
|
||||||
|
BigDecimal newValue = (BigDecimal) changeData.getNewValue();
|
||||||
|
log.info("SupplementInvoiceBillPlugin:申请金额新值:"+newValue);
|
||||||
|
BigDecimal changeValue = newValue.subtract(oldValue);
|
||||||
|
BigDecimal unapplyamount = (BigDecimal)this.getModel().getValue("unapplyinvoftaxamt",rowIndex);
|
||||||
|
log.info("SupplementInvoiceBillPlugin:未申请金额:"+unapplyamount);
|
||||||
|
unapplyamount = unapplyamount.subtract(changeValue);
|
||||||
|
log.info("SupplementInvoiceBillPlugin:扣减后的未申请金额:"+unapplyamount);
|
||||||
|
if (unapplyamount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||||
|
this.getModel().setValue("unapplyinvoftaxamt", unapplyamount,rowIndex);
|
||||||
|
}else{
|
||||||
|
this.getView().showTipNotification("合同进项发票信息第"+(rowIndex+1)+"行的 本次申请金额不能大于未申请含税金额。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue