【采购订单】分录的优惠金额分摊,分录增加计算返利和不计算返利按钮
This commit is contained in:
parent
23f573ca41
commit
940d77c017
|
@ -70,5 +70,30 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
||||||
}
|
}
|
||||||
this.getView().updateView("billentry");
|
this.getView().updateView("billentry");
|
||||||
}
|
}
|
||||||
|
if("tqq9_disamount".equals(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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package tqq9.lc123.cloud.app.plugin.form.pm;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单界面插件
|
||||||
|
* 明细计算返利、不计算返利两个按钮的逻辑
|
||||||
|
*/
|
||||||
|
public class PurorderEntryBtnPlugin extends AbstractBillPlugIn {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
this.addItemClickListeners("tbmainentry");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void itemClick(ItemClickEvent evt) {
|
||||||
|
super.itemClick(evt);
|
||||||
|
String itemKey = evt.getItemKey();
|
||||||
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
|
if("tqq9_calrefundbtn".equals(itemKey)){
|
||||||
|
//分录计算返利按钮
|
||||||
|
DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry");
|
||||||
|
for (int i = 0; i < billentries.size(); i++) {
|
||||||
|
this.getModel().setValue("tqq9_calrefund", true, i);
|
||||||
|
}
|
||||||
|
}else if("tqq9_nocalrefundbtn".equals(itemKey)){
|
||||||
|
DynamicObjectCollection billentries = dataEntity.getDynamicObjectCollection("billentry");
|
||||||
|
for (int i = 0; i < billentries.size(); i++) {
|
||||||
|
this.getModel().setValue("tqq9_calrefund", false, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// this.getView().updateView("billentry");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue