付款申请单 发票处理
This commit is contained in:
parent
5a5dff4a77
commit
2796d76cea
|
@ -0,0 +1,357 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import dm.jdbc.util.StringUtil;
|
||||||
|
import kd.bos.context.RequestContext;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.form.CloseCallBack;
|
||||||
|
import kd.bos.form.ShowFormHelper;
|
||||||
|
import kd.bos.form.ShowType;
|
||||||
|
import kd.bos.form.control.EntryGrid;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.events.ClosedCallBackEvent;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.ec.basedata.common.invoicecloud.InvoiceDataHandleHelper;
|
||||||
|
import kd.ec.basedata.common.invoicecloud.bean.InvoiceVO;
|
||||||
|
import kd.ec.contract.formplugin.PaymentApplyEditUI;
|
||||||
|
import kd.ec.contract.utils.ImportInvoiceUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class CustomInvoiceBillPlugin extends PaymentApplyEditUI {
|
||||||
|
private static final Log log = LogFactory.getLog(CustomInvoiceBillPlugin.class);
|
||||||
|
@Override
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
String billId = this.getModel().getDataEntity().getPkValue().toString();
|
||||||
|
log.info("SupplementInvoiceBillPlugin:主键值:"+billId);
|
||||||
|
// if (!billId.equals("0") && "A".equals(this.getModel().getValue("billstatus"))){
|
||||||
|
// log.info("SupplementInvoiceBillPlugin:单据暂存,走父类方法");
|
||||||
|
// super.beforeDoOperation(args);
|
||||||
|
// } else
|
||||||
|
if (!billId.equals("0") &&"C".equals(this.getModel().getValue("billstatus"))){
|
||||||
|
log.info("SupplementInvoiceBillPlugin:单据已审核,走子类方法");
|
||||||
|
FormOperate operate = (FormOperate)args.getSource();
|
||||||
|
String key = operate.getOperateKey();//获取操作码
|
||||||
|
log.info("SupplementInvoiceBillPlugin:操作码:"+key);
|
||||||
|
if(StringUtil.equals("supplementinvoice", key)) {//候补发票
|
||||||
|
log.info("SupplementInvoiceBillPlugin:点击候补发票");
|
||||||
|
this.beforeNewSubEntry1(args);
|
||||||
|
}else if(StringUtil.equals("savesupplement", key)) {
|
||||||
|
log.info("SupplementInvoiceBillPlugin:点击后补保存");
|
||||||
|
this.unapplyInvoftaxamtRevise(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void unapplyInvoftaxamtRevise(BeforeDoOperationEventArgs args) {
|
||||||
|
int rowCount = this.getModel().getEntryRowCount("subentryentity");
|
||||||
|
log.info("SupplementInvoiceBillPlugin:子单据体行数:"+rowCount);
|
||||||
|
if (rowCount <= 0) {
|
||||||
|
this.getView().showTipNotification("请先后补发票");
|
||||||
|
args.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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" +
|
||||||
|
" 不等于 合同进项发票的 本次申请金额总和 ,请重写填写合同进项发票的申请金额");
|
||||||
|
this.getView().showTipNotification("发票保存失败!");
|
||||||
|
args.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// DynamicObject[] invArr = new DynamicObject[rowCount];//用于存储发票
|
||||||
|
|
||||||
|
DynamicObjectCollection subentryentitys = rowEntity.getDynamicObjectCollection("subentryentity");
|
||||||
|
for (int i = 0; i < subentryentitys.size(); i++) {
|
||||||
|
Object invoiceNum = subentryentitys.get(i).get("invoice");
|
||||||
|
if(invoiceNum!=null){
|
||||||
|
DynamicObject invObj = (DynamicObject)invoiceNum;
|
||||||
|
log.info("SupplementInvoiceBillPlugin:获取第"+(i+1)+"行发票号"+invObj.getLong("id"));
|
||||||
|
DynamicObject invoice = BusinessDataServiceHelper.loadSingle(invObj.getLong("id"), "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;
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{invoice});
|
||||||
|
this.getView().showSuccessNotification("第"+(i+1)+"行发票保存成功");
|
||||||
|
}else {
|
||||||
|
this.getView().showTipNotification("合同进项发票信息第"+(i+1)+"行的 本次申请金额不能大于未申请含税金额。");
|
||||||
|
this.getView().showTipNotification("发票保存失败!");
|
||||||
|
args.setCancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
|
||||||
|
|
||||||
|
log.info("SupplementInvoiceBillPlugin:发生变动的字段:"+e.getProperty().getName());
|
||||||
|
String billId = this.getModel().getDataEntity().getPkValue().toString();
|
||||||
|
log.info("SupplementInvoiceBillPlugin:主键值:"+billId);
|
||||||
|
if (!"C".equals(this.getModel().getValue("billstatus"))){
|
||||||
|
super.propertyChanged(e);//单据不是审核状态
|
||||||
|
} else if (!billId.equals("0") &&"C".equals(this.getModel().getValue("billstatus"))){
|
||||||
|
|
||||||
|
String key = e.getProperty().getName();
|
||||||
|
// int rowIndex = e.getChangeSet()[0].getRowIndex();
|
||||||
|
log.info("SupplementInvoiceBillPlugin:发生变动的字段:"+key);
|
||||||
|
if(StringUtil.equals("applyinvoftaxamt", key)) {
|
||||||
|
log.info("SupplementInvoiceBillPlugin:发票申请金额发生变动,与未申请金额进行比较");
|
||||||
|
this.compareApplyInvoftaxamt1(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void compareApplyInvoftaxamt1(PropertyChangedArgs e) {
|
||||||
|
this.subtractUnapplyAmount(e);
|
||||||
|
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" +
|
||||||
|
" 不等于 合同进项发票的 本次申请金额总和 ,请重写填写合同进项发票的申请金额");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)+"行的 本次申请金额不能大于未申请含税金额。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void beforeNewSubEntry1(BeforeDoOperationEventArgs args) {
|
||||||
|
String billId = this.getModel().getDataEntity().getPkValue().toString();
|
||||||
|
log.info("SupplementInvoiceBillPlugin:主键值:"+billId);
|
||||||
|
if (!billId.equals("0") && "C".equals(this.getModel().getValue("billstatus"))) {//单据状态是否为审核
|
||||||
|
log.info("SupplementInvoiceBillPlugin:单据已审核");
|
||||||
|
EntryGrid grid = (EntryGrid)this.getView().getControl("entryentity");//获取单据体控件-合同付款信息
|
||||||
|
int[] rows = grid.getEntryState().getSelectedRows();//获取选择行号
|
||||||
|
log.info("SupplementInvoiceBillPlugin:导入的进项发票数量:"+rows.length);
|
||||||
|
if (rows.length != 1) {//只能选择一条
|
||||||
|
this.getView().showMessage(ResManager.loadKDString("必须选中一条合同付款信息记录。", "PaymentApplyEditUI_2", "ec-contract-formplugin", new Object[0]));
|
||||||
|
args.setCancel(true);
|
||||||
|
}else if(this.hasInvoice1(rows[0])){
|
||||||
|
this.getView().showMessage(ResManager.loadKDString("发票已导入,无需候补。", "PaymentApplyEditUI_2", "ec-contract-formplugin", new Object[0]));
|
||||||
|
args.setCancel(true);
|
||||||
|
}else if(!this.hasInvoice1(rows[0])) {//没有对应的发票,进项发票候补
|
||||||
|
log.info("SupplementInvoiceBillPlugin:单据已审核,已选择一条合同付款信息记录,没有对应的发票,可以进项发票候补");
|
||||||
|
this.showInvoice1("subentryentity");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.getView().showMessage(ResManager.loadKDString("单据不是审核状态,请先审核单据。", "PaymentApplyEditUI_1", "ec-contract-formplugin", new Object[0]));
|
||||||
|
args.setCancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void showInvoice1(String entryType) {
|
||||||
|
log.info("SupplementInvoiceBillPlugin:在进项发票基础资料中进项筛选");
|
||||||
|
Object currencyId = this.getModel().getValue("currency_id");
|
||||||
|
long orgId = ((DynamicObject)this.getModel().getValue("org")).getLong("id");
|
||||||
|
log.info("SupplementInvoiceBillPlugin:orgId"+orgId);
|
||||||
|
QFilter filter = new QFilter("org", "=", orgId);
|
||||||
|
filter.and(new QFilter("isclaimed", "=", false));
|
||||||
|
filter.and(new QFilter("billstatus", "=", "C"));
|
||||||
|
filter.and(new QFilter("currency", "=", currencyId));
|
||||||
|
filter.and(new QFilter("invoicestatus", "!=", "2"));
|
||||||
|
filter.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
|
||||||
|
QFilter filter1 = new QFilter("isclaimed", "=", true);
|
||||||
|
filter1.and(new QFilter("billstatus", "=", "C"));
|
||||||
|
int contEntryIndex = this.getModel().getEntryCurrentRowIndex("entryentity");
|
||||||
|
DynamicObject contract = (DynamicObject)this.getModel().getValue("contract", contEntryIndex);
|
||||||
|
if (contract != null) {
|
||||||
|
long contractId = contract.getLong("id");
|
||||||
|
filter1.and(new QFilter("contract", "=", contractId));
|
||||||
|
filter1.and(new QFilter("unapplyamount", ">", BigDecimal.ZERO));
|
||||||
|
DynamicObjectCollection contInvEntryCol = this.getModel().getEntryEntity("subentryentity");
|
||||||
|
if (contInvEntryCol.size() > 0) {
|
||||||
|
List<Long> selectedInvIds = new ArrayList(8);
|
||||||
|
|
||||||
|
for(DynamicObject contInvEntryObj : contInvEntryCol) {
|
||||||
|
DynamicObject invoice = contInvEntryObj.getDynamicObject("invoice");
|
||||||
|
selectedInvIds.add(invoice.getLong("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
filter1.and(new QFilter("id", "not in", selectedInvIds));//已选发票,不再出现
|
||||||
|
}
|
||||||
|
|
||||||
|
ListShowParameter param = ShowFormHelper.createShowListForm("ec_in_invoice_f7", true);
|
||||||
|
param.getListFilterParameter().setFilter(filter.or(filter1));
|
||||||
|
param.setMultiSelect(true);
|
||||||
|
param.setCloseCallBack(new CloseCallBack(this, entryType));
|
||||||
|
log.info("SupplementInvoiceBillPlugin:返回关闭标识:"+entryType);
|
||||||
|
param.getOpenStyle().setShowType(ShowType.Modal);
|
||||||
|
this.getView().showForm(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closedCallBack(ClosedCallBackEvent event) {
|
||||||
|
String billId = this.getModel().getDataEntity().getPkValue().toString();
|
||||||
|
log.info("SupplementInvoiceBillPlugin:主键值:"+billId);
|
||||||
|
if(!"C".equals(this.getModel().getValue("billstatus"))){
|
||||||
|
super.closedCallBack(event);
|
||||||
|
String actionId = event.getActionId();
|
||||||
|
Object returnData = event.getReturnData();
|
||||||
|
if (actionId.equals("selectinvoice") && returnData != null) {
|
||||||
|
this.selectInvoiceCallBack(returnData);
|
||||||
|
}
|
||||||
|
} else if (!billId.equals("0") &&"C".equals(this.getModel().getValue("billstatus"))){
|
||||||
|
String actionId = event.getActionId();//获取回调标识
|
||||||
|
Object returnData = event.getReturnData();//获取子页面返回的数据
|
||||||
|
log.info("SupplementInvoiceBillPlugin:获取回调标识:"+actionId);
|
||||||
|
if (actionId.equals("subentryentity") && returnData != null) {
|
||||||
|
this.invoiceCloseCallBack1(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void selectInvoiceCallBack(Object returnData) {
|
||||||
|
DynamicObject org = (DynamicObject)this.getModel().getValue("fiaccountorg");
|
||||||
|
List<InvoiceVO> invoiceVOList = InvoiceDataHandleHelper.parseXhInvoiceCloudReturnData(returnData);
|
||||||
|
Map<Boolean, Set<DynamicObject>> invoiceMap = CustomInvoiceDataHandleHelper.processInvoiceVO(invoiceVOList, RequestContext.get().getCurrUserId(), org.getLong("id"), new Date(), "ec_in_invoice", (DynamicObject)this.getModel().getValue("currency"), true);
|
||||||
|
ImportInvoiceUtils invoiceUtils = new ImportInvoiceUtils(this.getView(), this.getPageCache());
|
||||||
|
this.addInvoiceToEntry(invoiceUtils, invoiceMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void invoiceCloseCallBack1(ClosedCallBackEvent event) {
|
||||||
|
ListSelectedRowCollection rows = (ListSelectedRowCollection)event.getReturnData();
|
||||||
|
DynamicObject[] invArr = new DynamicObject[rows.size()];
|
||||||
|
int index = 0;
|
||||||
|
log.info("SupplementInvoiceBillPlugin:进项发票资料带下来");
|
||||||
|
for(ListSelectedRow row : rows) {
|
||||||
|
Object invoicePk = row.getPrimaryKeyValue().toString();
|
||||||
|
int rowIndex = this.getModel().createNewEntryRow("subentryentity");
|
||||||
|
this.getModel().setValue("invoice", invoicePk.toString(), rowIndex);
|
||||||
|
DynamicObject invoice = BusinessDataServiceHelper.loadSingle(invoicePk, "ec_in_invoice", "unapplyinvtax,unapplyamount,isClaimed,contract,project,connecttype,currency,totalamount,totaltax,totaloftaxamount");
|
||||||
|
|
||||||
|
this.getModel().setValue("invoicecurrency", invoice.getDynamicObject("currency") == null ? Long.valueOf("0") : invoice.getDynamicObject("currency").getPkValue(), rowIndex);
|
||||||
|
this.getModel().setValue("invoiceamount", invoice.getBigDecimal("totalamount"), rowIndex);
|
||||||
|
this.getModel().setValue("invoicetax", invoice.getBigDecimal("totaltax"), rowIndex);
|
||||||
|
this.getModel().setValue("oftaxinvoiceamount", invoice.getBigDecimal("totaloftaxamount"), rowIndex);
|
||||||
|
this.getModel().setValue("unapplyinvoftaxamt", invoice.getBigDecimal("unapplyamount"), rowIndex);
|
||||||
|
this.getModel().setValue("unapplyinvtax", invoice.getBigDecimal("unapplyinvtax"), rowIndex);
|
||||||
|
if(rows.size() == 1) {
|
||||||
|
this.setSingleApplyinvoftaxamt();
|
||||||
|
}else {
|
||||||
|
this.getModel().setValue("applyinvoftaxamt", invoice.getBigDecimal("unapplyamount"), rowIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
invArr[index++] = invoice;
|
||||||
|
invoice.set("isclaimed", true);
|
||||||
|
int upCurIndex = this.getModel().getEntryCurrentRowIndex("entryentity");
|
||||||
|
DynamicObject upContract = (DynamicObject)this.getModel().getValue("contract", upCurIndex);
|
||||||
|
invoice.set("contract", upContract);
|
||||||
|
invoice.set("project", upContract.getDynamicObject("project"));
|
||||||
|
invoice.set("connecttype", "contract");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// this.setApplyAmtByInvoice(this.getModel().getEntryCurrentRowIndex("entryentity"));
|
||||||
|
log.info("SupplementInvoiceBillPlugin:发票保存");
|
||||||
|
SaveServiceHelper.save(invArr);//发票保存
|
||||||
|
this.getView().invokeOperation("invoicesave");
|
||||||
|
this.setEnableByInvoice1();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSingleApplyinvoftaxamt() {
|
||||||
|
int rowCount = this.getModel().getEntryRowCount("subentryentity");//获取子单据分录行数
|
||||||
|
log.info("SupplementInvoiceBillPlugin:子单据体分录行数:"+rowCount);
|
||||||
|
EntryGrid grid = (EntryGrid)this.getView().getControl("entryentity");//获取单据体控件-合同付款信息
|
||||||
|
int[] entity_rows = grid.getEntryState().getSelectedRows();//获取选择行号
|
||||||
|
|
||||||
|
DynamicObject rowEntity = this.getModel().getEntryRowEntity("entryentity", entity_rows[0]);//获取对应行的单据体
|
||||||
|
BigDecimal applyoftaxamount = rowEntity.getBigDecimal("thisapplyoftax");//获取单据体对应的 本次申请金额
|
||||||
|
log.info("SupplementInvoiceBillPlugin:选中的单据体的申请金额数量:" + applyoftaxamount);
|
||||||
|
this.getModel().setValue("applyinvoftaxamt", applyoftaxamount,0);
|
||||||
|
// if(rowCount==1){
|
||||||
|
// this.getModel().setValue("applyinvoftaxamt", applyoftaxamount,0);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setEnableByInvoice1() {
|
||||||
|
int entryRowCount = this.getModel().getEntryRowCount("entryentity");
|
||||||
|
log.info("SupplementInvoiceBillPlugin:有发票,合同记录锁定 thisapplyoftax thisapplyamout 字段");
|
||||||
|
for(int i = 0; i < entryRowCount; ++i) {//有发票锁定 "thisapplyoftax", "thisapplyamount" 字段
|
||||||
|
this.getView().setEnable(!this.hasInvoice1(i), i, new String[]{"thisapplyoftax", "thisapplyamount"});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean hasInvoice1(int rowIndex) {
|
||||||
|
DynamicObject rowEntity = this.getModel().getEntryRowEntity("entryentity", rowIndex);//获取对应的单据体
|
||||||
|
DynamicObjectCollection subEntries = rowEntity.getDynamicObjectCollection("subentryentity");//获取单据体对应的子单据体
|
||||||
|
return subEntries != null && !subEntries.isEmpty();//子单据体不为null且有数据
|
||||||
|
}
|
||||||
|
|
||||||
|
// protected void setApplyAmtByInvoice(String subColumnId, String contractColumnId, int rowIndex) {
|
||||||
|
// BigDecimal totalAmount = this.getSum("subentryentity", subColumnId);
|
||||||
|
//// this.getModel().setValue(contractColumnId, totalAmount, rowIndex);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// protected void setApplyAmtByInvoice(int rowIndex) {
|
||||||
|
// this.setApplyAmtByInvoice("applyinvoftaxamt", "applyoftaxamount", rowIndex);
|
||||||
|
//// this.setApplyAmtByInvoice("applyinvamt", "applyamount", rowIndex);
|
||||||
|
//// this.setApplyAmtByInvoice("applyinvtax", "applytaxamount", rowIndex);
|
||||||
|
// }
|
||||||
|
|
||||||
|
protected BigDecimal getSum1(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);
|
||||||
|
}
|
||||||
|
log.info("SupplementInvoiceBillPlugin:发票申请总金额"+totalAmount);
|
||||||
|
return totalAmount;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue