/**
   * 列印公務車車籍資料
   *
   * @pdOid 60365696-e13e-4db6-bb22-47b491b7003d
   */
  @SuppressWarnings("unchecked")
  public String doPrintAction() {
    // 查詢條件: 查詢條件擇一輸入即可
    Map map = getFindCriteriaMap();
    CarLoan carLoan = (CarLoan) map.get("carLoan"); // 貸款別
    String userCode = (String) map.get("userCode"); // 車號
    String userName = (String) map.get("userName"); // 車號
    // String queryString = "";
    if (null == carLoan && StringUtils.isBlank(userCode) && StringUtils.isBlank(userName)) {
      throw new ExpRuntimeException(ErrorCode.B10055); // 請輸入至少一個查詢欄位。
    }
    // 組queryString
    StringBuffer queryString = new StringBuffer();
    queryString.append("1 ");

    if (StringUtils.isNotBlank(userCode)) {
      queryString.append("AND TBEXP_USER.CODE = '");
      queryString.append(userCode);
      queryString.append("'");
    }

    if (StringUtils.isNotBlank(userName)) {
      queryString.append("AND TBEXP_USER.NAME LIKE '");
      queryString.append(userName);
      queryString.append("%'");
    }

    if (null != carLoan) {
      queryString.append("AND TBEXP_CAR_LOAN.CODE = '");
      queryString.append(carLoan.getCode());
      queryString.append("'");
    }

    Map<String, Object> params = new HashMap<String, Object>();
    // 報表名稱與路徑
    params.put(
        "rptName",
        CrystalReportConfigManagedBean.getManagedBean().getPubAffCarRegisterQueryReportName());
    // 查詢字串
    params.put("queryString", queryString.toString());
    // 產生報表
    CrystalReportConfigManagedBean.generateReport(params);
    return "dialog:print";
  }
  /**
   * 執行查詢功能。
   *
   * @return
   */
  public String doQueryAction() {
    Calendar eDate = (Calendar) ((Map<String, Object>) getFindCriteriaMap()).get("eDate");
    if (eDate == null) {
      String[] paramStrs = {
        Messages.getString(
            "applicationResources",
            "tw_com_skl_exp_web_jsf_managed_gl_report_AirportExpandBizManagedBean_query_end_date",
            null)
      };
      // {0}欄位-必須有值。
      throw new ExpRuntimeException(ErrorCode.A10039, paramStrs);
    }

    Map<String, Object> params = new HashMap<String, Object>();
    // Crystal Report 檔案。
    CrystalReportConfigManagedBean crConfig = CrystalReportConfigManagedBean.getManagedBean();
    params.put(
        "rptName",
        crConfig.getReportRootPath() + crConfig.getEconomyInstituteBudgeExecuteReportName());
    params.put("eDate", DateUtils.getRocDateStrByCalendar(eDate));
    CrystalReportConfigManagedBean.generateReport(params);
    return "dialog:print";
  }