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_Usage.java

/**
 * Create a Report to generate Pending Billing Permanent Disconnection Report
         // w w w .  j  a  v  a  2  s .c  o  m
 * @param obj   a DTO which consist all the search parameters
 * @return      a ArrayList of dto which consist all the data of reports 
 * @exception   Sql Exception
 *            
 */

public ArrayList<ReportsDto> viewPendingBillingPDOrderList(ReportsDto objDto) throws Exception {
    //   Nagarjuna
    String methodName = "viewPendingBillingPDOrderList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<ReportsDto> objOrderList = new ArrayList<ReportsDto>();
    Connection conn = null;
    ResultSet rs = null;
    CallableStatement getOrder = null;

    try {
        conn = DbConnection.getReportsConnectionObject();
        getOrder = conn.prepareCall(SPGETSRORDERREPORT);
        String searchCRMOrder = objDto.getSearchCRMOrder();
        String searchfromDate = objDto.getSearchfromDate();
        String searchToDate = objDto.getSearchToDate();
        String searchSrno = objDto.getSearchSRNO();
        String searchLSI = objDto.getSearchLSI();
        if (searchCRMOrder == null || searchCRMOrder.trim().equals("")) {
            getOrder.setNull(1, java.sql.Types.BIGINT);
        } else {
            getOrder.setLong(1, Long.parseLong(searchCRMOrder));
        }
        if (searchfromDate == null || searchfromDate.trim().equals("")) {
            getOrder.setNull(2, java.sql.Types.VARCHAR);
        } else {
            getOrder.setString(2, searchfromDate);
        }

        if (searchToDate == null || searchToDate.trim().equals("")) {
            getOrder.setNull(3, java.sql.Types.VARCHAR);
        } else {
            getOrder.setString(3, searchToDate);
        }

        if (searchSrno == null || searchSrno.trim().equals("")) {
            getOrder.setNull(4, java.sql.Types.VARCHAR);
        } else {
            getOrder.setString(4, searchSrno);
        }

        if (searchLSI == null || searchLSI.trim().equals("")) {
            getOrder.setNull(5, java.sql.Types.VARCHAR);
        } else {
            getOrder.setString(5, searchLSI);
        }

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        getOrder.setString(6, pagingSorting.getSortByColumn());// columnName
        getOrder.setString(7, PagingSorting.DB_Asc_Desc1(pagingSorting.getSortByOrder()));// sort order
        getOrder.setInt(8, pagingSorting.getStartRecordId());// start index
        getOrder.setInt(9, pagingSorting.getEndRecordId());// end index
        getOrder.setInt(10, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index
        rs = getOrder.executeQuery();

        int countFlag = 0;
        int recordCount = 0;
        while (rs.next() != false) {
            countFlag++;
            objDto = new ReportsDto();
            objDto.setOrderNo(rs.getString("ORDERNO"));
            objDto.setSrno(rs.getString("SRNO"));
            objDto.setSrDate(rs.getString("SR_CREATION_DATE"));
            if (rs.getString("SR_CREATION_DATE") != null && !"".equals(rs.getString("SR_CREATION_DATE"))) {

                objDto.setSrDate(
                        (Utility.showDate_Report((rs.getTimestamp("SR_CREATION_DATE")))).toUpperCase());

            }
            objDto.setLogicalSINo(rs.getString("LSINO"));
            objDto.setOrderStatus(rs.getString("ORDER_STATUS"));
            objDto.setNeworder_remarks(rs.getString("REMARKS"));
            objDto.setProductName(rs.getString("SR_RAISED_BY"));
            objDto.setDisdate(rs.getString("DATE_DIS"));
            if (rs.getString("DATE_DIS") != null && !"".equals(rs.getString("DATE_DIS"))) {

                objDto.setDisdate((Utility.showDate_Report((rs.getTimestamp("DATE_DIS")))).toUpperCase());

            }

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }

            objOrderList.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 {
            rs.close();
            getOrder.close();
            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 objOrderList;
}

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

public ArrayList<ReportsDto> viewBulkSIUploadReport(ReportsDto objDto) {
    //   Nagarjuna
    String methodName = "viewBulkSIUploadReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;//from  w ww .j  a v a  2  s  . c  o  m
    int recordCount = 0;
    ArrayList<ReportsDto> listSearchDetails = new ArrayList<ReportsDto>();
    ReportsDto 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() != null && !"".equals(objDto.getDate_of_inst())) {
            proc.setString(1, objDto.getDate_of_inst().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

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

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

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

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

        if (objDto.getLinename() != null && !"".equals(objDto.getLinename())) {
            proc.setString(6, objDto.getLinename().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 ReportsDto();
            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"));
            objReportsDto.setInstallation_addressaa1(rs.getString("INSTALLATION_ADDRESSA1"));
            objReportsDto.setInstallation_addressaa2(rs.getString("INSTALLATION_ADDRESSA2"));
            objReportsDto.setInstallation_addressaa3(rs.getString("INSTALLATION_ADDRESSA3"));
            objReportsDto.setFrom_city(rs.getString("FROM_CITY"));
            objReportsDto.setFrom_state(rs.getString("FROM_STATE"));
            objReportsDto.setFrom_country(rs.getString("FROM_COUNTRY"));
            objReportsDto.setInstallation_addressab1(rs.getString("INSTALLATION_ADDRESSB1"));
            objReportsDto.setInstallation_addressab2(rs.getString("INSTALLATION_ADDRESSB2"));
            objReportsDto.setInstallation_addressab3(rs.getString("INSTALLATION_ADDRESSB3"));
            objReportsDto.setTo_city(rs.getString("TO_CITY"));
            objReportsDto.setTo_state(rs.getString("TO_STATE"));
            objReportsDto.setTo_country(rs.getString("TO_COUNTRY"));
            objReportsDto.setDate_of_inst(rs.getString("DATE_OF_INST"));
            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.setParent_name(rs.getString("PARENT_PRODUCT"));
            objReportsDto.setParent_circuit(rs.getString("PARENT_CIRCUIT"));
            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.setSi_id(rs.getInt("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.setTl(rs.getString("TL"));
            objReportsDto.setService_provider(rs.getString("LAST_MILE_PROVIDER"));

            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_Usage.java

public ArrayList<ReportsDto> viewZeroOrderValueReportDetails(ReportsDto objDto) throws Exception {

    //   Nagarjuna
    String methodName = "viewZeroOrderValueReportDetails", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<ReportsDto> objUserList = new ArrayList<ReportsDto>();
    Connection conn = null;/* ww w  .  j  a v  a 2  s . co m*/
    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(sqlZeroOrdervalueReport);

        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())) {
            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.getFromAccountNo() != 0 && objDto.getToAccountNo() != 0) {
            proc.setLong(4, objDto.getFromAccountNo());
            proc.setLong(5, objDto.getToAccountNo());
        } else {
            proc.setNull(4, java.sql.Types.BIGINT);
            proc.setNull(5, java.sql.Types.BIGINT);
        }

        if (objDto.getFromOrderNo() != 0 && objDto.getToOrderNo() != 0) {
            proc.setLong(6, objDto.getFromOrderNo());
            proc.setLong(7, objDto.getToOrderNo());
        } else {
            proc.setNull(6, java.sql.Types.BIGINT);
            proc.setNull(7, java.sql.Types.BIGINT);
        }
        if (objDto.getCustPoDetailNo() != null && !"".equals(objDto.getCustPoDetailNo())) {
            proc.setString(8, objDto.getCustPoDetailNo().trim());
        } else {
            proc.setNull(8, java.sql.Types.VARCHAR);
        }

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

        proc.setString(9, pagingSorting.getSortByColumn());// columnName
        proc.setString(10, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(11, pagingSorting.getStartRecordId());// start index
        proc.setInt(12, pagingSorting.getEndRecordId());// end index
        proc.setInt(13, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index

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

            objDto = new ReportsDto();

            objDto.setPartyName(rs.getString("PARTYNAME"));
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setPoDetailNo(rs.getString("PODETAILNUMBER"));
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setEntityId(rs.getString("ENTITYCODE"));
            objDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objDto.setCustPoDate(rs.getString("CUSTPODATE"));

            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {
                objDto.setCustPoDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("CUSTPODATE").getTime())))
                                .toUpperCase());
            }
            objDto.setPoAmounts(rs.getDouble("POAMOUNT"));
            objDto.setPaymentTerm(rs.getString("PAYMENTTERM"));
            objDto.setContractStartDate(rs.getString("CONTRACTSTARTDATE"));
            if (rs.getString("CONTRACTSTARTDATE") != null && !"".equals(rs.getString("CONTRACTSTARTDATE"))) {

                Date date = df.parse(objDto.getContractStartDate());
                objDto.setContractStartDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setContractEndDate(rs.getString("CONTRACTENDDATE"));
            if (rs.getString("CONTRACTENDDATE") != null && !"".equals(rs.getString("CONTRACTENDDATE"))) {

                Date date = df.parse(objDto.getContractEndDate());
                objDto.setContractEndDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setPoRecieveDate(rs.getString("PORECEIVEDATE"));
            if (rs.getString("PORECEIVEDATE") != null && !"".equals(rs.getString("PORECEIVEDATE"))) {

                Date date = df.parse(objDto.getPoRecieveDate());
                objDto.setPoRecieveDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setPoIssueBy(rs.getString("ISSUEDBY"));
            objDto.setPoEmailId(rs.getString("EMAILID"));
            objDto.setCrmACcountNO(rs.getString("CRMACCOUNTNO"));
            objDto.setPartyNo(rs.getInt("PARTY_NO"));
            objDto.setLogicalSINo(rs.getString("LOGICAL_SI_NO"));
            objDto.setAccountManager(rs.getString("ACCOUNTMANAGER"));
            objDto.setLineItemDescription(rs.getString("SERVICEPRODUCTID"));
            objDto.setRegionName(rs.getString("REGION"));
            objDto.setChargeAnnotation(rs.getString("ANNOTATION"));
            objDto.setM6OrderNo(rs.getInt("M6ORDERNO"));
            objDto.setFromLocation(rs.getString("FROM_LOCATION"));
            objDto.setToLocation(rs.getString("TO_LOCATION"));
            objDto.setServiceId(rs.getInt("SERVICEID"));
            objDto.setPoDemoContractPeriod(rs.getString("DEMOCONTRACTPERIOD"));
            objDto.setIsDefaultPO(rs.getInt("ISDEFAULTPO"));
            objDto.setCreatedBy(rs.getString("CREATEDBY"));
            objDto.setCreatedDate(rs.getString("CREATEDDATE"));
            if (rs.getString("CREATEDDATE") != null && !"".equals(rs.getString("CREATEDDATE"))) {
                objDto.setCreatedDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("CREATEDDATE").getTime())))
                                .toUpperCase());
            }
            objDto.setUom(rs.getString("UOM"));
            objDto.setBillingBandWidth(rs.getString("BILLING_BANDWIDTH"));
            objDto.setOrder_type(rs.getString("ORDER_TYPE"));
            objDto.setFxSiId(rs.getString("FX_SI_ID"));
            objDto.setSourceName("UNMIGRATED");
            objDto.setTokenNO(rs.getString("TOKEN_NO"));
            objDto.setPoEndDate(rs.getString("CONTRACTENDDATE"));
            if (rs.getString("CONTRACTENDDATE") != null && !"".equals(rs.getString("CONTRACTENDDATE"))) {

                Date date = df.parse(objDto.getPoEndDate());
                objDto.setPoEndDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setLastUpdatedDate("");
            objDto.setLastUpdatedBy("");

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
                //recordCount = countFlag;
            }
            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_Usage.java

public ArrayList<CustomerBaseReportsDTO> viewCustomerBaseReport(CustomerBaseReportsDTO objDto) {
    //   Nagarjuna
    String methodName = "viewCustomerBaseReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;/*from  w w  w  .  j  ava  2 s.c  om*/
    int recordCount = 0;
    ArrayList<CustomerBaseReportsDTO> listSearchDetails = new ArrayList<CustomerBaseReportsDTO>();
    CustomerBaseReportsDTO objReportsDto = null;
    Utility utility = new Utility();
    Date tempDate = null;
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetCustomerbaseReport);
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

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

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

        proc.setString(2, pagingSorting.getSortByColumn());// columnName
        proc.setString(3, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(4, pagingSorting.getStartRecordId());// start index
        proc.setInt(5, pagingSorting.getEndRecordId());// end index
        proc.setInt(6, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        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(7, formattedDate);
        } else {
            proc.setNull(7, 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(8, formattedDate1);
        } else {
            proc.setNull(8, java.sql.Types.VARCHAR);
        }
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new CustomerBaseReportsDTO();
            replaceSeperator("BILLING_LOCATION", rs.getString("BILLING_ADDRESS"));
            objReportsDto.setFxSiId(rs.getString("FX_SI_ID"));
            objReportsDto.setFx_external_acc_id(rs.getString("FX_ACCOUNT_EXTERNAL_ID"));
            tempDate = rs.getDate("SERVICEACTIVEDT");
            if (tempDate != null) {
                objReportsDto.setActiveDate(utility.showDate_Report(tempDate).toUpperCase());
            }
            objReportsDto.setInActiveDate(rs.getString("DISCONNECTION_DATE"));
            if (!(rs.getString("DISCONNECTION_DATE") == null || rs.getString("DISCONNECTION_DATE") == "")) {
                objReportsDto.setInActiveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("DISCONNECTION_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setOrderNo((rs.getString("ORDERNO")));
            objReportsDto.setCrmACcountNO(rs.getString("CRMACCOUNTNO"));
            objReportsDto.setAccountno(rs.getString("INTERNAL_ID"));
            objReportsDto.setAccountSegment(rs.getString("ACCOUNT_SEGMENT"));
            objReportsDto.setParent_name(rs.getString("PARENT_ID"));
            objReportsDto.setBillingFormatName(VAR_BILL_FNAME);
            objReportsDto.setBillCompany(rs.getString("BILL_COMPANY"));
            objReportsDto.setBillingAddress(VAR_BILL_ADDRESS1);
            objReportsDto.setBilling_address2(VAR_BILL_ADDRESS2);
            objReportsDto.setBilling_address(VAR_BILL_ADDRESS3);
            objReportsDto.setBillCity(VAR_BCP_CITY_NAME);
            objReportsDto.setBillState(VAR_BCP_STATE_NAME);
            objReportsDto.setAccountManager(rs.getString("ACCOUNT_MANAGER_NAME"));
            objReportsDto.setAcmgrEmail(rs.getString("ACCOUNT_MANAGER_EMAILID"));
            objReportsDto.setAccountMgrPhoneNo(rs.getString("ACCOUNT_MANAGER_PHONENO"));
            objReportsDto.setContact1_Phone(VAR_BILL_PHONE);
            objReportsDto.setContact2_Phone(rs.getString("CONTACT2_PHONE"));
            objReportsDto.setBillZip(VAR_BCP_PIN);
            objReportsDto.setOrder_type(rs.getString("ORDER_TYPE"));
            objReportsDto.setContactName(VAR_BILL_CON_PER_NAME);
            objReportsDto.setContactPersonEmail(VAR_EMAIL_ID);
            objReportsDto.setChairPersonName(rs.getString("CHAIRPERSON_NAME"));
            objReportsDto.setChairPersonPhone(rs.getString("CHAIRPERSON_PHONE"));
            objReportsDto.setChairPersonEmail(rs.getString("CHAIRPERSON_EMAIL"));
            objReportsDto.setComponentName(rs.getString("COMPONENT_NAME"));
            objReportsDto.setComponentActiveDate(rs.getString("COMP_ACTIVE_DATE"));
            if (!(rs.getString("COMP_ACTIVE_DATE") == null || rs.getString("COMP_ACTIVE_DATE") == "")) {
                objReportsDto.setComponentActiveDate(
                        (utility.showDate_Report(sdf.parse(rs.getString("COMP_ACTIVE_DATE")))).toUpperCase());
            }
            objReportsDto.setBusinessSegment(rs.getString("BUSINESS_SEGMENT"));
            if ((rs.getString("CONFIG_ID")) != null && !"".equals(rs.getString("CONFIG_ID"))
                    && (rs.getString("ENTITYID")) != null && !"".equals(rs.getString("ENTITYID"))) {
                String tBillPeriod = fnGetUsageReportBIllPeriod(rs.getString("CONFIG_ID"),
                        rs.getString("ENTITYID"));
                objReportsDto.setBill_period(tBillPeriod);
            }
            objReportsDto.setFrequencyName(rs.getString("BILL_FREQUENCY"));
            objReportsDto.setProductName(rs.getString("PRODUCT"));
            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_Usage.java

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

        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);
        }

        if (objDto.getSubChangeTypeName() != null && !"".equals(objDto.getSubChangeTypeName())) {
            proc.setString(4, objDto.getSubChangeTypeName().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

        proc.setString(6, pagingSorting.getSortByColumn());// columnName
        proc.setString(7, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(8, pagingSorting.getStartRecordId());// start index
        proc.setInt(9, pagingSorting.getEndRecordId());// end index
        proc.setInt(10, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        // index
        proc.setInt(11, objDto.getIsUsage());
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new RestPendingLineReportDTO();
            objReportsDto.setAccountID(rs.getInt("CUSTACCOUNTID"));
            objReportsDto.setPartyName(rs.getString("PARTYNAME"));
            objReportsDto.setPartyNo(rs.getInt("PARTY_NO"));
            objReportsDto.setOrderDate(rs.getString("ORDERDATE"));
            tempDate = rs.getDate("ORDERDATE");
            objReportsDto.setOrderDate(rs.getString("ORDERDATE"));
            if (tempDate != null && !"".equals(tempDate)) {
                objReportsDto.setOrderDate((utility.showDate_Report(tempDate)).toUpperCase());
            }
            /*          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());
                        }*/
            tempDate = rs.getDate("PODATE");
            objReportsDto.setPoDate(rs.getString("PODATE"));
            if (tempDate != null && !"".equals(tempDate)) {
                objReportsDto.setPoDate((utility.showDate_Report(tempDate)).toUpperCase());
            }
            /*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());
               }*/
            tempDate = rs.getDate("CUSTPODATE");
            objReportsDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (tempDate != null && !"".equals(tempDate)) {
                objReportsDto.setCustPoDate((utility.showDate_Report(tempDate)).toUpperCase());
            }
            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.setLink_type(rs.getString("LINK_TYPE"));
            objReportsDto.setIndicative_value(rs.getString("INDICATIVE_VALUE"));
            objReportsDto.setUom(rs.getString("UOM"));
            objReportsDto.setLast_mile_provider(rs.getString("LAST_MILE_PROVIDER"));
            objReportsDto.setBillingMode(rs.getString("BILLINGMODE"));
            objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objReportsDto.setPoNumber(rs.getInt("PONUMBER"));
            //objReportsDto.setPrimarylocation(rs.getString("PRIMARYLOCATION"));
            setBlank();
            replaceSeperator("PRIMARYLOCATION", rs.getString("PRIMARYLOCATION"));
            objReportsDto.setPrimarylocation(VAR_PRIMARYLOCATION);
            //objReportsDto.setSeclocation(rs.getString("SECONDARYLOCATION"));
            replaceSeperator("SECONDARYLOCATION", rs.getString("SECONDARYLOCATION"));
            objReportsDto.setSeclocation(VAR_SECONDARYLOCATION);

            /*objReportsDto.setRfs_date(rs.getString("SERVICE_RFS_DATE"));
            if (rs.getString("SERVICE_RFS_DATE") != null && !"".equals(rs.getString("SERVICE_RFS_DATE")))
            {
               Date date=df.parse(objReportsDto.getRfs_date());
               objReportsDto.setRfs_date((Utility.showDate_Report(date)).toUpperCase());
                    
            }*/
            tempDate = rs.getDate("SERVICE_RFS_DATE");
            objReportsDto.setRfs_date(rs.getString("SERVICE_RFS_DATE"));
            if (tempDate != null && !"".equals(tempDate)) {
                objReportsDto.setRfs_date((utility.showDate_Report(tempDate)).toUpperCase());
            }
            objReportsDto.setProductName(rs.getString("PRODUCTNAME"));
            objReportsDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            objReportsDto.setMocn_no(rs.getString("MOCN_NO"));
            objReportsDto.setBillingLevelNo(rs.getLong("BILLING_LEVEL_NO"));
            objReportsDto.setLogicalCircuitId(rs.getString("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setServiceName(rs.getString("SERVICENAME"));
            objReportsDto.setCkt_id(rs.getString("CKTID"));
            objReportsDto.setBillingLevel(rs.getString("BILLING_LEVELNAME"));
            objReportsDto.setDemoType(rs.getString("Demo_Type"));
            objReportsDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objReportsDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objReportsDto.setDistance(rs.getString("DISTANCE"));
            objReportsDto.setStageName(rs.getString("ORDERSTAGE"));
            objReportsDto.setOrder_type(rs.getString("ORDERTYPE"));
            objReportsDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objReportsDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));

            objReportsDto.setCurrencyName(rs.getString("CURRENCYNAME"));
            objReportsDto.setEntity(rs.getString("ENTITYNAME"));
            objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME"));
            objReportsDto.setBillingFormatName(rs.getString("BILLING_FORMATNAME"));
            objReportsDto.setLcompanyname(rs.getString("LCOMPANYNAME"));
            objReportsDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));
            objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objReportsDto.setTotalAmountIncludingCurrent(rs.getDouble("TOTALPOAMOUNT"));
            objReportsDto.setParty_id(rs.getInt("PARTY_ID"));
            objReportsDto.setCrmAccountNo(rs.getInt("CRMACCOUNTNO"));
            objReportsDto.setM6cktid(rs.getString("M6_PRODUCT_ID"));
            objReportsDto.setCust_total_poamt(rs.getDouble("CUST_TOT_PO_AMT"));

            if (objDto.getIsUsage() == 1) {
                objReportsDto.setCancelBy(rs.getString("CANCEL_BY"));
                //objReportsDto.setCanceldate(rs.getString("CANCELDATE"));

                tempDate = rs.getDate("CANCEL_DATE");
                if (tempDate != null) {
                    objReportsDto.setCanceldate((Utility.showDate_Report(tempDate)).toUpperCase());
                }

                objReportsDto.setCreditPeriodName(rs.getString("CREDIT_PERIODNAME"));
                objReportsDto.setM6_prod_id(rs.getString("CHILDSPECID"));
                objReportsDto.setServiceId(rs.getInt("SERVICE_NO"));
                objReportsDto.setServiceproductid(rs.getInt("Order_Line_Id"));
                objReportsDto.setLinename(rs.getString("SERVICEDETDESCRIPTION"));
                objReportsDto.setCancelServiceReason(rs.getString("CANCEL_RESION"));

                ComponentsDto dto = new ComponentsDto();
                objReportsDto.setRegionName(rs.getString("REGION"));
                objReportsDto.setAccountManager(rs.getString("ACCOUNTMANAGER"));
                objReportsDto.setProjectManager(rs.getString("PROJECTMANAGER"));
                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.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());
                   }*/
                tempDate = rs.getDate("PORECEIVEDATE");
                objReportsDto.setPoReceiveDate(rs.getString("PORECEIVEDATE"));
                if (tempDate != null && !"".equals(tempDate)) {
                    objReportsDto.setPoReceiveDate((utility.showDate_Report(tempDate)).toUpperCase());
                }
                //objReportsDto.setBilling_address(rs.getString("BILLING_ADDRESS"));
                replaceSeperator("BILLING_LOCATION", rs.getString("BILLING_ADDRESS"));
                objReportsDto.setBilling_address(VAR_BILLING_ADDRESS);
                objReportsDto.setLineno(rs.getInt("Order_Line_Id"));
                objReportsDto.setLocation_from(rs.getString("FROM_ADDRESS"));
                objReportsDto.setLocation_to(rs.getString("TO_ADDRESS"));
                objReportsDto.setServiceStage(rs.getString("SERVICE_STAGE"));
                objReportsDto.setChild_act_no(rs.getString("Child_Account_Number"));
                objReportsDto.setCrm_productname(rs.getString("SERVICEDETDESCRIPTION"));

                objReportsDto.setComponentInfoID(rs.getInt("COMPONENTINFOID"));
                dto.setComponentStatus(rs.getString("COMPONENT_STATUS"));
                objReportsDto.setComponentID(rs.getInt("COMPONENT_ID"));
                objReportsDto.setComponentName(rs.getString("COMPONENT_NAME"));
                objReportsDto.setPackageID(rs.getInt("PACKAGE_ID"));
                objReportsDto.setPackageName(rs.getString("PACKAGE_NAME"));
                objReportsDto.setFx_internal_acc_id(rs.getLong("INTERNAL_ID"));
                dto.setComponentInstanceID(rs.getString("COMPONENT_INST_ID"));
                dto.setComponentType(rs.getString("COMPONENT_TYPE"));
                dto.setComponentAmount(rs.getDouble("COMP_AMOUNT"));
                dto.setFxTokenNo(rs.getString("START_COMPONENT_TOKEN_NO"));
                dto.setStartDate(rs.getString("SYSTEM_START_DATE"));
                if (rs.getString("SYSTEM_START_DATE") != null
                        && !"".equalsIgnoreCase(rs.getString("SYSTEM_START_DATE"))) {
                    Date date = df.parse(dto.getStartDate());
                    dto.setStartDate((Utility.showDate_Report(date)).toUpperCase());
                }
                dto.setFxStartStatus(rs.getString("SYSTEM_START_STATUS"));
                dto.setEndFxStatus(rs.getString("SYSTEM_END_STATUS"));
                //dto.setComponentFXStatus(rs.getString("FX_STATUS"));
                // <!--GlobalDataBillingEfficiency BFR5  -->
                objReportsDto.setTaxExcemption_Reason(rs.getString("TAXEXCEMPTION_REASON"));

                objReportsDto.setComponentDto(dto);
            } else {
                objReportsDto.setCreditPeriod(rs.getInt("CREDITPERIOD"));
                objReportsDto.setLb_service_id(rs.getString("LB_SERVICE_LIST_ID"));
                objReportsDto.setServiceproductid(rs.getInt("SERVICEPRODUCTID"));
                objReportsDto.setServiceId(rs.getInt("SERVICEID"));
                objReportsDto.setPoAmountSum(rs.getLong("ORDERAMOUNT"));
                objReportsDto.setRegionName(rs.getString("REGIONNAME"));
                objReportsDto.setCancelServiceReason(rs.getString("CANCELREASON"));
                objReportsDto.setChild_act_no(rs.getString("CHILD_AC_NO"));
                objReportsDto.setBisource(rs.getString("BISOURCE"));
                objReportsDto.setServiceStage(rs.getString("SERVICESTAGE"));
                objReportsDto.setLocation_from(rs.getString("FROM_LOCATION"));
                objReportsDto.setLocation_to(rs.getString("TO_LOCATION"));
                objReportsDto.setLinename(rs.getString("LINENAME"));
                objReportsDto.setCrm_productname(rs.getString("CRMPRODUCTNAME"));
                objReportsDto.setAccountID(rs.getInt("CUSTACCOUNTID"));
                objReportsDto.setAccountManager(rs.getString("ACTMNAME"));
                objReportsDto.setProjectManager(rs.getString("PMNAME"));
                objReportsDto.setAmapprovaldate(rs.getString("AM_APPROVAL_DATE"));
                if (rs.getString("AM_APPROVAL_DATE") != null && !"".equals(rs.getString("AM_APPROVAL_DATE"))) {
                    objReportsDto.setAmapprovaldate(
                            (Utility.showDate_Report(new Date(rs.getTimestamp("AM_APPROVAL_DATE").getTime())))
                                    .toUpperCase());
                }
                objReportsDto.setPmapprovaldate(rs.getString("PM_APPROVAL_DATE"));
                if (rs.getString("PM_APPROVAL_DATE") != null && !"".equals(rs.getString("PM_APPROVAL_DATE"))) {
                    objReportsDto.setPmapprovaldate(
                            (Utility.showDate_Report(new Date(rs.getTimestamp("PM_APPROVAL_DATE").getTime())))
                                    .toUpperCase());
                }

                objReportsDto.setCopcapprovaldate(rs.getString("COPC_APPROVAL_DATE"));
                if (rs.getString("COPC_APPROVAL_DATE") != null
                        && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                    objReportsDto.setCopcApproveDate(
                            (Utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime())))
                                    .toUpperCase());
                }
                objReportsDto.setOrderDate(rs.getString("ORDERCREATEDATE"));
                if (rs.getString("ORDERCREATEDATE") != null && !"".equals(rs.getString("ORDERCREATEDATE"))) {
                    Date date = df.parse(objReportsDto.getOrderDate());
                    objReportsDto.setOrderDate((Utility.showDate_Report(date)).toUpperCase());
                }
                objReportsDto.setPoReceiveDate(rs.getString("CUSTPORECDATE"));
                if (rs.getString("CUSTPORECDATE") != null && !"".equals(rs.getString("CUSTPORECDATE"))) {
                    Date date = df.parse(objReportsDto.getPoReceiveDate());
                    objReportsDto.setPoReceiveDate((Utility.showDate_Report(date)).toUpperCase());
                }

                objReportsDto.setChargeEndDate(rs.getString("CHARGE_START_DATE"));
                if (rs.getString("CHARGE_START_DATE") != null
                        && !"".equals(rs.getString("CHARGE_START_DATE"))) {
                    Date date = df.parse(objReportsDto.getChargeEndDate());
                    objReportsDto.setChargeEndDate((Utility.showDate_Report(date)).toUpperCase());
                }
                objReportsDto.setLineno(rs.getInt("LINEITEMNO"));
                objReportsDto.setOpms_act_id(rs.getString("OPMS_ACT_ID"));
                objReportsDto.setAddress1(rs.getString("ADDRESS"));
                objReportsDto.setCancelflag(rs.getString("CANCELBY"));
                objReportsDto.setBilling_address(rs.getString("BILLING_LOCATION"));
                objReportsDto.setCanceldate(rs.getString("CANCELDATE"));

                objReportsDto.setDispatchAddress1(rs.getString("DISPATCHADDRESS"));
                objReportsDto.setHardware_flag(rs.getString("HARDWARE_FLAG"));
                objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPEID"));
                objReportsDto.setCharge_status(rs.getString("CHARGES_STATUS"));
                objReportsDto.setFormAvailable(rs.getString("FORM_C_AVAILABLE"));
                objReportsDto.setChargeName(rs.getString("CHARGE_NAME"));
                objReportsDto.setFx_status(rs.getString("FX_STATUS"));
                objReportsDto.setFx_sd_status(rs.getString("Fx_St_Chg_Status"));
                objReportsDto.setFx_ed_status(rs.getString("Fx_Ed_Chg_Status"));
                objReportsDto.setChild_ac_fxstatus(rs.getString("Child_Account_FX_Sataus"));
                objReportsDto.setFrequencyName(rs.getString("FREQUENCY"));
                objReportsDto.setHardwaretypeName(rs.getString("HARDWARETYPENAME"));
                objReportsDto.setTokenno(rs.getString("TOKENNO"));
                objReportsDto.setSaleNature(rs.getString("SALENATURENAME"));
                objReportsDto.setSaleType(rs.getString("SALETYPENAME"));
                objReportsDto.setRatio(rs.getString("RATIO"));
                objReportsDto.setAnnitation(rs.getString("ANNOTATION"));
                objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE"));
                objReportsDto.setStorename(rs.getString("STORENAME"));
                objReportsDto.setBill_period(rs.getString("BILL_PERIOD"));
                if ((rs.getString("CONFIG_ID")) != null && !"".equals(rs.getString("CONFIG_ID"))
                        && (rs.getString("ENTITYID")) != null && !"".equals(rs.getString("ENTITYID"))) {
                    String tBillPeriod = fnGetUsageReportBIllPeriod(rs.getString("CONFIG_ID"),
                            rs.getString("ENTITYID"));
                    objReportsDto.setBill_period(tBillPeriod);

                }
                objReportsDto.setChargeAmount(rs.getDouble("INV_AMT"));
                objReportsDto.setLineamt(rs.getLong("LINEITEMAMOUNT"));
                objReportsDto.setBusiness_serial_no(rs.getString("BUSINESS_SERIAL_NO"));
                objReportsDto.setLb_pk_charge_id(rs.getString("LB_PK_CHARGE_ID"));
                objReportsDto.setChargeinfoID(rs.getString("PK_CHARGE_ID"));
                objReportsDto.setAnnual_rate(rs.getInt("ANNUAL_RATE"));
                // <!--GlobalDataBillingEfficiency BFR5  -->
                objReportsDto.setTaxExcemption_Reason(rs.getString("TAXEXCEMPTION_REASON"));
            }
            //[005] Start
            objReportsDto.setInstallationFromCity(rs.getString("INSTALLATION_FROM_CITY"));
            objReportsDto.setInstallationToCity(rs.getString("INSTALLATION_TO_CITY"));
            objReportsDto.setInstallationFromState(rs.getString("INSTALLATION_FROM_STATE"));
            objReportsDto.setInstallationToState(rs.getString("INSTALLATION_TO_STATE"));
            objReportsDto.setBillingContactName(rs.getString("BILLING_CONTACT_NAME"));
            objReportsDto.setBillingContactNumber(rs.getString("BILLING_CONTACT_NUMBER"));
            objReportsDto.setBillingEmailId(rs.getString("BILLING_EMAIL_ID"));
            //[005] End

            //[006] Start
            objReportsDto.setStandardReason(rs.getString("STANDARDREASON"));
            //[006] End

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();   
    } 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_Usage.java

public ArrayList<ReportsDto> viewPendingServicesReport(ReportsDto objDto) {
    //Nagarjuna//from   w  w w.j  a va  2 s  .  c  om
    String methodName = "viewPendingServicesReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    ArrayList<ReportsDto> listSearchDetails = new ArrayList<ReportsDto>();
    ReportsDto objReportsDto = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetPendingServicesReport);
        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())) {
            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));
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new ReportsDto();
            objReportsDto.setParty_no(rs.getInt("Party_NO"));
            objReportsDto.setPartyName(rs.getString("PARTYNAME"));
            objReportsDto.setCrmAccountNoString(rs.getString("CRMACCOUNTNO"));
            objReportsDto.setAccountManager(rs.getString("ACCOUNTMANAGER"));
            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.setAmApproveDate(rs.getString("AM_APPROVED_DATE"));
            if (rs.getString("AM_APPROVED_DATE") != null && !"".equals(rs.getString("AM_APPROVED_DATE"))) {
                objReportsDto.setAmApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("AM_APPROVED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setAmName(rs.getString("AM_APPROVED_BY"));
            objReportsDto.setProjectManager(rs.getString("PROJECTMANAGER"));
            objReportsDto.setPmApproveDate(rs.getString("PM_APPROVED_DATE"));
            if (rs.getString("PM_APPROVED_DATE") != null && !"".equals(rs.getString("PM_APPROVED_DATE"))) {
                objReportsDto.setPmApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("PM_APPROVED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setPmName(rs.getString("PM_APPROVED_BY"));
            objReportsDto.setCopcApproveDate(rs.getString("FINAL_APPROVED_DATE"));//Copc date
            if (rs.getString("FINAL_APPROVED_DATE") != null
                    && !"".equals(rs.getString("FINAL_APPROVED_DATE"))) {
                objReportsDto.setCopcApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("FINAL_APPROVED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setCopcName(rs.getString("COPC_APPROVED_BY"));
            objReportsDto.setOrderType(rs.getString("ORDERTYPE"));
            objReportsDto.setOrderStage(rs.getString("APPROVED_STATUS"));
            objReportsDto.setServiceName(rs.getString("SERVICENAME"));
            objReportsDto.setM6OrderDate(rs.getString("M6_ORDER_DATE"));
            if (rs.getString("M6_ORDER_DATE") != null && !"".equals(rs.getString("M6_ORDER_DATE"))) {
                objReportsDto.setM6OrderDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("M6_ORDER_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setBillingStatus(rs.getString("BILLING_STATUS"));
            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.setEffStartDate(rs.getString("EFFECTIVE_START_DATE"));
            if (rs.getString("EFFECTIVE_START_DATE") != null
                    && !"".equals(rs.getString("EFFECTIVE_START_DATE"))) {
                objReportsDto.setEffStartDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("EFFECTIVE_START_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setOrderStatus(rs.getString("ORDER_STATUS"));
            objReportsDto.setServiceStage(rs.getString("SERVICE_STAGE"));
            objReportsDto.setCircuitStatus(rs.getString("CIRCUIT_STATUS"));
            objReportsDto.setRegionName(rs.getString("REGION"));
            objReportsDto.setZoneName(rs.getString("ZONE"));
            objReportsDto.setStandardReason(rs.getString("STANDARD_REASON"));
            objReportsDto.setLogicalSINo(rs.getString("LOGICAL_SI_NO"));
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));
            objReportsDto.setServiceIdString(rs.getString("SERVICEID"));
            objReportsDto.setAccountId(rs.getLong("ACCOUNTID"));
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();   
    } 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_Usage.java

public ArrayList<OBValueReportDTO> viewOBValueReport_Usage(OBValueReportDTO objDto) throws Exception {

    String methodName = "viewOBValueReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    ArrayList<OBValueReportDTO> objUserList = new ArrayList<OBValueReportDTO>();
    Connection conn = null;// www  .ja v a  2  s  .co m
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    OBValueReportDTO objRDto;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        conn = DbConnection.getReportsConnectionObject();
        proc = conn.prepareCall(sqlOBValueReport_Usage);

        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);
        } 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.getVerticalDetails() != null && !"".equals(objDto.getVerticalDetails())) {
            proc.setString(4, objDto.getVerticalDetails().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index
        proc.setString(5, pagingSorting.getSortByColumn());// columnName
        proc.setString(6, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(7, pagingSorting.getStartRecordId());// start index
        proc.setInt(8, pagingSorting.getEndRecordId());// end index
        proc.setInt(9, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            objDto = new OBValueReportDTO();
            objDto.setPartyNo(rs.getInt("PARTY_NO"));
            objDto.setPartyName(rs.getString("PARTYNAME"));
            objDto.setOrderNo(rs.getString("ORDERNO"));
            objDto.setOpportunityId((rs.getString("OPPORTUNITYID")));
            objDto.setLineType(rs.getString("LINETYPE"));
            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.setLogicalCircuitId(rs.getString("LOGICALCKTID"));
            objDto.setServiceId(rs.getInt("SERVICENO"));
            objDto.setQuoteNo(rs.getString("QUOTENO"));
            objDto.setProductName(rs.getString("PRODUCTNAME"));
            objDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            if (rs.getString("FROM_SITE") != null && !"".equals(rs.getString("FROM_SITE"))
                    && rs.getString("PRIMARYLOCATIONTYPE") != null) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("FROM_SITE").split("~~");
                    objDto.setPrimaryLocation(ss[0] + " " + ss[1] + " " + ss[4] + " " + ss[5] + " " + ss[6]
                            + " " + ss[7] + " " + ss[8] + " " + ss[9] + " " + ss[10] + " " + ss[2]);
                } else {
                    String ss[] = rs.getString("FROM_SITE").split("~~");
                    objDto.setPrimaryLocation(ss[0] + " " + ss[1] + " " + ss[5] + " " + ss[3]);
                }
            } else {
                objDto.setPrimaryLocation("");
            }
            if (rs.getString("TO_SITE") != null && !"".equals(rs.getString("TO_SITE"))
                    && rs.getString("SECONDARYLOCATIONTYPE") != null) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("TO_SITE").split("~~");
                    objDto.setSeclocation(ss[0] + " " + ss[1] + " " + ss[4] + " " + ss[5] + " " + ss[6] + " "
                            + ss[7] + " " + ss[8] + " " + ss[9] + " " + ss[10] + " " + ss[2]);
                } else {
                    String ss[] = rs.getString("TO_SITE").split("~~");
                    objDto.setSeclocation(ss[0] + " " + ss[1] + " " + ss[5] + " " + ss[3]);
                }
            } else {
                objDto.setSeclocation("");
            }
            objDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objDto.setPrjmngname(rs.getString("PRJ_MGR_NAME"));
            objDto.setPrjmgremail(rs.getString("PROJECTMGR_MAIL"));
            objDto.setActmngname(rs.getString("ACCT_MGR_NAME"));
            objDto.setZoneName(rs.getString("ZONENNAME"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {
                objDto.setCustPoDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("CUSTPODATE").getTime())))
                                .toUpperCase());
            }
            objDto.setOrderDate(rs.getString("ORDERDATE"));
            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {
                objDto.setOrderDate((utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime())))
                        .toUpperCase());
            }
            objDto.setPmApproveDate(rs.getString("PM_APPROVAL_DATE"));
            if (rs.getString("PM_APPROVAL_DATE") != null && !"".equals(rs.getString("PM_APPROVAL_DATE"))) {
                objDto.setPmApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("PM_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setAmApproveDate(rs.getString("AM_APPROVAL_DATE"));
            if (rs.getString("AM_APPROVAL_DATE") != null && !"".equals(rs.getString("AM_APPROVAL_DATE"))) {
                objDto.setAmApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("AM_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setDemo_infrastartdate(rs.getString("DEMP_INFRA_START_DATE"));
            objDto.setDemo_infra_enddate(rs.getString("DEMO_INFRA_ENDDATE"));
            objDto.setRfs_date(rs.getString("RFS_DATE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {
                objDto.setRfs_date((utility.showDate_Report(new Date(rs.getTimestamp("RFS_DATE").getTime())))
                        .toUpperCase());
            }
            objDto.setOrdercategory(rs.getString("ORDERCATEGORY"));
            objDto.setOrderStatus(rs.getString("STATUS"));
            objDto.setLinename(rs.getString("LINENAME"));
            objDto.setSub_linename(rs.getString("ORDER_SUBLINENAME"));
            objDto.setComponentName(rs.getString("COMPONENT_NAME"));
            objDto.setComponentID(rs.getInt("COMPONENTINFOID"));
            objDto.setServiceProductID(rs.getInt("LINENO"));
            objDto.setServiceName(rs.getString("SERVICENAME"));
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setEntity(rs.getString("COMPANYNAME"));
            objDto.setLicCompanyName(rs.getString("LCOMPANYNAME"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setServiceType(rs.getString("SERVICETYPE"));
            objDto.setUom(rs.getString("UOM"));
            objDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            if (rs.getString("FROM_CITY") != null && !"".equals(rs.getString("FROM_CITY"))
                    && rs.getString("PRIMARYLOCATIONTYPE") != null) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("FROM_CITY").split("~~");
                    objDto.setFrom_city(ss[8]);
                } else {
                    objDto.setFrom_city(" ");
                }
            } else {
                objDto.setFrom_city("");
            }
            if (rs.getString("TO_CITY") != null && !"".equals(rs.getString("TO_CITY"))
                    && rs.getString("SECONDARYLOCATIONTYPE") != null) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("TO_CITY").split("~~");
                    objDto.setTo_city(ss[8]);
                } else {
                    objDto.setTo_city(" ");
                }
            } else {
                objDto.setTo_city("");
            }
            objDto.setOldordertotal(rs.getString("OLD_ORDER_TOTAL"));
            objDto.setOldlineamt(rs.getString("OLD_LINE_AMT"));
            objDto.setOld_contract_period(rs.getString("OLD_CONTRACTPERIOD"));
            objDto.setRatio(rs.getString("RATIO"));
            objDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objDto.setFactory_ckt_id(rs.getString("FACTORY_CKT_ID"));
            objDto.setDistance(rs.getString("DISTANCE"));
            objDto.setAccountManager(rs.getString("ACCOUNTMGR_EMAIL"));
            objDto.setCurrencyCode(rs.getString("CURNAME"));
            objDto.setOrderTotal(rs.getDouble("ORDERTOTAL"));
            objDto.setPoAmount(rs.getString("POAMOUNT"));
            objDto.setBisource(rs.getString("BISOURCE"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setDispatchAddress1(rs.getString("DISPATCHADDRESS"));
            objDto.setParent_name(rs.getString("PARENTNAME"));
            objDto.setAccountName(rs.getString("ACCOUNTNAME"));
            objDto.setLoc_date(rs.getString("LOC_DATE"));
            objDto.setFinalOB(BigDecimal.valueOf((rs.getDouble("OB_VALUE"))).toPlainString());
            objDto.setFinalOBINR(Double.valueOf(Utility.round(rs.getDouble("OB_VALUE_INR"), 2)).toString());
            objDto.setCopcApprovedBy(rs.getString("COPC_APPROVER_NAME"));
            objDto.setPmApprovedby(rs.getString("PM_APPROVER_NAME"));
            objDto.setDemoFlag(rs.getString("ISDEMO"));
            objDto.setOffnet(rs.getString("OFFNET_LABELATTVALUE"));
            objDto.setMediaType(rs.getString("MEDIA_LABELATTVALUE"));
            objDto.setCancellationReason(rs.getString("CANCELLATION_REASON"));
            objDto.setrRDate(rs.getString("RR_DATE"));
            if (rs.getString("RR_DATE") != null && !"".equals(rs.getString("RR_DATE"))) {
                objDto.setrRDate((utility.showDate_Report(new Date(rs.getTimestamp("RR_DATE").getTime())))
                        .toUpperCase());
            }
            objDto.setDiffDays(rs.getString("DIFF_DAYS"));
            objDto.setOrderEnteredBy(rs.getString("ORDER_CREATED_BY_NAME"));
            objDto.setExchangeRate(BigDecimal.valueOf((rs.getDouble("EXCHANGE_RATE"))).toPlainString());
            objDto.setObValue(BigDecimal.valueOf((rs.getDouble("OB_VALUE_TRANSACTION"))).toPlainString());
            objDto.setObValueINR(
                    Double.valueOf(Utility.round(rs.getDouble("OB_VALUE_TRANSACTION_INR"), 2)).toString());

            objDto.setCustomerSegment(rs.getString("CUST_SEGMENT_CODE")); //newly added
            objDto.setProjectCategory(rs.getString("ORDERCATGRY_LABELATTVALUE")); //newly added
            objDto.setServiceRemarks(rs.getString("SERVICE_REMARKS")); // newly added

            objDto.setObMonth(rs.getString("OB_MONTH"));
            objDto.setObYear(rs.getString("OB_YEAR")); //pankaj

            objDto.setEntryType(rs.getString("ENTRY_TYPE"));
            objDto.setIsNfa("NFA");
            //[007] start
            objDto.setSalesForceOpportunityNumber(rs.getString("SF_OPP_ID"));
            objDto.setChannelPartner(rs.getString("PARTNER_NAME"));
            objDto.setNetworkType(rs.getString("NETWORK_SERVICE_TYPE"));
            objDto.setPartnerId(rs.getString("PARTNER_ID"));
            //[007] End
            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);
        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);
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

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

public ArrayList<LogicalSIDataReportDTO> viewLogicalSIDataReport(LogicalSIDataReportDTO objDto) {
    //Nagarjuna/*from w  w  w.ja v a  2 s . c  om*/
    String methodName = "viewLogicalSIDataReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    ArrayList<LogicalSIDataReportDTO> listSearchDetails = new ArrayList<LogicalSIDataReportDTO>();
    LogicalSIDataReportDTO objReportsDto = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    Date tempDate = null;
    Timestamp ts = null;
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetLogicalSIDataReport);

        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())) {
            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.getLogicalSINumber() != 0 && !"".equals(objDto.getLogicalSINumber())) {
            proc.setInt(6, objDto.getLogicalSINumber());
        } else {
            proc.setNull(6, java.sql.Types.BIGINT);
        }
        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));
        proc.setInt(12, objDto.getIsUsage());
        // index
        rs = proc.executeQuery();
        while (rs.next()) {
            setBlank();
            replaceSeperator("BILLING_LOCATION", rs.getString("BILLING_ADDRESS"));
            objReportsDto = new LogicalSIDataReportDTO();
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));

            objReportsDto.setLogicalSINumber(rs.getInt("LOGICAL_SI_NO"));
            objReportsDto.setServiceName(rs.getString("SERVICENAME"));
            objReportsDto.setParent_name(rs.getString("PARENT_NAME"));//PARENT LINE NAME
            objReportsDto.setServiceDetDescription(rs.getString("SERVICEDETDESCRIPTION"));//Line Name

            objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objReportsDto.setTotalPoAmt(rs.getString("TOTALPOAMOUNT"));

            objReportsDto.setBillingTriggerDate(rs.getString("BILLINGTRIGGERDATE"));
            if (rs.getString("BILLINGTRIGGERDATE") != null && !"".equals(rs.getString("BILLINGTRIGGERDATE"))) {

                Date date = df.parse(objReportsDto.getBillingTriggerDate());
                objReportsDto.setBillingTriggerDate((utility.showDate_Report(date)).toUpperCase());

            }

            objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objReportsDto.setPoAmount(rs.getString("CUST_TOT_PO_AMT"));
            objReportsDto.setEntity(rs.getString("ENTITYNAME"));
            // change
            tempDate = rs.getDate("CUSTPODATE");
            if (tempDate != null) {
                objReportsDto.setCustPoDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }
            objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));//PO Contract Period
            tempDate = rs.getDate("CONTRACTSTARTDATE");
            if (tempDate != null) {
                objReportsDto.setContractStartDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }
            tempDate = rs.getDate("CONTRACTENDDATE");
            if (tempDate != null) {
                objReportsDto.setContractEndDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }
            tempDate = rs.getDate("PORECEIVEDATE");
            if (tempDate != null) {
                objReportsDto.setPoRecieveDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }

            objReportsDto.setOrderLineNumber(rs.getInt("Order_Line_Id"));
            objReportsDto.setServiceId(rs.getInt("SERVICE_NO"));

            objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME"));
            objReportsDto.setBillingFormatName(rs.getString("BILLING_FORMATNAME"));
            objReportsDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objReportsDto.setLcompanyname(rs.getString("LCOMPANYNAME"));

            objReportsDto.setContactName(VAR_BILL_CON_PER_NAME);//Contact Person Name   
            objReportsDto.setDesignation(VAR_DESIGNATION);//Person Designation   
            objReportsDto.setTelePhoneNo(VAR_TELEPHONENO);//Person Mobile   
            objReportsDto.setEmailId(VAR_EMAIL_ID);//Person Email   
            objReportsDto.setFax(VAR_FAX);//Person Fax   

            //Remrks   
            objReportsDto.setBillingLevel(rs.getString("BILLING_LEVELNAME"));
            objReportsDto.setCommitmentPeriod(rs.getInt("COMMITMENTPERIOD"));
            objReportsDto.setNoticePeriod(rs.getInt("NOTICEPERIOD"));
            objReportsDto.setLogicalCircuitId(rs.getString("CKTID"));

            if (objDto.getIsUsage() == 0) {
                objReportsDto.setRecordStatus(rs.getString("recordStatus"));

                objReportsDto.setCreditPeriodName(rs.getString("CREDITPERIOD"));

                objReportsDto.setCountyName(rs.getString("COUNTRY_NAME"));
                objReportsDto.setAddress1(rs.getString("BILL_ADDRESS1"));//billing Address1
                objReportsDto.setAddress2(rs.getString("BILL_ADDRESS2"));//billing Address2   
                objReportsDto.setAddress3(rs.getString("BILL_ADDRESS3"));//billing Address3   
                objReportsDto.setAddress4(rs.getString("BILL_ADDRESS4"));//billing Address4
                objReportsDto.setCityName(rs.getString("CITY_NAME"));//need to add in view
                objReportsDto.setPostalCode(rs.getString("POSTAL_CODE"));//need to add in view
                objReportsDto.setStateName(rs.getString("STATE_NAME"));//need to add in view

                objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE"));
                objReportsDto.setChargeName(rs.getString("CHARGE_NAME"));
                objReportsDto.setCharge_status(rs.getString("CHARGES_STATUS"));

                objReportsDto.setFrequencyName(rs.getString("FREQUENCY"));
                objReportsDto.setFrequencyAmt(rs.getString("FREQUENCY_AMT"));
                objReportsDto.setStartDateLogic(rs.getString("STARTDATELOGIC"));
                objReportsDto.setStartDateDays(rs.getInt("START_DATE_DAYS"));
                objReportsDto.setStartDateMonth(rs.getInt("START_DATE_MONTH"));

                objReportsDto.setEndDateLogic(rs.getString("ENDDATELOGIC"));
                objReportsDto.setEndDateMonth(rs.getInt("END_DATE_MONTH"));
                objReportsDto.setEndDateDays(rs.getInt("END_DATE_DAYS"));
                objReportsDto.setChargeEndDate(rs.getString("END_DATE"));//Charge End Date
                if (rs.getString("END_DATE") != null && !"".equals(rs.getString("END_DATE"))) {

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

                }
                objReportsDto.setAnnual_rate(rs.getDouble("ANNUAL_RATE"));
                //--Trai Rate
                //--Discount
                //Advance
                //Installment Rate
                objReportsDto.setDnd_Dispatch_But_Not_Delivered(rs.getString("Dnd_Dispatch_But_Not_Delivered"));
                objReportsDto.setDnd_Dispatch_And_Delivered(rs.getString("Dnd_Dispatch_And_Delivered"));
                objReportsDto.setDnd_Disp_Del_Not_Installed(rs.getString("Ddni_Disp_Del_Not_Installed"));
                objReportsDto.setDnd_Disp_Delivered_Installed(rs.getString("Ddni_Disp_Delivered_Installed"));
                objReportsDto.setPoExclude(rs.getString("PO_EXCLUDE"));//Po Valid Exclude

                objReportsDto.setChargeinfoID(rs.getString("CHARGEINFOID"));//need to add in view

                //M6 Order Id   

                //remarks

                //Pk Charges Id   
                //M6 Product Id   
                //Parent Product Id   
                objReportsDto.setBillingInfoID(rs.getInt("CHARGE_HDR_ID"));//Charge Hdr Id   
                //Ib Pk Charges Id   
                //Ib Order Line Id

                //Order Line Si No   
                objReportsDto.setChargeAnnotation(rs.getString("ANNOTATION"));

                //               Active End Date

                objReportsDto.setLst_No(rs.getString("LST_NO"));//Lst No   
                objReportsDto.setLstDate(rs.getString("LST_DATE"));//Lst Date   
                if (rs.getString("LST_DATE") != null && !"".equals(rs.getString("LST_DATE"))) {
                    objReportsDto.setLstDate(
                            (utility.showDate_Report(new Date(rs.getTimestamp("LST_DATE").getTime())))
                                    .toUpperCase());

                }
                //Billing Address Type
                //objReportsDto.setAttributeLabel(rs.getString("Attribute_Name"));
                //objReportsDto.setAttributeValue(rs.getString("Attribute_Value"));
                objReportsDto.setStoreName(rs.getString("STORENAME"));
                objReportsDto.setHardwaretypeName(rs.getString("HARDWARETYPENAME"));
                objReportsDto.setSaleNature(rs.getString("SALENATURE"));
                objReportsDto.setFormAvailable(rs.getString("FORM_C_AVAILABLE"));
                objReportsDto.setSaleType(rs.getString("SALETYPE"));
                //Principle Amt   
                //Interest Rate   
                objReportsDto.setWarrantyStartDateLogic(rs.getString("WARRENTY_START_DATE_LOGIC"));
                objReportsDto.setWarrantyPeriodMonths(rs.getString("WARRENTY_PERIOD_MONTHS"));
                objReportsDto.setWarrantyPeriodDays(rs.getString("WARRENTY_PERIOD_DAYS"));
                objReportsDto.setWarrantyStartDate(rs.getString("WARRENTY_START_DATE"));
                if (rs.getString("WARRENTY_START_DATE") != null
                        && !"".equals(rs.getString("WARRENTY_START_DATE"))) {

                    Date date = df.parse(objReportsDto.getWarrantyStartDate());
                    objReportsDto.setWarrantyStartDate((utility.showDate_Report(date)).toUpperCase());

                }
                objReportsDto.setWarrantyEndDateLogic(rs.getString("WARRENTY_END_DATE_LOGIC"));
                objReportsDto.setWarrantyEndPeriodMonths(rs.getString("WARRENTY_END_PERIOD_MONTHS"));//need
                objReportsDto.setWarrantyEndPeriodDays(rs.getString("WARRENTY_END_PERIOD_DAYS"));//need
                objReportsDto.setWarrantyEndDate(rs.getString("WARRENTY_END_DATE"));//need
                if (rs.getString("WARRENTY_END_DATE") != null
                        && !"".equals(rs.getString("WARRENTY_END_DATE"))) {

                    Date date = df.parse(objReportsDto.getWarrantyEndDate());
                    objReportsDto.setWarrantyEndDate((utility.showDate_Report(date)).toUpperCase());

                }
                objReportsDto.setExtndSupportPeriodMonths(rs.getString("EXT_SUPPORT_PERIOD_MONTHS"));
                objReportsDto.setExtndSupportPeriodDays(rs.getString("EXT_SUPPORT_PERIOD_DAYS"));
                objReportsDto.setExtSuportEndDate(rs.getString("EXT_SUPPORT_END_DATE"));
                if (rs.getString("EXT_SUPPORT_END_DATE") != null
                        && !"".equals(rs.getString("EXT_SUPPORT_END_DATE"))) {

                    Date date = df.parse(objReportsDto.getExtSuportEndDate());
                    objReportsDto.setExtSuportEndDate((utility.showDate_Report(date)).toUpperCase());

                }
                objReportsDto.setDispatchAddress1(rs.getString("DISP_ADDRESS1"));//Dispatch Address1   
                objReportsDto.setDispatchAddress2(rs.getString("DISP_ADDRESS2"));//Dispatch Address2   
                objReportsDto.setDispatchAddress3(rs.getString("DISP_ADDRESS3"));//Dispatch Address3   
                objReportsDto.setDispatchCityName(rs.getString("DISP_CITY_NAME"));//Dispatch City   
                objReportsDto.setDispatchPostalCode(rs.getString("DISP_POSTAL_CODE"));//Dispatch Postal Code   
                objReportsDto.setDispatchStateName(rs.getString("DISP_STATE_NAME"));//Dispatch State   
                objReportsDto.setDispatchPersonName(rs.getString("DISP_Con_Person_Name"));//Dispatch Conact Person Name   
                objReportsDto.setDispatchPhoneNo(rs.getString("DISP_TELEPHONENO"));//Dispatch Contact Person Mobile   
                objReportsDto.setDispatchLstNumber(rs.getString("DISP_LST_NO"));//Dispatch Lst Number   
                objReportsDto.setDispatchLstDate(rs.getString("DISP_LST_DATE"));//Dispatch Lst Date   
                if (rs.getString("DISP_LST_DATE") != null && !"".equals(rs.getString("DISP_LST_DATE"))) {

                    objReportsDto.setDispatchLstDate(
                            (utility.showDate_Report(new Date(rs.getTimestamp("DISP_LST_DATE").getTime())))
                                    .toUpperCase());

                }
                //Dispatch Address Type   
                //New Service List Id   
                //New Crm Order Id   

            }

            if (objDto.getIsUsage() == 1) {

                objReportsDto.setDisconnection_remarks(rs.getString("DISCONNECTION_REMARKS"));
                objReportsDto.setNeworder_remarks(rs.getString("NEWORDER_REMARKS"));
                objReportsDto.setM6OrderNo(rs.getInt("M6ORDERNO"));

                objReportsDto.setCreditPeriodName(rs.getString("CREDIT_PERIODNAME"));
                objReportsDto.setCountyName(VAR_BCP_COUNTRY_NAME);
                objReportsDto.setAddress1(VAR_BILL_ADDRESS1);//billing Address1
                objReportsDto.setAddress2(VAR_BILL_ADDRESS2);//billing Address2   
                objReportsDto.setAddress3(VAR_BILL_ADDRESS3);//billing Address3   
                objReportsDto.setAddress4(VAR_BILL_ADDRESS4);//billing Address4
                objReportsDto.setCityName(VAR_BCP_CITY_NAME);//need to add in view
                objReportsDto.setPostalCode(VAR_BCP_PIN);//need to add in view
                objReportsDto.setStateName(VAR_BCP_STATE_NAME);//need to add in view

                objReportsDto.setFx_external_acc_id(rs.getString("Child_Account_Number"));
                objReportsDto.setFxInternalId(rs.getInt("INTERNAL_ID"));
                objReportsDto.setChild_account_creation_status(rs.getString("Child_Account_FX_Sataus"));
                objReportsDto.setPackageID(rs.getInt("PACKAGE_ID"));
                objReportsDto.setPackageName(rs.getString("PACKAGE_NAME"));
                objReportsDto.setComponentID(rs.getInt("COMPONENT_ID"));
                objReportsDto.setComponentName(rs.getString("COMPONENT_NAME"));
                objReportsDto.setComponentInfoID(rs.getInt("COMPONENTINFOID"));

                ComponentsDto dto = new ComponentsDto();
                dto.setComponentType(rs.getString("COMPONENT_TYPE"));
                dto.setComponentAmount(rs.getDouble("COMP_AMOUNT"));
                dto.setComponentStatus(rs.getString("COMPONENT_STATUS"));
                dto.setStartLogic(rs.getString("COMPONENT_START_LOGIC"));
                dto.setStartDateDays(rs.getInt("COMP_START_DAYS"));
                dto.setStartDateMonth(rs.getInt("COMP_START_MONTHS"));
                dto.setEndLogic(rs.getString("COMPONENT_END_LOGIC"));
                dto.setEndDateDays(rs.getInt("COMP_END_DAYS"));
                dto.setEndDateMonth(rs.getInt("COMP_END_MONTHS"));

                dto.setStartDate(rs.getString("SYSTEM_START_DATE"));
                if (rs.getString("SYSTEM_START_DATE") != null
                        && !"".equals(rs.getString("SYSTEM_START_DATE"))) {

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

                }

                dto.setEnd_date(rs.getString("SYSTEM_END_DATE"));
                if (rs.getString("SYSTEM_END_DATE") != null && !"".equals(rs.getString("SYSTEM_END_DATE"))) {

                    Date date = df.parse(dto.getEnd_date());
                    dto.setEnd_date((utility.showDate_Report(date)).toUpperCase());

                }
                objReportsDto.setComponentDto(dto);
            }

            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_Usage.java

public ArrayList<ReportsDto> ViewpendingOrderBillandHardwareList(ReportsDto objDto) throws Exception {
    //   Nagarjuna
    String methodName = "ViewpendingOrderBillandHardwareList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<ReportsDto> objUserList = new ArrayList<ReportsDto>();
    Connection conn = null;//www.  j a  va  2 s.  com
    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(sqlPendingOrderBillHardware);
        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        if (objDto.getFromAccountNo() != 0 && !"".equals(objDto.getFromAccountNo())) {
            proc.setInt(2, objDto.getFromAccountNo());
        } else {
            proc.setNull(2, java.sql.Types.BIGINT);
        }
        if (objDto.getToAccountNo() != 0 && !"".equals(objDto.getToAccountNo())) {
            proc.setInt(3, objDto.getToAccountNo());
        } else {
            proc.setNull(3, java.sql.Types.BIGINT);
        }
        if (objDto.getFromOrderDate() != null && !"".equals(objDto.getFromOrderDate())) {
            proc.setString(4, objDto.getFromOrderDate().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }
        if (objDto.getToOrderDate() != null && !"".equals(objDto.getToOrderDate())) {
            proc.setString(5, objDto.getToOrderDate().trim());
        } else {
            proc.setNull(5, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromCrmOrderid() != null && !"".equals(objDto.getFromCrmOrderid())) {
            proc.setLong(6, new Long(objDto.getFromCrmOrderid().trim()));
        } else {
            proc.setNull(6, java.sql.Types.BIGINT);
        }
        if (objDto.getToCrmOrderid() != null && !"".equals(objDto.getToCrmOrderid())) {
            proc.setLong(7, new Long(objDto.getToCrmOrderid().trim()));
        } else {
            proc.setNull(7, java.sql.Types.BIGINT);
        }

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

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

        proc.setString(9, pagingSorting.getSortByColumn());// columnName
        proc.setString(10, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(11, pagingSorting.getStartRecordId());// start index
        proc.setInt(12, pagingSorting.getEndRecordId());// end index
        proc.setInt(13, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index

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

            objDto = new ReportsDto();
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objDto.setCus_segment(rs.getString("CUST_SEGMENT_CODE"));
            objDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setActmngname(rs.getString("ACTMNAME"));
            objDto.setPrjmngname(rs.getString("PMNAME"));
            objDto.setAccountID(rs.getInt("CRMACCOUNTNO"));
            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.setOrderNo(rs.getString("ORDERNO"));
            objDto.setPoNumber(rs.getInt("PODETAILNO"));
            objDto.setServiceName(rs.getString("SERVICENAME"));
            objDto.setLogicalCircuitId(rs.getString("LOGICAL_SI_NO"));
            objDto.setFactory_ckt_id(rs.getString("FACTORY_CKT_ID"));
            objDto.setLinename(rs.getString("LINENAME"));
            objDto.setChargeAmount(rs.getDouble("CHARGEAMOUNT"));
            objDto.setStartDate(rs.getString("START_DATE"));
            if (rs.getString("START_DATE") != null && !"".equals(rs.getString("START_DATE"))) {
                Date date = df.parse(objDto.getStartDate());
                objDto.setStartDate((utility.showDate_Report(date)).toUpperCase());
            }

            objDto.setChallenno(rs.getString("CHALLEN_NO"));
            objDto.setChallendate(rs.getString("CHALLEN_DATE"));
            if (rs.getString("CHALLEN_DATE") != null && !"".equals(rs.getString("CHALLEN_DATE"))) {
                String s1 = rs.getString("CHALLEN_DATE");
                String s3 = s1.substring(0, 7);
                String s4 = s1.substring(9, 11);
                String s5 = s3.concat(s4);
                objDto.setChallendate(s5);
            }

            objDto.setPartyName(rs.getString("PARTYNAME"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));

            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_Usage.java

/**
 * //  w  w w.  j a  va  2 s. co  m
 * @param objDto
 * @return
 * @throws Exception
 */
public ArrayList<NewOrderDto> viewOrderReportChange(NewOrderDto objDto) throws Exception {
    //Nagarjuna
    String methodName = "viewOrderReportChange", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<NewOrderDto> objUserList = new ArrayList<NewOrderDto>();
    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())) {
            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);
        }

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

            objDto = new NewOrderDto();
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setCurrencyCode(rs.getString("CURNAME"));
            objDto.setLogicalSINo(rs.getString("LOGICAL_SI_NO"));
            objDto.setServiceSubTypeName(rs.getString("SERVICESTAGE"));
            objDto.setServiceId(rs.getInt("SERVICEID"));
            objDto.setServiceproductid(rs.getInt("SERVICEPRODUCTID"));
            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.setAccountName(rs.getString("ACCOUNTNAME"));
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setPoAmount(rs.getString("POAMOUNT"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setLicCompanyName(rs.getString("LCOMPANYNAME"));
            objDto.setFrequencyName(rs.getString("FREQUENCYNAME"));
            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.setAmApproveDate(rs.getString("AM_RECEIVE_DATE"));

            objDto.setOsp(rs.getString("OSP"));

            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());
            }
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
                //recordCount = countFlag;
            }
            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;
}