eas常用代码原创
金蝶云社区-湖南客户成功_刘敏
湖南客户成功_刘敏
42人赞赏了该文章 879次浏览 未经作者许可,禁止转载编辑于2024年10月17日 10:44:44

一、取单据分录上的合计值方法:

protected BigDecimal calculateSum(KDTable table, String colunmName) {

BigDecimal ret = new BigDecimal(0.0D);

String str = null;

Object o = null;

for (int i = 0; i < table.getRowCount(); i++) {

o = table.getRow(i).getCell(colunmName).getValue();

if (o == null)

continue;

str = o.toString();

if (str != null && StringUtil.isNumber(str)) {

BigDecimal value = new BigDecimal(str);

ret = ret.add(value);

}

}

 

return ret;

}

 

二、将分录单元格的值强制保留6位小数

taxprice=(BigDecimal)this.kdtEntries.getCell(e.getRowIndex(), "taxprice").getValue();

double f1 = taxprice.setScale(6, BigDecimal.ROUND_HALF_UP).doubleValue();

taxprice=new BigDecimal(f1).setScale(6, BigDecimal.ROUND_HALF_UP);

 

三、二开单据序时薄列添加合计行

image.png


ListUI中重写isFootVisible,设为true

 

四、序时薄界面通过DEP设置保留小数位不生效的处理方法

1、首先在onshow方法中,要循环整个tblMain,如下

for(int i=0;i<tblMain.getRowCount();i++){tblMain.getRow(i).getCell("entries.amount").getStyleAttributes().setNumberFormat("#,##0.00");

}

2、因为点击表头排序后表格样式又变了,需要再重新设置一下单元格的小数位

for(int i=0;i<tblMain.getRowCount();i++){tblMain.getRow(i).getCell("entries.amount").getStyleAttributes().setNumberFormat("#,##0.00");

}

 


图标赞 42
42人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!

您的鼓励与嘉奖将成为创作者们前进的动力,如果觉得本文还不错,可以给予作者创作打赏哦!

请选择打赏金币数 *

10金币20金币30金币40金币50金币60金币
可用金币: 0