diff --git a/lc123/cloud/app/common/AppflgConstant.java b/lc123/cloud/app/common/AppflgConstant.java index 654c4ae..17b866e 100644 --- a/lc123/cloud/app/common/AppflgConstant.java +++ b/lc123/cloud/app/common/AppflgConstant.java @@ -3,7 +3,7 @@ * If there are any issues during the use process, you can provide feedback to the kingdee developer community website. * Website: https://developer.kingdee.com/developer?productLineId=29 * Author: liebin.zheng - * Generate Date: 2025-07-16 13:21:13 + * Generate Date: 2025-07-16 13:18:37 */ package tqq9.lc123.cloud.app.common; @@ -13,7 +13,7 @@ package tqq9.lc123.cloud.app.common; * 标识或缓存的常量,需以"KEY_"、"FID_"、"ENTRY_"或"SUBENTRY_"作为变量的前缀。
* * @author tqq9 - * @date 2025-07-16 13:21:13 + * @date 2025-07-16 13:18:37 */ public class AppflgConstant { diff --git a/lc123/cloud/app/plugin/form/PuroderBillShareRefundPlugin.java b/lc123/cloud/app/plugin/form/PuroderBillShareRefundPlugin.java index 5c0c2a6..75db33a 100644 --- a/lc123/cloud/app/plugin/form/PuroderBillShareRefundPlugin.java +++ b/lc123/cloud/app/plugin/form/PuroderBillShareRefundPlugin.java @@ -22,27 +22,53 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn { DynamicObject dataEntity = this.getModel().getDataEntity(true); if("tqq9_hsxfsyje".equals(name)){ //含税现返使用金额 - BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal(name); + BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal(name);//单头含税现返使用金额 if(tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0){ BigDecimal totalallamount = dataEntity.getBigDecimal("totalallamount");//单头价税合计 DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry"); if(billentries != null && billentries.size() > 0){ - BigDecimal remainRefundAmt = totalallamount;//拆分后剩余的金额 + BigDecimal remainRefundAmt = tqq9_hsxfsyje;//拆分后剩余的金额 for (int i = 0; i <= billentries.size() - 1; i++) { DynamicObject billentry = billentries.get(i); if(i == billentries.size() - 1){ - billentry.set("tqq9_xfamount", remainRefundAmt);//明细现返使用金额 + //如果是最后一行 + this.getModel().setValue("tqq9_xfamount", remainRefundAmt, i);//明细现返使用金额 }else{ + //如果不是最后一行 BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计 - BigDecimal rate = amountandtax.divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例 + BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例 + this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额 + remainRefundAmt = remainRefundAmt.subtract(tqq9_xfamount); } } } } + this.getView().updateView("billentry"); } if("tqq9_hshfsyje".equals(name)){ //含税货返使用金额 - BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal(name); + BigDecimal tqq9_hshfsyje = dataEntity.getBigDecimal(name);//单头含税现返使用金额 + if(tqq9_hshfsyje.compareTo(BigDecimal.ZERO) > 0){ + BigDecimal totalallamount = dataEntity.getBigDecimal("totalallamount");//单头价税合计 + DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry"); + if(billentries != null && billentries.size() > 0){ + BigDecimal remainRefundAmt = tqq9_hshfsyje;//拆分后剩余的金额 + for (int i = 0; i <= billentries.size() - 1; i++) { + DynamicObject billentry = billentries.get(i); + if(i == billentries.size() - 1){ + //如果是最后一行 + this.getModel().setValue("tqq9_hfamount", remainRefundAmt, i);//明细货返使用金额 + }else{ + //如果不是最后一行 + BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计 + BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例 + this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额 + remainRefundAmt = remainRefundAmt.subtract(tqq9_hfamount); + } + } + } + } + this.getView().updateView("billentry"); } } }