dep实现修改分录数量计算金额原创
3人赞赏了该文章
537次浏览
编辑于2021年10月29日 17:39:09
var table = pluginCtx.getKDTable("kdtEntry"); table.getColumn("price").setEditor( new com.kingdee.bos.ctrl.kdf.table.KDTDefaultCellEditor( com.kingdee.eas.scm.im.inv.client.InvClientUtils.getNewFormatTxtField(6, false))); table.getColumn("amount").setEditor( new com.kingdee.bos.ctrl.kdf.table.KDTDefaultCellEditor( com.kingdee.eas.scm.im.inv.client.InvClientUtils.getNewFormatTxtField(2, false))); table.addKDTPropertyChangeListener(function(event,methodName){ if(methodName == "equals"){ return this ==event; } if(methodName == "propertyChange"){ if ((event.getType() == com.kingdee.bos.ctrl.kdf.table.KDTStyleConstants.BODY_ROW) && (event.getPropertyName()== "cellValue")){ var curRow = table.getRow(event.getRowIndex()); var colName=table.getColumn(event.getColIndex()).getKey(); var material = curRow.getCell("materialNumber").getValue(); if(material == null){ return; } var pricePrecision = material.get("pricePrecision"); if("price"==colName || "qty"==colName){ var qty = curRow.getCell("qty").getValue(); var price = curRow.getCell("price").getValue(); var value = 0; if(qty != null && price != null && price != 0){ value = qty * price; curRow.getCell("amount").setValue(value); var field = ["amount"]; com.kingdee.eas.scm.common.client.SCMClientUtils.changeCellPrecision(curRow,field,2); } } } } });
推荐阅读