// 添加付汇单前准备数据
 @SuppressWarnings("unused")
 private String toAddCustomerPayMoney(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   String resultPage = "/beijing/finance/customerPayMoney_add.jsp";
   try {
     request.setAttribute(
         "CustomerList",
         PageManager.getLimitData("BeiJingCustomer", "ID,ShortName", "Status!=-1"));
     request.setAttribute(
         "MandatorList", PageManager.getLimitData("BeiJingClient", "ID,ShortName", "Status!=-1"));
     request.setAttribute(
         "CurrencyList",
         PageManager.getLimitData("Currency", "ID,Currency", "Status!=-1 Order By Currency"));
     request.setAttribute(
         "BrandList",
         PageManager.getLimitData("BeiJingJieSuanBrand", "ID,BrandName", "Status!=-1"));
     request.setAttribute(
         "ReceiverList",
         PageManager.getLimitData("BJPayee", "ID,PayeeName as ReceiverName", "Status!=-1"));
     request.setAttribute(
         "SenderList", PageManager.getLimitData("BeiJingSender", "ID,SenderName", "Status!=-1"));
   } catch (Exception e) {
     request.setAttribute(Constant.ERROR_EXCEPTION, e);
     resultPage = Constant.ERROR_JSP;
   }
   return resultPage;
 }
 // 获得符合条件的发货人列表
 @SuppressWarnings({"rawtypes", "unused"})
 private String getSenderList(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   /*
    * pageRows:用户设置的每页显示条数
    * pageIndex:页码
    * totalNum:符合条件的总数据量
    * totalPages:总共要显示多少页
    */
   String resultPage = "/beijing/base/sender_list.jsp";
   // 获得页码
   try {
     int pageIndex = 1;
     try {
       pageIndex = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE));
     } catch (Exception ex) {
       pageIndex = 1;
     }
     // 获得用户设置的每页显示条数
     String UserID = GlobalFunc.getUserID(request);
     int pageRows = Integer.parseInt(GlobalFunc.getUserPerPageNum(request));
     // 获得用户输入的发货人名称
     String senderName = "";
     if (request.getParameter("senderName") != null) {
       senderName = request.getParameter("senderName");
     }
     // 获得符合条件的数据总量
     int totalNum = SenderManager.getSenderTotalRows(senderName);
     // 根据数据总量和每页显示条数获得数据总页数
     int totalPage = PageManager.getTotalPages(totalNum, pageRows);
     // 获得符合条件的某一个的数据
     ArrayList senderList = SenderManager.getSenderList(pageRows, pageIndex, senderName);
     request.setAttribute(Constant.PARA_LIST, senderList);
     request.setAttribute("senderName", senderName);
     request.setAttribute(Constant.PARA_PAGEROWS, pageRows);
     request.setAttribute(Constant.PARA_CURPAGE, pageIndex);
     request.setAttribute(Constant.PARA_TOTALROWS, totalNum);
     request.setAttribute(Constant.PARA_TOTALPAGE, new Integer(totalPage));
   } catch (ACDException e) {
     resultPage = Constant.ERROR_JSP;
   } catch (Exception e) {
     e.printStackTrace();
   }
   return resultPage;
 }
  // 添加付汇单页面查找数据
  @SuppressWarnings("unused")
  private String searchCustomerPayMoney(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String resultPage = "/beijing/finance/customerPayMoney_add.jsp";
    try {
      int page = 1;
      try {
        page = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE));
      } catch (Exception ex) {
        page = 1;
      }

      String BrandID = "";
      if (request.getParameter("BrandID") != null) {
        BrandID = request.getParameter("BrandID");
      }
      String CustomerID = "";
      if (request.getParameter("CustomerID") != null) {
        CustomerID = request.getParameter("CustomerID");
      }
      String MandatorID = "";
      if (request.getParameter("MandatorID") != null) {
        MandatorID = request.getParameter("MandatorID");
      }
      String CurrencyID = "";
      if (request.getParameter("CurrencyID") != null) {
        CurrencyID = request.getParameter("CurrencyID");
      }
      // 付汇日期
      String curDate = "";
      if (request.getParameter("OrderTime") != null) {
        curDate = request.getParameter("OrderTime");
      }
      // 付汇金额
      String curMoney = "";
      if (request.getParameter("Money") != null) {
        curMoney = request.getParameter("Money");
      }
      String SenderID = "";
      if (request.getParameter("SenderID") != null) {
        SenderID = request.getParameter("SenderID");
      }
      String ReceiverID = "";
      if (request.getParameter("ReceiverID") != null) {
        ReceiverID = request.getParameter("ReceiverID");
      }

      // 获得已经选中的接收单Id,传回页面
      String orderIds = "";
      if (request.getParameter("orderIds") != null
          && request.getParameter("orderIds").length() > 0) {
        orderIds = request.getParameter("orderIds");
      }
      // 选中了单据的钱的总和
      String chooseMoney = "";
      if (request.getParameter("chooseMoney") != null
          && request.getParameter("chooseMoney").length() > 0) {
        chooseMoney = request.getParameter("chooseMoney");
      }
      // 选中了单据后剩余的钱
      String remainMoney = "";
      if (request.getParameter("remainMoney") != null
          && request.getParameter("remainMoney").length() > 0) {
        remainMoney = request.getParameter("remainMoney");
      }

      HttpSession session = request.getSession(true);
      String strids = request.getParameter("strids");

      session.removeAttribute("PayMoneyIDS");
      session.setAttribute("PayMoneyIDS", strids);

      String UserID = GlobalFunc.getUserID(request);
      int pageRows = Integer.parseInt(GlobalFunc.getUserPerPageNum(request));

      int totalRows =
          payMoneyManager.getAddToPayReceiveOrderTotalRows(
              MandatorID, CustomerID, CurrencyID, BrandID, SenderID);

      int totalPage = PageManager.getTotalPages(totalRows, pageRows);
      ArrayList<?> Temp_List =
          payMoneyManager.getForFuHuiReceiveOrder(
              page, pageRows, MandatorID, CustomerID, CurrencyID, BrandID, SenderID);

      String totalUSDMoney =
          payMoneyManager.getRemainTotalMoney(
              MandatorID, CustomerID, CurrencyID, BrandID, SenderID);

      request.setAttribute("totalUSDMoney", totalUSDMoney);
      request.setAttribute(Constant.PARA_LIST, Temp_List);
      request.setAttribute("BorderHeight", GlobalFunc.getBorderHeight(request));

      request.setAttribute("CustomerID", CustomerID);
      request.setAttribute("MandatorID", MandatorID);
      request.setAttribute("SenderID", SenderID);
      request.setAttribute("CurrencyID", CurrencyID);
      request.setAttribute("ReceiverID", ReceiverID);
      request.setAttribute("BrandID", BrandID);
      request.setAttribute("curDate", curDate);
      request.setAttribute("curMoney", curMoney);

      request.setAttribute("orderIds", orderIds);
      request.setAttribute("remainMoney", remainMoney);
      request.setAttribute("chooseMoney", chooseMoney);

      request.setAttribute(Constant.PARA_CURPAGE, page);
      request.setAttribute(Constant.PARA_TOTALROWS, totalRows);
      request.setAttribute(Constant.PARA_TOTALPAGE, totalPage);
      request.setAttribute(
          "CustomerList",
          PageManager.getLimitData("BeiJingCustomer", "ID,ShortName", "Status!=-1"));
      request.setAttribute(
          "MandatorList", PageManager.getLimitData("BeiJingClient", "ID,ShortName", "Status!=-1"));
      request.setAttribute(
          "CurrencyList", PageManager.getLimitData("Currency", "ID,Currency", "Status!=-1"));
      request.setAttribute(
          "BrandList",
          PageManager.getLimitData("BeiJingJieSuanBrand", "ID,BrandName", "Status!=-1"));
      request.setAttribute(
          "ReceiverList",
          PageManager.getLimitData("BJPayee", "ID,PayeeName as ReceiverName", "Status!=-1"));
      request.setAttribute(
          "SenderList", PageManager.getLimitData("BeiJingSender", "ID,SenderName", "Status!=-1"));

    } catch (Exception e) {
      e.printStackTrace();
    }

    return resultPage;
  }
  // 添加核销单据之前准备数据
  @SuppressWarnings("unused")
  private String toAddOrderForFuHui(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String resultPage = "/beijing/finance/customerPayMoney_edit.jsp";
    try {
      int page = 1;
      try {
        page = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE));
      } catch (Exception ex) {
        page = 1;
      }

      // 根据ID获得付汇信息
      HashMap<String, String> orderHM = payMoneyManager.getFuHuiInfo(request.getParameter("ID"));
      String CurrencyID = orderHM.get("CurrencyID").toString();
      String MandatorID = orderHM.get("MandatorID").toString();
      String CustomerID = orderHM.get("CustomerID").toString();
      String BrandID = "";

      if (request.getParameter("BrandID") != null && request.getParameter("BrandID").length() > 0) {
        BrandID = request.getParameter("BrandID");
      }

      HttpSession session = request.getSession(true);
      String strids = request.getParameter("strids");

      session.removeAttribute("PayMoneyIDS");
      session.setAttribute("PayMoneyIDS", strids);

      double chooseMoney = 0.0;

      if (request.getParameter("chooseMoney") != null
          && request.getParameter("chooseMoney").toString().length() > 0) {
        chooseMoney = Double.parseDouble(request.getParameter("chooseMoney"));
      }

      double remainMoney = payMoneyManager.getFuHuiRemainMoney(orderHM, chooseMoney);
      remainMoney = PBMeth.round(remainMoney, 2);

      // 获得用户选择的接收单Id,传回页面
      String orderIds = "";
      if (request.getParameter("orderIds") != null
          && request.getParameter("orderIds").length() > 0) {
        orderIds = request.getParameter("orderIds");
      }

      // chooseMoney = Double.parseDouble(orderHM.get("Money").toString()) - remainMoney;

      // 获得用户设置的每页显示行数
      String UserID = GlobalFunc.getUserID(request);
      int pageRows = Integer.parseInt(GlobalFunc.getUserPerPageNum(request));

      // 根据付汇单信息获得可添加成核销的接收单数量
      int totalRows =
          payMoneyManager.getAddToPayReceiveOrderTotalRows(
              MandatorID, CustomerID, CurrencyID, BrandID, "");
      // 根据总数据量和每页显示行数得到总页数
      int totalPage = PageManager.getTotalPages(totalRows, pageRows);
      // 获得可添加的接收单List
      ArrayList<?> Temp_List =
          payMoneyManager.getForFuHuiReceiveOrder(
              page, pageRows, MandatorID, CustomerID, CurrencyID, BrandID, "");

      request.setAttribute(Constant.PARA_LIST, Temp_List);
      request.setAttribute("BorderHeight", GlobalFunc.getBorderHeight(request));
      request.setAttribute("remainMoney", String.valueOf(remainMoney));
      request.setAttribute("chooseMoney", String.valueOf(chooseMoney));
      request.setAttribute("orderIds", orderIds);
      request.setAttribute("OrderHM", orderHM);
      request.setAttribute("BrandID", BrandID);

      request.setAttribute(Constant.PARA_CURPAGE, page);
      request.setAttribute(Constant.PARA_TOTALROWS, totalRows);
      request.setAttribute(Constant.PARA_TOTALPAGE, totalPage);
      request.setAttribute("BrandList", GlobalFunction.getAllBJJieSuanBrand("0"));

    } catch (ACDException e) {
      request.setAttribute(Constant.ERROR_EXCEPTION, e);
      resultPage = Constant.ERROR_JSP;
    } catch (Exception e) {
      e.printStackTrace();
    }

    return resultPage;
  }
  // 根据条件获得某一页的付汇数据
  private String getPayList(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String resultPage = "/beijing/finance/customerPayMoney_list.jsp";
    // 获得查询条件
    try {
      int page = 1;
      try {
        page = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE));
      } catch (Exception ex) {
        page = 1;
      }

      String minTime = "";
      String strMinTime = "";
      if (request.getParameter("minTime") != null && request.getParameter("minTime").length() > 0) {
        minTime = request.getParameter("minTime");
        strMinTime = minTime + " 00:00:00";
      }
      String maxTime = "";
      String strMaxTime = "";
      if (request.getParameter("maxTime") != null && request.getParameter("maxTime").length() > 0) {
        maxTime = request.getParameter("maxTime");
        strMaxTime = maxTime + " 23:59:59";
      }
      // 客户
      String CustomerID = "";
      if (request.getParameter("CustomerID") != null) {
        CustomerID = request.getParameter("CustomerID");
      }
      // 委托人
      String MandatorID = "";
      if (request.getParameter("MandatorID") != null) {
        MandatorID = request.getParameter("MandatorID");
      }
      // 收款人
      String ReceiverID = "";
      if (request.getParameter("ReceiverID") != null) {
        ReceiverID = request.getParameter("ReceiverID");
      }
      String CurrencyID = "";
      if (request.getParameter("CurrencyID") != null) {
        CurrencyID = request.getParameter("CurrencyID");
      }

      String Status = "";
      if (request.getParameter("Status") != null) {
        Status = request.getParameter("Status");
      }
      String SendStatus = "";
      if (request.getParameter("SendStatus") != null) {
        SendStatus = request.getParameter("SendStatus");
      }

      // 获得当前登录用户设置的每页显示行数
      String UserID = GlobalFunc.getUserID(request);
      int pageRows = Integer.parseInt(GlobalFunc.getUserPerPageNum(request));
      // 根据查询条件获得需要显示的数据总量
      int totalRows =
          payMoneyManager.getPayTotalCount(
              strMinTime,
              strMaxTime,
              ReceiverID,
              MandatorID,
              CustomerID,
              CurrencyID,
              Status,
              SendStatus);
      // 根据数据总量和每页显示行数得到需要显示的总页数
      int totalPage = PageManager.getTotalPages(totalRows, pageRows);
      // 获得符合条件的某一页的数据
      ArrayList Temp_List =
          payMoneyManager.getPayMoneyList(
              page,
              pageRows,
              strMinTime,
              strMaxTime,
              ReceiverID,
              MandatorID,
              CustomerID,
              CurrencyID,
              Status,
              SendStatus);

      // 获得符合条件的付汇金额占总的包干费的占比
      String payRate = "0.0%";

      if (strMinTime.length() > 0) {
        payRate = payMoneyManager.getPayRate(CustomerID, CurrencyID, strMinTime, strMaxTime);
      }

      request.setAttribute(Constant.PARA_LIST, Temp_List);
      request.setAttribute("minTime", minTime);
      request.setAttribute("maxTime", maxTime);
      request.setAttribute("BorderHeight", GlobalFunc.getBorderHeight(request));

      request.setAttribute("ReceiverID", ReceiverID);
      request.setAttribute("CustomerID", CustomerID);
      request.setAttribute("MandatorID", MandatorID);
      request.setAttribute("CurrencyID", CurrencyID);
      request.setAttribute("Status", Status);
      request.setAttribute("SendStatus", SendStatus);
      request.setAttribute("payRate", payRate);

      request.setAttribute(Constant.PARA_CURPAGE, page);
      request.setAttribute(Constant.PARA_TOTALROWS, totalRows);
      request.setAttribute(Constant.PARA_TOTALPAGE, totalPage);
      // 为查询下拉列表做准备
      // 获得所有收款人信息
      request.setAttribute(
          "ReceiverList",
          PageManager.getLimitData(
              "BJPayee", "ID,PayeeName as ReceiverName", "Status!=-1 order by PayeeName"));
      // 获得所有委托人信息
      request.setAttribute(
          "MandatorList",
          PageManager.getLimitData(
              "BeiJingClient", "ID,ShortName", "Status!=-1 order by ShortName"));
      // 获得所有结算客户信息
      request.setAttribute(
          "CustomerList",
          PageManager.getLimitData(
              "BeiJingCustomer", "ID,ShortName", "Status!=-1 order by ShortName"));
      // 获得所有币种信息
      request.setAttribute(
          "CurrencyList",
          PageManager.getLimitData("Currency", "ID,Currency", "Status!=-1 order by Currency"));

    } catch (Exception e) {
      request.setAttribute(Constant.ERROR_EXCEPTION, e);
      resultPage = Constant.ERROR_JSP;
    }
    return resultPage;
  }