/**
   * Do pagina primera.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doPaginaPrimera(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;
    String error = "";
    int pagActual = Integer.parseInt(request.getParameter(PAG_ACTUAL));
    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 (form.getPaginacion() == null) {
        form = new ReporteConciliacionForm();
        error = ConciliaErrorKeys.PPINV_ERR_CONCILIACION_CONSULTA_REPORTE.toString();
        res.setResponseContent(jsonize(form));
      }

      if ("".equals(error)) {
        form = service.consultaOperConciliacion(form, "paginaPrimera", pagActual, repBoletas);
        res.setResponseError(null);
        res.setResponseContent(jsonize(form));
      } else {
        res.setResponseError(error);
      }
    } catch (FrontClientException e) {
      LOG.error(e.getMessage(), e);
      res.setResponseError(e.getMessage());
    } catch (BeansException e) {
      LOG.error(e.getMessage(), e);
      res.setResponseError(GralErrorKeys.PPINV_ERR_GRAL.toString());
    } finally {
      res.commit();
    }

    return null;
  }
  /**
   * Do consulta reporte conciliacion.
   *
   * @param mapping the mapping
   * @param actionForm the action form
   * @param request the request
   * @param response the response
   * @return the action forward
   * @throws Exception the exception
   */
  public final ActionForward doConsultaReporteConciliacion(
      final ActionMapping mapping,
      final ActionForm actionForm,
      final HttpServletRequest request,
      final HttpServletResponse response)
      throws Exception {

    PseudoResponse res = new PseudoResponse(request, response);
    ReporteConciliacionForm form;
    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();
    }

    final ReporteConciliacionService service =
        (ReporteConciliacionService)
            getWebApplicationContext().getBean(REPORTE_CONCILIACION_SERVICE);
    String errorFechas = validaFechas(form.getFechaIni(), form.getFehcaFin(), form.isHistorico());
    if ("".equals(errorFechas)) {
      form = service.consultaOperConciliacion(form, "paginaPrimera", 1, repBoletas);
      res.setResponseError(null);
      res.setResponseContent(jsonize(form));
    } else {
      res.setResponseError(errorFechas);
    }

    res.commit();

    return null;
  }