/**
* 添加分录监听事件,实现分录表格默认值 该方法被onLoad()调用
*/
private void addKdtEntryDetailPanelListener() {
IDetailPanelListener listener = new DetailPanelAdapter() {
public void beforeEvent(DetailPanelEvent e) throws Exception {
setLineValue(e); // 设置分录表格的默认值
}
public void afterEvent(DetailPanelEvent arg0) throws Exception {
}
};
kdtEntrys_detailPanel.addAddListener(listener);//增加分录
kdtEntrys_detailPanel.addInsertListener(listener);//插入分录
kdtEntrys_detailPanel.addRemoveListener(listener);//删除分录
// kdtEntrys.setAfterAction(new BeforeActionListener() {
// public void beforeAction(BeforeActionEvent e) {
// KDTable table = (KDTable) e.getSource();
// IRow row = table.getRow((Integer) e.getParameter());
// row.getCell("carRelation").setValue(BigDecimal.ONE);
// row.getCell("companyOrgUnit").setValue(
// SysContext.getSysContext().getCurrentFIUnit());
//
// }
//
// });
}
/**
* 新增一行的时候,设置默认值
*/
private void setLineValue(DetailPanelEvent e) {
UnitsPaymentEntryInfo objectValue = (UnitsPaymentEntryInfo) e.getObjectValue(); //获取分录对象
objectValue.setYear(DATE.getYear() + 1900); //当前年度
objectValue.setMonth(MonthEnum.getEnum(DATE.getMonth() + 1)); //当前月份
}