public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws javax.servlet.ServletException, java.io.IOException {

    ActionErrors errors = new ActionErrors();
    HttpSession session = request.getSession();
    DbUserSession sessionUser = SessionHelpers.getUserSession(request);
    DatabaseTransaction t = null;
    DbSpeedData[] dbSpeedData = null;
    DbLocation[] dbLocation = null;
    LocaleDTO userlocale = null;

    MiscCashReceiptsForm miscCashReceipts = new MiscCashReceiptsForm();
    java.util.ArrayList locationList = new java.util.ArrayList();
    java.util.ArrayList glDescriptionList = new java.util.ArrayList();
    java.util.ArrayList cashAcctList = new java.util.ArrayList();
    java.util.ArrayList payMethodList = new java.util.ArrayList();
    java.util.ArrayList pleaseSelect = new java.util.ArrayList();

    if (sessionUser == null) {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.login.invalid"));
    }

    // Database Access Logic
    try {
      t = (DatabaseTransaction) DatabaseTransaction.getTransaction(sessionUser);

      // Set the list of receipt types in session.
      SessionHelpers.setReceiptTypesInSession(request);

      // Populate the locationList collection
      dbLocation = FdmsDb.getInstance().getLocationsForRegion(t, sessionUser.getRegion());
      // AppLog.trace("DbLocation list length = " +dbLocation.length);
      for (int i = 0; i < dbLocation.length; i++) {
        String listValue = String.valueOf(dbLocation[i].getId());
        String listLabel = dbLocation[i].getName();
        locationList.add(new OptionsList(listValue, listLabel));
      }

      // Populate the glDescriptionList collection
      dbSpeedData =
          FdmsDb.getInstance()
              .getSpeedData(sessionUser.getDbLookup(), sessionUser.getRegion(), "REVTYPE");
      // AppLog.trace("DbSpeedData for REVTYPE list length = " +dbSpeedData.length);
      for (int i = 0; i < dbSpeedData.length; i++) {
        String listValue = CsvTable.getField(dbSpeedData[i].getData(), 2);
        String listLabel = CsvTable.getField(dbSpeedData[i].getData(), 1);
        glDescriptionList.add(new OptionsList(listValue, listLabel));
      }

      // Populate the cashAcctList collection
      dbSpeedData =
          FdmsDb.getInstance()
              .getSpeedData(sessionUser.getDbLookup(), sessionUser.getRegion(), "CASHTYPE");
      // AppLog.trace("DbSpeedData for CASHTYPE list length = " +dbSpeedData.length);
      for (int i = 0; i < dbSpeedData.length; i++) {
        String listValue = CsvTable.getField(dbSpeedData[i].getData(), 2);
        String listLabel = CsvTable.getField(dbSpeedData[i].getData(), 1);
        cashAcctList.add(new OptionsList(listValue, listLabel));
      }

      // Populate the payMethodList", payMethodList)
      userlocale =
          FdmsDb.getInstance().getLocale(sessionUser.getDbLookup(), sessionUser.getRegion());
      dbSpeedData =
          FdmsDb.getInstance()
              .getSpeedData(sessionUser.getDbLookup(), sessionUser.getRegion(), "PAYMETHOD");
      // AppLog.trace("DbSpeedData for PAYMETHOD list length = " +dbSpeedData.length);
      for (int i = 0; i < dbSpeedData.length; i++) {
        if (dbSpeedData[i].getData() != null && dbSpeedData[i].getData().length() > 1) {
          String listValue = dbSpeedData[i].getData().substring(0, 2);
          String listLabel = dbSpeedData[i].getData();
          payMethodList.add(new OptionsList(listValue, listLabel));
        }
      }

      // Form Defaults
      miscCashReceipts.setSubmitButton("");
      miscCashReceipts.setAmountOfTran("0");
      miscCashReceipts.setDateOfTran(FormatDate.getCurrentDateFormatedMMDDYYYY());
      miscCashReceipts.setFormId("None");
      miscCashReceipts.setReceiptNumber(String.valueOf(userlocale.getNextReceiptNo()));

      pleaseSelect.add(new OptionsList("", "--Select--"));
      // AppLog.trace("Finished setting miscCashReceipts form bean");

    } catch (PersistenceException pe) {
      logger.error("Persistence Exception in ShowMiscCashReceipts.doPerform. " + pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.PersistenceException", pe.getCause()));
    } catch (Exception pe) {
      logger.error("Exception in ShowMiscCashReceipts.doPerform. ", pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.GeneralException", pe.getMessage()));
    } finally {
      if (t != null) t.closeConnection();
    }

    // Set Form Bean Into Scope
    session.setAttribute("miscCashReceipts", miscCashReceipts);
    session.setAttribute("locationList", locationList);
    session.setAttribute("glDescriptionList", glDescriptionList);
    session.setAttribute("cashAcctList", cashAcctList);
    session.setAttribute("payMethodList", payMethodList);
    session.setAttribute("pleaseSelect", pleaseSelect);
    // AppLog.trace("Setting miscCashReceipts form bean and collection arrays into session scope.");

    ActionForward actionForward = mapping.findForward("miscCashReceipts");

    if (!errors.isEmpty()) {
      // AppLog.info("ShowMiscCahsReceipts invoking forward mapping getInput().");
      saveErrors(request, errors);
      actionForward = new ActionForward(mapping.getInput());
    }

    return actionForward;
  }
  /** Insert the method's description here. Creation date: (11/22/2002 9:31:43 AM) */
  public void setNewForm(
      HttpServletRequest request,
      DbUserSession sessionUser,
      HttpSession session,
      fdms.ui.struts.form.MiscCashReceiptsForm form,
      ActionErrors errors) {

    DatabaseTransaction t = null;
    DbSpeedData[] dbSpeedData = null;
    DbLocation[] dbLocation = null;
    LocaleDTO userlocale = null;
    ArrayList locationList = new ArrayList();
    ArrayList glDescriptionList = new ArrayList();
    ArrayList cashAcctList = new ArrayList();
    ArrayList payMethodList = new ArrayList();
    ArrayList pleaseSelect = new ArrayList();

    // Database Access Logic
    try {
      t = (DatabaseTransaction) DatabaseTransaction.getTransaction(sessionUser);

      // Set the list of receipt types in session.
      SessionHelpers.setReceiptTypesInSession(request);

      // Populate the locationList collection
      dbLocation = FdmsDb.getInstance().getLocationsForRegion(t, sessionUser.getRegion());
      // AppLog.trace("DbLocation list length = " +dbLocation.length);
      for (int i = 0; i < dbLocation.length; i++) {
        String listValue = String.valueOf(dbLocation[i].getId());
        String listLabel = dbLocation[i].getName();
        locationList.add(new OptionsList(listValue, listLabel));
      }

      // Populate the glDescriptionList collection
      dbSpeedData =
          FdmsDb.getInstance()
              .getSpeedData(sessionUser.getDbLookup(), sessionUser.getRegion(), "REVTYPE");
      // AppLog.trace("DbSpeedData for REVTYPE list length = " +dbSpeedData.length);
      for (int i = 0; i < dbSpeedData.length; i++) {
        String listValue = CsvTable.getField(dbSpeedData[i].getData(), 2);
        String listLabel = CsvTable.getField(dbSpeedData[i].getData(), 1);
        glDescriptionList.add(new OptionsList(listValue, listLabel));
      }

      // Populate the cashAcctList collection
      dbSpeedData =
          FdmsDb.getInstance()
              .getSpeedData(sessionUser.getDbLookup(), sessionUser.getRegion(), "CASHTYPE");
      // AppLog.trace("DbSpeedData for CASHTYPE list length = " +dbSpeedData.length);
      for (int i = 0; i < dbSpeedData.length; i++) {
        String listValue = CsvTable.getField(dbSpeedData[i].getData(), 2);
        String listLabel = CsvTable.getField(dbSpeedData[i].getData(), 1);
        cashAcctList.add(new OptionsList(listValue, listLabel));
      }

      // Populate the payMethodList", payMethodList)
      userlocale =
          FdmsDb.getInstance().getLocale(sessionUser.getDbLookup(), sessionUser.getRegion());

      dbSpeedData =
          FdmsDb.getInstance()
              .getSpeedData(sessionUser.getDbLookup(), sessionUser.getRegion(), "PAYMETHOD");
      // AppLog.trace("DbSpeedData for PAYMETHOD list length = " +dbSpeedData.length);
      for (int i = 0; i < dbSpeedData.length; i++) {
        String listValue = dbSpeedData[i].getData().substring(0, 2);
        String listLabel = dbSpeedData[i].getData();
        payMethodList.add(new OptionsList(listValue, listLabel));
      }

      // Form Defaults
      form.setSubmitButton("");
      form.setAmountOfTran("0");
      form.setDateOfTran(FormatDate.getCurrentDateFormatedMMDDYYYY());
      form.setFormId("None");
      form.setReceiptNumber(String.valueOf(userlocale.getNextReceiptNo()));

      pleaseSelect.add(new OptionsList("", "--Select--"));
      // AppLog.trace("Finished setting miscCashReceipts form bean");

    } catch (PersistenceException pe) {
      logger.error("Persistence Exception in ProcessMiscCashReceipts.setNewForm. " + pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.PersistenceException", pe.getCause()));
    } catch (Exception pe) {
      logger.error("Exception in ProcessMiscCashReceipts.setNewForm. ", pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.GeneralException", pe.getMessage()));
    } finally {
      if (t != null) {
        try {
          t.closeConnection();
        } catch (Exception e) {
          logger.error("Error in closeConnection() : ", e);
        }
      }
    }

    // Set Form Bean Into Scope
    session.setAttribute("locationList", locationList);
    session.setAttribute("glDescriptionList", glDescriptionList);
    session.setAttribute("cashAcctList", cashAcctList);
    session.setAttribute("payMethodList", payMethodList);
    session.setAttribute("pleaseSelect", pleaseSelect);
    // AppLog.trace("Setting miscCashReceipts collection arrays into session scope.");

  }