工程管理付款申请复制功能字段缺失问题处理
This commit is contained in:
parent
426c023324
commit
944ba17c7e
|
@ -0,0 +1,59 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
public class PaymentapplyCopyPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
|
||||
@Override
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
//监听工具栏按钮点击事件
|
||||
this.addItemClickListeners("entrytoolbar");
|
||||
//this.addClickListeners("advcontoolbarap");
|
||||
}
|
||||
@Override
|
||||
public void itemClick(ItemClickEvent evt) {
|
||||
super.itemClick(evt);
|
||||
String ENTITY_KEY = "entryentity";
|
||||
if (evt.getItemKey().equals("zcgj_pay_copy")) {
|
||||
EntryGrid entryGrid = this.getControl("entryentity");
|
||||
//获取选中行,数组为行号,从0开始int[]
|
||||
int[] selectRows = entryGrid.getSelectRows();
|
||||
//获取单据体数据集合
|
||||
DynamicObjectCollection entity=this.getModel().getEntryEntity("entryentity");
|
||||
List<DynamicObject> dynamicObjects = entity.subList(entity.size() - selectRows.length, entity.size());
|
||||
for (int i = 0; i < selectRows.length; i++) {
|
||||
DynamicObject dynamicObject = entity.get(selectRows[i]); //选择的单据体数据
|
||||
DynamicObject dynamicObjectCopy = dynamicObjects.get(i); //复制的单据提数据
|
||||
dynamicObjectCopy.set("thisapplyoftax",dynamicObject.get("thisapplyoftax"));
|
||||
dynamicObjectCopy.set("applyoftaxamount",dynamicObject.get("applyoftaxamount"));
|
||||
dynamicObjectCopy.set("endpaymentrate",dynamicObject.get("endpaymentrate"));
|
||||
}
|
||||
this.getModel().setValue("totalshouldpay", this.getSum("entryentity", "applyoftaxamount"));
|
||||
this.getView().updateView(ENTITY_KEY);
|
||||
this.getView().updateView("totalshouldpay");
|
||||
}
|
||||
}
|
||||
|
||||
protected BigDecimal getSum(String entryId, String columnId) {
|
||||
int rowCount = this.getModel().getEntryRowCount(entryId);
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
|
||||
for(int i = 0; i < rowCount; ++i) {
|
||||
BigDecimal amount = (BigDecimal)this.getModel().getValue(columnId, i);
|
||||
amount = amount == null ? BigDecimal.ZERO : amount;
|
||||
totalAmount = totalAmount.add(amount);
|
||||
}
|
||||
|
||||
return totalAmount;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue