@RequestMapping(value = "/paySurvey")
  public void paySurvey(
      @RequestParam(required = true) String paySurveyIds,
      @RequestParam(required = false) String token,
      HttpSession session,
      HttpServletResponse response)
      throws ServletException, IOException, JRException, Exception {

    List<String> fileList = new ArrayList<String>();
    List<InputStream> inputStreams = new ArrayList<InputStream>();
    HashMap<String, Object> param;
    ThaiBaht thaiBaht = new ThaiBaht();

    String[] arrPaySurveyId = paySurveyIds.split(",");
    for (String paySurveyId : arrPaySurveyId) {
      param = new HashMap<String, Object>();

      PaySurvey paySurvey = paySurveyService.findById(Integer.parseInt(paySurveyId));

      float sumSurveyTrans = 0;
      float sumSurveyInvest = 0;
      float sumSurveyDaily = 0;
      float sumSurveyPhoto = 0;
      float sumSurveyTel = 0;
      float sumSurveyClaim = 0;
      float sumSurveyConditionRight = 0;
      float sumSurveyOther = 0;
      float sumSurveyFine = 0;
      float sumSurveyTotal = 0;
      for (Claim claim : paySurvey.getClaims()) {
        sumSurveyTrans += NumberToolsUtil.nullToFloat(claim.getSurveyTrans());
        sumSurveyInvest += NumberToolsUtil.nullToFloat(claim.getSurveyInvest());
        sumSurveyDaily += NumberToolsUtil.nullToFloat(claim.getSurveyDaily());
        sumSurveyPhoto += NumberToolsUtil.nullToFloat(claim.getSurveyPhoto());
        sumSurveyTel += NumberToolsUtil.nullToFloat(claim.getSurveyTel());
        sumSurveyClaim += NumberToolsUtil.nullToFloat(claim.getSurveyClaim());
        sumSurveyConditionRight += NumberToolsUtil.nullToFloat(claim.getSurveyConditionRight());
        sumSurveyOther += NumberToolsUtil.nullToFloat(claim.getSurveyOther());
        sumSurveyFine += NumberToolsUtil.nullToFloat(claim.getSurveyFine());
        sumSurveyTotal += ClaimServiceImpl.calcTotalSurvey(claim);
      }

      param.put("sumSurveyTrans", sumSurveyTrans);
      param.put("sumSurveyInvest", sumSurveyInvest);
      param.put("sumSurveyDaily", sumSurveyDaily);
      param.put("sumSurveyPhoto", sumSurveyPhoto);
      param.put("sumSurveyTel", sumSurveyTel);
      param.put("sumSurveyClaim", sumSurveyClaim);
      param.put("sumSurveyConditionRight", sumSurveyConditionRight);
      param.put("sumSurveyOther", sumSurveyOther);
      param.put("sumSurveyFine", sumSurveyFine);
      param.put("totalThai", "=" + thaiBaht.getText(sumSurveyTotal) + "=");
      param.put("total", sumSurveyTotal);
      param.put(
          "sumSurveyPart1",
          sumSurveyTrans + sumSurveyInvest + sumSurveyDaily + sumSurveyConditionRight);

      SurveyEmployee surveyEmployee = paySurvey.getClaims().get(0).getSurveyEmployee();
      if (surveyEmployee != null) {
        param.put("surveyEmployeeCode", surveyEmployee.getCode());
        param.put("surveyEmployeeName", surveyEmployee.getFullname());
      }

      param.put("paySurveyNo", paySurvey.getCode());

      ByteArrayOutputStream reportOut =
          downloadService.generateReportXLS(
              null,
              session.getServletContext().getRealPath("/jasperreport/paySurvey"),
              ExporterService.EXTENSION_TYPE_EXCEL,
              param,
              "paySurvey",
              paySurvey.getClaims());

      if (reportOut != null) {
        InputStream in = new ByteArrayInputStream(reportOut.toByteArray());
        inputStreams.add(in);
        fileList.add("payment_" + paySurvey.getCode() + ".xls");
      }

      // -----------------------------------------------------

      param = new HashMap<String, Object>();

      param.put("paySurveyNo", paySurvey.getCode());
      if (surveyEmployee != null) {
        param.put("surveyEmployeeCode", surveyEmployee.getCode());
        param.put("surveyEmployeeName", surveyEmployee.getFullname());
      }
      param.put("total", sumSurveyTotal);
      param.put("totalThai", "(" + thaiBaht.getText(sumSurveyTotal) + ")");

      reportOut =
          downloadService.generateReportXLS(
              null,
              session.getServletContext().getRealPath("/jasperreport/paySurveyApprove"),
              ExporterService.EXTENSION_TYPE_EXCEL,
              param,
              "paySurveyApprove",
              paySurvey.getClaims());

      if (reportOut != null) {
        InputStream in = new ByteArrayInputStream(reportOut.toByteArray());
        inputStreams.add(in);
        fileList.add("approveForm_" + paySurvey.getCode() + ".xls");
      }
    }

    OutputStream outs = null;
    outs = response.getOutputStream();

    String header = "attachment; filename=billing.zip";

    header = new String(header.getBytes("UTF-8"), "ISO8859_1");
    response.setHeader("Content-Disposition", header);
    response.setContentType("application/ms-excel");

    downloadService.writeZipFile(fileList, inputStreams, outs, token);
  }