// 判断id是否在数据库中存在,若存在,则非新增,不判断;
// 1.onload方法中判断是否新增
// 2.actionCopy_actionPerformed方法
public void onLoad() throws Exception {
super.onLoad();
judgeIsNew();
}
public void actionCopy_actionPerformed(ActionEvent e) throws Exception {
super.actionCopy_actionPerformed(e);
judgeIsNew();
unlockBill();
}
private void judgeIsNew() {
// 判断id是否在数据库中存在,若存在,则非新增,不判断;
// 不存在则认定为新增,判断单据状态,判断是否为开始,不为开始,修改为开始,若为开始,判断分录体,删除分录体所有内容
if(this.editData != null){
btnUpdContacter.setVisible(false);
btnUpdDate.setVisible(false);
btnUpdSupply.setVisible(false);
BOSUuid id = this.editData.getId();
IObjectPK pk = new ObjectUuidPK(id);
String sql = "select count(*) count from CT_CON_CContract where FID ='"+pk+"'";
ISQLExecutor se = SQLExecutorFactory.getRemoteInstance(sql);
IRowSet rs;
try {
rs = se.executeSQL();
rs.next();
if(rs.getInt("count") < 1){
this.txtoperateStatus.setText("开始");
this.txtamount.setText("0");
//txtamount.setValue(0);
txtamount.setNumberValue(0);
this.txtamountApply.setText("0");
//txtamountApply.setValue(0);
txtamountApply.setNumberValue(0);
this.txtamountDone.setText("0");
//txtamountDone.setValue(0);
txtamountDone.setNumberValue(0);
this.txtamountNoApply.setText("0");
//txtamountNoApply.setValue(0);
txtamountNoApply.setNumberValue(0);
this.txtamountNoDone.setText("0");
//txtamountNoDone.setValue(0);
txtamountNoDone.setNumberValue(0);
this.txtamountNoTax.setText("0");
//txtamountNoTax.setValue(0);
txtamountNoTax.setNumberValue(0);
this.txttax.setText("0");
//txttax.setValue(0);
txttax.setNumberValue(0);
this.txtbudget.setText("0");
//txtbudget.setValue(0);
txtbudget.setNumberValue(0);
prmtleaseCard.setValue(null);
this.kdtEntrys.removeRows();
this.kdtInvoice.removeRows();
this.kdtPlanRate.removeRows();
this.kdtStatusInfo.removeRows();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void unlockBill(){
btnDone.setEnabled(false);
btnEdit.setVisible(true);
btnReset.setVisible(false);
btnFinance.setEnabled(true);
btnFinance.setVisible(true);// 财务协作按钮隐藏
btnSave.setVisible(true);
this.contCreator.setEnabled(true);
this.contCreateTime.setEnabled(true);
this.contLastUpdateUser.setEnabled(true);
this.contLastUpdateTime.setEnabled(true);
this.contNumber.setEnabled(false);
this.contBizDate.setEnabled(true);
this.contDescription.setEnabled(true);
this.contAuditor.setEnabled(true);
this.contbillName.setEnabled(true);
this.contoaBill.setEnabled(true);
this.contdeptName.setEnabled(true);
this.contbudget.setEnabled(true);
this.contisFrame.setEnabled(true);
this.contcurrencyType.setEnabled(true);
this.contcontractSel.setEnabled(true);
this.contcontractNO.setEnabled(true);
this.prmtcontacter.setEnabled(true);
this.contcompany.setEnabled(true);
this.contdeptNo.setEnabled(true);
this.contsupply.setEnabled(true);
this.contaccountBank.setEnabled(true);
this.contaccountName.setEnabled(true);
this.contaccountNumber.setEnabled(true);
this.contsrvEndDate.setEnabled(true);
this.contsrvBeginDate.setEnabled(true);
this.contBizDate.setEnabled(true);
this.contpayType.setEnabled(true);
this.contcostCenter.setEnabled(true);
this.contdateCheck.setEnabled(true);
this.contperCheckDate.setEnabled(true);
this.contbillPayDate.setEnabled(true);
this.contsrvNote.setEnabled(true);
this.contnoteAmount.setEnabled(true);
this.contnote.setEnabled(true);
this.contpayCondition.setEnabled(true);
this.contamountApply.setEnabled(false);
this.contamount.setEnabled(true);
this.contamountNoTax.setEnabled(true);
this.conttax.setEnabled(false);
this.contamountDone.setEnabled(false);
this.contamountNoDone.setEnabled(false);
this.contamountNoApply.setEnabled(false);
this.kdtInvoice.setEnabled(false);
this.kdtStatusInfo.setEnabled(false);
this.kdtEntrys.setEnabled(true);
this.kdtPlanRate.setEnabled(true);
this.kdtEntrys.getColumn("expenseType").setRequired(false);// 费用报销必填
prmtcontractType.setEnabled(true);
contcontractSel.setEnabled(true);
prmtproject.setEnabled(true);
contothers.setEnabled(true);
// 锁定备注框
txtnote.setEnabled(true);
txtsrvNote.setEnabled(true);
txtnoteAmount.setEnabled(true);
txtpayCondition.setEnabled(true);
}