Compare commits

..

No commits in common. "82805a2a04ae54746abe3d15ac0700fcd89bd8e9" and "5f8a4a4c41e30bd71a8f9d3211a98cc67f81b96a" have entirely different histories.

2 changed files with 108 additions and 97 deletions

View File

@ -1,7 +1,6 @@
package zcgj.zcdev.zcdev.pr.plugin.form; package zcgj.zcdev.zcdev.pr.plugin.form;
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.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.ChangeData;
@ -40,30 +39,11 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
BigDecimal taxPrice = (BigDecimal) this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); BigDecimal taxPrice = (BigDecimal) this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
BigDecimal amount = taxPrice.multiply(qty); BigDecimal amount = taxPrice.multiply(qty);
this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex); this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex);
// if (this.isInContract()) { if (this.isInContract()) {
this.countPercent(rowIndex, parentRowIndex); this.countPercent(rowIndex, parentRowIndex);
// }
// }
}
@Override
protected void doLockFieldWithPriceAdjustMode(PriceAdjustModeEnum mode) {
super.doLockFieldWithPriceAdjustMode(mode);
int entryRowCount = this.getModel().getEntryRowCount("listentry");
Boolean adjustoftax = (Boolean)this.getModel().getValue("zcgj_hsjell");
int i;
if (adjustoftax) {
for(i = 0; i < entryRowCount; ++i) {
this.getView().setEnable(false, i, new String[]{"curtaxprice", "currentprice"});
this.getView().setEnable(true, i, new String[]{"thisoftaxmount","thisqty"});
}
}else{
for(i = 0; i < entryRowCount; ++i) {
this.getView().setEnable(true, i, new String[]{"curtaxprice", "currentprice"});
this.getView().setEnable(false, i, new String[]{"thisoftaxmount"});
}
} }
// }
} }
@Override @Override
@ -154,29 +134,57 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
} else { } else {
this.onDateChanged(changeData, propName); this.onDateChanged(changeData, propName);
} }
int rowIndex = changeData.getRowIndex(); // String name = e.getProperty().getName();
int parentRowIndex = changeData.getParentRowIndex(); // ChangeData changeData = e.getChangeSet()[0];
if (StringUtils.equals(propName, "zcgj_hsjell")) { // int rowIndex = changeData.getRowIndex();
doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null); // int parentRowIndex = changeData.getParentRowIndex();
} else if (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount")) { // BigDecimal curtaxprice = BigDecimal.ZERO;//当前含税单价
BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex); // BigDecimal currentprice = BigDecimal.ZERO;//当前单价
BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex); // BigDecimal qty = BigDecimal.ZERO;//数量
BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex); // BigDecimal taxrate = BigDecimal.ZERO;//税率
BigDecimal entrytaxrate =(BigDecimal) this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); //// if(name.equals("curtaxprice")||name.equals("currentprice")) {
BigDecimal tax = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); //// if (parentRowIndex>=0&&rowIndex>=0){
BigDecimal zero = new BigDecimal(0); //// Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
if (thisqty.compareTo(zero)>0 && thisoftaxmount.compareTo(zero)>0) { //// if (curtaxpriceobj != null) {
BigDecimal curtaxprice = thisoftaxmount.divide(thisqty,6,BigDecimal.ROUND_HALF_UP); //// curtaxprice = (BigDecimal) curtaxpriceobj;
BigDecimal currentprice = curtaxprice.divide(tax, 6, BigDecimal.ROUND_HALF_UP); //// }
DynamicObjectCollection listmodelentry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry"); //// Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex);
DynamicObject listentry = listmodelentry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex); //// if (currentpriceobj != null) {
listentry.set("curtaxprice",curtaxprice); //// currentprice = (BigDecimal) currentpriceobj;
listentry.set("currentprice",currentprice); //// ;
listentry.set("currentamt",currentprice.multiply(totalqty)); //// }
listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty))); //// Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
listentry.set("currentoftax",curtaxprice.multiply(totalqty)); //// if (totalqtyibj != null) {
this.getView().updateView(); //// qty = (BigDecimal) totalqtyibj;
} //// }
} //// Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex);
//// if (entrytaxrateobj != null) {
//// 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 = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价
//// BigDecimal multiply = divide.multiply(qty);//当前金额
//// BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
//// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
////// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex);
//// this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
//// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
//// this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
//// this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
//// } else if (name.equals("currentprice")&&currentprice.compareTo(new BigDecimal(0))>0) {
//// BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价
//// BigDecimal multiply = currentprice.multiply(qty);//当前金额
//// BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
//// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
//// this.getModel().setValue("curtaxprice",divide, 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();
//// }
////
// }
} }
} }

View File

