业务场景:分录中含有F7字段,还有一些字段值需要从该F7字段中带出,类似于已有基础资料相关属性字段,通过代码实现的话,请参考以下代码片段。
以下示例中,单据包含两个分录:kdtTitle、kdtItem;分录中type、item均为F7字段。
/**
* 标题分录编辑结束事件
*/
protected void kdtTitle_editStopped(KDTEditEvent e) throws Exception {
int rowCount = kdtTitle.getRowCount();
txttitlesCount.setValue(rowCount); //标题行数
int rowIndex = e.getRowIndex(); //当前编辑行
DataElementInfo type = (DataElementInfo) kdtTitle.getCell(rowIndex, "type").getValue(); //取数类型
if(type != null){
if(VerifyUtil.isNull(kdtTitle.getCell(rowIndex, "typeName").getValue())){
kdtTitle.getCell(rowIndex, "typeName").setValue(type.getName());
}
}
}
/**
* 项目分录编辑结束事件
*/
protected void kdtItem_editStopped(KDTEditEvent e) throws Exception {
int rowCount = kdtItem.getRowCount();
txtitemsCount.setValue(rowCount); //项目行数
int rowIndex = e.getRowIndex(); //当前编辑行
RPTItemInfo item = (RPTItemInfo) kdtItem.getCell(rowIndex, "item").getValue(); //报表项目
if(item != null){
if(VerifyUtil.isNull(kdtItem.getCell(rowIndex, "itemName").getValue())){
kdtItem.getCell(rowIndex, "itemName").setValue(item.getName());
}
}
}