优化支出合同结算逻辑
This commit is contained in:
parent
b93d3e8159
commit
9cc062a69c
|
|
@ -362,14 +362,37 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//二开添加逻辑↓
|
||||||
|
boolean zcgj_transset = (boolean) this.getModel().getValue("zcgj_transset");//按入库运费结算
|
||||||
|
// 处理zcgj_transset逻辑
|
||||||
|
if (zcgj_transset) {
|
||||||
|
// 当启用按入库运费结算时,材料金额设为0
|
||||||
|
this.getModel().setValue("oftaxamount", BigDecimal.ZERO, 0);//合同支付项-价税合计
|
||||||
|
this.getModel().setValue("amount", BigDecimal.ZERO, 0);//合同支付项-金额
|
||||||
|
this.getModel().setValue("taxamt", BigDecimal.ZERO, 0);//合同支付项-税额
|
||||||
|
|
||||||
|
// 检查第一行是否为"HTJL"类型的支付项
|
||||||
|
// DynamicObject firstItemEntry = this.getModel().getEntryRowEntity("itementry", 0);
|
||||||
|
// if (firstItemEntry != null) {
|
||||||
|
// DynamicObject payItem = firstItemEntry.getDynamicObject("payitem");//合同支付项-名称
|
||||||
|
// boolean hasSettleTrans = "HTJL".equals(payItem.getString("number"));
|
||||||
|
// if (hasSettleTrans) {
|
||||||
|
// // 如果第一行是HTJL且启用了zcgj_transset,则删除该行
|
||||||
|
// this.getModel().deleteEntryRow("itementry", 0);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
// 未启用按入库运费结算时,正常计算材料金额
|
||||||
this.getModel().setValue("oftaxamount", ofTaxAmount, 0);//合同支付项-价税合计
|
this.getModel().setValue("oftaxamount", ofTaxAmount, 0);//合同支付项-价税合计
|
||||||
this.getModel().setValue("amount", amount, 0);//合同支付项-金额
|
this.getModel().setValue("amount", amount, 0);//合同支付项-金额
|
||||||
if (BigDecimal.ZERO.compareTo(amount) != 0) {
|
if (BigDecimal.ZERO.compareTo(amount) != 0) {
|
||||||
this.getPageCache().put("ignoreRateChanged", "1");
|
this.getPageCache().put("ignoreRateChanged", "1");
|
||||||
this.getModel().setValue("rate", ofTaxAmount.subtract(amount).divide(amount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 0);//合同支付项-税率(%)
|
this.getModel().setValue("rate", ofTaxAmount.subtract(amount).divide(amount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 0);//合同支付项-税率(%)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getModel().setValue("taxamt", ofTaxAmount.subtract(amount), 0);//合同支付项-税额
|
this.getModel().setValue("taxamt", ofTaxAmount.subtract(amount), 0);//合同支付项-税额
|
||||||
|
}
|
||||||
|
//二开添加逻辑↑
|
||||||
|
|
||||||
int entryRowCount = this.getModel().getEntryRowCount("itementry");//合同支付项分录
|
int entryRowCount = this.getModel().getEntryRowCount("itementry");//合同支付项分录
|
||||||
if (entryRowCount <= 1) {
|
if (entryRowCount <= 1) {
|
||||||
if (isSettleTrans) {
|
if (isSettleTrans) {
|
||||||
|
|
@ -539,14 +562,12 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement
|
||||||
this.isEqSettleChanged(changeData);
|
this.isEqSettleChanged(changeData);
|
||||||
} else if (StringUtils.equals(name, "zcgj_transset")) {
|
} else if (StringUtils.equals(name, "zcgj_transset")) {
|
||||||
//按入库运费结算
|
//按入库运费结算
|
||||||
|
//二开添加逻辑↓
|
||||||
Boolean zcgj_transset = (Boolean) changeData.getNewValue();//按入库运费结算新值
|
Boolean zcgj_transset = (Boolean) changeData.getNewValue();//按入库运费结算新值
|
||||||
DynamicObjectCollection materialInEntry = this.getModel().getEntryEntity("materialinentry");//入库单分录
|
DynamicObjectCollection materialInEntry = this.getModel().getEntryEntity("materialinentry");//入库单分录
|
||||||
if (materialInEntry != null && materialInEntry.size() != 0) {
|
if (materialInEntry != null && materialInEntry.size() != 0) {
|
||||||
BigDecimal amount = BigDecimal.ZERO;//入库单明细-材料不含税金额汇总
|
BigDecimal amount = BigDecimal.ZERO;//入库单明细-材料不含税金额汇总
|
||||||
BigDecimal ofTaxAmount = BigDecimal.ZERO;//入库单明细-材料含税金额汇总
|
BigDecimal ofTaxAmount = BigDecimal.ZERO;//入库单明细-材料含税金额汇总
|
||||||
/* boolean isSettleTrans = false;//入库单明细-存在运费结算
|
|
||||||
BigDecimal transAmount = BigDecimal.ZERO;//入库单明细-运费不含税金额汇总
|
|
||||||
BigDecimal transOfTaxAmount = BigDecimal.ZERO;//入库单明细-运费含税金额汇总*/
|
|
||||||
Iterator var7 = materialInEntry.iterator();
|
Iterator var7 = materialInEntry.iterator();
|
||||||
|
|
||||||
DynamicObject transSettleItem;
|
DynamicObject transSettleItem;
|
||||||
|
|
@ -556,25 +577,17 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement
|
||||||
BigDecimal materialNoTaxAmount = transSettleItem.getBigDecimal("matnotaxamount");//入库单明细-材料不含税金额
|
BigDecimal materialNoTaxAmount = transSettleItem.getBigDecimal("matnotaxamount");//入库单明细-材料不含税金额
|
||||||
amount = amount.add(materialNoTaxAmount);
|
amount = amount.add(materialNoTaxAmount);
|
||||||
ofTaxAmount = ofTaxAmount.add(materialTaxAmount);
|
ofTaxAmount = ofTaxAmount.add(materialTaxAmount);
|
||||||
/* boolean settleTrans = transSettleItem.getBoolean("istranssettle");//入库单明细-运费结算
|
|
||||||
if (settleTrans) {
|
|
||||||
BigDecimal transTaxAmount = transSettleItem.getBigDecimal("transtaxamount");//入库单明细-运费含税金额
|
|
||||||
BigDecimal transNoTaxAmount = transSettleItem.getBigDecimal("transnotaxamount");//入库单明细-运费不含税金额
|
|
||||||
transAmount = transAmount.add(transNoTaxAmount);
|
|
||||||
transOfTaxAmount = transOfTaxAmount.add(transTaxAmount);
|
|
||||||
isSettleTrans = true;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
transSettleItem = this.getModel().getEntryRowEntity("itementry", 0);
|
transSettleItem = this.getModel().getEntryRowEntity("itementry", 0);
|
||||||
DynamicObject payItem = transSettleItem.getDynamicObject("payitem");//合同支付项-名称
|
DynamicObject payItem = transSettleItem.getDynamicObject("payitem");//合同支付项-名称
|
||||||
boolean hasSettleTrans = "HTJL".equals(payItem.getString("number"));
|
boolean hasSettleTrans = "HTJL".equals(payItem.getString("number"));
|
||||||
if (hasSettleTrans && zcgj_transset) {
|
if (hasSettleTrans && zcgj_transset) {
|
||||||
this.getModel().setValue("oftaxamount", 0, 0);//合同支付项-价税合计
|
this.getModel().setValue("oftaxamount", BigDecimal.ZERO, 0);//合同支付项-价税合计
|
||||||
this.getModel().setValue("amount", 0, 0);//合同支付项-金额
|
this.getModel().setValue("amount", BigDecimal.ZERO, 0);//合同支付项-金额
|
||||||
this.getModel().deleteEntryRow("itementry", 0);
|
// this.getModel().deleteEntryRow("itementry", 0);
|
||||||
} else {
|
} else {
|
||||||
this.getModel().insertEntryRow("itementry", 0);
|
// this.getModel().insertEntryRow("itementry", 0);
|
||||||
this.getModel().setValue("payitem", "506427748873442304", 0);//合同支付项-名称
|
// this.getModel().setValue("payitem", "506427748873442304", 0);//合同支付项-名称
|
||||||
this.getModel().setValue("oftaxamount", ofTaxAmount, 0);//合同支付项-价税合计
|
this.getModel().setValue("oftaxamount", ofTaxAmount, 0);//合同支付项-价税合计
|
||||||
this.getModel().setValue("amount", amount, 0);//合同支付项-金额
|
this.getModel().setValue("amount", amount, 0);//合同支付项-金额
|
||||||
if (BigDecimal.ZERO.compareTo(amount) != 0) {
|
if (BigDecimal.ZERO.compareTo(amount) != 0) {
|
||||||
|
|
@ -585,6 +598,7 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement
|
||||||
this.getModel().setValue("taxamt", ofTaxAmount.subtract(amount), 0);//合同支付项-税额
|
this.getModel().setValue("taxamt", ofTaxAmount.subtract(amount), 0);//合同支付项-税额
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//二开添加逻辑↑
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue