入库单优化计算

This commit is contained in:
xuhaihui 2025-09-16 20:23:48 +08:00
parent 132879f830
commit 87c7d69118
1 changed files with 23 additions and 23 deletions

View File

@ -514,7 +514,7 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
this.getModel().beginInit();
BigDecimal price = (BigDecimal) this.getModel().getValue("price", i);
BigDecimal taxprice = price.multiply(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))));
this.getModel().setValue("taxprice", taxprice, i);
// this.getModel().setValue("taxprice", taxprice, i);//入库含税单价
BigDecimal qty = (BigDecimal) this.getModel().getValue("qty", i);
BigDecimal notaxamount = price.multiply(qty);
BigDecimal oftaxamount = notaxamount.multiply(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))));
@ -522,9 +522,9 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
this.getModel().setValue("notaxamount", notaxamount, i);
this.getModel().setValue("oftaxamount", oftaxamount, i);
this.getModel().setValue("taxamount", taxamount, i);
// this.getModel().setValue("notaxamount", notaxamount, i);
// this.getModel().setValue("oftaxamount", oftaxamount, i);
// this.getModel().setValue("taxamount", taxamount, i);
this.getModel().endInit();
this.getView().updateView("taxprice", i);
this.getView().updateView("notaxamount", i);
@ -554,15 +554,15 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
BigDecimal notaxamount = oftaxamount.divide(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))), 10, RoundingMode.HALF_UP);
BigDecimal qty = EcNumberHelper.toBigDecimal(this.getModel().getValue("qty", i));
BigDecimal price = notaxamount.divide(qty, 10, RoundingMode.HALF_UP);
this.getModel().setValue("price", price, i);
// this.getModel().setValue("price", price, i);
BigDecimal taxprice = oftaxamount.divide(qty, 10, RoundingMode.HALF_UP);
this.getModel().setValue("taxprice", taxprice, i);
// this.getModel().setValue("taxprice", taxprice, i);
int amtPrecision = this.getAmtPrecision();
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
this.getModel().setValue("notaxamount", notaxamount, i);
this.getModel().setValue("taxamount", taxamount, i);
// this.getModel().setValue("notaxamount", notaxamount, i);
// this.getModel().setValue("taxamount", taxamount, i);
this.getModel().endInit();
this.getView().updateView("notaxamount", i);
this.getView().updateView("price", i);
@ -579,16 +579,16 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
BigDecimal notaxamount = EcNumberHelper.toBigDecimal(this.getModel().getValue("notaxamount"), i);
BigDecimal qty = EcNumberHelper.toBigDecimal(this.getModel().getValue("qty", i));
BigDecimal price = notaxamount.divide(qty, 10, RoundingMode.HALF_UP);
this.getModel().setValue("price", price, i);
// this.getModel().setValue("price", price, i);
BigDecimal oftaxamount = notaxamount.multiply(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))));
BigDecimal taxprice = oftaxamount.divide(qty, 10, RoundingMode.HALF_UP);
this.getModel().setValue("taxprice", taxprice, i);
// this.getModel().setValue("taxprice", taxprice, i);
int amtPrecision = this.getAmtPrecision();
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
this.getModel().setValue("oftaxamount", oftaxamount, i);
this.getModel().setValue("taxamount", taxamount, i);
// this.getModel().setValue("oftaxamount", oftaxamount, i);
// this.getModel().setValue("taxamount", taxamount, i);
this.getModel().endInit();
this.getView().updateView("price", i);
this.getView().updateView("oftaxamount", i);
@ -603,7 +603,7 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
this.getModel().beginInit();
BigDecimal taxprice = (BigDecimal) this.getModel().getValue("taxprice", i);
BigDecimal price = taxprice.divide(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))), 10, RoundingMode.HALF_UP);
this.getModel().setValue("price", price, i);
// this.getModel().setValue("price", price, i);
BigDecimal qty = (BigDecimal) this.getModel().getValue("qty", i);
BigDecimal notaxamount = price.multiply(qty);
BigDecimal oftaxamount = notaxamount.multiply(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))));
@ -611,9 +611,9 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
this.getModel().setValue("notaxamount", notaxamount, i);
this.getModel().setValue("oftaxamount", oftaxamount, i);
this.getModel().setValue("taxamount", taxamount, i);
// this.getModel().setValue("notaxamount", notaxamount, i);
// this.getModel().setValue("oftaxamount", oftaxamount, i);
// this.getModel().setValue("taxamount", taxamount, i);
this.getModel().endInit();
this.getView().updateView("price", i);
this.getView().updateView("notaxamount", i);
@ -959,7 +959,7 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
BigDecimal oftaxamount = (BigDecimal) this.getView().getModel().getValue("oftaxamount", rowIndex);
taxrate = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
BigDecimal taxamount = oftaxamount.subtract(taxrate);
this.getView().getModel().setValue("taxamount", taxamount, rowIndex);
// this.getView().getModel().setValue("taxamount", taxamount, rowIndex);
this.sumMaTaxAmount();
} else if (isInputtotalprice && !isInputtaxprice && !isAdjustamount && !isAdjustoftax) {
DynamicObject mattaxrateObj = ((DynamicObject) this.getModel().getEntryEntity("entryentity").get(curIndex)).getDynamicObject("entrytaxrate");
@ -995,14 +995,14 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
notaxamount = (BigDecimal) this.getView().getModel().getValue("oftaxamount", rowIndex);
taxamount = (BigDecimal) this.getView().getModel().getValue("taxamount", rowIndex);
oftaxamount = notaxamount.subtract(taxamount);
this.getView().getModel().setValue("notaxamount", oftaxamount, rowIndex);
// this.getView().getModel().setValue("notaxamount", oftaxamount, rowIndex);
BigDecimal sum = grid1.getSum("notaxamount");
this.getModel().setValue("matamount", sum);
} else if (isAdjustoftax) {
notaxamount = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
taxamount = (BigDecimal) this.getView().getModel().getValue("taxamount", rowIndex);
oftaxamount = notaxamount.add(taxamount);
this.getView().getModel().setValue("oftaxamount", oftaxamount, rowIndex);
// this.getView().getModel().setValue("oftaxamount", oftaxamount, rowIndex);
this.sumMaoftaxAmount();
}
@ -1021,7 +1021,7 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
taxPrice = (BigDecimal) this.getView().getModel().getValue("oftaxamount", rowIndex);
ofTaxAmount = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
qty = taxPrice.subtract(ofTaxAmount);
this.getView().getModel().setValue("taxamount", qty, rowIndex);
// this.getView().getModel().setValue("taxamount", qty, rowIndex);
this.sumMaTaxAmount();
} else {
if (isInputtaxprice && isInputtotalprice && !isAdjustamount && !isAdjustoftax) {
@ -1040,12 +1040,12 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
qty = EcNumberHelper.toBigDecimal(this.getModel().getValue("qty", curIndex));
BigDecimal taxRateNum = this.getTaxRateNum();
if (taxRateNum.compareTo(BigDecimal.ZERO) == 0) {
this.getModel().setValue("notaxamount", ofTaxAmount, curIndex);
// this.getModel().setValue("notaxamount", ofTaxAmount, curIndex);
}
if (taxPrice.compareTo(BigDecimal.ZERO) == 0 && ofTaxAmount.compareTo(BigDecimal.ZERO) != 0 && qty.compareTo(BigDecimal.ZERO) != 0) {
taxPrice = ofTaxAmount.divide(qty, 10, RoundingMode.HALF_UP);
this.getModel().setValue("taxprice", taxPrice, curIndex);
// this.getModel().setValue("taxprice", taxPrice, curIndex);
}
}
@ -1326,7 +1326,7 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
String matinSourceName = (String) this.getModel().getValue("matinsource");
if ("4".equals(matinSourceName)) {
BigDecimal priceValue = propValue.getBigDecimal("price");
this.getModel().setValue("price", priceValue, curIndex);
// this.getModel().setValue("price", priceValue, curIndex);
}
} else {
this.getModel().setValue("measureunit", (Object) null, curIndex);