parent
9931f50964
commit
721dd91f04
|
@ -3,7 +3,7 @@
|
||||||
* If there are any issues during the use process, you can provide feedback to the kingdee developer community website.
|
* 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
|
* Website: https://developer.kingdee.com/developer?productLineId=29
|
||||||
* Author: liebin.zheng
|
* 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;
|
package tqq9.lc123.cloud.app.common;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ package tqq9.lc123.cloud.app.common;
|
||||||
* 标识或缓存的常量,需以"KEY_"、"FID_"、"ENTRY_"或"SUBENTRY_"作为变量的前缀。<br>
|
* 标识或缓存的常量,需以"KEY_"、"FID_"、"ENTRY_"或"SUBENTRY_"作为变量的前缀。<br>
|
||||||
*
|
*
|
||||||
* @author tqq9
|
* @author tqq9
|
||||||
* @date 2025-07-16 13:21:13
|
* @date 2025-07-16 13:18:37
|
||||||
*/
|
*/
|
||||||
public class AppflgConstant {
|
public class AppflgConstant {
|
||||||
|
|
||||||
|
|
|
@ -22,27 +22,53 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
||||||
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
if("tqq9_hsxfsyje".equals(name)){
|
if("tqq9_hsxfsyje".equals(name)){
|
||||||
//含税现返使用金额
|
//含税现返使用金额
|
||||||
BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal(name);
|
BigDecimal tqq9_hsxfsyje = dataEntity.getBigDecimal(name);//单头含税现返使用金额
|
||||||
if(tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0){
|
if(tqq9_hsxfsyje.compareTo(BigDecimal.ZERO) > 0){
|
||||||
BigDecimal totalallamount = dataEntity.getBigDecimal("totalallamount");//单头价税合计
|
BigDecimal totalallamount = dataEntity.getBigDecimal("totalallamount");//单头价税合计
|
||||||
DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry");
|
DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry");
|
||||||
if(billentries != null && billentries.size() > 0){
|
if(billentries != null && billentries.size() > 0){
|
||||||
BigDecimal remainRefundAmt = totalallamount;//拆分后剩余的金额
|
BigDecimal remainRefundAmt = tqq9_hsxfsyje;//拆分后剩余的金额
|
||||||
for (int i = 0; i <= billentries.size() - 1; i++) {
|
for (int i = 0; i <= billentries.size() - 1; i++) {
|
||||||
DynamicObject billentry = billentries.get(i);
|
DynamicObject billentry = billentries.get(i);
|
||||||
if(i == billentries.size() - 1){
|
if(i == billentries.size() - 1){
|
||||||
billentry.set("tqq9_xfamount", remainRefundAmt);//明细现返使用金额
|
//如果是最后一行
|
||||||
|
this.getModel().setValue("tqq9_xfamount", remainRefundAmt, i);//明细现返使用金额
|
||||||
}else{
|
}else{
|
||||||
|
//如果不是最后一行
|
||||||
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
|
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)){
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue