change:折扣率计算

This commit is contained in:
zzs01@yunemao.com 2024-09-10 19:00:19 +08:00
parent 618fc6c004
commit 494f1bc86e
3 changed files with 37 additions and 1 deletions

View File

@ -300,6 +300,7 @@ public class SalesOrderPJEdit extends AbstractBillPlugIn implements Plugin, Befo
ClientUtils.totalSaFobAmount(model, "yem_es_materialinfo", "yem_ifgift", "yem_safobamount", "yem_amount");//销售fob金额 汇总表头 fob金额 ClientUtils.totalSaFobAmount(model, "yem_es_materialinfo", "yem_ifgift", "yem_safobamount", "yem_amount");//销售fob金额 汇总表头 fob金额
ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额 ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额
ClientUtils.countAfterFrontAmt(model, rowIndex);//计算折扣后销售金额 ClientUtils.countAfterFrontAmt(model, rowIndex);//计算折扣后销售金额
ClientUtils.calculateDiscountRate(model, rowIndex);//计算折扣率
break; break;
case "yem_onecarsum"://单车总费用 case "yem_onecarsum"://单车总费用
ClientUtils.countFrontDisPrice(model, rowIndex);//折扣前单价 ClientUtils.countFrontDisPrice(model, rowIndex);//折扣前单价
@ -321,6 +322,7 @@ public class SalesOrderPJEdit extends AbstractBillPlugIn implements Plugin, Befo
ClientUtils.countAfterFrontAmt(model, rowIndex);//计算折扣后销售金额 ClientUtils.countAfterFrontAmt(model, rowIndex);//计算折扣后销售金额
ClientUtils.countPoolAmt(view, model, "yem_es_materialinfo");//汇总折扣金额使用金额 ClientUtils.countPoolAmt(view, model, "yem_es_materialinfo");//汇总折扣金额使用金额
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额价格条款结算币别 ClientUtils.addSaAmountTk(model, rowIndex);//销售金额价格条款结算币别
ClientUtils.calculateDiscountRate(model, rowIndex);//计算折扣率
break; break;
case "yem_fundusetype"://资金使用类型 case "yem_fundusetype"://资金使用类型
model.setValue("yem_fundpoolamt", BigDecimal.ZERO); model.setValue("yem_fundpoolamt", BigDecimal.ZERO);
@ -355,6 +357,7 @@ public class SalesOrderPJEdit extends AbstractBillPlugIn implements Plugin, Befo
case "yem_accamtusetype"://配件资金使用方式 case "yem_accamtusetype"://配件资金使用方式
ClientUtils.delValue(model, "yem_es_materialinfo"); ClientUtils.delValue(model, "yem_es_materialinfo");
// ClientUtils.countDisAmt(model,"yem_es_materialinfo",rowIndex);//计算折扣金额 // ClientUtils.countDisAmt(model,"yem_es_materialinfo",rowIndex);//计算折扣金额
ClientUtils.calculateDiscountRate(model, -1);//计算折扣率
break; break;
case "yem_fundpoolamt"://使用额度 case "yem_fundpoolamt"://使用额度
ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额 ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额

View File

@ -331,7 +331,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
// ClientUtils.countSaPricePriceClause(model, rowIndex);//计算销售单价价格条款 // ClientUtils.countSaPricePriceClause(model, rowIndex);//计算销售单价价格条款
ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额 ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额
ClientUtils.countAfterFrontAmt(model, rowIndex);//计算折扣后销售金额 ClientUtils.countAfterFrontAmt(model, rowIndex);//计算折扣后销售金额
ClientUtils.calculateDiscountRate(model, rowIndex);//计算折扣率
break; break;
case "yem_sastandardprice":// case "yem_sastandardprice"://
ClientUtils.countFobAmtSaleRMB(model, rowIndex);//销售FOB标配青岛单价本位币 ClientUtils.countFobAmtSaleRMB(model, rowIndex);//销售FOB标配青岛单价本位币
@ -446,6 +446,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
break; break;
case "yem_accamtusetype"://配件资金使用方式 case "yem_accamtusetype"://配件资金使用方式
ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额 ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额
ClientUtils.calculateDiscountRate(model, -1);//计算折扣率
break; break;
case "yem_fundpoolamt"://使用额度 case "yem_fundpoolamt"://使用额度
ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额 ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额
@ -463,6 +464,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
ClientUtils.countFrontDisAmt(model, rowIndex);//折扣前金额 ClientUtils.countFrontDisAmt(model, rowIndex);//折扣前金额
ClientUtils.countAfterFrontAmt(model, rowIndex);//计算折扣后销售金额 ClientUtils.countAfterFrontAmt(model, rowIndex);//计算折扣后销售金额
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额价格条款结算币别 ClientUtils.addSaAmountTk(model, rowIndex);//销售金额价格条款结算币别
ClientUtils.calculateDiscountRate(model, rowIndex);//计算折扣率
break; break;
case "yem_giveproactype": case "yem_giveproactype":
summarizeModules(rowIndex); summarizeModules(rowIndex);

View File

@ -1589,6 +1589,7 @@ public class ClientUtils {
view.updateView("yem_disamt", i); view.updateView("yem_disamt", i);
} }
ClientUtils.countAfterFrontAmt(model, i);//计算折扣后销售金额 ClientUtils.countAfterFrontAmt(model, i);//计算折扣后销售金额
ClientUtils.calculateDiscountRate(model, -1);
} }
} }
@ -1756,6 +1757,36 @@ public class ClientUtils {
} }
} }
} }
public static void calculateDiscountRate(IDataModel model, int idx) {
String accamtusetype = (String) model.getValue("yem_accamtusetype");
if ("A".equals(accamtusetype)) {
if (idx != -1) {
doCalculateDiscountRate(model, idx);
} else {
int rowCount = model.getEntryRowCount("yem_es_materialinfo");
for (int i = 0; i < rowCount; i++) {
doCalculateDiscountRate(model, i);
}
}
}
}
/**
* 计算折扣率
* @param model
* @param idx
*/
private static void doCalculateDiscountRate(IDataModel model, int idx) {
//yem_frontrateentry = ( yem_safobamount - yem_disamt ) / yem_safobamount * 100
//折扣率% = ( 销售FOB金额 - 折扣金额 ) / 销售FOB金额 * 100
BigDecimal safobamount = (BigDecimal) model.getValue("yem_safobamount", idx);
BigDecimal disamt = (BigDecimal) model.getValue("yem_disamt", idx);
BigDecimal div = BigDecimalUtils.div(safobamount.subtract(disamt), safobamount, 12).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
model.setValue("yem_frontrateentry", div, idx);
}
} }