Example usage for java.sql CallableStatement executeQuery

List of usage examples for java.sql CallableStatement executeQuery

Introduction

In this page you can find the example usage for java.sql CallableStatement executeQuery.

Prototype

ResultSet executeQuery() throws SQLException;

Source Link

Document

Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query.

Usage

From source file:com.ibm.ioes.dao.ReportsDao.java

public ArrayList<BulkSIUploadReportDto> viewBulkSIUploadReport(BulkSIUploadReportDto objDto) {
    //   Nagarjuna
    String methodName = "viewBulkSIUploadReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end//ww w .  j a  v a  2  s .c  o m
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    ArrayList<BulkSIUploadReportDto> listSearchDetails = new ArrayList<BulkSIUploadReportDto>();
    BulkSIUploadReportDto objReportsDto = null;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetBulkUploadReports);

        /*if (objDto.getDate_of_inst_from() != null
              && !"".equals(objDto.getDate_of_inst_from())) {
           proc.setString(1, objDto.getDate_of_inst_from().trim());
        } else {
           proc.setNull(1, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getDate_of_inst_to() != null
              && !"".equals(objDto.getDate_of_inst_to())) {
           proc.setString(2, objDto.getDate_of_inst_to().trim());
        } else {
           proc.setNull(2, java.sql.Types.VARCHAR);
        }*/

        if (objDto.getDate_of_installation_from() != null
                && !"".equals(objDto.getDate_of_installation_from())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getDate_of_installation_from());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(1, formattedDate);
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }
        if (objDto.getDate_of_installation_to() != null && !"".equals(objDto.getDate_of_installation_to())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getDate_of_installation_to());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate1 = formatter1.format(date2);
            proc.setString(2, formattedDate1);
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }

        if (objDto.getServiceName() != null && !"".equals(objDto.getServiceName())) {
            proc.setString(3, objDto.getServiceName().trim());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }

        if (objDto.getParty_no() != 0 && !"".equals(objDto.getParty_no())) {
            proc.setInt(4, objDto.getParty_no());
        } else {
            proc.setNull(4, java.sql.Types.BIGINT);
        }

        if (objDto.getOrderNo() != null && !"".equals(objDto.getOrderNo())) {
            proc.setString(5, objDto.getOrderNo().trim());
        } else {
            proc.setNull(5, java.sql.Types.VARCHAR);
        }

        if (objDto.getLogicalSINo() != null && !"".equals(objDto.getLogicalSINo())) {
            proc.setString(6, objDto.getLogicalSINo().trim());
        } else {
            proc.setNull(6, java.sql.Types.VARCHAR);
        }

        if (objDto.getLinename() != null && !"".equals(objDto.getLinename())) {
            proc.setString(7, objDto.getLinename().trim());
        } else {
            proc.setNull(7, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(8, pagingSorting.getSortByColumn());// columnName
        proc.setString(9, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(10, pagingSorting.getStartRecordId());// start index
        proc.setInt(11, pagingSorting.getEndRecordId());// end index
        proc.setInt(12, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        // index
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new BulkSIUploadReportDto();
            objReportsDto.setAccountName(rs.getString("ACCOUNTNAME"));
            objReportsDto.setOrderNumber(rs.getInt("CRM_ORDER_MOCN_NO"));
            objReportsDto.setCrm_service_opms_id(rs.getString("CRM_SERVICE_OPMS_ID"));
            objReportsDto.setServiceName(rs.getString("SERVICETYPE"));

            //          get city,state,country

            if (rs.getString("FROM_CITY") != null && !"".equals(rs.getString("FROM_CITY"))) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("FROM_CITY").split("~~");
                    objReportsDto.setFrom_city(ss[8]);
                } else {
                    objReportsDto.setFrom_city(" ");
                }
                //objDto.setFrom_city(rs.getString("FROM_CITY"));
            } else {
                objReportsDto.setFrom_city("");
            }
            if (rs.getString("TO_CITY") != null && !"".equals(rs.getString("TO_CITY"))) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("TO_CITY").split("~~");
                    objReportsDto.setTo_city(ss[8]);
                } else {
                    objReportsDto.setTo_city(" ");
                }
                //objDto.setTo_city(rs.getString("TO_CITY"));
            } else {
                objReportsDto.setTo_city("");
            }

            if (rs.getString("FROM_CITY") != null && !"".equals(rs.getString("FROM_CITY"))) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("FROM_CITY").split("~~");
                    objReportsDto.setFrom_state(ss[9]);
                } else {
                    objReportsDto.setFrom_state(" ");
                }
                //objDto.setFrom_city(rs.getString("FROM_CITY"));
            } else {
                objReportsDto.setFrom_state("");
            }
            if (rs.getString("TO_CITY") != null && !"".equals(rs.getString("TO_CITY"))) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("TO_CITY").split("~~");
                    objReportsDto.setTo_state(ss[9]);
                } else {
                    objReportsDto.setTo_state(" ");
                }
                //objDto.setTo_city(rs.getString("TO_CITY"));
            } else {
                objReportsDto.setTo_state("");
            }

            if (rs.getString("FROM_CITY") != null && !"".equals(rs.getString("FROM_CITY"))) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("FROM_CITY").split("~~");
                    objReportsDto.setFrom_country(ss[10]);
                } else {
                    objReportsDto.setFrom_country(" ");
                }
                //objDto.setFrom_city(rs.getString("FROM_CITY"));
            } else {
                objReportsDto.setFrom_country("");
            }
            if (rs.getString("TO_CITY") != null && !"".equals(rs.getString("TO_CITY"))) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("TO_CITY").split("~~");
                    objReportsDto.setTo_country(ss[10]);
                } else {
                    objReportsDto.setTo_country(" ");
                }
                //objDto.setTo_city(rs.getString("TO_CITY"));
            } else {
                objReportsDto.setTo_country("");
            }

            //          get city,state,country end

            // get addresses start

            if (rs.getString("PRIMARYLOCATION") != null && !"".equals(rs.getString("PRIMARYLOCATION"))) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("PRIMARYLOCATION").split("~~");
                    objReportsDto.setInstallation_addressaa1(ss[4]);
                } else {
                    String ss[] = rs.getString("PRIMARYLOCATION").split("~~");
                    objReportsDto.setInstallation_addressaa1(ss[5]);
                }
            } else {
                objReportsDto.setInstallation_addressaa1("");
            }

            if (rs.getString("SECONDARYLOCATION") != null && !"".equals(rs.getString("SECONDARYLOCATION"))) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("SECONDARYLOCATION").split("~~");
                    objReportsDto.setInstallation_addressab1(ss[4]);
                } else {
                    String ss[] = rs.getString("SECONDARYLOCATION").split("~~");
                    objReportsDto.setInstallation_addressab1(ss[5]);
                }
            } else {
                objReportsDto.setInstallation_addressab1("");
            }

            if (rs.getString("PRIMARYLOCATION") != null && !"".equals(rs.getString("PRIMARYLOCATION"))) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("PRIMARYLOCATION").split("~~");
                    objReportsDto.setInstallation_addressaa2(ss[5]);
                } else {
                    objReportsDto.setInstallation_addressaa2("");
                }
            } else {
                objReportsDto.setInstallation_addressaa2("");
            }

            if (rs.getString("PRIMARYLOCATION") != null && !"".equals(rs.getString("PRIMARYLOCATION"))) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("PRIMARYLOCATION").split("~~");
                    objReportsDto.setInstallation_addressaa3(ss[6]);
                } else {
                    objReportsDto.setInstallation_addressaa3("");
                }
            } else {
                objReportsDto.setInstallation_addressaa3("");
            }

            if (rs.getString("SECONDARYLOCATION") != null && !"".equals(rs.getString("SECONDARYLOCATION"))) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("SECONDARYLOCATION").split("~~");
                    objReportsDto.setInstallation_addressab2(ss[5]);
                } else {
                    objReportsDto.setInstallation_addressab2("");
                }
            } else {
                objReportsDto.setInstallation_addressab2("");
            }

            if (rs.getString("SECONDARYLOCATION") != null && !"".equals(rs.getString("SECONDARYLOCATION"))) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("SECONDARYLOCATION").split("~~");
                    objReportsDto.setInstallation_addressab3(ss[6]);
                } else {
                    objReportsDto.setInstallation_addressab3("");
                }
            } else {
                objReportsDto.setInstallation_addressab3("");
            }

            objReportsDto.setDate_of_inst(rs.getString("DATE_OF_INST")); //left
            objReportsDto.setDate_of_act(rs.getString("DATE_OF_ACT"));
            if (rs.getString("DATE_OF_ACT") != null && !"".equals(rs.getString("DATE_OF_ACT"))) {
                Date date = df.parse(objReportsDto.getDate_of_act());
                objReportsDto.setDate_of_act((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objReportsDto.setUom(rs.getString("UOM"));
            objReportsDto.setLob(rs.getString("LOB"));
            objReportsDto.setCircle(rs.getString("CIRCLE"));
            objReportsDto.setZone(rs.getString("ZONE"));
            objReportsDto.setLocation_from(rs.getString("SUPPORT_LOCATION_A"));
            objReportsDto.setLocation_to(rs.getString("SUPPORT_LOCATION_B"));
            objReportsDto.setCommited_sla(rs.getString("COMMITED_SLA"));
            objReportsDto.setHub_location(rs.getString("UB_LOCATION"));
            objReportsDto.setPlatform(rs.getString("PLATFORM"));
            objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setFxSiId(rs.getString("SIID"));
            objReportsDto.setIpls(rs.getString("IPLC"));
            objReportsDto.setManaged_yes_no(rs.getString("MANAGED_YES_NO"));
            objReportsDto.setActmngname(rs.getString("ACTMNAME"));
            objReportsDto.setPrjmngname(rs.getString("PMNAME"));
            objReportsDto.setService_provider(rs.getString("LAST_MILE_PROVIDER"));
            objReportsDto.setLineItemDescription(rs.getString("LINENAME"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        //ex.printStackTrace();   
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        }
    }
    return listSearchDetails;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

public ArrayList<PerformanceDetailReportDTO> viewPerformanceDetailList(PerformanceDetailReportDTO objDto) {
    //   Nagarjuna
    String methodName = "viewPerformanceDetailList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end   //  w  w  w.jav  a2  s  .  c  om
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    ArrayList<PerformanceDetailReportDTO> listSearchDetails = new ArrayList<PerformanceDetailReportDTO>();
    PerformanceDetailReportDTO objReportsDto = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetPerformanceDetailReport);

        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(2, formattedDate);
            //proc.setString(2, objDto.getFromDate().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate1 = formatter1.format(date2);
            proc.setString(3, formattedDate1);
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        /*if (objDto.getFromDate() != null
              && !"".equals(objDto.getFromDate())) {
           proc.setString(2, objDto.getFromDate().trim());
        } else {
           proc.setNull(2, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getToDate() != null 
              && !"".equals(objDto.getToDate())) {
           proc.setString(3, objDto.getToDate().trim());
        } else {
           proc.setNull(3, java.sql.Types.VARCHAR);
        }*/

        if (objDto.getFromOrderNo() != 0 && !"".equals(objDto.getFromOrderNo())) {
            proc.setInt(4, objDto.getFromOrderNo());
        } else {
            proc.setNull(4, java.sql.Types.BIGINT);
        }

        if (objDto.getToOrderNo() != 0 && !"".equals(objDto.getToOrderNo())) {
            proc.setInt(5, objDto.getToOrderNo());
        } else {
            proc.setNull(5, java.sql.Types.BIGINT);
        }

        if (objDto.getFromAccountNo() != 0 && !"".equals(objDto.getFromAccountNo())) {
            proc.setInt(6, objDto.getFromAccountNo());
        } else {
            proc.setNull(6, java.sql.Types.BIGINT);
        }

        if (objDto.getToAccountNo() != 0 && !"".equals(objDto.getToAccountNo())) {
            proc.setInt(7, objDto.getToAccountNo());
        } else {
            proc.setNull(7, java.sql.Types.BIGINT);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(8, pagingSorting.getSortByColumn());// columnName
        proc.setString(9, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(10, pagingSorting.getStartRecordId());// start index
        proc.setInt(11, pagingSorting.getEndRecordId());// end index
        proc.setInt(12, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(13, objDto.getOsp().trim());
        } else {
            proc.setNull(13, java.sql.Types.VARCHAR);
        }
        // index
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new PerformanceDetailReportDTO();
            objReportsDto.setPartyNo(rs.getInt("PARTY_NO"));
            objReportsDto.setPartyName(rs.getString("PARTYNAME"));
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));
            objReportsDto.setRegionName(rs.getString("REGION"));
            objReportsDto.setZoneName(rs.getString("ZONE"));
            objReportsDto.setCrmACcountNO(rs.getString("CRMACCOUNTNO"));
            objReportsDto.setCus_segment(rs.getString("CUST_SEGMENT_CODE"));
            objReportsDto.setIndustrySegment(rs.getString("INDUSTRYSEGMENT"));
            objReportsDto.setOrder_type(rs.getString("DEMO_TYPE"));
            objReportsDto.setOrderType(rs.getString("ORDERTYPE"));
            objReportsDto.setOrdersubtype(rs.getString("ORDER_SUBTYPE"));
            objReportsDto.setOrderStatus(rs.getString("STAGE"));
            objReportsDto.setOrderDate(rs.getString("ORDERDATE"));

            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {
                objReportsDto.setOrderDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setOrderApproveDate(rs.getString("ORDER_APPROVED_DATE"));

            if (rs.getString("ORDER_APPROVED_DATE") != null
                    && !"".equals(rs.getString("ORDER_APPROVED_DATE"))) {
                objReportsDto.setOrderApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("ORDER_APPROVED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setPublishedDate(rs.getString("PUBLISHED_DATE"));

            if (rs.getString("PUBLISHED_DATE") != null && !"".equals(rs.getString("PUBLISHED_DATE"))) {
                objReportsDto.setPublishedDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("PUBLISHED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setAccountManager(rs.getString("ACCOUNTMANAGER"));
            objReportsDto.setProjectManager(rs.getString("PROJECTMANAGER"));
            objReportsDto.setVertical(rs.getString("VERTICAL_DETAILS"));
            objReportsDto.setOrderTotal(rs.getDouble("ORDER_TOTAL"));
            objReportsDto.setTaskName(rs.getString("TASK_NAME"));
            objReportsDto.setActualStartDate(rs.getString("TASKSTARTDATE"));

            if (rs.getString("TASKSTARTDATE") != null && !"".equals(rs.getString("TASKSTARTDATE"))) {
                objReportsDto.setActualStartDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("TASKSTARTDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setActualEndDate(rs.getString("TASKENDDATE"));

            if (rs.getString("TASKENDDATE") != null && !"".equals(rs.getString("TASKENDDATE"))) {
                objReportsDto.setActualEndDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("TASKENDDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setTaskNumber(rs.getInt("TASKID"));
            objReportsDto.setOwner(rs.getString("OWNER_NAME"));
            objReportsDto.setAccountMgrPhoneNo(rs.getString("PHONENO"));//changed by kalpana from long to string for bug id HYPR11042013001
            objReportsDto.setEmailId(rs.getString("EMAILID"));
            objReportsDto.setUserName(rs.getString("USER_NAME"));
            objReportsDto.setTotalDays(rs.getString("TASK_DAYS"));
            objReportsDto.setRemarks(rs.getString("ACTION_REMARKS"));
            objReportsDto.setOutCome(rs.getString("OUTCOME"));
            objReportsDto.setOsp(rs.getString("OSP"));
            objReportsDto.setPoNumber(rs.getInt("PODETAILNUMBER"));
            //         [404040] Start 
            objReportsDto.setOpportunityId((rs.getString("OPPORTUNITYID")));
            //[404040] End 
            objReportsDto.setOldLsi(rs.getString("OLD_LSI_CRM"));
            objReportsDto.setGroupName((rs.getString("GROUPNAME")));
            //lawkush start
            objReportsDto.setCopcStartDate(rs.getString("COPC_START_DATE"));
            if (rs.getString("COPC_START_DATE") != null && !"".equals(rs.getString("COPC_START_DATE"))) {
                objReportsDto.setCopcStartDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_START_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setCopcEndDate(rs.getString("COPC_END_DATE"));
            if (rs.getString("COPC_END_DATE") != null && !"".equals(rs.getString("COPC_END_DATE"))) {
                objReportsDto.setCopcEndDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_END_DATE").getTime())))
                                .toUpperCase());
            }
            //lawkush End
            //[130] start
            objReportsDto.setSalesForceOpportunityNumber(rs.getString("SF_OPP_ID"));
            objReportsDto.setChannelPartner(rs.getString("PARTNER_NAME"));
            objReportsDto.setPartnerId(rs.getString("PARTNER_ID"));
            //[130] End
            //[131] start
            objReportsDto.setPartnerCode(rs.getString("PARTNER_CODE"));
            objReportsDto.setFieldEngineer(rs.getString("FIELD_ENGINEER"));
            //[131] end
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        //ex.printStackTrace();
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        }
    }
    return listSearchDetails;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

/**
 * /*from ww  w  . j av a  2  s.  c  o  m*/
 * @param objDto
 * @return
 * @throws Exception
 */
public ArrayList<OrderDetailChangeReportDTO> viewOrderReportChange(OrderDetailChangeReportDTO objDto)
        throws Exception {
    //   Nagarjuna
    String methodName = "viewOrderReportChange", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end   
    ArrayList<OrderDetailChangeReportDTO> objUserList = new ArrayList<OrderDetailChangeReportDTO>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlOrderReportChange);

        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("yyyy-MM-dd");
            formattedDate = formatter.format(date1);
            proc.setString(2, formattedDate);
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("yyyy-MM-dd");
            formattedDate1 = formatter1.format(date2);
            proc.setString(3, formattedDate1);
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }

        /*if (objDto.getFromDate() != null
              && !"".equals(objDto.getFromDate())) {
           proc.setString(2, objDto.getFromDate().trim());
        } else {
           proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
           proc.setString(3, objDto.getToDate().trim());
        } else {
           proc.setNull(3, java.sql.Types.VARCHAR);
        }*/
        //Company Name
        proc.setNull(4, java.sql.Types.VARCHAR);
        // Logical Si no
        if (objDto.getLogicalSINo() != null && !"".equals(objDto.getLogicalSINo())) {
            proc.setLong(5, new Long(objDto.getLogicalSINo().trim()));
        } else {
            proc.setNull(5, java.sql.Types.BIGINT);
        }

        if (objDto.getFromAccountNo() != 0 && objDto.getToAccountNo() != 0) {
            proc.setLong(6, objDto.getFromAccountNo());
            proc.setLong(7, objDto.getToAccountNo());
        } else {
            proc.setNull(6, java.sql.Types.BIGINT);
            proc.setNull(7, java.sql.Types.BIGINT);
        }

        if (objDto.getFromOrderNo() != 0 && objDto.getToOrderNo() != 0) {
            proc.setLong(8, objDto.getFromOrderNo());
            proc.setLong(9, objDto.getToOrderNo());
        } else {
            proc.setNull(8, java.sql.Types.BIGINT);
            proc.setNull(9, java.sql.Types.BIGINT);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(10, pagingSorting.getSortByColumn());// columnName
        proc.setString(11, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(12, pagingSorting.getStartRecordId());// start index
        proc.setInt(13, pagingSorting.getEndRecordId());// end index
        proc.setInt(14, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(15, objDto.getOsp().trim());
        } else {
            proc.setNull(15, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromOrderDate() != null && !"".equals(objDto.getFromOrderDate())
                && objDto.getToOrderDate() != null && !"".equals(objDto.getToOrderDate())) {
            proc.setString(16, objDto.getFromOrderDate());
            proc.setString(17, objDto.getToOrderDate());
        } else {
            proc.setNull(16, java.sql.Types.VARCHAR);
            proc.setNull(17, java.sql.Types.VARCHAR);
        }

        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            objDto = new OrderDetailChangeReportDTO();
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setAccountManager(rs.getString("ACCT_MGR_NAME"));
            objDto.setAccountno(rs.getString("CRMACCOUNTNO"));
            objDto.setCustSegmentCode(rs.getString("CUST_SEGMENT_CODE"));
            objDto.setAccountCategory(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setServiceSubTypeName(rs.getString("SERVICESTAGE"));
            objDto.setServiceDetDescription(rs.getString("SERVICEDETDESCRIPTION"));
            objDto.setChargeStartDate(rs.getString("START_DATE"));
            if (rs.getString("START_DATE") != null && !"".equals(rs.getString("START_DATE"))) {
                Date date = df.parse(objDto.getChargeStartDate());
                objDto.setChargeStartDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setCancelFlag(rs.getString("CANCELFLAG"));
            objDto.setEntity(rs.getString("ENTITYNAME"));
            objDto.setServiceproductid(rs.getInt("SERVICEPRODUCTID"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setOrderDate(rs.getString("ORDERDATE"));
            if (rs.getDate("ORDERDATE") != null && !"".equals(rs.getDate("ORDERDATE"))) {
                Date date = rs.getDate("ORDERDATE");
                objDto.setOrderDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setCurrencyCode(rs.getString("CURNAME"));
            objDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {
                Date date = df.parse(objDto.getCustPoDate());
                objDto.setCustPoDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setLineItemQuantity(rs.getString("ITEM_QUANTITY"));
            objDto.setBillingBandwidth(rs.getString("BILLING_BANDWIDTH"));
            objDto.setBillingBandwidthUOM(rs.getString("BILLING_BANDWIDTH_UOM"));
            objDto.setDistance(rs.getString("DISTANCE"));
            objDto.setLineItemAmount(BigDecimal.valueOf((rs.getDouble("CHARGEAMOUNT"))).toPlainString());
            objDto.setChargeAnnotation(rs.getString("ANNOTATION"));
            objDto.setLOC_Date(rs.getString("LOCDATE"));
            if (rs.getString("LOCDATE") != null && !"".equals(rs.getString("LOCDATE"))) {
                Date date = df.parse(objDto.getLOC_Date());
                objDto.setLOC_Date((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setCopcApproveDate(rs.getString("COPC_APPROVAL_DATE"));
            if (rs.getString("COPC_APPROVAL_DATE") != null && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                objDto.setCopcApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setRfsDate(rs.getString("RFS_DATE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {
                Date date = df.parse(objDto.getRfsDate());
                objDto.setRfsDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setRfs_date(rs.getString("CUST_RFS_DATE"));
            if (rs.getString("CUST_RFS_DATE") != null && !"".equals(rs.getString("CUST_RFS_DATE"))) {
                Date date = df.parse(objDto.getRfs_date());
                objDto.setRfs_date((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objDto.setPoAmount(BigDecimal.valueOf((rs.getDouble("POAMOUNT"))).toPlainString());
            objDto.setOrderTotalAmount(BigDecimal.valueOf((rs.getDouble("TOT_AMOUNT"))).toPlainString());
            objDto.setAmApproveDate(rs.getString("AM_RECEIVE_DATE"));
            if (rs.getString("AM_RECEIVE_DATE") != null && !"".equals(rs.getString("AM_RECEIVE_DATE"))) {
                objDto.setAmApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("AM_RECEIVE_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setLogicalSINo(rs.getString("LOGICAL_SI_NO"));
            objDto.setStartDate(rs.getString("CHARGE_CRT_ORDERNO"));
            objDto.setEndDate(rs.getString("END_ORDER_NO"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setFrequencyName(rs.getString("FREQUENCYNAME"));
            objDto.setProjectManager(rs.getString("PRJ_MGR_NAME"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setRatio(rs.getString("RATIO"));
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objDto.setOsp(rs.getString("OSP"));
            // Anadi's   
            objDto.setCopcEndDate(rs.getString("COPC_END_DATE"));

            if (rs.getString("COPC_END_DATE") != null && !"".equals(rs.getString("COPC_END_DATE"))) {
                objDto.setCopcEndDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_END_DATE").getTime())))
                                .toUpperCase());

                //Date date=df.parse(objDto.getCopcEndDate());
                //objDto.setCopcEndDate((utility.showDate_Report(date)).toUpperCase());
            }
            // End : Anadi   
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

public ArrayList<DisconnectLineReportDTO> viewDisconnectionLineReport(DisconnectLineReportDTO objDto) {
    //   Nagarjuna
    String methodName = "viewDisconnectionLineReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end   /*from w  w w .j ava2  s  . c o  m*/
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    ArrayList<DisconnectLineReportDTO> listSearchDetails = new ArrayList<DisconnectLineReportDTO>();
    DisconnectLineReportDTO objReportsDto = null;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetDisconnectionLineReport);

        /*if (objDto.getOrdermonth() != null
              && !"".equals(objDto.getOrdermonth())) {
           proc.setString(1, objDto.getOrdermonth().trim());
        } else {
           proc.setNull(1, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getFromDate() != null
              && !"".equals(objDto.getFromDate())) {
           proc.setString(1, objDto.getFromDate().trim());
        } else {
           proc.setNull(1, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getToDate() != null 
              && !"".equals(objDto.getToDate())) {
           proc.setString(2, objDto.getToDate().trim());
        } else {
           proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getServiceName() != null 
              && !"".equals(objDto.getServiceName())) {
           proc.setString(3, objDto.getServiceName().trim());
        } else {
           proc.setNull(3, java.sql.Types.VARCHAR);
        }
        System.out.println("Vijay 2");
        if (objDto.getOrdersubtype() != null 
              && !"".equals(objDto.getOrdersubtype())) {
           proc.setString(4, objDto.getOrdersubtype().trim());
        } else {
           proc.setNull(4, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getVerticalDetails() != null 
              && !"".equals(objDto.getVerticalDetails())) {
           proc.setString(5, objDto.getVerticalDetails().trim());
        } else {
           proc.setNull(5, java.sql.Types.VARCHAR);
        }
                
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index
        System.out.println("Vijay 3");
        proc.setString(3, pagingSorting.getSortByColumn());// columnName
                
        System.out.println("Vijay sort column name :"+pagingSorting.getSortByColumn());
                
        proc.setString(4, PagingSorting.DB_Asc_Desc(pagingSorting
              .getSortByOrder()));// sort order
        proc.setInt(5, pagingSorting.getStartRecordId());// start index
         proc.setInt(6, pagingSorting.getEndRecordId());// end index
        proc.setInt(7, (pagingSorting.isPagingToBeDone() ? 1 : 0));*/

        if (objDto.getOrderNo() != null && !"".equals(objDto.getOrderNo())) {
            proc.setInt(1, new Integer(objDto.getOrderNo()));
        } else {
            proc.setNull(1, java.sql.Types.BIGINT);
        }
        //[303030]START
        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate()) && objDto.getToDate() != null
                && !"".equals(objDto.getToDate())) {
            //proc.setString(2, objDto.getCopcApproveDate());
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(objDto.getFromDate());
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(2, formattedDate);

            //proc.setString(2, objDto.getFromDate());

            formatter = new SimpleDateFormat("dd/MM/yyyy");
            dateStr = formatter.parse(objDto.getToDate());
            formattedDate = formatter.format(dateStr);
            date1 = formatter.parse(objDto.getToDate());
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(3, formattedDate);

            ///proc.setString(3, objDto.getToDate());

        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        //[303030]END
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(4, pagingSorting.getSortByColumn());// columnName
        proc.setString(5, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(6, pagingSorting.getStartRecordId());// start index
        proc.setInt(7, pagingSorting.getEndRecordId());// end index
        proc.setInt(8, (pagingSorting.isPagingToBeDone() ? 1 : 0));

        // index

        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new DisconnectLineReportDTO();
            objReportsDto.setPartyNo(rs.getInt("PARTY_NO"));
            objReportsDto.setAccountID(rs.getInt("CRMACCOUNTNO"));
            objReportsDto.setCust_name(rs.getString("PARTYNAME"));
            objReportsDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objReportsDto.setRegionName(rs.getString("REGION"));
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));
            objReportsDto.setOrder_type(rs.getString("ORDERTYPE"));
            objReportsDto.setM6OrderNo(rs.getInt("M6ORDERNO"));
            objReportsDto.setServiceName(rs.getString("SERVICENAME"));
            objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setLinename(rs.getString("SERVICEDETDESCRIPTION"));
            objReportsDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objReportsDto.setCkt_id(rs.getString("CKTID"));
            objReportsDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objReportsDto.setUom(rs.getString("UOM"));
            objReportsDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objReportsDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objReportsDto.setDistance(rs.getString("DISTANCE"));
            objReportsDto.setLocation_from(rs.getString("FROM_ADDRESS"));
            objReportsDto.setLocation_to(rs.getString("TO_ADDRESS"));
            objReportsDto.setPrimarylocation(rs.getString("PRIMARYLOCATION"));
            objReportsDto.setSeclocation(rs.getString("SECONDARYLOCATION"));
            objReportsDto.setProductName(rs.getString("PRODUCTNAME"));
            objReportsDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            objReportsDto.setEntity(rs.getString("ENTITYNAME"));
            objReportsDto.setLcompanyname(rs.getString("LCOMPANYNAME"));
            objReportsDto.setCurrencyName(rs.getString("CURRENCYNAME"));
            objReportsDto.setCreditPeriod(rs.getInt("CREDITPERIOD"));
            objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME"));
            objReportsDto.setBillingFormatName(rs.getString("BILLING_FORMATNAME"));
            objReportsDto.setBillingLevel(rs.getString("BILLING_LEVELNAME"));
            objReportsDto.setBillingLevelNo(rs.getLong("BILLING_LEVEL_NO"));
            objReportsDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objReportsDto.setHardwaretypeName(rs.getString("HARDWARETYPENAME"));
            objReportsDto.setHardware_flag(rs.getString("HARDWARE_FLAG"));
            objReportsDto.setStorename(rs.getString("STORENAME"));
            objReportsDto.setSaleType(rs.getString("SALETYPE"));
            objReportsDto.setBill_period(rs.getString("BILL_PERIOD"));
            objReportsDto.setBillingMode(rs.getString("BILLINGMODE"));
            objReportsDto.setPoNumber(rs.getInt("PONUMBER"));
            objReportsDto.setOldLsi(rs.getString("OLD_LSI_CRM"));
            objReportsDto.setBusiness_serial_n(rs.getInt("BUSINESS_SERIAL_NO"));
            objReportsDto.setOpms_Account_Id(rs.getString("OPMS_ACCOUNT_ID"));
            objReportsDto.setPoDate(rs.getString("PODATE"));
            if (rs.getString("PODATE") != null && !"".equals(rs.getString("PODATE"))) {
                Date date = df.parse(objReportsDto.getPoDate());
                objReportsDto.setPoDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objReportsDto.setTotalAmountIncludingCurrent(rs.getDouble("TOTALPOAMOUNT"));
            objReportsDto.setPoReceiveDate(rs.getString("PORECEIVEDATE"));
            if (rs.getString("PORECEIVEDATE") != null && !"".equals(rs.getString("PORECEIVEDATE"))) {
                Date date = df.parse(objReportsDto.getPoReceiveDate());
                objReportsDto.setPoReceiveDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objReportsDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {
                Date date = df.parse(objReportsDto.getCustPoDate());
                objReportsDto.setCustPoDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setCust_total_poamt(rs.getDouble("CUST_TOT_PO_AMT"));
            objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE"));
            objReportsDto.setChargeName(rs.getString("CHARGE_NAME"));
            objReportsDto.setChargeEndDate(rs.getString("CSTATE_CHARGE_CURRENT_START_DATE"));
            if (rs.getString("CSTATE_CHARGE_CURRENT_START_DATE") != null
                    && !"".equals(rs.getString("CSTATE_CHARGE_CURRENT_START_DATE"))) {
                Date date = df.parse(objReportsDto.getChargeEndDate());
                objReportsDto.setChargeEndDate((utility.showDate_Report(date)).toUpperCase());
            }
            //lawkush Start
            objReportsDto.setFrequencyAmount(rs.getDouble("INV_AMT"));
            objReportsDto.setChargeAmount(rs.getDouble("CUST_TOT_PO_AMT"));
            //lawkush End
            //   objReportsDto.setLineamt(rs.getLong("LINEITEMAMOUNT"));      //do
            objReportsDto.setLineamt(0);

            objReportsDto.setAnnitation(rs.getString("ANNOTATION"));
            objReportsDto.setLocDate(rs.getString("LOCDATE"));
            if (rs.getString("LOCDATE") != null && !"".equals(rs.getString("LOCDATE"))) {
                Date date = df.parse(objReportsDto.getLocDate());
                objReportsDto.setLocDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setLocno(rs.getString("LOCNO"));
            objReportsDto.setBilling_trigger_date(rs.getString("BILLINGTRIGGERDATE"));
            if (rs.getString("BILLINGTRIGGERDATE") != null && !"".equals(rs.getString("BILLINGTRIGGERDATE"))) {
                Date date = df.parse(objReportsDto.getBilling_trigger_date());
                objReportsDto.setBilling_trigger_date((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setBillingtrigger_createdate(rs.getString("BILLING_TRIGGER_CREATEDATE"));
            if (rs.getString("BILLING_TRIGGER_CREATEDATE") != null
                    && !"".equals(rs.getString("BILLING_TRIGGER_CREATEDATE"))) {
                objReportsDto.setBillingtrigger_createdate((utility
                        .showDate_Report(new Date(rs.getTimestamp("BILLING_TRIGGER_CREATEDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setPmapprovaldate(rs.getString("PM_PROV_DATE"));
            if (rs.getString("Pm_Prov_Date") != null && !"".equals(rs.getString("Pm_Prov_Date"))) {
                String s1 = rs.getString("Pm_Prov_Date");
                String s3 = s1.substring(0, 7);
                String s4 = s1.substring(9, 11);
                String s5 = s3.concat(s4);
                objReportsDto.setPmApproveDate(s5);
            }
            objReportsDto.setBilling_Trigger_Flag(rs.getString("BILLING_TRIGGER_FLAG"));

            objReportsDto.setTokenno(rs.getString("CSTATE_START_DETAILS_FX_TOKEN_NO"));
            objReportsDto.setFx_status(rs.getString("CSTATE_START_DETAILS_FX_STATUS"));
            objReportsDto.setFx_sd_status(rs.getString("CSTATE_FX_CHARGE_START_STATUS"));
            objReportsDto.setServiceId(rs.getInt("SERVICE_NO"));
            objReportsDto.setPre_crmorderid(rs.getInt("Pre_Crm_orderNo"));
            objReportsDto.setDisconnection_remarks(rs.getString("DISCONNECTION_REMARKS"));
            objReportsDto.setStageName(rs.getString("STAGE"));
            objReportsDto.setServiceStage(rs.getString("SERVICE_STAGE"));
            objReportsDto.setNeworder_remarks(rs.getString("NEWORDER_REMARKS"));
            objReportsDto.setCopcapprovaldate(rs.getString("COPC_APPROVED_DATE"));
            if (rs.getString("COPC_APPROVED_DATE") != null && !"".equals(rs.getString("COPC_APPROVED_DATE"))) {
                objReportsDto.setCopcapprovaldate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVED_DATE").getTime())))
                                .toUpperCase());
            }
            //objReportsDto.setRequest_rec_date(rs.getString("DISCONNECTION_RECEIVE_DATE"));

            objReportsDto.setStandard_reason(rs.getString("STANDARDREASON"));
            objReportsDto.setOrderDate(rs.getString("ORDERDATE"));
            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {
                objReportsDto.setOrderDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setRatio(rs.getString("RATIO"));
            objReportsDto.setChild_account_number(rs.getString("CHILD_ACCOUNT_NUMBER"));
            objReportsDto.setOrdermonth(rs.getString("ORDER_MONTH"));
            objReportsDto.setCkt_id(rs.getString("CKTID"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        //ex.printStackTrace();   
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        }
    }
    return listSearchDetails;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

public ArrayList<DisconnectChangeOrdeReportDTO> viewDisconnectionChangeOrderReport(
        DisconnectChangeOrdeReportDTO objDto) {
    //   Nagarjuna
    String methodName = "viewDisconnectionChangeOrderReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end//ww  w  .j  a v  a 2 s.c o  m
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    ArrayList<DisconnectChangeOrdeReportDTO> listSearchDetails = new ArrayList<DisconnectChangeOrdeReportDTO>();
    DisconnectChangeOrdeReportDTO objReportsDto = null;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat formatter2 = new SimpleDateFormat("MM-dd-yyyy");
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetDisconnectionChangeOrderReport);
        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            Date dateStr = formatter.parse(objDto.getFromDate().trim());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formattedDate = formatter2.format(date1);
            proc.setString(1, formattedDate);

        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            Date dateStr = formatter.parse(objDto.getToDate().trim());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formattedDate = formatter2.format(date1);
            proc.setString(2, formattedDate);
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(3, pagingSorting.getSortByColumn());// columnName
        proc.setString(4, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(5, pagingSorting.getStartRecordId());// start index
        proc.setInt(6, pagingSorting.getEndRecordId());// end index
        proc.setInt(7, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        if (objDto.getServiceName() != null && !"".equals(objDto.getServiceName())) {
            proc.setString(8, objDto.getServiceName().trim().toUpperCase());
        } else {
            proc.setNull(8, java.sql.Types.VARCHAR);
        }

        if (objDto.getOrdersubtype() != null && !"".equals(objDto.getOrdersubtype())) {
            proc.setInt(9, Integer.parseInt(objDto.getOrdersubtype().trim()));
        } else {
            proc.setNull(9, java.sql.Types.BIGINT);
        }
        proc.setNull(10, java.sql.Types.VARCHAR);
        if (objDto.getVerticalDetails() != null && !"".equals(objDto.getVerticalDetails())) {
            proc.setString(11, objDto.getVerticalDetails().trim().toUpperCase());
        } else {
            proc.setNull(11, java.sql.Types.VARCHAR);
        }

        if (objDto.getCus_segment() != null && !"".equals(objDto.getCus_segment())) {
            proc.setString(12, objDto.getCus_segment().trim().toUpperCase());
        } else {
            proc.setNull(12, java.sql.Types.VARCHAR);
        }
        if (objDto.getSrrequest() != null && !"".equals(objDto.getSrrequest())) {
            proc.setString(13, objDto.getSrrequest());
        } else {
            proc.setNull(13, java.sql.Types.VARCHAR);
        }

        /*if (objDto.getOrdermonth() != null
              && !"".equals(objDto.getOrdermonth())) {
           proc.setString(1, objDto.getOrdermonth().trim());
        } else {
           proc.setNull(1, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getFromDate() != null
              && !"".equals(objDto.getFromDate())) {
           Date dateStr = formatter.parse(objDto.getFromDate().trim());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formattedDate = formatter2.format(date1);
            proc.setString(2, formattedDate);
                   
        } else {
           proc.setNull(2, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getToDate() != null 
              && !"".equals(objDto.getToDate())) {
           Date dateStr = formatter.parse(objDto.getToDate().trim());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formattedDate = formatter2.format(date1);
           proc.setString(3, formattedDate);
        } else {
           proc.setNull(3, java.sql.Types.VARCHAR);
        }
        if (objDto.getServiceName() != null 
              && !"".equals(objDto.getServiceName())) {
           proc.setString(4, objDto.getServiceName().trim());
        } else {
           proc.setNull(4, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getOrdersubtype() != null
              && !"".equals(objDto.getOrdersubtype())) {
           proc.setInt(5, Integer.parseInt(objDto.getOrdersubtype().trim()));
        } else {
           proc.setNull(5, java.sql.Types.BIGINT);
        }
                
        if (objDto.getVerticalDetails() != null 
              && !"".equals(objDto.getVerticalDetails())) {
           proc.setString(6, objDto.getVerticalDetails().trim());
        } else {
           proc.setNull(6, java.sql.Types.VARCHAR);
        }
                
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index
                
        proc.setString(7, pagingSorting.getSortByColumn());// columnName
        proc.setString(8, PagingSorting.DB_Asc_Desc(pagingSorting
              .getSortByOrder()));// sort order
        proc.setInt(9, pagingSorting.getStartRecordId());// start index
         proc.setInt(10, pagingSorting.getEndRecordId());// end index
        proc.setInt(11, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        */
        // index
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new DisconnectChangeOrdeReportDTO();
            objReportsDto.setLogicalCircuitId(rs.getString("LOGICALCIRCUITID"));
            objReportsDto.setServiceName(rs.getString("SERVICENAME"));
            objReportsDto.setLinename(rs.getString("SERVICEDETDESCRIPTION"));
            objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE"));
            objReportsDto.setChargeName(rs.getString("CHARGE_NAME"));
            objReportsDto.setFrequencyName(rs.getString("FREQUENCY"));
            objReportsDto.setCus_segment(rs.getString("CUST_SEGMENT_CODE"));
            objReportsDto.setBill_period(rs.getString("BILL_PERIOD"));
            objReportsDto.setStartDateLogic(rs.getString("STARTDATELOGIC"));
            objReportsDto.setEndDateLogic(rs.getString("ENDDATELOGIC"));
            objReportsDto.setChargeEndDate(rs.getString("END_DATE"));
            if (!(rs.getString("END_DATE") == null || rs.getString("END_DATE") == "")) {

                Date date = df.parse(objReportsDto.getChargeEndDate());
                objReportsDto.setChargeEndDate((utility.showDate_Report(date)).toUpperCase());

            }

            objReportsDto.setStartDate(rs.getString("START_DATE"));
            if (!(rs.getString("START_DATE") == null || rs.getString("START_DATE") == "")) {

                Date date = df.parse(objReportsDto.getStartDate());
                objReportsDto.setStartDate((utility.showDate_Report(date)).toUpperCase());

            }
            objReportsDto.setAccountID(rs.getInt("CRMACCOUNTNO"));
            objReportsDto.setCreditPeriodName(rs.getString("CREDITPERIOD"));
            objReportsDto.setCurrencyName(rs.getString("CURRENCYNAME"));
            objReportsDto.setEntity(rs.getString("ENTITYNAME"));
            objReportsDto.setBillingMode(rs.getString("BILLINGMODE"));
            objReportsDto.setBilling_Trigger_Status(rs.getString("BILLING_TRIGGER_STATUS"));
            objReportsDto.setBilling_Trigger_Flag(rs.getString("Billing_Trigger_Flag"));
            objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME"));
            objReportsDto.setBillingformat(rs.getString("BILLING_FORMATNAME"));
            objReportsDto.setLicCompanyName(rs.getString("LCOMPANYNAME"));
            objReportsDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objReportsDto.setPenaltyClause(rs.getString("PENALTYCLAUSE"));
            objReportsDto.setBillingLevel(rs.getString("BILLING_LEVELNAME"));
            objReportsDto.setBillingLevelId(rs.getInt("BILLING_LEVEL_NO"));
            objReportsDto.setStore(rs.getString("STORENAME"));
            objReportsDto.setHardwareType(rs.getString("HARDWARETYPENAME"));
            objReportsDto.setFormAvailable(rs.getString("FORM_C_AVAILABLE"));
            objReportsDto.setNature_sale(rs.getString("SALENATURE"));
            objReportsDto.setType_sale(rs.getString("SALETYPE"));
            objReportsDto.setPoNumber(rs.getInt("PONUMBER"));
            objReportsDto.setPoDate(rs.getString("PODATE"));
            if (!(rs.getString("PODATE") == null || rs.getString("PODATE") == "")) {

                Date date = df.parse(objReportsDto.getPoDate());
                objReportsDto.setPoDate((utility.showDate_Report(date)).toUpperCase());

            }
            objReportsDto.setParty(rs.getString("PARTYNAME"));
            objReportsDto.setAnnitation(rs.getString("ANNOTATION"));
            objReportsDto.setTokenno(rs.getString("CSTATE_START_DETAILS_FX_TOKEN_NO"));
            objReportsDto.setPm_pro_date(rs.getString("Pm_Prov_Date"));

            objReportsDto.setLocDate(rs.getString("LOCDATE"));
            if (!(rs.getString("LOCDATE") == null || rs.getString("LOCDATE") == "")) {

                Date date = df.parse(objReportsDto.getLocDate());
                objReportsDto.setLocDate((utility.showDate_Report(date)).toUpperCase());

            }
            objReportsDto.setBillingTriggerDate(rs.getString("BILLINGTRIGGERDATE"));
            if (!(rs.getString("BILLINGTRIGGERDATE") == null || rs.getString("BILLINGTRIGGERDATE") == "")) {
                Date date = df.parse(objReportsDto.getBillingTriggerDate());
                objReportsDto.setBillingTriggerDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setChallenno(rs.getString("CHALLEN_NO"));
            objReportsDto.setChallendate(rs.getString("CHALLEN_DATE"));
            if (!(rs.getString("CHALLEN_DATE") == null || rs.getString("CHALLEN_DATE") == "")) {
                objDto.setChallendate(rs.getString("CHALLEN_DATE"));
                if (rs.getString("CHALLEN_DATE") != null && !"".equals(rs.getString("CHALLEN_DATE"))) {
                    String s1 = rs.getString("CHALLEN_DATE");
                    if (s1.length() == 10) {
                        s1 = "0" + s1;
                    }

                    String s3 = s1.substring(0, 7).toUpperCase();
                    String s4 = s1.substring(9, 11);
                    String s5 = s3.concat(s4);
                    objDto.setChallendate(s5);
                }
            }
            objReportsDto.setChild_act_no(rs.getString("Child_Account_Number"));
            objReportsDto.setChild_ac_fxstatus(rs.getString("Child_Account_FX_Sataus"));
            objReportsDto.setOrderDate(rs.getString("ORDERDATE"));
            if (!(rs.getString("ORDERDATE") == null || rs.getString("ORDERDATE") == "")) {
                objReportsDto.setOrderDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setOrder_type(rs.getString("ORDERTYPE"));
            objReportsDto.setServiceOrderType(rs.getString("SERVICE_ORDER_TYPE_DESC"));
            objReportsDto.setCopcapprovaldate(rs.getString("COPC_APPROVED_DATE"));
            if (!(rs.getString("COPC_APPROVED_DATE") == null || rs.getString("COPC_APPROVED_DATE") == "")) {
                objReportsDto.setCopcapprovaldate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setBillingtrigger_createdate(rs.getString("BILLING_TRIGGER_CREATEDATE"));
            if (!(rs.getString("BILLING_TRIGGER_CREATEDATE") == null
                    || rs.getString("BILLING_TRIGGER_CREATEDATE") == "")) {
                //Date date=df.parse(objReportsDto.getBillingtrigger_createdate());
                //objReportsDto.setBillingtrigger_createdate((utility.showDate_Report(date)).toUpperCase());
                objReportsDto.setBillingtrigger_createdate((utility
                        .showDate_Report(new Date(rs.getTimestamp("BILLING_TRIGGER_CREATEDATE").getTime())))
                                .toUpperCase());

            }
            objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setHardware_flag(rs.getString("HARDWARE_FLAG"));
            objReportsDto.setChargeinfoID(rs.getString("CHARGETYPEID"));
            if (objReportsDto.getChargeinfoID() == null) {
                objReportsDto.setChargeinfoID(" ");
            }
            objReportsDto.setServiceStage(rs.getString("SERVICE_STAGE"));
            objReportsDto.setOrderStage(rs.getString("STAGE"));
            objReportsDto.setActmgrname(rs.getString("ACCOUNTMANAGER"));
            objReportsDto.setPrjmngname(rs.getString("PROJECTMANAGER"));
            /*objReportsDto.setOrderDate(rs.getString("ORDERDATE"));
            if(!(rs.getString("ORDERDATE")==null || rs.getString("ORDERDATE")==""))
            {
               objReportsDto.setOrderDate((utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime()))).toUpperCase());
            }*/
            objReportsDto.setRfs_date(rs.getString("SERVICE_RFS_DATE"));
            if (!(rs.getString("SERVICE_RFS_DATE") == null || rs.getString("SERVICE_RFS_DATE") == "")) {
                //objReportsDto.setRfs_date(rs.getString("SERVICE_RFS_DATE"));
                //Date date=df.parse(objReportsDto.getRfs_date().trim());
                //objReportsDto.setRfs_date((utility.showDate_Report(date)).toUpperCase());
                objReportsDto.setRfs_date(
                        (utility.showDate_Report(new Date(rs.getTimestamp("SERVICE_RFS_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setCust_po_rec_date(rs.getString("PORECEIVEDATE"));
            if (!(rs.getString("PORECEIVEDATE") == null || rs.getString("PORECEIVEDATE") == "")) {

                Date date = df.parse(objReportsDto.getCust_po_rec_date());
                objReportsDto.setCust_po_rec_date((utility.showDate_Report(date)).toUpperCase());

            }
            objReportsDto.setCharge_status(rs.getString("CHARGES_STATUS"));
            objReportsDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objReportsDto.setRegion(rs.getString("REGION"));
            objReportsDto.setDemo(rs.getString("Demo_Type"));
            objReportsDto.setNewOrderRemark(rs.getString("NEWORDER_REMARKS"));
            //objReportsDto.setOrderStageDescription(rs.getString("STAGE"));
            //objReportsDto.setMocn_no(rs.getString("MOCN_NO"));
            objReportsDto.setDisconnection_remarks(rs.getString("DISCONNECTION_REMARKS"));
            objReportsDto.setSrno(rs.getString("SR_NO"));
            objReportsDto.setRequest_rec_date(rs.getString("SRDATE"));
            //objReportsDto.setLineno(rs.getInt("M6_CKTID"));
            //objReportsDto.setOrderDate((utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime()))).toUpperCase());
            String tmpDate = objReportsDto.getOrderDate().substring(
                    (objReportsDto.getOrderDate().indexOf("-") + 1), objReportsDto.getOrderDate().length());
            objReportsDto.setOrdermonth(tmpDate);
            objReportsDto.setCkt_id(rs.getString("CKTID"));
            objReportsDto.setStandard_reason(rs.getString("STANDARDREASON"));
            objReportsDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objReportsDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objReportsDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            //objReportsDto.setBandwidth_att(rs.getString("BANDWIDTH_ATT"));
            objReportsDto.setUom(rs.getString("UOM"));
            objReportsDto.setRate_code(rs.getString("RATECODE"));
            objReportsDto.setLast_mile_media(rs.getString("LAST_MILE_MEDIA"));
            objReportsDto.setLast_mile_remarks(rs.getString("LAST_MILE_REMARKS"));
            objReportsDto.setChargeable_Distance(rs.getString("DISTANCE"));
            objReportsDto.setLast_mile_provider(rs.getString("LAST_MILE_PROVIDER"));
            objReportsDto.setLink_type(rs.getString("LINK_TYPE"));
            objReportsDto.setDispatchAddress1(rs.getString("DISP_ADDRESS1"));
            objReportsDto.setIndicative_value(rs.getString("INDICATIVE_VALUE"));
            objReportsDto.setProductName(rs.getString("SERVICEDETDESCRIPTION"));
            objReportsDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (!(rs.getString("CUSTPODATE") == null || rs.getString("CUSTPODATE") == "")) {

                Date date = df.parse(objReportsDto.getCustPoDate());
                objReportsDto.setCustPoDate((utility.showDate_Report(date)).toUpperCase());

            }
            objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objReportsDto.setLocno(rs.getString("LOCNO"));
            objReportsDto.setPrimarylocation(rs.getString("PRIMARYLOCATION"));
            objReportsDto.setProdAlisName(rs.getString("PRODUCTNAME"));
            objReportsDto.setRatio(rs.getString("RATIO"));
            objReportsDto.setSeclocation(rs.getString("SECONDARYLOCATION"));
            objReportsDto.setSub_linename(rs.getString("SUBPRODUCTNAME"));
            //objReportsDto.setTokenNO(rs.getString("CSTATE_START_DETAILS_FX_TOKEN_NO"));
            objReportsDto.setOrderNo(rs.getString("ORDERNO"));
            objReportsDto.setCharge_hdr_id(rs.getInt("CHARGE_HDR_ID"));
            objReportsDto.setOrderLineNumber(rs.getInt("Order_Line_Id"));
            //objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setServiceId(rs.getInt("SERVICE_NO"));
            //objReportsDto.setLineItemAmount(rs.getString("LINEITEMAMOUNT"));
            objReportsDto
                    .setFrequencyAmt(BigDecimal.valueOf((rs.getDouble("CHARGEFREQUENCYAMT"))).toPlainString());

            if (objReportsDto.getFrequencyAmt() == null) {
                objReportsDto.setFrequencyAmt(" ");
            }
            //objReportsDto.setAmt(rs.getLong("CHARGEAMOUNT"));//particular charge amount
            objReportsDto.setLineItemAmount(BigDecimal.valueOf((rs.getDouble("CHARGEAMOUNT"))).toPlainString());

            if (objReportsDto.getLineItemAmount() == null) {
                objReportsDto.setLineItemAmount(" ");
            }
            //objReportsDto.setTotalAmountIncludingCurrent(rs.getDouble("TOTALPOAMOUNT"));
            objReportsDto.setChargeAmount_String(objReportsDto.getLineItemAmount());
            //objReportsDto.setAdvance(rs.getString("ADVANCE"));
            //objReportsDto.setInstallation_addressaa1(rs.getString("INSTALLEMENT"));
            objReportsDto.setStartDateDays(rs.getInt("START_DATE_DAYS"));
            objReportsDto.setStartDateMonth(rs.getInt("START_DATE_MONTH"));
            objReportsDto.setEndDateDays(rs.getInt("END_DATE_DAYS"));
            objReportsDto.setEndDateMonth(rs.getInt("END_DATE_MONTH"));
            objReportsDto.setAnnualRate(rs.getString("ANNUAL_RATE"));
            objReportsDto.setContractMonths(rs.getInt("CONTRACTPERIOD"));
            objReportsDto.setCommitmentPeriod(rs.getInt("COMMITMENTPERIOD"));
            objReportsDto.setNoticePeriod(rs.getInt("NOTICEPERIOD"));
            objReportsDto.setPeriodsInMonths(rs.getString("CONTRACTPERIOD"));
            objReportsDto.setTotalPoAmt(BigDecimal.valueOf((rs.getDouble("POAMOUNT"))).toPlainString());

            if (objReportsDto.getTotalPoAmt() == null) {
                objReportsDto.setTotalPoAmt(" ");
            }
            objReportsDto.setParty_id(rs.getInt("PARTY_NO"));
            objReportsDto.setCust_act_id(rs.getString("CUSTACCOUNTID"));
            //objReportsDto.setM6_prod_id(rs.getString("M6_PRODUCT_ID"));
            objReportsDto.setM6_order_id(rs.getString("M6ORDERNO"));
            objReportsDto.setPre_crmorderid(rs.getInt("Pre_Crm_orderNo"));
            //objReportsDto.setM6cktid(rs.getString("M6_CKTID"));
            objReportsDto.setPk_charge_id(rs.getString("CHARGEINFOID"));
            //objReportsDto.setBusiness_serial_no(rs.getString("Business_No"));
            objReportsDto.setBilling_location_from(rs.getString("FROM_ADDRESS"));
            objReportsDto.setBilling_location_to(rs.getString("TO_ADDRESS"));
            /*20151224-R1-021980 - Changes in Disconnection Report || ROM 
             *  CHanged by :satish Start*/
            objReportsDto.setDesiredDueDate(rs.getString("DESIRED_DUE_DATE"));
            objReportsDto.setDerivedDisconnectionDate(rs.getString("DERIVEDDISCONNECTIONDATE"));
            objReportsDto.setIsTriggerRequired(rs.getString("ISTRIGGERREQUIRED(Y/N)"));
            objReportsDto.setLineTriggered(rs.getString("LINETRIGGERED(Y/N)"));
            objReportsDto.setTriggerProcess(rs.getString("TRIGGERPROCESS"));
            objReportsDto.setTriggerDoneBy(rs.getString("BILLINGTRIGGERDONEBY"));
            objReportsDto.setAutomaticTriggerError(rs.getString("AUTOMATICTRIGGERERROR"));

            /*20151224-R1-021980 - Changes in Disconnection Report ||ends*/
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        //ex.printStackTrace();   
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        }
    }
    return listSearchDetails;
}