Example usage for java.sql ResultSet getDate

List of usage examples for java.sql ResultSet getDate

Introduction

In this page you can find the example usage for java.sql ResultSet getDate.

Prototype

java.sql.Date getDate(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.

Usage

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

public ArrayList<DisconnectLineReportDTO> viewDisconnectionLineReport(DisconnectLineReportDTO objDto) {
    //   Nagarjuna
    String methodName = "viewDisconnectionLineReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    ArrayList<DisconnectLineReportDTO> listSearchDetails = new ArrayList<DisconnectLineReportDTO>();
    DisconnectLineReportDTO objReportsDto = null;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    Date tempDate = null;//  ww w.  j a  va2s.  c  o  m

    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetDisconnectionLineReportForUsage);

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

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

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

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

        proc.setString(7, pagingSorting.getSortByColumn());// columnName
        proc.setString(8, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(9, pagingSorting.getStartRecordId());// start index
        proc.setInt(10, pagingSorting.getEndRecordId());// end index
        proc.setInt(11, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        proc.setInt(12, objDto.getIsUsage());
        // index
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new DisconnectLineReportDTO();
            objReportsDto.setPartyNo(rs.getInt("PARTY_NO"));
            objReportsDto.setAccountID(rs.getInt("CRMACCOUNTNO"));
            objReportsDto.setCust_name(rs.getString("PARTYNAME"));
            objReportsDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objReportsDto.setRegionName(rs.getString("REGION"));
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));
            objReportsDto.setOrder_type(rs.getString("ORDERTYPE"));
            objReportsDto.setM6OrderNo(rs.getInt("M6ORDERNO"));
            objReportsDto.setServiceName(rs.getString("SERVICENAME"));
            objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setLinename(rs.getString("SERVICEDETDESCRIPTION"));
            objReportsDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objReportsDto.setCkt_id(rs.getString("CKTID"));
            objReportsDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objReportsDto.setUom(rs.getString("UOM"));
            objReportsDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objReportsDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objReportsDto.setDistance(rs.getString("DISTANCE"));
            objReportsDto.setLocation_from(rs.getString("FROM_ADDRESS"));
            objReportsDto.setLocation_to(rs.getString("TO_ADDRESS"));
            //objReportsDto.setPrimarylocation(rs.getString("PRIMARYLOCATION"));
            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.setProductName(rs.getString("PRODUCTNAME"));
            objReportsDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            objReportsDto.setEntity(rs.getString("ENTITYNAME"));
            objReportsDto.setLcompanyname(rs.getString("LCOMPANYNAME"));
            objReportsDto.setCurrencyName(rs.getString("CURRENCYNAME"));

            objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME"));
            objReportsDto.setBillingFormatName(rs.getString("BILLING_FORMATNAME"));
            objReportsDto.setBillingLevel(rs.getString("BILLING_LEVELNAME"));
            objReportsDto.setBillingLevelNo(rs.getLong("BILLING_LEVEL_NO"));
            objReportsDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objReportsDto.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.setBillingMode(rs.getString("BILLINGMODE"));
            objReportsDto.setPoNumber(rs.getInt("PONUMBER"));
            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(objReportsDto.getPoDate())).toUpperCase());
            }
            objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objReportsDto.setTotalAmountIncludingCurrent(rs.getDouble("TOTALPOAMOUNT"));
            objReportsDto.setPoReceiveDate(rs.getString("PORECEIVEDATE"));
            tempDate = rs.getDate("PORECEIVEDATE");
            objReportsDto.setPoRecieveDate(rs.getString("PORECEIVEDATE"));
            if (tempDate != null && !"".equals(tempDate)) {
                objReportsDto.setPoReceiveDate((utility.showDate_Report(tempDate)).toUpperCase());
            }
            objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            tempDate = rs.getDate("CUSTPODATE");
            objReportsDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (tempDate != null && !"".equals(tempDate)) {
                objReportsDto.setCustPoDate((utility.showDate_Report(tempDate)).toUpperCase());
            }
            objReportsDto.setLocDate(rs.getString("LOCDATE"));
            if (rs.getString("LOCDATE") != null && !"".equals(rs.getString("LOCDATE"))) {
                Date date = df.parse(objReportsDto.getLocDate());
                objReportsDto.setLocDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setLocno(rs.getString("LOCNO"));
            objReportsDto.setBilling_trigger_date(rs.getString("BILLINGTRIGGERDATE"));
            if (rs.getString("BILLINGTRIGGERDATE") != null && !"".equals(rs.getString("BILLINGTRIGGERDATE"))) {
                Date date = df.parse(objReportsDto.getBilling_trigger_date());
                objReportsDto.setBilling_trigger_date((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setPmapprovaldate(rs.getString("PM_PROV_DATE"));
            if (rs.getString("Pm_Prov_Date") != null && !"".equals(rs.getString("Pm_Prov_Date"))) {
                String s1 = rs.getString("Pm_Prov_Date");
                String s3 = (s1.substring(0, 7)).toUpperCase();
                String s4 = s1.substring(9, 11);
                String s5 = s3.concat(s4);
                objReportsDto.setPmApproveDate(s5);
            }
            objReportsDto.setBilling_Trigger_Flag(rs.getString("BILLING_TRIGGER_FLAG"));
            objReportsDto.setLineno(rs.getInt("ORDER_LINE_ID"));
            objReportsDto.setServiceId(rs.getInt("SERVICE_NO"));
            objReportsDto.setPre_crmorderid(rs.getInt("Pre_Crm_orderNo"));
            objReportsDto.setDisconnection_remarks(rs.getString("DISCONNECTION_REMARKS"));
            objReportsDto.setStageName(rs.getString("STAGE"));
            objReportsDto.setServiceStage(rs.getString("SERVICE_STAGE"));
            objReportsDto.setNeworder_remarks(rs.getString("NEWORDER_REMARKS"));
            objReportsDto.setCopcapprovaldate(rs.getString("COPC_APPROVED_DATE"));
            if (rs.getString("COPC_APPROVED_DATE") != null && !"".equals(rs.getString("COPC_APPROVED_DATE"))) {
                objReportsDto.setCopcapprovaldate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setRequest_rec_date(rs.getString("DISCONNECTION_RECEIVE_DATE"));

            objReportsDto.setStandard_reason(rs.getString("STANDARDREASON"));
            tempDate = rs.getDate("ORDERDATE");
            objReportsDto.setOrderDate(rs.getString("ORDERDATE"));
            if (tempDate != null && !"".equals(tempDate)) {
                objReportsDto.setOrderDate((utility.showDate_Report(tempDate)).toUpperCase());
            }
            if (objDto.getIsUsage() == 0) {
                objReportsDto.setRatio(rs.getString("RATIO"));
                objReportsDto.setCreditPeriod(rs.getInt("CREDITPERIOD"));
                objReportsDto.setHardwaretypeName(rs.getString("HARDWARETYPENAME"));
                objReportsDto.setHardware_flag(rs.getString("HARDWARE_FLAG"));
                objReportsDto.setStorename(rs.getString("STORENAME"));
                objReportsDto.setSaleType(rs.getString("SALETYPE"));
                objReportsDto.setCust_total_poamt(rs.getDouble("CUST_TOT_PO_AMT"));
                objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE"));
                objReportsDto.setChargeName(rs.getString("CHARGE_NAME"));
                objReportsDto.setChargeEndDate(rs.getString("CSTATE_CHARGE_CURRENT_START_DATE"));
                if (rs.getString("CSTATE_CHARGE_CURRENT_START_DATE") != null
                        && !"".equals(rs.getString("CSTATE_CHARGE_CURRENT_START_DATE"))) {
                    Date date = df.parse(objReportsDto.getChargeEndDate());
                    objReportsDto.setChargeEndDate((utility.showDate_Report(date)).toUpperCase());
                }
                objReportsDto.setChargeAmount(rs.getDouble("INV_AMT"));
                objReportsDto.setLineamt(rs.getLong("LINEITEMAMOUNT"));
                objReportsDto.setAnnitation(rs.getString("ANNOTATION"));
                objReportsDto.setBillingtrigger_createdate(rs.getString("BILLING_TRIGGER_CREATEDATE"));
                if (rs.getString("BILLING_TRIGGER_CREATEDATE") != null
                        && !"".equals(rs.getString("BILLING_TRIGGER_CREATEDATE"))) {
                    objReportsDto.setBillingtrigger_createdate((utility
                            .showDate_Report(new Date(rs.getTimestamp("BILLING_TRIGGER_CREATEDATE").getTime())))
                                    .toUpperCase());
                }
                objReportsDto.setTokenno(rs.getString("CSTATE_START_DETAILS_FX_TOKEN_NO"));
                objReportsDto.setFx_status(rs.getString("CSTATE_START_DETAILS_FX_STATUS"));
                objReportsDto.setFx_sd_status(rs.getString("CSTATE_FX_CHARGE_START_STATUS"));
                objReportsDto.setBusiness_serial_no(rs.getString("Business_No"));
                objReportsDto.setOpms_act_id(rs.getString("Opms_Account_Id"));
            }
            if (objDto.getIsUsage() == 1) {
                objReportsDto.setRatio(rs.getString("RATIO"));
                objReportsDto.setCreditPeriodName(rs.getString("CREDIT_PERIODNAME"));
                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.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.setFxTokenNo(rs.getString("START_COMPONENT_TOKEN_NO"));
                dto.setComponentInstanceID(rs.getString("COMPONENT_INST_ID"));
                dto.setFxStartStatus(rs.getString("SYSTEM_START_STATUS"));
                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());
                }
                dto.setEndFxStatus(rs.getString("SYSTEM_END_STATUS"));
                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.java

/**
 * /* ww  w.  ja va 2 s.  c o  m*/
 * @param objDto
 * @return
 * @throws Exception
 */
public ArrayList<OrderDetailReportDTO> viewOrderReportDetails(OrderDetailReportDTO objDto) throws Exception {

    //   Nagarjuna
    String methodName = "viewOrderReportDetails", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end   
    ArrayList<OrderDetailReportDTO> objUserList = new ArrayList<OrderDetailReportDTO>();
    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(sqlOrderReportDetail);

        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.getDemo() != null && !"".equals(objDto.getDemo())) {
            proc.setString(4, objDto.getDemo().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }

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

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

        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
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(14, objDto.getOsp().trim());
        } else {
            proc.setNull(14, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromOrderDate() != null && !"".equals(objDto.getFromOrderDate())
                && objDto.getToOrderDate() != null && !"".equals(objDto.getToOrderDate())) {
            proc.setString(15, objDto.getFromOrderDate());
            proc.setString(16, objDto.getToOrderDate());
        } else {
            proc.setNull(15, java.sql.Types.VARCHAR);
            proc.setNull(16, java.sql.Types.VARCHAR);
        }

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

            objDto = new OrderDetailReportDTO();
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setAccountManager(rs.getString("ACCOUNTMANAGER"));
            objDto.setCrmACcountNO(rs.getString("CRMACCOUNTNO"));
            objDto.setPoAmounts(rs.getDouble("POAMOUNT"));
            objDto.setCus_segment(rs.getString("CUST_SEGMENT_CODE"));
            objDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objDto.setBillingPODate(rs.getString("START_DATE"));
            if (rs.getString("START_DATE") != null && !"".equals(rs.getString("START_DATE"))) {
                DateFormat dformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
                DateFormat dformat2 = new SimpleDateFormat("dd-MM-yyyy");
                Date date;
                if (objDto.getBillingPODate().length() > 10) {
                    date = dformat.parse(objDto.getBillingPODate());
                } else if (objDto.getBillingPODate().indexOf('-') != -1) {
                    date = dformat2.parse(objDto.getBillingPODate());
                } else {
                    date = df.parse(objDto.getBillingPODate());
                }
                objDto.setBillingPODate((utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setServiceDetDescription(rs.getString("SERVICESTAGE"));
            objDto.setOrderLineNumber(rs.getInt("SERVICEPRODUCTID"));
            objDto.setLinename(rs.getString("SERVICEDETDESCRIPTION"));
            objDto.setCancelflag(rs.getString("CANCELFLAG"));
            objDto.setProvisionBandWidth(rs.getString("BANDWIDTH"));
            objDto.setUom(rs.getString("UOM"));
            objDto.setBillingBandWidth(rs.getString("BILLING_BANDWIDTH"));
            objDto.setStoreName(rs.getString("STORENAME"));
            objDto.setBillUom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objDto.setCategoryOfOrder(rs.getString("ORDERCATEGORY"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setCompanyName(rs.getString("COMPANYNAME"));
            objDto.setOrderDate(rs.getString("ORDERCREATIONDATE"));
            if (rs.getDate("ORDERCREATIONDATE") != null && !"".equals(rs.getDate("ORDERCREATIONDATE"))) {
                Date date = rs.getDate("ORDERCREATIONDATE");
                objDto.setOrderDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setCustomerRfsDate(rs.getString("RFS_DATE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {
                DateFormat dformat = new SimpleDateFormat("yyyy-MM-dd");
                Date date;
                if (objDto.getCustomerRfsDate().indexOf('-') != -1) {
                    date = dformat.parse(objDto.getCustomerRfsDate());
                } else {
                    date = df.parse(objDto.getCustomerRfsDate());
                }
                objDto.setCustomerRfsDate((utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setCustomerServiceRfsDate(rs.getString("SERVICE_RFS_DATE"));
            if (rs.getString("SERVICE_RFS_DATE") != null && !"".equals(rs.getString("SERVICE_RFS_DATE"))) {

                Date date = df.parse(objDto.getCustomerServiceRfsDate());
                objDto.setCustomerServiceRfsDate((utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setCurrencyCode(rs.getString("CURRENCYNAME"));
            objDto.setChargeName(rs.getString("CHARGE_NAME"));
            objDto.setCustomerPoDate(rs.getString("PODATE"));
            if (rs.getString("PODATE") != null && !"".equals(rs.getString("PODATE"))) {

                Date date = df.parse(objDto.getCustomerPoDate());
                objDto.setCustomerPoDate((utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setCustomerPoNumber(rs.getString("CUSTPONUMBER"));
            objDto.setCyclicNonCyclic(rs.getString("CYCLIC_NONCYCLIC"));
            objDto.setChallenno(rs.getString("CHALLEN_NO"));
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setFromSite(rs.getString("PRIMARYLOCATION"));
            objDto.setFromSite(objDto.getFromSite() == null ? null : objDto.getFromSite().replaceAll("~", ""));
            objDto.setToSite(rs.getString("SECONDARYLOCATION"));
            objDto.setToSite(objDto.getToSite() == null ? null : objDto.getToSite().replaceAll("~", ""));
            objDto.setItemQuantity(1);
            objDto.setKmsDistance(rs.getString("DISTANCE"));
            objDto.setChargeAmount(rs.getDouble("LINEITEMAMOUNT"));
            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.setLineItemDescription(rs.getString("SERVICEDETDESCRIPTION"));
            objDto.setLocDate(rs.getString("LOCDATE"));
            if (rs.getString("LOCDATE") != null && !"".equals(rs.getString("LOCDATE"))) {

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

            }
            objDto.setAmReceiveDate(rs.getString("AMRECEIVEDATE"));
            if (rs.getString("AMRECEIVEDATE") != null && !"".equals(rs.getString("AMRECEIVEDATE"))) {

                Date date = df.parse(objDto.getAmReceiveDate());
                objDto.setAmReceiveDate((utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setOrderTotal(rs.getDouble("POAMOUNT"));
            objDto.setOrderEntryDate(rs.getString("ORDERCREATIONDATE"));
            if (rs.getDate("ORDERCREATIONDATE") != null && !"".equals(rs.getDate("ORDERCREATIONDATE"))) {
                Date date = rs.getDate("ORDERCREATIONDATE");
                objDto.setOrderEntryDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objDto.setLicenceCoName(rs.getString("LCOMPANYNAME"));
            objDto.setLogicalCircuitNumber(rs.getString("LOGICAL_CIRCUITID"));
            objDto.setOrderType(rs.getString("ORDERCATEGORY"));
            objDto.setPaymentTerm(rs.getString("PAYMENTTERM"));
            objDto.setProjectManager(rs.getString("PROJECTMANAGER"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setOldLineitemAmount("");
            objDto.setDemoType(rs.getString("DEMO_TYPE"));
            objDto.setPartyName(rs.getString("PARTYNAME"));
            objDto.setOrderStageDescription(rs.getString("STAGE"));
            objDto.setServiceStageDescription(rs.getString("SERVICE_STAGE"));
            objDto.setChargeEndDate(rs.getString("END_DATE"));
            if (rs.getString("END_DATE") != null && !"".equals(rs.getString("END_DATE"))) {

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

            }
            objDto.setEndDateLogic(rs.getString("ENDDATELOGIC"));
            objDto.setNewOrderRemark(rs.getString("NEWORDER_REMARKS"));
            objDto.setRemarks(rs.getString("REMARKS"));
            objDto.setServiceOrderType(rs.getString("SERVICE_ORDER_TYPE"));
            objDto.setOsp(rs.getString("OSP"));

            //         [404040] Start 
            objDto.setOpportunityId((rs.getString("OPPORTUNITYID")));
            //[404040] End 
            //<!--GlobalDataBillingEfficiency BFR6  -->
            objDto.setTaxExcemption_Reason(rs.getString("TAXEXCEMPTION_REASON"));
            //[130] 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"));
            //[130] End
            //[131] start
            objDto.setPartnerCode(rs.getString("PARTNER_CODE"));
            objDto.setFieldEngineer(rs.getString("FIELD_ENGINEER"));
            //[131] end

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

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

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlOrderReportChange);

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

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

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

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

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

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

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

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

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

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

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

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

    return objUserList;
}

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

public ArrayList<BillingWorkQueueReportDTO> viewBillingWorkQueueList(BillingWorkQueueReportDTO objDto)
        throws Exception {
    //   Nagarjuna
    String methodName = "viewBillingWorkQueueList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<BillingWorkQueueReportDTO> objUserList = new ArrayList<BillingWorkQueueReportDTO>();
    Connection conn = null;//from  w w w .  ja  v  a2  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(sqlBillingWorkQueue);
        proc.setInt(1, java.sql.Types.BIGINT);
        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(2, objDto.getOrderType().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            proc.setString(3, objDto.getFromDate().trim());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            proc.setString(4, objDto.getToDate().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }

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

        /*
         * add party no and party name
         */
        if (objDto.getParty_no() != 0 && !"".equals(objDto.getParty_no())) {
            proc.setInt(7, objDto.getParty_no());
        } else {
            proc.setNull(7, java.sql.Types.BIGINT);
        }
        if (objDto.getPartyName() != null && !"".equals(objDto.getPartyName())) {
            proc.setString(8, objDto.getPartyName().trim());
        } else {
            proc.setNull(8, java.sql.Types.VARCHAR);
        }
        if (objDto.getOrderStage() != null && !"".equals(objDto.getOrderStage())) {
            proc.setString(9, objDto.getOrderStage().trim());
        } else {
            proc.setNull(9, java.sql.Types.VARCHAR);
        }
        if (objDto.getHardwareType() != null && !"".equals(objDto.getHardwareType())) {
            proc.setString(10, objDto.getHardwareType().trim());
        } else {
            proc.setNull(10, java.sql.Types.VARCHAR);
        }
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(11, pagingSorting.getSortByColumn());// columnName
        proc.setString(12, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(13, pagingSorting.getStartRecordId());// start index
        proc.setInt(14, pagingSorting.getEndRecordId());// end index
        proc.setInt(15, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        //proc.setInt(15, (pagingSorting.isPagingToBeDone() ? 0 : 0));// end
        // index
        //System.out.println("sqlBillingWorkQueue :"+sqlBillingWorkQueue);
        rs = proc.executeQuery();
        int countFlag = 0;
        BillingWorkQueueReportDTO objdto;

        while (rs.next() != false) {
            countFlag++;
            //   System.out.println("in while roop of rs");
            setBlank();
            replaceSeperator("BILLING_LOCATION", rs.getString("BILLING_ADDRESS"));
            replaceSeperator("PRIMARYLOCATION", rs.getString("PRIMLOC"));
            replaceSeperator("SECONDARYLOCATION", rs.getString("SECLOC"));
            objdto = new BillingWorkQueueReportDTO();
            objdto.setLogicalSINo(rs.getString("LOGICAL_CIRCUIT_ID"));
            objdto.setCustSINo(rs.getString("CUST_LOGICAL_SI_ID"));
            objdto.setServiceName(rs.getString("SERVICE_NAME"));
            objdto.setLinename(rs.getString("LINE_NAME"));
            //            objdto.setChargeTypeName(rs.getString("CHARGE_TYPE"));
            //            objdto.setChargeTypeID(rs.getInt("CHARGE_TYPE_ID")); 
            //            objdto.setChargeName(rs.getString("CHARGE_NAME"));
            //            objdto.setChargeFrequency(rs.getString("FREQUENCY"));
            //            objdto.setBillPeriod(rs.getString("BILL_PERIOD"));
            /*
             * newly added fields in code
             */
            //            objdto.setEndDateLogic(rs.getString("ENDDATELOGIC"));
            //            if (rs.getString("CHARGE_START_DATE") != null && !"".equals(rs.getString("CHARGE_START_DATE")))
            //            {
            //               objdto.setStartDate(rs.getString("CHARGE_START_DATE"));
            //Date date=df.parse(objdto.getStartDate());
            //objdto.setStartDate((utility.showDate_Report(date)).toUpperCase());
            //            }
            //            if (rs.getString("CHARGE_END_DATE") != null && !"".equals(rs.getString("CHARGE_END_DATE")))
            //            {
            //               objdto.setChargeEndDate(rs.getString("CHARGE_END_DATE"));
            //            }
            //            objdto.setAdvance(rs.getString("ADVANCE"));
            //            objdto.setRate_code(rs.getString("TRAI_RATE"));
            //            objdto.setDiscount(rs.getString("DISCOUNT"));
            //            objdto.setInstallRate(rs.getString("INSTALRATE"));
            //            objdto.setInterestRate(rs.getInt("INTREST_RATE"));
            //            objdto.setPrincipalAmount(rs.getInt("PRINCIPAL_AMOUNT"));
            objdto.setNoticePeriod(rs.getLong("NOTICEPERIOD"));
            objdto.setPenaltyClause(rs.getString("PENALTYCLAUSE"));
            objdto.setCommitmentPeriod(rs.getInt("COMMITMENTPERIOD"));

            //            if (rs.getString("WARRANTY_START_DATE") != null && !"".equals(rs.getString("WARRANTY_START_DATE")))
            //            {
            //               objdto.setWarrantyStartDate(rs.getString("WARRANTY_START_DATE"));
            //               objdto.setPoDate((utility.showDate_Report(objdto.getWarrantyStartDate())).toUpperCase());
            //            }
            //            if (rs.getString("WARRANTY_END_DATE") != null && !"".equals(rs.getString("WARRANTY_END_DATE")))
            //            {
            //               objdto.setWarrantyEndDate(rs.getString("WARRANTY_END_DATE"));
            //               objdto.setPoDate((utility.showDate_Report(objdto.getWarrantyEndDate())).toUpperCase());
            //            }
            //            objdto.setExtSuportEndDate(rs.getString("EXT_SUPPORT_END_DATE"));
            objdto.setContractStartDate(rs.getString("CONTRACT_START_DATE"));
            objdto.setContractEndDate(rs.getString("CONTRACT_END_DATE"));
            //            objdto.setStartDateLogic(rs.getString("STARTDATELOGIC"));
            //            objdto.setDnd_Dispatch_And_Delivered(rs.getString("DND_DISPATCH_AND_DELIVERED"));
            //            objdto.setDnd_Dispatch_But_Not_Delivered(rs.getString("DND_DISPATCH_BUT_NOT_DELIVERED"));
            objdto.setBilling_address(VAR_BILLING_ADDRESS);
            objdto.setServiceTypeDescription(rs.getString("SERVICE_ORDER_TYPE_DESC"));
            objdto.setCancelBy(rs.getString("CANCEL_BY"));
            objdto.setCanceldate(rs.getString("CANCEL_DATE"));
            if (rs.getString("CANCEL_DATE") != null && !"".equals(rs.getString("CANCEL_DATE"))) {
                objdto.setCanceldate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("CANCEL_DATE").getTime())))
                                .toUpperCase());
            }
            objdto.setCancelReason(rs.getString("CANCEL_REASON"));
            objdto.setDemo(rs.getString("DEMO_TYPE"));
            /*
             * end of newly ended code
             */
            // start_date = ?
            objdto.setAccountID(rs.getInt("ACCOUNT_NUMBER"));
            objdto.setCreditPeriodName(rs.getString("CREDIT_PERIOD"));
            //objdto.setCurrencyName(rs.getString("CURNAME")); // is it currency 
            objdto.setCurrencyName(rs.getString("CURRENCY"));
            //objdto.setEntity(rs.getString("ENTITYNAME")); // is it legal entity
            objdto.setEntity(rs.getString("LEGAL_ENTITY"));
            objdto.setBillingMode(rs.getString("BILLING_MODE_NAME")); // text of BILLINGMODE
            objdto.setBillingTypeName(rs.getString("BILL_TYPE"));
            objdto.setBillingformat(rs.getString("BILL_FORMAT"));
            objdto.setLicCompanyName(rs.getString("LICENSE_COMP"));
            objdto.setTaxation(rs.getString("TAXATION_NAME")); // is it TAXATION
            //            objdto.setTaxation(rs.getString("TAXATION"));
            objdto.setBillingLevelNo(rs.getLong("BILLING_LEVEL_NO"));
            objdto.setBillingLevelName(rs.getString("BILLING_LEVELNAME")); // is it BILLINGLEVEL
            //            objdto.setBillingLevelName(rs.getString("BILLINGLEVEL"));
            //objdto.setStore(rs.getString("STORENAME")); // is it STORE 
            //            objdto.setStore(rs.getString("STORE"));
            //            objdto.setHardwaretypeName(rs.getString("HARDWARETYPE"));
            objdto.setFormAvailable(rs.getString("FORM_C_AVAILABLE"));
            //            objdto.setSaleNature(rs.getString("NATURE_OF_SALE"));
            //            objdto.setSaleTypeName(rs.getString("TYPE_OF_SALE"));
            objdto.setPrimaryLocation(VAR_PRIMARYLOCATION);
            objdto.setSeclocation(VAR_SECONDARYLOCATION);
            objdto.setPoNumber(rs.getInt("PODETAILNUMBER"));
            objdto.setPoDate(rs.getString("PODATE"));
            if (rs.getString("PODATE") != null && !"".equals(rs.getString("PODATE"))) {
                Date date = rs.getDate("PODATE");
                objdto.setPoDate((utility.showDate_Report(date)).toUpperCase());
            }

            objdto.setParty_num(rs.getString("PARTY_NO"));
            //            objdto.setChargeAnnotation(rs.getString("ANNOTATION"));
            //            objdto.setFx_sd_charge_status(rs.getString("FX_SD_CHG_STATUS"));

            //            objdto.setFx_charge_status(rs.getString("FX_STATUS"));
            //            objdto.setFx_Ed_Chg_Status(rs.getString("FX_ED_CHG_STATUS"));
            //objdto.setTokenID(rs.getInt("TOKEN_ID")); // is it TOKEN_NO
            //            objdto.setTokenno(rs.getString("TOKEN_NO"));
            objdto.setModifiedDate(rs.getString("LAST_UPDATE_DATE"));
            if (rs.getString("LAST_UPDATE_DATE") != null && !"".equals(rs.getString("LAST_UPDATE_DATE"))) {
                objdto.setModifiedDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("LAST_UPDATE_DATE").getTime())))
                                .toUpperCase());
            }
            objdto.setBillingTriggerFlag(rs.getString("BILLING_TRIG_FLAGNAME")); // text of BILLING_TRIG_FLAG

            if (rs.getString("PM_PROV_DATE") != null && !"".equals(rs.getString("PM_PROV_DATE"))) {
                objdto.setPm_pro_date(rs.getString("PM_PROV_DATE"));
                /* String s1=rs.getString("PM_PROVISIONING_DATE");
                 String s3=s1.substring(0,7).toUpperCase();
                 String s4=s1.substring(9,11);
                 String s5=s3.concat(s4);
                 objdto.setPm_pro_date(s5);*/
            }
            if (rs.getString("LOC_DATE") != null && !"".equals(rs.getString("LOC_DATE"))) {
                objdto.setLocDate(rs.getString("LOC_DATE"));
                Date date = df.parse(objdto.getLocDate());
                objdto.setLocDate((utility.showDate_Report(date)).toUpperCase());
            }
            if (rs.getString("BILLING_TRIG_DATE") != null && !"".equals(rs.getString("BILLING_TRIG_DATE"))) {
                objdto.setBilling_trigger_date(rs.getString("BILLING_TRIG_DATE"));
                Date date = df.parse(objdto.getBilling_trigger_date());
                objdto.setBilling_trigger_date((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");
                if (s1.length() == 10) {
                    s1 = "0" + s1;
                }
                String s3 = s1.substring(0, 7).toUpperCase();
                String s4 = s1.substring(9, 11);
                String s5 = s3.concat(s4);
                objdto.setChallendate(s5);
            }

            //FX_ACCOUNT_EXTERNAL_ID = ?
            //objdto.setFx_external_acc_id(rs.getString("FX_ACCOUNT_EXTERNAL_ID"));
            //objdto.setChild_account_creation_status(rs.getString("CHILD_ACCOUNT_FX_STATUS"));
            objdto.setChild_act_no(rs.getString("CHILD_ACCOUNT_NUMBER"));
            objdto.setChild_ac_fxstatus(rs.getString("CHILD_ACCOUNT_STATUS_NAME")); // text of CHILD_ACCOUNT_FX_STATUS

            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {
                objdto.setOrderDate(rs.getString("ORDERDATE"));
                //Date date=df.parse(objdto.getOrderDate());
                objdto.setOrderDate((utility.showDate_Report(objdto.getOrderDate())).toUpperCase());

            }
            if (rs.getString("APPROVED_DATE") != null && !"".equals(rs.getString("APPROVED_DATE"))) {
                objdto.setCopcapprovaldate(rs.getString("APPROVED_DATE"));
                objdto.setCopcapprovaldate(
                        (utility.showDate_Report(objdto.getCopcapprovaldate())).toUpperCase());
            }
            objdto.setOrderType(rs.getString("ORDERTYPE"));
            if (rs.getString("BILL_TRG_CREATE_DATE") != null
                    && !"".equals(rs.getString("BILL_TRG_CREATE_DATE"))) {
                objdto.setBillingtrigger_createdate(rs.getString("BILL_TRG_CREATE_DATE"));
                objdto.setBillingtrigger_createdate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("BILL_TRG_CREATE_DATE").getTime())))
                                .toUpperCase());
            }
            objdto.setRatio(rs.getString("RATIO"));
            objdto.setProductName(rs.getString("PRODUCT"));
            objdto.setSubProductName(rs.getString("SUBPRODUCT"));
            objdto.setHardwareType(rs.getString("HARDWARE_FLAG"));
            objdto.setServiceStage(rs.getString("SERVICE_STAGE"));
            objdto.setOrderStage(rs.getString("ORDER_STAGE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {
                objdto.setRfsDate(rs.getString("RFS_DATE"));
                objdto.setRfsDate((utility.showDate_Report(objdto.getRfsDate())).toUpperCase());

            }
            // PORECEIVEDATE = ?
            /*objdto.setPoReceiveDate(rs.getString("PORECEIVEDATE"));
            if (rs.getString("PORECEIVEDATE") != null && !"".equals(rs.getString("PORECEIVEDATE")))
            {
                       
               Date date=df.parse(objdto.getPoReceiveDate());
               objdto.setPoReceiveDate((utility.showDate_Report(date)).toUpperCase());
                       
            }*/
            objdto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {
                objdto.setCustPoDate(rs.getString("CUSTPODATE"));
                //Date date=df.parse(objdto.getCustPoDate());
                objdto.setCustPoDate((utility.showDate_Report(objdto.getCustPoDate())).toUpperCase());
            }
            //            objdto.setCharge_status(rs.getString("CHARGES_STATUS"));
            objdto.setLOC_No(rs.getString("LOC_NUMBER"));
            //objdto.setAddress1(rs.getString("ADDRESS")); // is it BILLING_ADDRESS
            objdto.setAddress1(VAR_BILLING_ADDRESS);
            objdto.setM6cktid(rs.getString("CIRCUIT_ID"));
            objdto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objdto.setRegion(rs.getString("REGION"));
            objdto.setBandwaidth(rs.getString("BILLING_BANDWIDTH"));
            objdto.setVertical(rs.getString("VERTICAL"));
            objdto.setAccountManager(rs.getString("ACCOUNT_MGR"));
            objdto.setProjectManager(rs.getString("PROJECT_MGR"));
            objdto.setDistance(rs.getString("CHARGEABLE_DISTANCE"));
            //            objdto.setDispatchAddress1(rs.getString("DISPATCH_ADDRESS"));
            objdto.setIndicative_value(rs.getString("INDICATIVE_VALUE"));
            // productname
            objdto.setPartyName(rs.getString("PARTY_NAME"));
            //objdto.setBilling_location_from(rs.getString("BILLING_ADDRESS"));

            // DEMO_ORDER = ?
            //objdto.setDemo(rs.getString("DEMO_ORDER"));

            // CRM_PRODUCTNAME = ?
            //objdto.setCrm_productname(rs.getString("CRM_PRODUCTNAME"));

            objdto.setToLocation(rs.getString("TO_ADDRESS"));
            objdto.setFromLocation(rs.getString("FROM_ADDRESS"));
            objdto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));

            //BILLING_BANDWIDTH_UOM = ?   //remove this column
            //objdto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));

            //BL_SOURCE = ?
            //objdto.setBlSource(rs.getString("BL_SOURCE"));
            objdto.setServiceproductid(rs.getInt("ORDER_LINE_ID"));
            objdto.setOrderNumber(rs.getInt("ORDERID"));
            //            objdto.setChargeAmount(rs.getDouble("INV_AMT"));
            // LINEITEMAMOUNT = ?
            //objdto.setLineamt(rs.getDouble("LINEITEMAMOUNT"));
            //TOTAL_CHARGE_AMT = ?
            //objdto.setChargesSumOfLineitem(rs.getDouble("TOTAL_CHARGE_AMT"));
            //            objdto.setContractPeriod(rs.getInt("CONTRACT_PERIOD_MNTHS"));

            //objdto.setTotalPoAmt(""+rs.getDouble("TOTAL_POAMOUNT")); // is it POAMOUNT
            objdto.setTotalPoAmt("" + rs.getDouble("POAMOUNT"));
            //PARTY_ID = ?
            //objdto.setParty_id(rs.getInt("PARTY_ID")); // is it party no

            // CRMACCOUNTNO = ?
            //objdto.setCrmAccountNoString(rs.getString("CRMACCOUNTNO"));
            //m6 productid
            objdto.setM6OrderNo(rs.getInt("M6_ORDER_ID"));

            // CUST_TOT_PO_AMT = ?
            objdto.setCust_total_poamt(rs.getDouble("tot_amount")); // old value from CUST_TOT_PO_AMT

            //m6 order,business
            // PK_CHARGE_ID = ?
            //objdto.setPk_charge_id(rs.getString("PK_CHARGE_ID"));//Added by Ashutosh as on 26-Jun-12

            // objdto.setContractPeriod(rs.getInt("CONTRACTPERIOD")); // CONTRACT_PERIOD_MNTHS is using above 
            //              objdto.setAnnual_rate(rs.getDouble("ANNUAL_RATE"));
            objdto.setServiceId(rs.getInt("SERVICE_NO"));
            if (rs.getString("PO_EXPIRY_DATE") != null && !"".equals(rs.getString("PO_EXPIRY_DATE"))) {
                objdto.setPoExpiryDate(rs.getString("PO_EXPIRY_DATE"));
                objdto.setPoExpiryDate((utility.showDate_Report(objdto.getPoExpiryDate())).toUpperCase());
            }
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
                //recordCount = countFlag;
            }
            objdto.setFxInternalId(rs.getInt("INTERNAL_ID"));
            //            objdto.setMinimum_bandwidth(rs.getString("MINIMUM_BANDWIDTH"));//Need to add in View : AKS(Added)
            //            objdto.setMinimum_bandwidth_UOM(rs.getString("MINIMUM_BANDWIDTH_UOM"));//Need to add in View : AKS(Added)
            objdto.setComponentInfoID(rs.getInt("COMPONENTINFOID"));
            objdto.setComponentID(rs.getInt("COMPONENT_ID"));
            objdto.setComponentName(rs.getString("COMPONENT_NAME"));
            objdto.setPackageID(rs.getInt("PACKAGE_ID"));
            objdto.setPackageName(rs.getString("PACKAGE_NAME"));
            ComponentsDto dto = new ComponentsDto();
            dto.setComponentType(rs.getString("COMPONENT_TYPE"));
            dto.setComponentAmount(rs.getDouble("COMP_AMOUNT"));//RC_NRC_COMP_AMOUNT : AKS
            dto.setComponentStatus(rs.getString("COMPONENT_STATUS"));
            dto.setStartLogic(rs.getString("COMPONENT_START_LOGIC"));
            dto.setStartDate(rs.getString("SYSTEM_START_DATE")); // COMPONENT_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.setEndLogic(rs.getString("COMPONENT_END_LOGIC"));
            dto.setEnd_date(rs.getString("SYSTEM_END_DATE")); // COMPONENT_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());
            }
            dto.setFxTokenNo(rs.getString("START_COMPONENT_TOKEN_NO"));
            dto.setEndTokenNo(rs.getString("END_COMPONENT_TOKEN_NO"));
            dto.setFxStartStatus(rs.getString("SYSTEM_START_STATUS"));
            //dto.setChargesSumOfLineitem(rs.getString("FX_START_COMPONENT_STATUS"));
            dto.setComponentInstanceID(rs.getString("COMPONENT_INST_ID"));//COMP_FX_INSTANCE_ID : AKS
            dto.setEndFxStatus(rs.getString("SYSTEM_END_STATUS"));//FX_END_COMPONENT_STATUS :AKS
            //dto.setStartStatus(rs.getString("FX_ST_COMPONENT_STATUS"));
            objdto.setComponentDto(dto);

            objUserList.add(objdto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

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

    return objUserList;
}

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

public ArrayList<AdvancePaymentReportDTO> viewAdvancePaymentReport(AdvancePaymentReportDTO objDto)
        throws Exception {
    String methodName = "viewAdvancePaymentReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;

    ArrayList<AdvancePaymentReportDTO> objUserList = new ArrayList<AdvancePaymentReportDTO>();
    AdvancePaymentReportDTO objReportsDto = null;
    Connection conn = null;/* w  w  w.  ja  v a2 s .  c o  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(sqlAdvancePayementReport);
        if (objDto.getCrmAccountNo() != null && !"".equals(objDto.getCrmAccountNo())) {
            proc.setString(1, objDto.getCrmAccountNo().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        if (objDto.getArcChqNo() != null && !"".equals(objDto.getArcChqNo())) {
            proc.setString(2, objDto.getArcChqNo().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getOtcChqNo() != null && !"".equals(objDto.getOtcChqNo())) {
            proc.setString(3, objDto.getOtcChqNo().trim());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromorderCreationDate() != null && !"".equals(objDto.getFromorderCreationDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            proc.setString(4, objDto.getFromorderCreationDate().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }
        if (objDto.getToorderCreationDate() != null && !"".equals(objDto.getToorderCreationDate())) {
            proc.setString(5, objDto.getToorderCreationDate().trim());
        } else {
            proc.setNull(5, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromChqDate() != null && !"".equals(objDto.getFromChqDate())) {
            proc.setString(6, objDto.getFromChqDate().trim());
        } else {
            proc.setNull(6, java.sql.Types.VARCHAR);
        }
        if (objDto.getToChqDate() != null && !"".equals(objDto.getToChqDate())) {
            proc.setString(7, objDto.getToChqDate().trim());
        } else {
            proc.setNull(7, java.sql.Types.VARCHAR);
        }
        if (objDto.getDatetype() != null && !"".equals(objDto.getDatetype())) {
            proc.setString(8, objDto.getDatetype().trim());
        } else {
            proc.setNull(8, java.sql.Types.VARCHAR);
        }

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        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_Desc1(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

        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;
            objReportsDto = new AdvancePaymentReportDTO();
            objReportsDto.setOrderNo(rs.getInt("ORDERNO"));
            objReportsDto.setOrderStatus(rs.getString("ORDER_STATUS"));
            objReportsDto.setOrderCreationDate(rs.getString("ORDER_CREATION_DATE"));
            if (rs.getString("ORDER_CREATION_DATE") != null
                    && !"".equals(rs.getString("ORDER_CREATION_DATE"))) {
                objReportsDto.setOrderCreationDate(
                        (utility.showDate_Report(objReportsDto.getOrderCreationDate())).toUpperCase());
            }

            objReportsDto.setCrmAccountNo(rs.getString("CRMACCOUNTNO"));
            objReportsDto.setCustomerSegment(rs.getString("CUSTOMERSEGMENT"));
            //objReportsDto.setCircle(rs.getString("CIRCLE"));
            objReportsDto.setLicenseCompany(rs.getString("LICENCE_COMPANY"));
            objReportsDto.setCurrencyofOrder(rs.getString("CURRENCY_ORDER"));
            objReportsDto.setAmApprovalDate(rs.getString("AM_APPROVALS"));
            if (rs.getString("AM_APPROVALS") != null && !"".equals(rs.getString("AM_APPROVALS"))) {
                //Date date=df.parse(objReportsDto.getCustPoDate());
                objReportsDto.setAmApprovalDate(
                        utility.showDate_Report(objReportsDto.getAmApprovalDate()).toUpperCase());
            }

            objReportsDto.setPmApprovalDate(rs.getString("PM_APPROVALS"));
            if (rs.getString("PM_APPROVALS") != null && !"".equals(rs.getString("PM_APPROVALS"))) {
                objReportsDto.setPmApprovalDate((utility.showDate_Report(objReportsDto.getPmApprovalDate())));
            }

            objReportsDto.setOrderApprovalDate(rs.getString("COPC_APPROVALS"));
            if (rs.getString("COPC_APPROVALS") != null && !"".equals(rs.getString("COPC_APPROVALS"))) {
                objReportsDto
                        .setOrderApprovalDate((utility.showDate_Report(objReportsDto.getOrderApprovalDate())));
            }
            objReportsDto.setServiceNo(rs.getInt("SERVICE_NO"));
            objReportsDto.setProduct(rs.getString("PRODUCT"));
            objReportsDto.setLsi(rs.getInt("LSI"));
            objReportsDto.setFxChildAccount(rs.getString("FX_CHILD_ACCOUNT"));
            if (rs.getString("LOC_DATE") != null && !"".equals(rs.getString("LOC_DATE"))) {
                Date date = df.parse(rs.getString("LOC_DATE"));
                objReportsDto.setLocDate((utility.showDate_Report(date)).toUpperCase());
            }
            if (rs.getString("BILLINGTRIGGERDATE") != null && !"".equals(rs.getString("BILLINGTRIGGERDATE"))) {
                Date date = df.parse(rs.getString("BILLINGTRIGGERDATE"));
                objReportsDto.setBillingTriggerDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setArcChqNo(rs.getString("ARCCHQNO"));
            objReportsDto.setArcChqDate(rs.getString("ARCCHQDATE"));

            if (rs.getString("ARCCHQDATE") != null && !"".equals(rs.getString("ARCCHQDATE"))) {
                Date date = df.parse(objReportsDto.getArcChqDate());
                objReportsDto.setArcChqDate((utility.showDate_Report(date)).toUpperCase());
            }

            objReportsDto.setArcChqAmt(rs.getDouble("ARCCHQAMT"));
            objReportsDto.setArcBankName(rs.getString("ARCBANKNAME"));
            objReportsDto.setArcAmtAjd(rs.getDouble("ARCAMTAJD"));
            //objReportsDto.setArcAmtAjd(rs.getString("ARCAMTAJD"));
            objReportsDto.setOtcChqNo(rs.getString("OTCCHQNO"));
            objReportsDto.setArcExempted(rs.getString("ARCEXEMPTED"));
            objReportsDto.setArcExpreason(rs.getString("ARCEXPREASON"));
            objReportsDto.setOtcExempted(rs.getString("OTCEXEMPTED"));
            objReportsDto.setOtcExpreason(rs.getString("OTCEXPREASON"));
            objReportsDto.setOtcChqDate(rs.getString("OTCCHQDATE"));

            //Start [128]
            objReportsDto.setArcReEnterCheckamount(rs.getDouble("ARCRECHQAMT"));
            objReportsDto.setArcReEnterCheckNumber(rs.getString("ARCRECHQNO"));
            objReportsDto.setArcBankAccountNumber(rs.getString("ARCBANKACNO"));
            objReportsDto.setArcReEnterBankAccountNumber(rs.getString("ARCREBANKACNO"));
            objReportsDto.setArcIfscCode(rs.getString("ARCIFSCCODE"));
            objReportsDto.setArcReEnterIfscCode(rs.getString("ARCREIFSCCODE"));

            objReportsDto.setOtcReEnterCheckamount(rs.getDouble("OTCRECHQAMT"));
            objReportsDto.setOtcReEnterCheckNumber(rs.getString("OTCRECHQNO"));
            objReportsDto.setOtcBankAccountNumber(rs.getString("OTCBANKACNO"));
            objReportsDto.setOtcReEnterBankAccountNumber(rs.getString("OTCREBANKACNO"));
            objReportsDto.setOtcIfscCode(rs.getString("OTCIFSCCODE"));
            objReportsDto.setOtcReEnterIfscCode(rs.getString("OTCREIFSCCODE"));
            //End [128]

            objReportsDto.setLineNo(rs.getString("SPID"));
            objReportsDto.setLineName(rs.getString("LineName"));
            if (rs.getString("OTCCHQDATE") != null && !"".equals(rs.getString("OTCCHQDATE"))) {
                Date date = df.parse(objReportsDto.getOtcChqDate());
                objReportsDto.setOtcChqDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setOtcChqAmt(rs.getDouble("OTCCHQAMT"));
            objReportsDto.setOtcBankName(rs.getString("OTCBANKNAME"));
            objReportsDto.setOtcAmtAjd(rs.getDouble("OTCAMTAJD"));
            objReportsDto.setPartyNo(rs.getString("PARTY_NO"));
            objReportsDto.setAccountName(rs.getString("ACCOUNTNAME"));
            objReportsDto.setBillingTriggerActionDate(rs.getTimestamp("BILLINGTRIGGERDATEACTION"));
            String BillActionDate_String = utility.showDate_Report(objReportsDto.getBillingTriggerActionDate());
            objReportsDto.setBillingTriggerActionDate_string(BillActionDate_String);
            objReportsDto.setProductName(rs.getString("PRODUCTNAME"));
            objReportsDto.setSubproductName(rs.getString("SERVICESUBTYPENAME"));
            objReportsDto.setParty_id(rs.getString("PARTY_ID"));
            objReportsDto.setPodate(rs.getDate("PODATE"));
            String poDate_String = utility.showDate_Report(objReportsDto.getPodate());
            objReportsDto.setPodate_String(poDate_String);
            objReportsDto.setPoRecieveDate(rs.getDate("PORECEIVEDATE"));
            String poRDate_String = utility.showDate_Report(objReportsDto.getPoRecieveDate());
            objReportsDto.setPoRecieveDate_String(poRDate_String);
            objReportsDto.setZoneName(rs.getString("ZONENNAME"));
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }

            objUserList.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

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

    return objUserList;
}

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

/**
 * Create a Report to generate LEPM Order Cancel Report
         //from   w  ww .ja v  a 2s .  c om
 * @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<LempCancelOrderReportDTO> viewLEPMOrderCancelReport(LempCancelOrderReportDTO objDto)
        throws Exception {
    //   Nagarjuna
    String methodName = "viewLEPMOrderCancelReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end
    ArrayList<LempCancelOrderReportDTO> objUserList = new ArrayList<LempCancelOrderReportDTO>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    int countFlag = 0;
    LempCancelOrderReportDTO objReportsDto = null;
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    ArrayList<LempCancelOrderReportDTO> listSearchDetails = new ArrayList<LempCancelOrderReportDTO>();

    try {
        //[101010]START
        conn = DbConnection.getReportsConnectionObject();
        proc = conn.prepareCall(sqlLEPMOrderCancelReport);

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

        /*if (objDto.getCanceldatefrom() != null
              && !"".equals(objDto.getCanceldatefrom())) {
           SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
           Date dateStr1 = formatter.parse(objDto.getCanceldatefrom());
           String formattedDate1 = formatter.format(dateStr1);
           proc.setString(1, formattedDate1);
        } else {
           proc.setNull(1, java.sql.Types.VARCHAR);
        }
        if (objDto.getCanceldateto() != null
              && !"".equals(objDto.getCanceldateto())) {
           SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
           Date dateStr2 = formatter1.parse(objDto.getCanceldateto());
           String formattedDate2 = formatter1.format(dateStr2);
           proc.setString(1, formattedDate2);
           proc.setString(2, objDto.getCanceldateto().trim());
        } else {
           proc.setNull(2, java.sql.Types.VARCHAR);
        }*/

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

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

        while (rs.next() != false) {
            objDto = new LempCancelOrderReportDTO();
            objDto.setPartyName(rs.getString("PARTYNAME"));
            objDto.setOrderNo(rs.getString("ORDERNO"));
            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((rs.getTimestamp("COPC_APPROVAL_DATE")))).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"));
            objDto.setPrimarylocation(rs.getString("FROM_SITE"));
            objDto.setSeclocation(rs.getString("TO_SITE"));
            objDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objDto.setLineItemAmount(rs.getString("CHARGEAMOUNT"));
            objDto.setPrjmngname(rs.getString("PMNAME"));
            objDto.setPrjmgremail(rs.getString("PMEMAIL"));
            objDto.setActmngname(rs.getString("ACTMNAME"));
            objDto.setZoneName(rs.getString("ZONENNAME"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {

                objDto.setCustPoDate((Utility.showDate_Report((rs.getTimestamp("CUSTPODATE")))).toUpperCase());

            }
            objDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objDto.setOrderDate(rs.getString("ORDERDATE"));
            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {

                objDto.setOrderDate((Utility.showDate_Report((rs.getTimestamp("ORDERDATE")))).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((rs.getTimestamp("PM_APPROVAL_DATE")))).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((rs.getTimestamp("AM_APPROVAL_DATE")))).toUpperCase());
            }
            objDto.setNio_approve_date(rs.getString("NIO_APPROVAL_DATE"));
            if (rs.getString("NIO_APPROVAL_DATE") != null && !"".equals(rs.getString("NIO_APPROVAL_DATE"))) {
                objDto.setNio_approve_date(
                        (Utility.showDate_Report((rs.getTimestamp("NIO_APPROVAL_DATE")))).toUpperCase());
            }

            objDto.setRfs_date(rs.getString("RFS_DATE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {

                Date date = df.parse(objDto.getRfs_date());
                objDto.setRfs_date((Utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setOrdercategory(rs.getString("ORDERCATEGORY"));
            objDto.setOrderStatus(rs.getString("STATUS"));
            objDto.setLine_desc(rs.getString("LINE_ITEM_DESC"));
            objDto.setLinename(rs.getString("LINENAME"));
            objDto.setSub_linename(rs.getString("ORDER_SUBLINENAME"));
            objDto.setChargeName(rs.getString("CHARGE_NAME"));
            objDto.setChargeinfoID(rs.getString("CHARGEINFOID"));
            objDto.setServiceProductID(rs.getInt("LINENO"));
            objDto.setServiceName(rs.getString("SERVICENAME"));
            objDto.setPartyid(rs.getString("PARTY_ID"));
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setLicCompanyName(rs.getString("LCOMPANYNAME"));
            objDto.setEntity(rs.getString("COMPANYNAME"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setFrequencyName(rs.getString("PAYMENTTERM"));
            objDto.setChargeTypeName(rs.getString("CYCLICNONCYCLIC"));
            if ("NULL".equals(rs.getString("SERVICETYPE"))) {
                objDto.setServiceType("");
            } else {
                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"))) {
                //[505053] start
                try {
                    if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                        String ss[] = rs.getString("FROM_CITY").split("~~");
                        objDto.setFrom_city(ss[8]);
                    } else {
                        objDto.setFrom_city(" ");
                    }
                } catch (Exception exp) {
                    //It's okay to  ignore 'exp' here because setting a default value
                    objDto.setFrom_city(" ");
                }
                //[505053] end
            } else {
                objDto.setFrom_city("");
            }
            if (rs.getString("TO_CITY") != null && !"".equals(rs.getString("TO_CITY"))) {
                //[505053] start
                try {
                    if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                        String ss[] = rs.getString("TO_CITY").split("~~");
                        objDto.setTo_city(ss[8]);
                    } else {
                        objDto.setTo_city(" ");
                    }
                } catch (Exception exp) {
                    //It's okay to  ignore 'exp' here because setting a default value
                    objDto.setTo_city(" ");
                }
                //[505053] end
            } else {
                objDto.setTo_city("");
            }

            objDto.setRatio(rs.getString("RATIO"));
            objDto.setTaxation(rs.getString("TAXATIONVALUE"));
            //objDto.setAm_approval_remarks(rs.getString("AM_APPROVAL_TASK_REMARKS"));
            //objDto.setPm_approval_remarks(rs.getString("PM_APPROVAL_TASK_REMARKS"));
            //objDto.setCopc_approval_remarks(rs.getString("COPC_APPROVAL_TASK_REMARKS"));

            objDto.setDistance(rs.getString("DISTANCE"));
            objDto.setAccountManager(rs.getString("ACTMEMAIL"));
            objDto.setCurrencyCode(rs.getString("CURNAME"));
            objDto.setOrderTotal(rs.getDouble("ORDERTOTAL"));
            objDto.setPoAmount(rs.getString("POAMOUNT"));

            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setDispatchAddress1(rs.getString("DISPATCHADDRESS"));
            //nagarjuna
            objDto.setCharge_Disconnection_Status(rs.getString("CHARGES_STATUS"));
            objDto.setSubchange_type(rs.getString("NAME_SUBTYPE"));
            //nagarjuna end
            objDto.setServiceStage(rs.getString("STAGE"));
            //[909090]
            objDto.setOrd_cancel_reason(rs.getString("ORD_CANCEL_REASON"));

            //Start [10990] 
            objDto.setServ_cancel_reson(rs.getString("SERV_CANCEL_REASON"));
            objDto.setService_cancelledby(rs.getString("SERVICE_CANCELLEDBY"));
            objDto.setServ_cancel_remarks(rs.getString("SERV_CANCEL_REMARKS"));
            objDto.setService_cancl_date(rs.getString("SERVICE_CANCEL_DATE"));
            if (rs.getString("SERVICE_CANCEL_DATE") != null && !"".equals(rs.getString("SERVICE_CANCEL_DATE")))//service_cancel_Date for IB2B cancelation
            {

                objDto.setService_cancl_date(
                        (Utility.showDate_Report((rs.getDate("SERVICE_CANCEL_DATE")))).toUpperCase());

            }
            //end [10990] 
            objDto.setCanceldate(rs.getString("CANCEL_DATE"));
            if (rs.getString("CANCEL_DATE") != null && !"".equals(rs.getString("CANCEL_DATE"))) {

                objDto.setCanceldate((Utility.showDate_Report((rs.getDate("CANCEL_DATE")))).toUpperCase());

            }

            //lawkush Start
            objDto.setOpportunityId((rs.getString("OPPORTUNITYID")));
            //lawkush End

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

}