@ -1,7 +1,6 @@
package zcgj.zcdev.zcdev.pr.plugin.form; package zcgj.zcdev.zcdev.pr.plugin.form;
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.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.ChangeData;
@ -11,7 +10,6 @@ import kd.bos.form.ShowFormHelper;
import kd.bos.list.ListShowParameter; import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.ec.contract.common.enums.PriceAdjustModeEnum;
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.math.RoundingMode;
@ -38,31 +36,10 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd
BigDecimal taxPrice = (BigDecimal) this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); BigDecimal taxPrice = (BigDecimal) this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
BigDecimal amount = taxPrice.multiply(qty); BigDecimal amount = taxPrice.multiply(qty);
this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex); this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex);
// if (this.isInContract()) { if (this.isInContract()) {
this.countPercent(rowIndex, parentRowIndex); this.countPercent(rowIndex, parentRowIndex);
// }
}
@Override
protected void doLockFieldWithPriceAdjustMode(PriceAdjustModeEnum mode) {
super.doLockFieldWithPriceAdjustMode(mode);
int entryRowCount = this.getModel().getEntryRowCount("listentry");
Boolean adjustoftax = (Boolean)this.getModel().getValue("zcgj_hsjell");
int i;
if (adjustoftax) {
for(i = 0; i < entryRowCount; ++i) {
this.getView().setEnable(false, i, new String[]{"curtaxprice", "currentprice"});
this.getView().setEnable(true, i, new String[]{"thisoftaxmount","thisqty"});
}
}else{
for(i = 0; i < entryRowCount; ++i) {
this.getView().setEnable(true, i, new String[]{"curtaxprice", "currentprice"});
this.getView().setEnable(false, i, new String[]{"thisoftaxmount"});
}
} }
} }
@Override @Override
@ -172,32 +149,58 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd
@Override @Override
public void propertyChanged(PropertyChangedArgs e) { public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e); super.propertyChanged(e);
String propName = e.getProperty().getName(); // String name = e.getProperty().getName();
ChangeData changeData = e.getChangeSet()[0]; // ChangeData changeData = e.getChangeSet()[0];
int rowIndex = changeData.getRowIndex(); // int rowIndex = changeData.getRowIndex();
int parentRowIndex = changeData.getParentRowIndex(); // int parentRowIndex = changeData.getParentRowIndex();
if (StringUtils.equals(propName, "zcgj_hsjell")) { // BigDecimal curtaxprice = BigDecimal.ZERO;//当前含税单价
doLockFieldWithPriceAdjustMode((PriceAdjustModeEnum)null); // BigDecimal currentprice = BigDecimal.ZERO;//当前单价
} else if (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount")) { // BigDecimal qty = BigDecimal.ZERO;//数量
BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex); // BigDecimal taxrate = BigDecimal.ZERO;//税率
BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex); // if(name.equals("curtaxprice")||name.equals("currentprice")) {
BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex); // if (parentRowIndex>=0&&rowIndex>=0){
BigDecimal entrytaxrate =(BigDecimal) this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); // Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
BigDecimal tax = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); // if (curtaxpriceobj != null) {
BigDecimal zero = new BigDecimal(0); // curtaxprice = (BigDecimal) curtaxpriceobj;
if (thisqty.compareTo(zero)>0 && thisoftaxmount.compareTo(zero)>0) { // }
BigDecimal curtaxprice = thisoftaxmount.divide(thisqty,6,BigDecimal.ROUND_HALF_UP); // Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex);
BigDecimal currentprice = curtaxprice.divide(tax, 6, BigDecimal.ROUND_HALF_UP); // if (currentpriceobj != null) {
DynamicObjectCollection listmodelentry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry"); // currentprice = (BigDecimal) currentpriceobj;
DynamicObject listentry = listmodelentry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex); // ;
listentry.set("curtaxprice",curtaxprice); // }
listentry.set("currentprice",currentprice); // Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
listentry.set("currentamt",currentprice.multiply(totalqty)); // if (totalqtyibj != null) {
listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty))); // qty = (BigDecimal) totalqtyibj;
listentry.set("currentoftax",curtaxprice.multiply(totalqty)); // }
this.getView().updateView(); // Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex);
} // if (entrytaxrateobj != null) {
} // 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 = curtaxprice.divide(taxrate,6,RoundingMode.HALF_UP);//当前单价
// BigDecimal multiply = divide.multiply(qty);//当前金额
// BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
//// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex);
// this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
// this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
// this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
// } else if (name.equals("currentprice")&&currentprice.compareTo(new BigDecimal(0))>0) {
// BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价
// BigDecimal multiply = currentprice.multiply(qty);//当前金额
// BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
// this.getModel().setValue("curtaxprice",divide, 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();
// }
//
// }
} }
protected void updateAmount(ChangeData changeData) { protected void updateAmount(ChangeData changeData) {