优化标识
This commit is contained in:
parent
44f69553d8
commit
468d17c611
|
|
@ -336,97 +336,97 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement
|
||||||
|
|
||||||
protected void sumMaterialInAmountToItemEntry() {
|
protected void sumMaterialInAmountToItemEntry() {
|
||||||
this.getModel().updateCache();
|
this.getModel().updateCache();
|
||||||
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;
|
boolean isSettleTrans = false;//入库单明细-存在运费结算
|
||||||
BigDecimal transAmount = BigDecimal.ZERO;
|
BigDecimal transAmount = BigDecimal.ZERO;//入库单明细-运费不含税金额汇总
|
||||||
BigDecimal transOfTaxAmount = BigDecimal.ZERO;
|
BigDecimal transOfTaxAmount = BigDecimal.ZERO;//入库单明细-运费含税金额汇总
|
||||||
Iterator var7 = materialInEntry.iterator();
|
Iterator var7 = materialInEntry.iterator();
|
||||||
|
|
||||||
DynamicObject transSettleItem;
|
DynamicObject transSettleItem;
|
||||||
while (var7.hasNext()) {
|
while (var7.hasNext()) {
|
||||||
transSettleItem = (DynamicObject) var7.next();
|
transSettleItem = (DynamicObject) var7.next();//入库单明细
|
||||||
BigDecimal materialTaxAmount = transSettleItem.getBigDecimal("mattaxamount");
|
BigDecimal materialTaxAmount = transSettleItem.getBigDecimal("mattaxamount");//入库单明细-材料含税金额
|
||||||
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");
|
boolean settleTrans = transSettleItem.getBoolean("istranssettle");//入库单明细-运费结算
|
||||||
if (settleTrans) {
|
if (settleTrans) {
|
||||||
BigDecimal transTaxAmount = transSettleItem.getBigDecimal("transtaxamount");
|
BigDecimal transTaxAmount = transSettleItem.getBigDecimal("transtaxamount");//入库单明细-运费含税金额
|
||||||
BigDecimal transNoTaxAmount = transSettleItem.getBigDecimal("transnotaxamount");
|
BigDecimal transNoTaxAmount = transSettleItem.getBigDecimal("transnotaxamount");//入库单明细-运费不含税金额
|
||||||
transAmount = transAmount.add(transNoTaxAmount);
|
transAmount = transAmount.add(transNoTaxAmount);
|
||||||
transOfTaxAmount = transOfTaxAmount.add(transTaxAmount);
|
transOfTaxAmount = transOfTaxAmount.add(transTaxAmount);
|
||||||
isSettleTrans = true;
|
isSettleTrans = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
this.getModel().insertEntryRow("itementry", 1);
|
this.getModel().insertEntryRow("itementry", 1);
|
||||||
this.getModel().setValue("payitem", "760004250343646208", 1);
|
this.getModel().setValue("payitem", "760004250343646208", 1);//合同支付项-名称
|
||||||
this.fillItemEntryCbs(1);
|
this.fillItemEntryCbs(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
transSettleItem = this.getModel().getEntryRowEntity("itementry", 1);
|
transSettleItem = this.getModel().getEntryRowEntity("itementry", 1);
|
||||||
DynamicObject payItem = transSettleItem.getDynamicObject("payitem");
|
DynamicObject payItem = transSettleItem.getDynamicObject("payitem");//合同支付项-名称
|
||||||
boolean hasSettleTrans = "YFJS".equals(payItem.getString("number"));
|
boolean hasSettleTrans = "YFJS".equals(payItem.getString("number"));
|
||||||
if (isSettleTrans && !hasSettleTrans) {
|
if (isSettleTrans && !hasSettleTrans) {
|
||||||
this.getModel().insertEntryRow("itementry", 1);
|
this.getModel().insertEntryRow("itementry", 1);
|
||||||
this.getModel().setValue("payitem", "760004250343646208", 1);
|
this.getModel().setValue("payitem", "760004250343646208", 1);//合同支付项-名称
|
||||||
this.fillItemEntryCbs(1);
|
this.fillItemEntryCbs(1);
|
||||||
} else if (!isSettleTrans && hasSettleTrans) {
|
} else if (!isSettleTrans && hasSettleTrans) {
|
||||||
this.getModel().setValue("oftaxamount", transOfTaxAmount, 1);
|
this.getModel().setValue("oftaxamount", transOfTaxAmount, 1);//合同支付项-价税合计
|
||||||
this.getModel().setValue("amount", transAmount, 1);
|
this.getModel().setValue("amount", transAmount, 1);//合同支付项-金额
|
||||||
this.getModel().deleteEntryRow("itementry", 1);
|
this.getModel().deleteEntryRow("itementry", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSettleTrans) {
|
if (isSettleTrans) {
|
||||||
this.getModel().setValue("oftaxamount", transOfTaxAmount, 1);
|
this.getModel().setValue("oftaxamount", transOfTaxAmount, 1);//合同支付项-价税合计
|
||||||
this.getModel().setValue("amount", transAmount, 1);
|
this.getModel().setValue("amount", transAmount, 1);//合同支付项-金额
|
||||||
if (BigDecimal.ZERO.compareTo(transAmount) != 0) {
|
if (BigDecimal.ZERO.compareTo(transAmount) != 0) {
|
||||||
this.getModel().setValue("rate", transOfTaxAmount.subtract(transAmount).divide(transAmount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 1);
|
this.getModel().setValue("rate", transOfTaxAmount.subtract(transAmount).divide(transAmount, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)), 1);//合同支付项-税率(%)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getModel().setValue("taxamt", transOfTaxAmount.subtract(transAmount), 1);
|
this.getModel().setValue("taxamt", transOfTaxAmount.subtract(transAmount), 1);//合同支付项-税额
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int entryRowCount = this.getModel().getEntryRowCount("itementry");
|
int entryRowCount = this.getModel().getEntryRowCount("itementry");//合同支付项分录行数
|
||||||
DynamicObject taxRate;
|
DynamicObject taxRate;
|
||||||
if (entryRowCount > 1) {
|
if (entryRowCount > 1) {
|
||||||
taxRate = this.getModel().getEntryRowEntity("itementry", 1);
|
taxRate = this.getModel().getEntryRowEntity("itementry", 1);
|
||||||
DynamicObject payItem = taxRate.getDynamicObject("payitem");
|
DynamicObject payItem = taxRate.getDynamicObject("payitem");//合同支付项-名称
|
||||||
if (payItem != null && "YFJS".equals(payItem.getString("number"))) {
|
if (payItem != null && "YFJS".equals(payItem.getString("number"))) {
|
||||||
this.getModel().deleteEntryRow("itementry", 1);
|
this.getModel().deleteEntryRow("itementry", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getModel().setValue("oftaxamount", 0, 0);
|
this.getModel().setValue("oftaxamount", 0, 0);//合同支付项-价税合计
|
||||||
taxRate = this.getModel().getDataEntity().getDynamicObject("taxrate");
|
taxRate = this.getModel().getDataEntity().getDynamicObject("taxrate");//税率
|
||||||
if (taxRate != null) {
|
if (taxRate != null) {
|
||||||
this.getModel().setValue("rate", taxRate.getBigDecimal("taxrate"), 0);
|
this.getModel().setValue("rate", taxRate.getBigDecimal("taxrate"), 0);//合同支付项-税率(%)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getModel().setValue("taxamt", 0, 0);
|
this.getModel().setValue("taxamt", 0, 0);//合同支付项-税额
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fillItemEntryCbs(int row) {
|
protected void fillItemEntryCbs(int row) {
|
||||||
DynamicObject cbs = this.getNeedFillCbs();
|
DynamicObject cbs = this.getNeedFillCbs();
|
||||||
if (cbs != null && !(Boolean) this.getModel().getValue("isonlist")) {
|
if (cbs != null && !(Boolean) this.getModel().getValue("isonlist")) {//基于清单
|
||||||
this.getModel().setValue("itemcbs", cbs.getPkValue(), row);
|
this.getModel().setValue("itemcbs", cbs.getPkValue(), row);//合同支付项-成本分解结构
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -537,10 +537,55 @@ public class OutContractSettleEditPluginExt extends AbstractBillPlugIn implement
|
||||||
this.periodChanged(changeData);
|
this.periodChanged(changeData);
|
||||||
} else if (StringUtils.equals(name, "iseqsettle")) {
|
} else if (StringUtils.equals(name, "iseqsettle")) {
|
||||||
this.isEqSettleChanged(changeData);
|
this.isEqSettleChanged(changeData);
|
||||||
}else if (StringUtils.equals(name, "zcgj_transset")){
|
} else if (StringUtils.equals(name, "zcgj_transset")) {
|
||||||
this.getModel().deleteEntryRow("itementry", 0);
|
//按入库运费结算
|
||||||
}
|
Boolean zcgj_transset = (Boolean) changeData.getNewValue();//按入库运费结算新值
|
||||||
|
DynamicObjectCollection materialInEntry = this.getModel().getEntryEntity("materialinentry");//入库单分录
|
||||||
|
if (materialInEntry != null && materialInEntry.size() != 0) {
|
||||||
|
BigDecimal amount = BigDecimal.ZERO;//入库单明细-材料不含税金额汇总
|
||||||
|
BigDecimal ofTaxAmount = BigDecimal.ZERO;//入库单明细-材料含税金额汇总
|
||||||
|
/* boolean isSettleTrans = false;//入库单明细-存在运费结算
|
||||||
|
BigDecimal transAmount = BigDecimal.ZERO;//入库单明细-运费不含税金额汇总
|
||||||
|
BigDecimal transOfTaxAmount = BigDecimal.ZERO;//入库单明细-运费含税金额汇总*/
|
||||||
|
Iterator var7 = materialInEntry.iterator();
|
||||||
|
|
||||||
|
DynamicObject transSettleItem;
|
||||||
|
while (var7.hasNext()) {
|
||||||
|
transSettleItem = (DynamicObject) var7.next();//入库单明细
|
||||||
|
BigDecimal materialTaxAmount = transSettleItem.getBigDecimal("mattaxamount");//入库单明细-材料含税金额
|
||||||
|
BigDecimal materialNoTaxAmount = transSettleItem.getBigDecimal("matnotaxamount");//入库单明细-材料不含税金额
|
||||||
|
amount = amount.add(materialNoTaxAmount);
|
||||||
|
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);
|
||||||
|
DynamicObject payItem = transSettleItem.getDynamicObject("payitem");//合同支付项-名称
|
||||||
|
boolean hasSettleTrans = "HTJL".equals(payItem.getString("number"));
|
||||||
|
if (hasSettleTrans && zcgj_transset) {
|
||||||
|
this.getModel().setValue("oftaxamount", 0, 0);//合同支付项-价税合计
|
||||||
|
this.getModel().setValue("amount", 0, 0);//合同支付项-金额
|
||||||
|
this.getModel().deleteEntryRow("itementry", 0);
|
||||||
|
} else {
|
||||||
|
this.getModel().insertEntryRow("itementry", 0);
|
||||||
|
this.getModel().setValue("payitem", "506427748873442304", 0);//合同支付项-名称
|
||||||
|
this.getModel().setValue("oftaxamount", ofTaxAmount, 0);//合同支付项-价税合计
|
||||||
|
this.getModel().setValue("amount", amount, 0);//合同支付项-金额
|
||||||
|
if (BigDecimal.ZERO.compareTo(amount) != 0) {
|
||||||
|
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("taxamt", ofTaxAmount.subtract(amount), 0);//合同支付项-税额
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void periodChanged(ChangeData changeData) {
|
protected void periodChanged(ChangeData changeData) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue