入库单优化计算
This commit is contained in:
parent
132879f830
commit
87c7d69118
|
@ -514,7 +514,7 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
|
||||||
this.getModel().beginInit();
|
this.getModel().beginInit();
|
||||||
BigDecimal price = (BigDecimal) this.getModel().getValue("price", i);
|
BigDecimal price = (BigDecimal) this.getModel().getValue("price", i);
|
||||||
BigDecimal taxprice = price.multiply(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))));
|
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 qty = (BigDecimal) this.getModel().getValue("qty", i);
|
||||||
BigDecimal notaxamount = price.multiply(qty);
|
BigDecimal notaxamount = price.multiply(qty);
|
||||||
BigDecimal oftaxamount = notaxamount.multiply(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))));
|
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);
|
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
||||||
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
||||||
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
|
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
|
||||||
this.getModel().setValue("notaxamount", notaxamount, i);
|
// this.getModel().setValue("notaxamount", notaxamount, i);
|
||||||
this.getModel().setValue("oftaxamount", oftaxamount, i);
|
// this.getModel().setValue("oftaxamount", oftaxamount, i);
|
||||||
this.getModel().setValue("taxamount", taxamount, i);
|
// this.getModel().setValue("taxamount", taxamount, i);
|
||||||
this.getModel().endInit();
|
this.getModel().endInit();
|
||||||
this.getView().updateView("taxprice", i);
|
this.getView().updateView("taxprice", i);
|
||||||
this.getView().updateView("notaxamount", 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 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 qty = EcNumberHelper.toBigDecimal(this.getModel().getValue("qty", i));
|
||||||
BigDecimal price = notaxamount.divide(qty, 10, RoundingMode.HALF_UP);
|
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);
|
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();
|
int amtPrecision = this.getAmtPrecision();
|
||||||
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
||||||
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
||||||
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
|
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
|
||||||
this.getModel().setValue("notaxamount", notaxamount, i);
|
// this.getModel().setValue("notaxamount", notaxamount, i);
|
||||||
this.getModel().setValue("taxamount", taxamount, i);
|
// this.getModel().setValue("taxamount", taxamount, i);
|
||||||
this.getModel().endInit();
|
this.getModel().endInit();
|
||||||
this.getView().updateView("notaxamount", i);
|
this.getView().updateView("notaxamount", i);
|
||||||
this.getView().updateView("price", 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 notaxamount = EcNumberHelper.toBigDecimal(this.getModel().getValue("notaxamount"), i);
|
||||||
BigDecimal qty = EcNumberHelper.toBigDecimal(this.getModel().getValue("qty", i));
|
BigDecimal qty = EcNumberHelper.toBigDecimal(this.getModel().getValue("qty", i));
|
||||||
BigDecimal price = notaxamount.divide(qty, 10, RoundingMode.HALF_UP);
|
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 oftaxamount = notaxamount.multiply(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))));
|
||||||
BigDecimal taxprice = oftaxamount.divide(qty, 10, RoundingMode.HALF_UP);
|
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();
|
int amtPrecision = this.getAmtPrecision();
|
||||||
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
||||||
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
||||||
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
|
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
|
||||||
this.getModel().setValue("oftaxamount", oftaxamount, i);
|
// this.getModel().setValue("oftaxamount", oftaxamount, i);
|
||||||
this.getModel().setValue("taxamount", taxamount, i);
|
// this.getModel().setValue("taxamount", taxamount, i);
|
||||||
this.getModel().endInit();
|
this.getModel().endInit();
|
||||||
this.getView().updateView("price", i);
|
this.getView().updateView("price", i);
|
||||||
this.getView().updateView("oftaxamount", i);
|
this.getView().updateView("oftaxamount", i);
|
||||||
|
@ -603,7 +603,7 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
|
||||||
this.getModel().beginInit();
|
this.getModel().beginInit();
|
||||||
BigDecimal taxprice = (BigDecimal) this.getModel().getValue("taxprice", i);
|
BigDecimal taxprice = (BigDecimal) this.getModel().getValue("taxprice", i);
|
||||||
BigDecimal price = taxprice.divide(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))), 10, RoundingMode.HALF_UP);
|
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 qty = (BigDecimal) this.getModel().getValue("qty", i);
|
||||||
BigDecimal notaxamount = price.multiply(qty);
|
BigDecimal notaxamount = price.multiply(qty);
|
||||||
BigDecimal oftaxamount = notaxamount.multiply(BigDecimal.ONE.add(taxrate.divide(BigDecimal.valueOf(100L))));
|
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);
|
notaxamount = notaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
||||||
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
oftaxamount = oftaxamount.setScale(amtPrecision, RoundingMode.HALF_UP);
|
||||||
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
|
BigDecimal taxamount = oftaxamount.subtract(notaxamount);
|
||||||
this.getModel().setValue("notaxamount", notaxamount, i);
|
// this.getModel().setValue("notaxamount", notaxamount, i);
|
||||||
this.getModel().setValue("oftaxamount", oftaxamount, i);
|
// this.getModel().setValue("oftaxamount", oftaxamount, i);
|
||||||
this.getModel().setValue("taxamount", taxamount, i);
|
// this.getModel().setValue("taxamount", taxamount, i);
|
||||||
this.getModel().endInit();
|
this.getModel().endInit();
|
||||||
this.getView().updateView("price", i);
|
this.getView().updateView("price", i);
|
||||||
this.getView().updateView("notaxamount", 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);
|
BigDecimal oftaxamount = (BigDecimal) this.getView().getModel().getValue("oftaxamount", rowIndex);
|
||||||
taxrate = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
|
taxrate = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
|
||||||
BigDecimal taxamount = oftaxamount.subtract(taxrate);
|
BigDecimal taxamount = oftaxamount.subtract(taxrate);
|
||||||
this.getView().getModel().setValue("taxamount", taxamount, rowIndex);
|
// this.getView().getModel().setValue("taxamount", taxamount, rowIndex);
|
||||||
this.sumMaTaxAmount();
|
this.sumMaTaxAmount();
|
||||||
} else if (isInputtotalprice && !isInputtaxprice && !isAdjustamount && !isAdjustoftax) {
|
} else if (isInputtotalprice && !isInputtaxprice && !isAdjustamount && !isAdjustoftax) {
|
||||||
DynamicObject mattaxrateObj = ((DynamicObject) this.getModel().getEntryEntity("entryentity").get(curIndex)).getDynamicObject("entrytaxrate");
|
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);
|
notaxamount = (BigDecimal) this.getView().getModel().getValue("oftaxamount", rowIndex);
|
||||||
taxamount = (BigDecimal) this.getView().getModel().getValue("taxamount", rowIndex);
|
taxamount = (BigDecimal) this.getView().getModel().getValue("taxamount", rowIndex);
|
||||||
oftaxamount = notaxamount.subtract(taxamount);
|
oftaxamount = notaxamount.subtract(taxamount);
|
||||||
this.getView().getModel().setValue("notaxamount", oftaxamount, rowIndex);
|
// this.getView().getModel().setValue("notaxamount", oftaxamount, rowIndex);
|
||||||
BigDecimal sum = grid1.getSum("notaxamount");
|
BigDecimal sum = grid1.getSum("notaxamount");
|
||||||
this.getModel().setValue("matamount", sum);
|
this.getModel().setValue("matamount", sum);
|
||||||
} else if (isAdjustoftax) {
|
} else if (isAdjustoftax) {
|
||||||
notaxamount = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
|
notaxamount = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
|
||||||
taxamount = (BigDecimal) this.getView().getModel().getValue("taxamount", rowIndex);
|
taxamount = (BigDecimal) this.getView().getModel().getValue("taxamount", rowIndex);
|
||||||
oftaxamount = notaxamount.add(taxamount);
|
oftaxamount = notaxamount.add(taxamount);
|
||||||
this.getView().getModel().setValue("oftaxamount", oftaxamount, rowIndex);
|
// this.getView().getModel().setValue("oftaxamount", oftaxamount, rowIndex);
|
||||||
this.sumMaoftaxAmount();
|
this.sumMaoftaxAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1021,7 +1021,7 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
|
||||||
taxPrice = (BigDecimal) this.getView().getModel().getValue("oftaxamount", rowIndex);
|
taxPrice = (BigDecimal) this.getView().getModel().getValue("oftaxamount", rowIndex);
|
||||||
ofTaxAmount = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
|
ofTaxAmount = (BigDecimal) this.getView().getModel().getValue("notaxamount", rowIndex);
|
||||||
qty = taxPrice.subtract(ofTaxAmount);
|
qty = taxPrice.subtract(ofTaxAmount);
|
||||||
this.getView().getModel().setValue("taxamount", qty, rowIndex);
|
// this.getView().getModel().setValue("taxamount", qty, rowIndex);
|
||||||
this.sumMaTaxAmount();
|
this.sumMaTaxAmount();
|
||||||
} else {
|
} else {
|
||||||
if (isInputtaxprice && isInputtotalprice && !isAdjustamount && !isAdjustoftax) {
|
if (isInputtaxprice && isInputtotalprice && !isAdjustamount && !isAdjustoftax) {
|
||||||
|
@ -1040,12 +1040,12 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
|
||||||
qty = EcNumberHelper.toBigDecimal(this.getModel().getValue("qty", curIndex));
|
qty = EcNumberHelper.toBigDecimal(this.getModel().getValue("qty", curIndex));
|
||||||
BigDecimal taxRateNum = this.getTaxRateNum();
|
BigDecimal taxRateNum = this.getTaxRateNum();
|
||||||
if (taxRateNum.compareTo(BigDecimal.ZERO) == 0) {
|
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) {
|
if (taxPrice.compareTo(BigDecimal.ZERO) == 0 && ofTaxAmount.compareTo(BigDecimal.ZERO) != 0 && qty.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
taxPrice = ofTaxAmount.divide(qty, 10, RoundingMode.HALF_UP);
|
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");
|
String matinSourceName = (String) this.getModel().getValue("matinsource");
|
||||||
if ("4".equals(matinSourceName)) {
|
if ("4".equals(matinSourceName)) {
|
||||||
BigDecimal priceValue = propValue.getBigDecimal("price");
|
BigDecimal priceValue = propValue.getBigDecimal("price");
|
||||||
this.getModel().setValue("price", priceValue, curIndex);
|
// this.getModel().setValue("price", priceValue, curIndex);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.getModel().setValue("measureunit", (Object) null, curIndex);
|
this.getModel().setValue("measureunit", (Object) null, curIndex);
|
||||||
|
|
Loading…
Reference in New Issue