入库单优化运费计算逻辑和添加运费税额计算逻辑
This commit is contained in:
parent
3911f536e9
commit
7e11644a33
|
@ -76,6 +76,9 @@ import kd.ec.material.formplugin.materialin.PoundAutoFetchBiz;
|
|||
import kd.pccs.placs.common.utils.ext.MetaDataUtil;
|
||||
import org.apache.commons.lang.time.DateFormatUtils;
|
||||
|
||||
/**
|
||||
* 入库单二开系统插件
|
||||
*/
|
||||
public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implements BeforeF7SelectListener, HyperLinkClickListener {
|
||||
private static final String KEY_ENTRYENTITY = "entryentity";
|
||||
private static final String DO_ENABLELOT = "enablelot";
|
||||
|
@ -1524,73 +1527,90 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
|
|||
}
|
||||
|
||||
private void doTransSplit() {
|
||||
this.getView().setVisible(true, new String[]{"ftransamount", "amount"});
|
||||
BigDecimal transamount = (BigDecimal) this.getModel().getValue("transamount");
|
||||
BigDecimal transoftaxamount = (BigDecimal) this.getModel().getValue("transoftaxamount");
|
||||
//二开添加运费税额计算赋值逻辑
|
||||
this.getView().setVisible(true, new String[]{"ftransamount", "amount"});//运费,含运费金额(不含税)
|
||||
BigDecimal transamount = (BigDecimal) this.getModel().getValue("transamount");//总运费
|
||||
BigDecimal transoftaxamount = (BigDecimal) this.getModel().getValue("transoftaxamount");//含税总运费
|
||||
BigDecimal transtaxamount = (BigDecimal) this.getModel().getValue("transtaxamount");//运费总税额
|
||||
int entryRowCount3 = this.getModel().getEntryRowCount("entryentity");
|
||||
EntryGrid grid = (EntryGrid) this.getView().getControl("entryentity");
|
||||
BigDecimal totalAmount = grid.getSum("notaxamount");
|
||||
BigDecimal totalAmount = grid.getSum("notaxamount");//金额
|
||||
if (totalAmount.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("请填写入库单明细的金额(不含税)字段。", "MaterialInBillEditPlugin_3", "ec-ecma-formplugin", new Object[0]));
|
||||
} else {
|
||||
String splitType = this.getView().getModel().getDataEntity().getString("splittype");
|
||||
String splitType = this.getView().getModel().getDataEntity().getString("splittype");//分摊类型
|
||||
BigDecimal recordTransamount;
|
||||
BigDecimal recordTransoftaxamount;
|
||||
BigDecimal zcgj_transtaxamounts;
|
||||
BigDecimal lastTransamount;
|
||||
BigDecimal lastTransoftaxamount;
|
||||
BigDecimal zcgj_transtaxamounts2;
|
||||
BigDecimal splitTaxAmount;
|
||||
BigDecimal amount;
|
||||
BigDecimal zcgj_transtaxamounts3;
|
||||
if ("1".equals(splitType)) {
|
||||
recordTransamount = transamount.divide(new BigDecimal(entryRowCount3), 10, RoundingMode.CEILING);
|
||||
recordTransoftaxamount = transoftaxamount.divide(new BigDecimal(entryRowCount3), 10, RoundingMode.CEILING);
|
||||
zcgj_transtaxamounts = transtaxamount.divide(new BigDecimal(entryRowCount3), 10, RoundingMode.CEILING);
|
||||
this.getModel().beginInit();
|
||||
lastTransamount = new BigDecimal(0);
|
||||
lastTransoftaxamount = new BigDecimal(0);
|
||||
zcgj_transtaxamounts2 = new BigDecimal(0);
|
||||
|
||||
for (int i = 0; i < entryRowCount3 - 1; ++i) {
|
||||
splitTaxAmount = (BigDecimal) this.getModel().getValue("notaxamount", i);
|
||||
this.getModel().setValue("ftransamount", recordTransamount, i);
|
||||
splitTaxAmount = (BigDecimal) this.getModel().getValue("notaxamount", i);//金额
|
||||
this.getModel().setValue("ftransamount", recordTransamount, i);//运费
|
||||
lastTransamount = EcNumberHelper.add(lastTransamount, this.getModel().getValue("ftransamount", i));
|
||||
this.getModel().setValue("taxtransamount", recordTransoftaxamount, i);
|
||||
this.getModel().setValue("taxtransamount", recordTransoftaxamount, i);//含税运费
|
||||
lastTransoftaxamount = EcNumberHelper.add(lastTransoftaxamount, this.getModel().getValue("taxtransamount", i));
|
||||
this.getModel().setValue("amount", recordTransamount.add(splitTaxAmount), i);
|
||||
this.getModel().setValue("zcgj_transtaxamount", zcgj_transtaxamounts, i);//运费税额
|
||||
zcgj_transtaxamounts2 = EcNumberHelper.add(zcgj_transtaxamounts2, this.getModel().getValue("zcgj_transtaxamount", i));
|
||||
this.getModel().setValue("amount", recordTransamount.add(splitTaxAmount), i);//含运费金额(不含税)
|
||||
}
|
||||
|
||||
amount = transamount.subtract(lastTransamount);
|
||||
splitTaxAmount = transoftaxamount.subtract(lastTransoftaxamount);
|
||||
// BigDecimal amount = (BigDecimal)this.getModel().getValue("notaxamount", entryRowCount3 - 1);//系统默认
|
||||
amount = (BigDecimal) this.getModel().getValue("notaxamount", entryRowCount3 - 1);//二开替换
|
||||
this.getModel().setValue("ftransamount", amount, entryRowCount3 - 1);
|
||||
this.getModel().setValue("taxtransamount", splitTaxAmount, entryRowCount3 - 1);
|
||||
this.getModel().setValue("amount", EcNumberHelper.add(this.getModel().getValue("ftransamount", entryRowCount3 - 1), amount), entryRowCount3 - 1);
|
||||
zcgj_transtaxamounts3 = transtaxamount.subtract(zcgj_transtaxamounts2);
|
||||
BigDecimal amount1 = (BigDecimal)this.getModel().getValue("notaxamount", entryRowCount3 - 1);//金额
|
||||
this.getModel().setValue("ftransamount", amount, entryRowCount3 - 1);//运费
|
||||
this.getModel().setValue("taxtransamount", splitTaxAmount, entryRowCount3 - 1);//含税运费
|
||||
this.getModel().setValue("zcgj_transtaxamount", zcgj_transtaxamounts3, entryRowCount3 - 1);//运费税额
|
||||
this.getModel().setValue("amount", EcNumberHelper.add(this.getModel().getValue("ftransamount", entryRowCount3 - 1), amount1), entryRowCount3 - 1);//含运费金额(不含税)
|
||||
this.getModel().endInit();
|
||||
} else if ("2".equals(splitType)) {
|
||||
this.getModel().beginInit();
|
||||
recordTransamount = new BigDecimal(0);
|
||||
recordTransoftaxamount = new BigDecimal(0);
|
||||
zcgj_transtaxamounts = new BigDecimal(0);
|
||||
|
||||
for (int i = 0; i < entryRowCount3 - 1; ++i) {
|
||||
lastTransoftaxamount = (BigDecimal) this.getModel().getValue("notaxamount", i);
|
||||
lastTransoftaxamount = (BigDecimal) this.getModel().getValue("notaxamount", i);//金额
|
||||
amount = lastTransoftaxamount.divide(totalAmount, 10, RoundingMode.CEILING).multiply(transamount);
|
||||
splitTaxAmount = lastTransoftaxamount.divide(totalAmount, 10, RoundingMode.CEILING).multiply(transoftaxamount);
|
||||
this.getModel().setValue("ftransamount", amount, i);
|
||||
recordTransamount = EcNumberHelper.add(recordTransamount, this.getModel().getValue("ftransamount", i));
|
||||
this.getModel().setValue("taxtransamount", splitTaxAmount, i);
|
||||
recordTransoftaxamount = EcNumberHelper.add(recordTransoftaxamount, this.getModel().getValue("taxtransamount", i));
|
||||
this.getModel().setValue("amount", amount.add(lastTransoftaxamount), i);
|
||||
zcgj_transtaxamounts3 = lastTransoftaxamount.divide(totalAmount, 10, RoundingMode.CEILING).multiply(transtaxamount);
|
||||
this.getModel().setValue("ftransamount", amount, i);//运费
|
||||
recordTransamount = EcNumberHelper.add(recordTransamount, this.getModel().getValue("ftransamount", i));//运费
|
||||
this.getModel().setValue("taxtransamount", splitTaxAmount, i);//含税运费
|
||||
recordTransoftaxamount = EcNumberHelper.add(recordTransoftaxamount, this.getModel().getValue("taxtransamount", i));//含税运费
|
||||
this.getModel().setValue("zcgj_transtaxamount", zcgj_transtaxamounts3, i);//运费税额
|
||||
zcgj_transtaxamounts = EcNumberHelper.add(zcgj_transtaxamounts, this.getModel().getValue("zcgj_transtaxamount", i));//运费税额
|
||||
this.getModel().setValue("amount", amount.add(lastTransoftaxamount), i);//含运费金额(不含税)
|
||||
}
|
||||
|
||||
lastTransamount = transamount.subtract(recordTransamount);
|
||||
lastTransoftaxamount = transoftaxamount.subtract(recordTransoftaxamount);
|
||||
amount = (BigDecimal) this.getModel().getValue("notaxamount", entryRowCount3 - 1);
|
||||
this.getModel().setValue("ftransamount", lastTransamount, entryRowCount3 - 1);
|
||||
this.getModel().setValue("taxtransamount", lastTransoftaxamount, entryRowCount3 - 1);
|
||||
this.getModel().setValue("amount", EcNumberHelper.add(this.getModel().getValue("ftransamount", entryRowCount3 - 1), amount), entryRowCount3 - 1);
|
||||
zcgj_transtaxamounts2 = transtaxamount.subtract(zcgj_transtaxamounts);
|
||||
amount = (BigDecimal) this.getModel().getValue("notaxamount", entryRowCount3 - 1);//金额
|
||||
this.getModel().setValue("ftransamount", lastTransamount, entryRowCount3 - 1);//运费
|
||||
this.getModel().setValue("taxtransamount", lastTransoftaxamount, entryRowCount3 - 1);//含税运费
|
||||
this.getModel().setValue("zcgj_transtaxamount", zcgj_transtaxamounts2, entryRowCount3 - 1);//含税运费
|
||||
this.getModel().setValue("amount", EcNumberHelper.add(this.getModel().getValue("ftransamount", entryRowCount3 - 1), amount), entryRowCount3 - 1);//含运费金额(不含税)
|
||||
this.getModel().endInit();
|
||||
} else {
|
||||
for (int i = 0; i < entryRowCount3; ++i) {
|
||||
this.getModel().setValue("ftransamount", 0, i);
|
||||
this.getModel().setValue("taxtransamount", 0, i);
|
||||
this.getModel().setValue("ftransamount", 0, i);//运费
|
||||
this.getModel().setValue("taxtransamount", 0, i);//含税运费
|
||||
this.getModel().setValue("zcgj_transtaxamount", 0, i);//运费税额
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue