收入合同计量报错
This commit is contained in:
parent
fd3b56c285
commit
6d1e5eb8b7
|
@ -0,0 +1,61 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.form.field.BasedataEdit;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据界面插件
|
||||||
|
* 合同类型过滤插件
|
||||||
|
*/
|
||||||
|
public class ContractFilterPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
//给物品基础资料添加beforef7Select事件监听
|
||||||
|
BasedataEdit supplies = this.getControl("contracttype");
|
||||||
|
supplies.addBeforeF7SelectListener(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
|
||||||
|
if (beforeF7SelectEvent.getProperty().getName().equals("contracttype")) {
|
||||||
|
// int row = beforeF7SelectEvent.getRow();
|
||||||
|
// if (this.getModel().getValue("contracttype") != null) {
|
||||||
|
//判断当前支出还是收入
|
||||||
|
String name = this.getModel().getDataEntity().getDataEntityType().getName();
|
||||||
|
String groupNum = "";
|
||||||
|
if(name.equals("ec_in_contract")){
|
||||||
|
groupNum = "01";//收入
|
||||||
|
}else{
|
||||||
|
groupNum = "02";//支出
|
||||||
|
}
|
||||||
|
//获取物品分类
|
||||||
|
QFilter f1 = new QFilter("number", "=", groupNum);
|
||||||
|
DynamicObject contkind = BusinessDataServiceHelper.loadSingle("ec_contkind", new QFilter[]{f1});
|
||||||
|
Long typeId = contkind.getLong("id");
|
||||||
|
String number = contkind.getString("number");
|
||||||
|
// 生成过滤条件对象QFilter
|
||||||
|
QFilter qFilter = new QFilter("group.id", QCP.equals, typeId);
|
||||||
|
QFilter treeFilter = new QFilter("number", QCP.equals, number);
|
||||||
|
// 设置F7列表数据过滤条件
|
||||||
|
ListShowParameter showParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||||
|
showParameter.getListFilterParameter().getQFilters().add(qFilter);
|
||||||
|
//设置F7列表左树的过滤条件
|
||||||
|
showParameter.getTreeFilterParameter().getQFilters().add(treeFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.ec.contract.formplugin.InContractMeasureBillEditPlugin;
|
import kd.ec.contract.formplugin.InContractMeasureBillEditPlugin;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -126,45 +127,50 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd
|
||||||
BigDecimal curtaxprice = BigDecimal.ZERO;//当前含税单价
|
BigDecimal curtaxprice = BigDecimal.ZERO;//当前含税单价
|
||||||
BigDecimal currentprice = BigDecimal.ZERO;//当前单价
|
BigDecimal currentprice = BigDecimal.ZERO;//当前单价
|
||||||
BigDecimal qty = BigDecimal.ZERO;//数量
|
BigDecimal qty = BigDecimal.ZERO;//数量
|
||||||
BigDecimal entrytaxrate = BigDecimal.ZERO;//税率
|
BigDecimal taxrate = BigDecimal.ZERO;//税率
|
||||||
BigDecimal taxrate = entrytaxrate.divide(new BigDecimal(100));
|
if(name.equals("curtaxprice")||name.equals("currentprice")) {
|
||||||
if (parentRowIndex+rowIndex>0){
|
if (parentRowIndex>=0&&rowIndex>=0){
|
||||||
Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
|
Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
|
||||||
if (curtaxpriceobj != null) {
|
if (curtaxpriceobj != null) {
|
||||||
curtaxprice = (BigDecimal) curtaxpriceobj;
|
curtaxprice = (BigDecimal) curtaxpriceobj;
|
||||||
}
|
}
|
||||||
Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex);
|
Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex);
|
||||||
if (currentpriceobj != null) {
|
if (currentpriceobj != null) {
|
||||||
currentprice = (BigDecimal) currentpriceobj;
|
currentprice = (BigDecimal) currentpriceobj;
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
|
Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
|
||||||
if (totalqtyibj != null) {
|
if (totalqtyibj != null) {
|
||||||
qty = (BigDecimal) totalqtyibj;
|
qty = (BigDecimal) totalqtyibj;
|
||||||
}
|
}
|
||||||
Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex);
|
Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex);
|
||||||
if (entrytaxrateobj != null) {
|
if (entrytaxrateobj != null) {
|
||||||
entrytaxrate = (BigDecimal) entrytaxrateobj;
|
BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj;
|
||||||
}
|
taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1));
|
||||||
if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) {
|
}
|
||||||
BigDecimal divide = currentprice.divide(taxrate.add(new BigDecimal(1)));//当前单价
|
if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) {
|
||||||
BigDecimal multiply = divide.multiply(qty);//当前金额
|
BigDecimal divide = curtaxprice.divide(taxrate,6,RoundingMode.HALF_UP);//当前单价
|
||||||
BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
|
BigDecimal multiply = divide.multiply(qty);//当前金额
|
||||||
BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
|
||||||
this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
|
BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
||||||
this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex);
|
||||||
this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
|
this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
|
||||||
this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
|
this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
||||||
} else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) {
|
this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
|
||||||
BigDecimal divide = curtaxprice.multiply(taxrate.add(new BigDecimal(1)));//当前含税单价
|
this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
|
||||||
BigDecimal multiply = curtaxprice.multiply(qty);//当前金额
|
} else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) {
|
||||||
BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
|
BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价
|
||||||
BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
BigDecimal multiply = currentprice.multiply(qty);//当前金额
|
||||||
this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价
|
BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
|
||||||
this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
||||||
this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额
|
this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价
|
||||||
this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计
|
this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
||||||
}
|
this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额
|
||||||
|
this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计
|
||||||
|
}
|
||||||
|
this.getView().updateView();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.orm.ORM;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
@ -33,24 +34,35 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
|
||||||
DynamicObjectCollection listmodelentry = inContract.getDynamicObjectCollection("listmodelentry");
|
DynamicObjectCollection listmodelentry = inContract.getDynamicObjectCollection("listmodelentry");
|
||||||
for (int x = 0; x < listmodelentry.size(); x++ ) {
|
for (int x = 0; x < listmodelentry.size(); x++ ) {
|
||||||
DynamicObject dynamicObject = listmodelentry.get(x);
|
DynamicObject dynamicObject = listmodelentry.get(x);
|
||||||
this.getModel().getEntryEntity("listmodelentry").add(x,dynamicObject);
|
DynamicObjectCollection listmodelentry1 = this.getModel().getEntryEntity("listmodelentry");
|
||||||
|
DynamicObjectType dynamicObjectType = listmodelentry1.getDynamicObjectType();
|
||||||
|
ORM orm = ORM.create();
|
||||||
|
long listingid = orm.genLongId(dynamicObjectType);
|
||||||
|
int entryRow = this.getModel().insertEntryRow("listmodelentry", x);
|
||||||
|
this.getModel().setValue("modelname",dynamicObject.getString("modelname"),entryRow);
|
||||||
|
this.getModel().setValue("cmptype",dynamicObject.getString("cmptype"),entryRow);
|
||||||
|
this.getModel().setValue("rowamount",dynamicObject.getString("rowamount"),entryRow);
|
||||||
|
this.getModel().setValue("rowtax",dynamicObject.getString("rowtax"),entryRow);
|
||||||
|
this.getModel().setValue("rowoftax",dynamicObject.getString("rowoftax"),entryRow);
|
||||||
|
this.getModel().setValue("listmodelid",listingid,entryRow);
|
||||||
DynamicObjectCollection sublistentry = dynamicObject.getDynamicObjectCollection("sublistentry");
|
DynamicObjectCollection sublistentry = dynamicObject.getDynamicObjectCollection("sublistentry");
|
||||||
for (int i = 0; i < sublistentry.size(); i++) {
|
for (int i = 0; i < sublistentry.size(); i++) {
|
||||||
DynamicObject object = sublistentry.get(i);
|
DynamicObject object = sublistentry.get(i);
|
||||||
int row = this.getModel().insertEntryRow("sublistentry", i+1);
|
int row = this.getModel().insertEntryRow("sublistentry", i);
|
||||||
this.getModel().setValue("sysnumber",object.getString("sysnumber"),row+1);
|
this.getModel().setValue("sublistmodelid",listingid,row);
|
||||||
|
this.getModel().setValue("sysnumber",object.getString("sysnumber"),row);
|
||||||
this.getModel().setValue("listnumber",object.getString("listnumber"),row);
|
this.getModel().setValue("listnumber",object.getString("listnumber"),row);
|
||||||
this.getModel().setValue("listname",object.getString("listname"),row);
|
this.getModel().setValue("listname",object.getString("listname"),row);
|
||||||
this.getModel().setValue("resourceitem",object.getString("resourceitem"),row);
|
this.getModel().setValue("resourceitem",object.getString("resourceitem"),row);
|
||||||
this.getModel().setValue("measureunit",object.getString("measureunit"),row);
|
this.getModel().setValue("measureunit",object.getDynamicObject("measureunit"),row);
|
||||||
this.getModel().setValue("qty",object.getString("qty"),row);
|
this.getModel().setValue("qty",object.getBigDecimal("qty"),row);
|
||||||
this.getModel().setValue("price",object.getString("price"),row);
|
this.getModel().setValue("price",object.getBigDecimal("price"),row);
|
||||||
this.getModel().setValue("amount",object.getString("amount"),row);
|
this.getModel().setValue("amount",object.getBigDecimal("amount"),row);
|
||||||
this.getModel().setValue("rateobj",object.getString("rateobj"),row);
|
this.getModel().setValue("rateobj",object.getDynamicObject("rateobj"),row);
|
||||||
this.getModel().setValue("tax",object.getString("tax"),row);
|
this.getModel().setValue("tax",object.getBigDecimal("tax"),row);
|
||||||
this.getModel().setValue("taxprice",object.getString("taxprice"),row);
|
this.getModel().setValue("taxprice",object.getBigDecimal("taxprice"),row);
|
||||||
this.getModel().setValue("oftax",object.getString("oftax"),row);
|
this.getModel().setValue("oftax",object.getBigDecimal("oftax"),row);
|
||||||
this.getModel().setValue("listunitproject",object.getString("listunitproject"),row);
|
this.getModel().setValue("listunitproject",object.getDynamicObject("listunitproject"),row);
|
||||||
this.getModel().setValue("desc",object.getString("desc"),row);
|
this.getModel().setValue("desc",object.getString("desc"),row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.resource.ResManager;
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.ExtendedDataEntity;
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.ec.contract.opplugin.validator.InContractSettleValidator;
|
import kd.ec.contract.opplugin.validator.InContractSettleValidator;
|
||||||
|
|
||||||
|
@ -24,7 +26,14 @@ public class InContractSettlementValidator extends InContractSettleValidator {
|
||||||
if (contractTemp == null) {
|
if (contractTemp == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
long id = dataEntity.getDataEntity().getLong("id");
|
||||||
|
QFilter f1 = new QFilter("id", "=", id);
|
||||||
|
DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1});
|
||||||
|
DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry");
|
||||||
|
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
|
||||||
|
if(itementry.isEmpty()) {
|
||||||
|
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||||
|
}
|
||||||
DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract");
|
DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract");
|
||||||
BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount");
|
BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount");
|
||||||
BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount");
|
BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount");
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.resource.ResManager;
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.ExtendedDataEntity;
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.ec.contract.opplugin.validator.OutContractSettleValidator;
|
import kd.ec.contract.opplugin.validator.OutContractSettleValidator;
|
||||||
|
|
||||||
|
@ -15,6 +17,14 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
|
||||||
{
|
{
|
||||||
BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount");
|
BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount");
|
||||||
DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract");
|
DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract");
|
||||||
|
long id = dataEntity.getDataEntity().getLong("id");
|
||||||
|
QFilter f1 = new QFilter("id", "=", id);
|
||||||
|
DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1});
|
||||||
|
DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry");
|
||||||
|
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
|
||||||
|
if(itementry.isEmpty()) {
|
||||||
|
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||||
|
}
|
||||||
if (contractTemp == null) {
|
if (contractTemp == null) {
|
||||||
this.addErrorMessage(dataEntity, ResManager.loadKDString("合同不可为空。", "OutContractSettleValidator_5", "ec-contract-opplugin", new Object[0]));
|
this.addErrorMessage(dataEntity, ResManager.loadKDString("合同不可为空。", "OutContractSettleValidator_5", "ec-contract-opplugin", new Object[0]));
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue