@SuppressWarnings("unchecked")
 public void getTicketDetail(
     String status_for, String deptid, String empName, SessionFactory connectionSpace) {
   try {
     //	System.out.println("ddddddd  "+deptid);
     List ticketData =
         new AssetDashboardHelper().getLodgedTickets(deptid, status_for, empName, connectionSpace);
     ticketsList = new ArrayList<FeedbackPojo>();
     System.out.println(">>>>>>> " + ticketData.size());
     if (ticketData != null && ticketData.size() > 0) {
       for (Iterator iterator = ticketData.iterator(); iterator.hasNext(); ) {
         Object[] object = (Object[]) iterator.next();
         FeedbackPojo fp = new FeedbackPojo();
         fp.setId(Integer.parseInt(object[0].toString()));
         fp.setTicket_no(object[1].toString());
         fp.setFeed_by(DateUtil.makeTitle(object[2].toString()));
         fp.setOpen_date(DateUtil.convertDateToIndianFormat(object[3].toString()));
         fp.setOpen_time(object[4].toString().substring(0, 5));
         fp.setStatus(object[5].toString());
         ticketsList.add(fp);
       }
     }
     System.out.println(" >>>>>> " + ticketsList.size());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  public String beforeShowClientBirthdayTable() {
    String returnValue = ERROR;
    if (ValidateSession.checkSession()) {
      try {
        StringBuilder query7 = new StringBuilder("");
        query7.append(
            "select cbd.clientName, ccd.personName, ccd.birthday from client_basic_data as cbd, "
                + "client_contact_data as ccd where cbd.id = ccd.clientName  "
                + "and (ccd.birthday >= '"
                + DateUtil.getCurrentDateUSFormat()
                + "' and ccd.birthday <= '"
                + DateUtil.getDateAfterDays(7)
                + "') order by ccd.birthday ");
        List dataCount7 = coi.executeAllSelectQuery(query7.toString(), connectionSpace);

        if (dataCount7 != null && dataCount7.size() > 0) {
          birthdayList = new ArrayList<ArrayList<String>>();
          for (Iterator iterator = dataCount7.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            if (object != null && object[2] != null && !object[2].toString().equalsIgnoreCase("")) {
              ArrayList<String> data = new ArrayList<String>();
              data.add(object[0].toString());
              data.add(object[1].toString());
              data.add(DateUtil.convertDateToIndianFormat(object[2].toString()));

              birthdayList.add(data);
            }
          }
        }

        returnValue = SUCCESS;
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      returnValue = LOGIN;
    }
    return returnValue;
  }
  @SuppressWarnings({"rawtypes", "unchecked"})
  public String viewDARReportData() {
    if (ValidateSession.checkSession()) {
      try {
        SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
        CommonOperInterface cbt = new CommonConFactory().createInterface();
        String accountID = (String) session.get("accountid");
        String userName = (String) session.get("uName");
        DARReportHelper DRH = new DARReportHelper();
        TaskRegistrationHelper TRH = new TaskRegistrationHelper();
        StringBuilder query = new StringBuilder("");
        query.append("select count(*) from task_registration");
        List dataCount = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
        if (dataCount != null) {
          BigInteger count = new BigInteger("3");
          Object obdata = null;
          for (Iterator it = dataCount.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            count = (BigInteger) obdata;
          }
          setRecords(count.intValue());
          int to = (getRows() * getPage());
          if (to > getRecords()) to = getRecords();
          String userEmpID = null;
          String alltedTo = null;
          String empIdofuser = (String) session.get("empIdofuser");
          if (empIdofuser == null || empIdofuser.split("-")[1].trim().equals("")) return ERROR;
          userEmpID = empIdofuser.split("-")[1].trim();
          String userContID = null;
          userContID = TRH.getEmpDetailsByUserName("DAR", userName, connectionSpace)[0];
          alltedTo = TRH.getContactListForReports(userEmpID, userContID, connectionSpace);

          // System.out.println(">>>>>> FINAL CONTACT LIST IS AS ::::  "+alltedTo);
          query.setLength(0);
          query.append("SELECT  ");
          List fieldNames =
              Configuration.getColomnList(
                  "mapped_dar_configuration", accountID, connectionSpace, "dar_configuration");
          List<Object> Listhb = new ArrayList<Object>();
          int i = 0;
          for (Iterator it = fieldNames.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            if (obdata != null) {
              if (!obdata.toString().equalsIgnoreCase("userName")
                  && !obdata.toString().equalsIgnoreCase("date")
                  && !obdata.toString().equalsIgnoreCase("time")) {
                if (obdata.toString().equalsIgnoreCase("tasktype")) {
                  query.append("ty.tasktype" + ",");
                } else if (obdata.toString().equalsIgnoreCase("allotedto")) {
                  query.append("emp1.empName as allotedto,");
                } else if (obdata.toString().equalsIgnoreCase("allotedby")) {
                  query.append("emp2.empName as allotedby,");
                } else if (obdata.toString().equalsIgnoreCase("validate_By_2")) {
                  query.append("emp3.empName as val2,");
                } else if (obdata.toString().equalsIgnoreCase("validate_By_1")) {
                  query.append("emp4.empName as val1,");
                } else if (obdata.toString().equalsIgnoreCase("guidance")) {
                  query.append("emp5.empName as guidance,");
                } else {
                  query.append("tr." + obdata.toString() + ",");
                }
              }
            }
            i++;
          }
          fieldNames.remove("userName");
          fieldNames.remove("date");
          fieldNames.remove("time");

          i = 0;
          List gridFields = new ArrayList();
          List fieldNames1 =
              Configuration.getColomnList(
                  "mapped_dar_configuration",
                  accountID,
                  connectionSpace,
                  "dar_submission_configuration");
          for (Iterator it = fieldNames1.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            if (obdata != null) {
              if (!obdata.toString().equalsIgnoreCase("taskname")
                  && !obdata.toString().equalsIgnoreCase("id")
                  && !obdata.toString().equalsIgnoreCase("userName")) {
                gridFields.add(obdata.toString());
                if (i < fieldNames1.size() - 1) query.append("ds." + obdata.toString() + ",");
                else query.append("ds." + obdata.toString());
              }
            }
            i++;
          }
          query.append(" FROM task_registration AS tr ");
          query.append(" LEFT JOIN dar_submission AS ds ON ds.taskname=tr.id ");
          query.append("LEFT JOIN compliance_contacts AS cc1 ON tr.allotedto=cc1.id ");
          query.append("LEFT JOIN compliance_contacts AS cc2 ON tr.allotedby=cc2.id ");
          query.append("LEFT JOIN compliance_contacts AS cc3 ON tr.validate_By_2=cc3.id ");
          query.append("LEFT JOIN compliance_contacts AS cc4 ON tr.validate_By_1=cc4.id ");
          query.append("LEFT JOIN compliance_contacts AS cc5 ON tr.guidance=cc5.id  ");
          query.append("LEFT JOIN employee_basic emp1 ON cc1.emp_id= emp1.id  ");
          query.append("LEFT JOIN employee_basic emp2 ON cc2.emp_id= emp2.id  ");
          query.append("LEFT JOIN employee_basic emp3 ON cc3.emp_id= emp3.id ");
          query.append("LEFT JOIN employee_basic emp4 ON cc4.emp_id= emp4.id ");
          query.append("LEFT JOIN employee_basic emp5 ON cc5.emp_id= emp5.id ");
          query.append("LEFT JOIN task_type ty ON tr.tasktype= ty.id   ");
          if (fdate.split("-")[0].length() < 3) {
            fdate = DateUtil.convertDateToUSFormat(fdate);
            tdate = DateUtil.convertDateToUSFormat(tdate);
          }
          query.append(" WHERE  ds.date BETWEEN '" + fdate + "' AND '" + tdate + "'  ");
          if (allotTo != null && !allotTo.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.allotedTo='" + allotTo + "' ");
          }
          if (clientFor != null && !clientFor.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.clientfor='" + clientFor + "' ");
          }
          if (taskTyp != null && !taskTyp.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.tasktype='" + taskTyp + "' ");
          }
          if (taskPriority != null && !taskPriority.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.priority='" + taskPriority + "' ");
          }
          if (statusWork != null && !statusWork.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.status='" + statusWork + "' ");
          }
          if (alltedTo != null && alltedTo.length() > 0) {
            query.append(" AND  tr.allotedTo IN (" + alltedTo + ") ");
          }
          if (getSearchField() != null
              && getSearchString() != null
              && !getSearchField().equalsIgnoreCase("")
              && !getSearchString().equalsIgnoreCase("")) {
            query.append(" and ");
            if (getSearchOper().equalsIgnoreCase("eq")) {
              query.append(" " + getSearchField() + " = '" + getSearchString() + "'");
            } else if (getSearchOper().equalsIgnoreCase("cn")) {
              query.append(" " + getSearchField() + " like '%" + getSearchString() + "%'");
            } else if (getSearchOper().equalsIgnoreCase("bw")) {
              query.append(" " + getSearchField() + " like '" + getSearchString() + "%'");
            } else if (getSearchOper().equalsIgnoreCase("ne")) {
              query.append(" " + getSearchField() + " <> '" + getSearchString() + "'");
            } else if (getSearchOper().equalsIgnoreCase("ew")) {
              query.append(" " + getSearchField() + " like '%" + getSearchString() + "'");
            }
          }
          System.out.println("QUERY OF REPORT IS AS ::::  " + query.toString());
          List data = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
          for (int k = 0; k < gridFields.size(); k++) {
            fieldNames.add(gridFields.get(k).toString());
          }
          if (data != null && data.size() > 0) {

            String clientData = null;
            String clientVal = null;
            Object[] obdata11 = null;
            for (Iterator it = data.iterator(); it.hasNext(); ) {
              obdata11 = (Object[]) it.next();
              Map<String, Object> one = new HashMap<String, Object>();
              for (int k = 0; k < fieldNames.size(); k++) {
                if (fieldNames.get(k) != null
                    && obdata11[k] != null
                    && !obdata11[k].toString().equalsIgnoreCase("")) {
                  if (obdata11[k].toString().matches("\\d{4}-[01]\\d-[0-3]\\d")) {
                    one.put(
                        fieldNames.get(k).toString(),
                        DateUtil.convertDateToIndianFormat(obdata11[k].toString()));
                  }
                  /*else if(fieldNames.get(k).toString().equalsIgnoreCase("attachment")||  fieldNames.get(k).toString().equalsIgnoreCase("attachmentt")||fieldNames.get(k).toString().equalsIgnoreCase("reviewDoc")  )
                  {
                  	String str=obdata11[k].toString().substring(obdata11[k].toString().indexOf("//"), obdata11[k].toString().length());
                  	String docName=str.substring(14,str.length());
                  	one.put(fieldNames.get(k).toString(),docName);
                  }*/
                  else if (fieldNames.get(k).toString().equalsIgnoreCase("clientfor")) {
                    clientVal = obdata11[k].toString();
                    if (obdata11[k].toString().equalsIgnoreCase("PA")) {
                      one.put(fieldNames.get(k).toString(), "Prospect Associate");
                    } else if (obdata11[k].toString().equalsIgnoreCase("PC")) {
                      one.put(fieldNames.get(k).toString(), "Prospect Client");
                    } else if (obdata11[k].toString().equalsIgnoreCase("N")) {
                      one.put(fieldNames.get(k).toString(), "Other");
                    } else if (obdata11[k].toString().equalsIgnoreCase("EC")) {
                      one.put(fieldNames.get(k).toString(), "Existing Client");
                    } else if (obdata11[k].toString().equalsIgnoreCase("EA")) {
                      one.put(fieldNames.get(k).toString(), "Existing Associate");
                    } else if (obdata11[k].toString().equalsIgnoreCase("IN")) {
                      one.put(fieldNames.get(k).toString(), "Internal");
                    }
                  } else if (fieldNames.get(k).toString().equalsIgnoreCase("cName")) {
                    clientData = obdata11[k].toString();
                    one.put(
                        fieldNames.get(k).toString(),
                        DRH.clientName(clientVal, obdata11[k].toString(), connectionSpace));
                  } else if (fieldNames.get(k).toString().equalsIgnoreCase("offering")) {
                    one.put(
                        fieldNames.get(k).toString(),
                        DRH.offeringName(
                            clientVal, clientData, obdata11[k].toString(), connectionSpace));
                  } else {
                    one.put(fieldNames.get(k).toString(), obdata11[k].toString());
                  }
                } else {
                  one.put(fieldNames.get(k).toString(), "NA");
                }
              }
              Listhb.add(one);
            }
            setViewList(Listhb);
            setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
          }
        }
        return SUCCESS;
      } catch (Exception exp) {
        exp.printStackTrace();
        return ERROR;
      }
    } else {
      return ERROR;
    }
  }
  public String viewCustomerResInGrid() {
    boolean valid = ValidateSession.checkSession();
    if (valid) {
      try {

        CommonOperInterface cbt = new CommonConFactory().createInterface();
        {
          custDataList = new ArrayList<CustomerPojo>();
          Map session = ActionContext.getContext().getSession();
          SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");

          StringBuilder queryNew2 = new StringBuilder("");
          if (getMode() != null) {
            // System.out.println(">>>>>>>>>>>>Online"+getMode());
            queryNew2.append(
                "select feedbt.id as feedback_ticketId,feedbt.feedTicketNo,feedData.openDate,feedData.openTime,"
                    + " feedbck.escalation_date,feedbck.escalation_time,feedbck.level,feedData.clientId,feedData.clientName,feedData.mobNo,"
                    + " feedData.emailId,feedData.refNo,feedData.centerCode,feedData.centreName, feedData.id,feedData.problem,"
                    + " feedData.compType,feedData.handledBy,feedData.remarks,"
                    + " feedData.kword,feedData.ip from feedback_ticket as feedbt"
                    + " inner join feedback_status as feedbck on feedbt.feed_stat_id=feedbck.id "
                    + " inner join feedbackdata as feedData on feedbt.feed_data_id=feedData.id where (feedData.targetOn='No' || feedData.targetOn='Yes') && feedData.mode='"
                    + getMode()
                    + "'");

            queryNew2.append(" order by feedData.openDate DESC");
          }
          //   System.out.println("Querry is as >>>>>>>>>>>>>>>>"+queryNew2);
          List ticketDataList = cbt.executeAllSelectQuery(queryNew2.toString(), connectionSpace);
          // System.out.println("size of the list ticketDataList>>>>>>"+ticketDataList.size());
          List<CustomerPojo> tempList = new ArrayList<CustomerPojo>();
          int i = 1;
          if (ticketDataList != null && ticketDataList.size() > 0) {
            for (Iterator iterator = ticketDataList.iterator(); iterator.hasNext(); ) {
              CustomerPojo feed = new CustomerPojo();
              Object[] type = (Object[]) iterator.next();

              if (type[14] != null) {
                feed.setId(Integer.parseInt(type[14].toString()));
              }

              if (type[0] != null) {
                feed.setFeedTicketId(Integer.parseInt(type[0].toString()));
              }
              if (type[1] != null) {
                feed.setTicketNo(type[1].toString());
              }
              if (type[2] != null) {
                feed.setOpenDate(DateUtil.convertDateToIndianFormat(type[2].toString()));
              }

              if (type[3] != null) {
                feed.setOpenTime(type[3].toString());
              }

              if (type[4] != null) {
                feed.setEscalationDate(DateUtil.convertDateToIndianFormat(type[4].toString()));
              }

              if (type[5] != null) {
                feed.setEscalationTime(type[5].toString());
              }

              if (type[6] != null) {
                feed.setLevel(type[6].toString());
              }

              if (type[7] != null) {
                feed.setClientId(type[7].toString());
              }

              if (type[8] != null) {
                feed.setClientName(type[8].toString());
              }

              if (type[9] != null) {
                feed.setMobNo(type[9].toString());
              }

              if (type[10] != null) {
                feed.setEmailId(type[10].toString());
              }

              if (type[11] != null) {
                feed.setRefNo(type[12].toString());
              }

              if (type[12] != null) {
                feed.setCentreCode(type[12].toString());
              }

              if (type[13] != null) {
                feed.setCentreName(type[13].toString());
              }

              if (type[15] != null) {
                feed.setProblem(type[15].toString());
              }

              if (type[16] != null) {
                feed.setComplaintType(type[16].toString());
              }

              if (type[17] != null) {
                feed.setHandledBy(type[17].toString());
              }

              if (type[18] != null) {
                feed.setRemarks(type[18].toString());
              }

              if (type[19] != null) {
                feed.setKeyWord(type[19].toString());
              }

              if (type[20] != null) {
                feed.setIp(type[20].toString());
              }

              tempList.add(feed);
            }
            setCustDataList(tempList);
          }
        }
        return SUCCESS;
      } catch (Exception e) {
        e.printStackTrace();
        log.error(
            "Problem in method viewCustomerResInGrid of class "
                + getClass()
                + " on "
                + DateUtil.getCurrentDateIndianFormat()
                + " at "
                + DateUtil.getCurrentTimeHourMin(),
            e);
        return ERROR;
      }
    } else {
      return LOGIN;
    }
  }