优化代码 解决合同计量行带出有误的问题
This commit is contained in:
parent
7eb7bc216b
commit
630d2af080
|
@ -80,57 +80,57 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
|
||||||
@Override
|
@Override
|
||||||
public void propertyChanged(PropertyChangedArgs e) {
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
super.propertyChanged(e);
|
super.propertyChanged(e);
|
||||||
String name = 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();
|
||||||
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 taxrate = BigDecimal.ZERO;//税率
|
// BigDecimal taxrate = BigDecimal.ZERO;//税率
|
||||||
if(name.equals("curtaxprice")||name.equals("currentprice")) {
|
// if(name.equals("curtaxprice")||name.equals("currentprice")) {
|
||||||
if (parentRowIndex>=0&&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) {
|
||||||
BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj;
|
// BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj;
|
||||||
taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1));
|
// taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1));
|
||||||
}
|
// }
|
||||||
if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) {
|
// if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) {
|
||||||
BigDecimal divide = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价
|
// BigDecimal divide = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价
|
||||||
BigDecimal multiply = divide.multiply(qty);//当前金额
|
// BigDecimal multiply = divide.multiply(qty);//当前金额
|
||||||
BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
|
// BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
|
||||||
BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
||||||
// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex);
|
//// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex);
|
||||||
this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
|
// this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
|
||||||
this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
||||||
this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
|
// this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
|
||||||
this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
|
// this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
|
||||||
} else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) {
|
// } else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) {
|
||||||
BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价
|
// BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价
|
||||||
BigDecimal multiply = currentprice.multiply(qty);//当前金额
|
// BigDecimal multiply = currentprice.multiply(qty);//当前金额
|
||||||
BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
|
// BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
|
||||||
BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
||||||
this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价
|
// this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价
|
||||||
this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
||||||
this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额
|
// this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额
|
||||||
this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计
|
// this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计
|
||||||
}
|
// }
|
||||||
this.getView().updateView();
|
// this.getView().updateView();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,58 +122,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 name = 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();
|
||||||
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 taxrate = BigDecimal.ZERO;//税率
|
// BigDecimal taxrate = BigDecimal.ZERO;//税率
|
||||||
if(name.equals("curtaxprice")||name.equals("currentprice")) {
|
// if(name.equals("curtaxprice")||name.equals("currentprice")) {
|
||||||
if (parentRowIndex>=0&&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) {
|
||||||
BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj;
|
// BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj;
|
||||||
taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1));
|
// taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1));
|
||||||
}
|
// }
|
||||||
if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) {
|
// if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) {
|
||||||
BigDecimal divide = curtaxprice.divide(taxrate,6,RoundingMode.HALF_UP);//当前单价
|
// BigDecimal divide = curtaxprice.divide(taxrate,6,RoundingMode.HALF_UP);//当前单价
|
||||||
BigDecimal multiply = divide.multiply(qty);//当前金额
|
// BigDecimal multiply = divide.multiply(qty);//当前金额
|
||||||
BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
|
// BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
|
||||||
BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
||||||
// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex);
|
//// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex);
|
||||||
this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
|
// this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
|
||||||
this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
||||||
this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
|
// this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
|
||||||
this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
|
// this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
|
||||||
} else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) {
|
// } else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) {
|
||||||
BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价
|
// BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价
|
||||||
BigDecimal multiply = currentprice.multiply(qty);//当前金额
|
// BigDecimal multiply = currentprice.multiply(qty);//当前金额
|
||||||
BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
|
// BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
|
||||||
BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
|
||||||
this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价
|
// this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价
|
||||||
this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
|
||||||
this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额
|
// this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额
|
||||||
this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计
|
// this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计
|
||||||
}
|
// }
|
||||||
this.getView().updateView();
|
// this.getView().updateView();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateAmount(ChangeData changeData) {
|
protected void updateAmount(ChangeData changeData) {
|
||||||
|
|
Loading…
Reference in New Issue