关于DEP如何实现减法运算?

栏目:eas cloud知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

关于DEP如何实现减法运算?

问题:

如下图总金额=油费+差旅费,现在总金额不变的情况下,输入油费自动算出差旅费,输入差旅费自动算出油费

image.webp

分析:为分录加上监听,总金额不变的情况下控制其余两个数值变化

实现思路:

1、打开编辑界面--扩展定义

image.webp

2、输入以下脚本实现如下图:

image.webp

3、实现效果

image.webp

4、参考脚本

pluginCtx.getKDTable("kdtEntrys").addKDTEditListener(function(event,methodName){

if(methodName == "equals"){

         return this ==event;

     }

if(methodName == "editStopped"){

var table = pluginCtx.getKDTable("kdtEntrys");

var curRow =  table.getRow(event.getRowIndex());

           var colName=table.getColumn(event.getColIndex()).getKey();

             //如果当前列为数量列

           var totalMoney= curRow.getCell("totalMoney").getValue(); 

           if(totalMoney!=null){

              if("travelPrice"==colName ){

                    var travelPrice = curRow.getCell("travelPrice").getValue(); //取差旅费用

                        var difference = com.kingdee.bos.ui.face.UIRuleUtil.getIntValue(totalMoney)-com.kingdee.bos.ui.face.UIRuleUtil.getIntValue(travelPrice);

                        curRow.getCell("oilPrice").setValue(difference); //为油费赋值

                }

               if("oilPrice"==colName ){

                    var carPrice = curRow.getCell("oilPrice").getValue(); 

                        var difference1 = com.kingdee.bos.ui.face.UIRuleUtil.getIntValue(totalMoney)-com.kingdee.bos.ui.face.UIRuleUtil.getIntValue(carPrice);

                        curRow.getCell("travelPrice").setValue(difference1);//为 差旅费赋值        

                }

        }

}

});

至于加法,乘法等计算逻辑也是通过监听去实现,代码不同而已,不在赘述。



关于DEP如何实现减法运算?

问题:如下图总金额=油费+差旅费,现在总金额不变的情况下,输入油费自动算出差旅费,输入差旅费自动算出油费分析:为分录加上监听,总金额...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息