EAS分录操作

1、删除分录

this.kdtOtherEntrys.removeRows();
this.kdtSettleEntry.removeRow(i);

2、新增行

this.kdtOtherEntrys.addRow(); 
this.kdtEntrys.getCell(0, "period").setValue("期初");
this.kdtEntrys.getCell(0, "periodNum").setValue(0);

3、获取单元格数据,给单元格赋值

Object custType = this.kdtSettleEntry.getCell(i, "custType").getValue();
this.kdtOtherEntrys.getCell(0, "fa").setValue(prmtfa.getData());

4、锁定行

kdtAssEntrys.getRow(0).getStyleAttributes().setLocked(true);

5、设置字体

kdtAssEntrys.getRow(0).getStyleAttributes().setItalic(true);

6、显示合计行

@Override

protected void setTableToSumField() {

   super.setTableToSumField();

   setTableToSumField(kdtEntrys, new String[] {"amtLease","amtDepreciation","amtInterest","amtPrincipal"});

}

7、列表显示格式

table.getColumn(colIndex).getStyleAttributes().setNumberFormat(formatString); //设置某列显示格式

table.getCell(rowIndex, colIndex).getStyleAttributes().setNumberFormat(formatString); //设置某单元格显示格式

####//0.设置分录样式
this.kdtEntrys.getRow(0).getStyleAttributes().setBackground(new Color(167,167,167));

####//1.数值类

table.getColumn(colIndex).getStyleAttributes().setNumberFormat("0.00");//0.00 表示显示两位小数,末尾为0时0仍显示

table.getColumn(colIndex).getStyleAttributes().setNumberFormat("0.##");//0.## 表示显示两位小数,末尾为0时0不显示

table.getColumn(colIndex).getStyleAttributes().setNumberFormat("#,##0.00");//#,##0.00 表示显示两位小数,且显示千分位

####//2.日期类 

table.getColumn(colIndex).getStyleAttributes().setNumberFormat("yyyy-m-d");

table.getColumn(colIndex).getStyleAttributes().setNumberFormat("yyyy-MM-dd");

table.getColumn(colIndex).getStyleAttributes().setNumberFormat("yyyy-MM-dd HH:mm:ss");

table.getColumn(colIndex).getStyleAttributes().setNumberFormat("yyyy年MM月dd日");

####//3.百分比

table.getColumn(colIndex).getStyleAttributes().setNumberFormat("0%");

分录按钮隐藏

kdtContractEntry_detailPanel.getAddNewLineButton().setVisible(false);
kdtContractEntry_detailPanel.getInsertLineButton().setVisible(false);  
kdtContractEntry_detailPanel.getRemoveLinesButton().setVisible(false);

监听分录按钮(新增、删除、插入行)

// 1. 实现IDetailPanelListener接口
class DetailPanelImp implements IDetailPanelListener {
	
	public DetailPanelImp() {}
	public void beforeEvent(DetailPanelEvent e) throws Exception {}
	public void afterEvent(DetailPanelEvent e) throws Exception {}
	
}
// 2. onLoad方法中监听并注册实现类
// 1. 禁止删除客户分录
IDetailPanelListener listener = new DetailPanelImp() {
    public void beforeEvent(DetailPanelEvent e) throws Exception {
    		judgeIsDel(e); //设置分录表格的默认值
    }
    		
    private void judgeIsDel(DetailPanelEvent e) {
	int[] selectRows = KDTableUtil.getSelectedRows(kdtSettleEntry);
	int length = selectRows.length;
	String type = "";
	if(length >= 1){
	  for(int i = 0 ; i < length ; i++){
		type = kdtSettleEntry.getCell(selectRows[i],"custType").getValue().toString();
		if("客户".equals(type)){
		  MsgBox.showError("客户禁止删除");
		  SysUtil.abort();
		}
	   }
	}
    }
};
kdtSettleEntry_detailPanel.addRemoveListener(listener);

监听分录

         // 进度信息,值改变监控
         kdtSettleEntry.addKDTEditListener(new KDTEditAdapter(){
         	public void editStopped(KDTEditEvent e) {
     			try {				
     				settleEntryChange(e);
     			}
     			catch (Exception exc) {
     				handUIException(exc);
     			}
     		}
         });
``
protected void settleEntryChange(KDTEditEvent e) {
	int rowIndex = e.getRowIndex();
	int colIndex = e.getColIndex();
	int count = (kdtSettleEntry.getRowCount());
	
	// 实收3,水份扣吨4,结算吨数5
	if(colIndex == 3 || colIndex == 4 || colIndex == 5){
		entryQtyChange();
	}
	// 合同调价6

	// 结算金额8
	if(colIndex == 6){
		entryPriceChange();
	}
	// 结算单价7,直接计算结算金额
	if(colIndex == 7){
		entryCalSettleAmt();
	}
	
	if(colIndex == 8){
		entryCalSettlePrice();
	}
private void entryPriceChange() {
	// 结算明细价格变化
	BigDecimal price0 = kdtSettleEntry.getCell(0, "price").getValue() == null ? new BigDecimal("0") : new BigDecimal(kdtSettleEntry.getCell(0, "price").getValue() + "");
	BigDecimal price1 = kdtSettleEntry.getCell(1, "price").getValue() == null ? new BigDecimal("0") : new BigDecimal(kdtSettleEntry.getCell(1, "price").getValue() + "");
	BigDecimal amtHF = getAmtKJ(this.txtamtHF);
	BigDecimal amtLF = getAmtKJ(this.txtamtLF);;
	BigDecimal amtHFF = getAmtKJ(this.txtamtHFF);;
	BigDecimal amtSF = getAmtKJ(this.txtamtSF);; //水份扣减
	BigDecimal amtRFYY = getAmtKJ(this.txtamtRFYX);; //热反应性CRI
	BigDecimal amtRFYQD = getAmtKJ(this.txtamtRFYQD); //热反应强度CSR
	BigDecimal amtLD25 = getAmtKJ(this.txtamtLD25);//粒度25
	BigDecimal amtLD80 = getAmtKJ(this.txtamtLD80); //粒度80
	BigDecimal amtM10 = getAmtKJ(this.txtamtM10); //粒度80
	BigDecimal amtM25 = getAmtKJ(this.txtamtM25); //粒度80
	
	BigDecimal priceSettle0 = price0.subtract(amtHF).subtract(amtLF).subtract(amtHFF).subtract(amtSF)
		.subtract(amtRFYY).subtract(amtRFYQD).subtract(amtLD25).subtract(amtLD80).subtract(amtM10).subtract(amtM25);
	BigDecimal priceSettle1 = price1.subtract(amtHF).subtract(amtLF).subtract(amtHFF).subtract(amtSF)
	.subtract(amtRFYY).subtract(amtRFYQD).subtract(amtLD25).subtract(amtLD80).subtract(amtM10).subtract(amtM25);
	
	kdtSettleEntry.getCell(0, "priceSettle").setValue(priceSettle0);
	kdtSettleEntry.getCell(1, "priceSettle").setValue(priceSettle1);
	
	// 结算结算金额
	entryCalSettleAmt();
	
}
posted @   明明很有才  阅读(801)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示