/**
   * Do exporta reporte conciliacion.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   */
  public final ActionForward doExportaReporteConciliacion(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response) {

    ReporteConciliacionForm form;
    String error = "";
    final Boolean repBoletas =
        (request.getParameter(REP_BOLETAS) == null)
            ? false
            : Boolean.parseBoolean(request.getParameter(REP_BOLETAS));
    if (actionForm instanceof ReporteConciliacionForm) {
      form = (ReporteConciliacionForm) actionForm;
    } else {
      form = new ReporteConciliacionForm();
    }

    try {
      final ReporteConciliacionService service =
          (ReporteConciliacionService)
              getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);

      if ("".equals(error)) {

        String cadenaExcel = service.armaExcel(form, repBoletas);

        response.setContentType("application/vnd.ms-excel");
        response.setHeader("Content-Disposition", "attachment;filename=reporte.xls");
        response.getOutputStream().print(EXCEL_HEADER + cadenaExcel + EXCEL_FOOTER);

      } else {
        response.getOutputStream().print("<script>window.alert(" + error + ");</script>");
      }

    } catch (IOException e) {
      LOG.error(e.getMessage(), e);
      try {
        response.getOutputStream().print("<script>alert(\"Error al exportar.\");</script>");
      } catch (IOException e1) {
        LOG.error(e1.getMessage(), e1);
      }
    } catch (FrontClientException e) {
      LOG.error(e.getMessage(), e);
      try {
        response.getOutputStream().print("<script>alert(\"Error al exportar.\");</script>");
      } catch (IOException e1) {
        LOG.error(e1.getMessage(), e1);
      }
    }

    return null;
  }