public void refreshAccountingCycleOldList(VoucherTypeMgr accMgr) throws SQLException { this.accountingCycleOldList.clear(); PreparedStatement pstmt = null; ResultSet rs = null; Connection conn = com.cynosure.common.sql.OracleGate.getConnection(); StringBuffer sqlBuffer = new StringBuffer(); try { sqlBuffer.append( " SELECT TO_CHAR(CYCLE_END_DATE,'DD-MM-YYYY'), PHYSICAL_INVENTORY_FLAG, INVENTORY_ADJUSTMENT_FLAG "); sqlBuffer.append(" , DEPRECIATION_FLAG, EVENT_ADJUSTMENT_FLAG, MONTHLY_CLOSED_FLAG "); sqlBuffer.append(" , YEARLY_CLOSED_FLAG, CYCLE_NO "); sqlBuffer.append(" FROM FM_AC_ACCOUNTING_CYCLE "); sqlBuffer.append(" WHERE (PHYSICAL_INVENTORY_FLAG = 'Y' "); sqlBuffer.append(" OR INVENTORY_ADJUSTMENT_FLAG = 'Y' "); sqlBuffer.append(" OR DEPRECIATION_FLAG = 'Y' "); sqlBuffer.append(" OR EVENT_ADJUSTMENT_FLAG = 'Y') "); sqlBuffer.append(" AND CYCLE_END_DATE > (SELECT MAX(CYCLE_END_DATE) "); sqlBuffer.append(" FROM FM_AC_ACCOUNTING_CYCLE "); sqlBuffer.append(" WHERE CYCLE_END_DATE < (SELECT MAX(CYCLE_END_DATE) "); sqlBuffer.append(" FROM FM_AC_ACCOUNTING_CYCLE "); sqlBuffer.append(" WHERE PHYSICAL_INVENTORY_FLAG = 'Y' "); sqlBuffer.append(" AND INVENTORY_ADJUSTMENT_FLAG = 'Y' "); sqlBuffer.append(" AND DEPRECIATION_FLAG = 'Y' "); sqlBuffer.append(" AND EVENT_ADJUSTMENT_FLAG = 'Y' "); sqlBuffer.append(" AND YEARLY_CLOSED_FLAG ='Y') "); sqlBuffer.append(" AND YEARLY_CLOSED_FLAG ='Y') "); sqlBuffer.append(" ORDER BY CYCLE_END_DATE "); pstmt = conn.prepareStatement(sqlBuffer.toString()); rs = pstmt.executeQuery(); int rowNumber = 0; while (rs.next()) { rowNumber++; AccountingCycleDetail accountingCycleDetail = new AccountingCycleDetail(); accountingCycleDetail.setRowNumber(rowNumber); accountingCycleDetail.setCycleDate(Decoder.convertGetString(rs.getString(1))); accountingCycleDetail.setPhysicalInventory(Decoder.convertGetString(rs.getString(2))); accountingCycleDetail.setInventoryAdjustment(Decoder.convertGetString(rs.getString(3))); accountingCycleDetail.setDepresciation(Decoder.convertGetString(rs.getString(4))); accountingCycleDetail.setEventAdjustment(Decoder.convertGetString(rs.getString(5))); accountingCycleDetail.setMonthlyFlag(Decoder.convertGetString(rs.getString(6))); accountingCycleDetail.setYearlyFlag(Decoder.convertGetString(rs.getString(7))); accountingCycleDetail.setCycleNo(Decoder.convertGetString(rs.getString(8))); this.accountingCycleOldList.add(accountingCycleDetail); } } finally { try { pstmt.close(); pstmt = null; rs.close(); rs = null; com.cynosure.common.sql.OracleGate.freeConnection(conn); } catch (Exception e) { } } }
public void validate() { mCode = VALID; super.validate(); Iterator iterator = this.accountingCycleList.iterator(); while (iterator.hasNext()) { AccountingCycleDetail accountingCycleDetail = (AccountingCycleDetail) iterator.next(); accountingCycleDetail.validate(); if (!accountingCycleDetail.isValid()) mCode = INVALID; } }
public void removeAccountingCycleDetail(String row) { this.getAccountingCycleList().remove(Integer.parseInt(row) - 1); Iterator iterator = this.getAccountingCycleList().iterator(); int rowNumber = 0; while (iterator.hasNext()) { rowNumber++; AccountingCycleDetail accountingCycleDetail = (AccountingCycleDetail) iterator.next(); accountingCycleDetail.setRowNumber(rowNumber); } }