采购订单-现返货返分摊到明细

测试提交
This commit is contained in:
tanfengling@x-ri.com 2025-07-16 14:06:01 +08:00
parent 9931f50964
commit 721dd91f04
2 changed files with 33 additions and 7 deletions

View File

@ -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_"作为变量的前缀<br>
*
* @author tqq9
* @date 2025-07-16 13:21:13
* @date 2025-07-16 13:18:37
*/
public class AppflgConstant {

View File

@ -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");
}
}
}