收入合同履约记录列表插件添加刷新历史金额逻辑

This commit is contained in:
xuhaihui 2026-01-12 17:09:25 +08:00
parent 6eca284ab2
commit 3346b244d9
1 changed files with 47 additions and 0 deletions

View File

@ -2,8 +2,12 @@ package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.ListSelectedRow;
import kd.bos.entity.datamodel.ListSelectedRowCollection;
import kd.bos.form.ShowType;
import kd.bos.form.control.events.ItemClickEvent;
import kd.bos.form.events.HyperLinkClickArgs;
import kd.bos.list.BillList;
import kd.bos.list.ListShowParameter;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.mvc.list.ListView;
@ -11,7 +15,9 @@ import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -44,4 +50,45 @@ public class InPerFormRecordsListPlugin extends AbstractListPlugin {
this.getView().showForm(listShowParameter);
}
}
@Override
public void itemClick(ItemClickEvent evt) {
super.itemClick(evt);
String itemKey = evt.getItemKey();
if ("zcgj_amountrefresher".equals(itemKey)) {
BillList billList = this.getView().getControl(AbstractListPlugin.BILLLISTID);
//获取到选中行的数据
ListSelectedRowCollection selectedRows = billList.getSelectedRows();
if (selectedRows.isEmpty()) {
this.getView().showTipNotification(String.format("请选择要确认的数据。"));
return;
}
for (ListSelectedRow selectedRow : selectedRows) {
Long contractSettleId = (Long) selectedRow.getPrimaryKeyValue();
QFilter accountTableFilter = new QFilter("id", QCP.equals, contractSettleId);
DynamicObject ec_in_performrecords = BusinessDataServiceHelper.loadSingle("ec_in_performrecords",
"id,billno,entryentity,entryentity.amount,entryentity.notaxamount,entryentity.tax," +
"zcgj_taxperformeamou,zcgj_performamount,zcgj_taxamount", new QFilter[]{accountTableFilter});
BigDecimal totalAmount = BigDecimal.ZERO; // 价税合计总额
BigDecimal totalNotaxAmount = BigDecimal.ZERO; // 不含税金额总额
BigDecimal totalTax = BigDecimal.ZERO; // 税额总额
DynamicObjectCollection entryEntityCollection = ec_in_performrecords.getDynamicObjectCollection("entryentity");
if (entryEntityCollection.size() == 0) {
continue;
}
for (DynamicObject entryEntity : entryEntityCollection) {
BigDecimal amount = entryEntity.getBigDecimal("amount");//价税合计
BigDecimal notaxamount = entryEntity.getBigDecimal("notaxamount");//金额
BigDecimal tax = entryEntity.getBigDecimal("tax");//税额
totalAmount = totalAmount.add(amount);
totalNotaxAmount = totalNotaxAmount.add(notaxamount);
totalTax = totalTax.add(tax);
}
ec_in_performrecords.set("zcgj_taxperformeamou", totalAmount.abs());//含税履约金额
ec_in_performrecords.set("zcgj_performamount", totalNotaxAmount.abs());//履约金额不含税
ec_in_performrecords.set("zcgj_taxamount", totalTax.abs());//履约税额
SaveServiceHelper.update(ec_in_performrecords);
}
}
}
}