예제 #1
0
 // 删除付汇附件
 private void deleteFuHuiAttachment(HttpServletRequest request, HttpServletResponse response) {
   response.setContentType("text/json");
   PrintWriter out = null;
   try {
     out = response.getWriter();
     // 获得将要删除附件的付汇单Id
     String orderId = request.getParameter("ID");
     int iresult = payMoneyManager.deleteFuHuiUploadFile(orderId, 0);
     if (iresult != 1) {
       iresult = 0;
     }
     out.print("{\"result\":\"" + iresult + "\"}");
     out.close();
   } catch (Exception e) {
     if (out != null) {
       out.print("{\"result\":\"-3\"}");
       out.close();
     } else {
       e.printStackTrace();
     }
   } finally {
     if (null != out) {
       out.flush();
       out.close();
     }
   }
 }
예제 #2
0
 // 获得付汇单明细前准备数据
 private String detailCustomerPayMoney(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   String resultPage = "/beijing/finance/customerPayMoney_detail.jsp";
   try {
     String ID = request.getParameter("ID");
     // 付汇单信息
     HashMap<String, String> hm = payMoneyManager.getFuHuiInfo(ID);
     // 付汇单对应的鲜活接收单信息
     ArrayList<?> ls = payMoneyManager.getReceiveOrderInfoByFuHuiID(ID);
     request.setAttribute("OrderHM", hm);
     request.setAttribute("detailList", ls);
   } catch (Exception e) {
     request.setAttribute(Constant.ERROR_EXCEPTION, e);
     resultPage = Constant.ERROR_JSP;
   }
   return resultPage;
 }
예제 #3
0
  // 上传付汇单据的附件
  private void uploadFuHuiAttachment(HttpServletRequest request, HttpServletResponse response) {
    response.setContentType("text/json");
    PrintWriter out = null;
    try {
      out = response.getWriter();

      // 获得将要上传附件的付汇单Id
      String orderId = request.getParameter("ID");
      int FileTypeID = Integer.parseInt(request.getParameter("FileTypeID"));
      // 定义将要存放文件的路径

      String uploadPath = "workflow\\attachment\\payment\\";
      if (FileTypeID == 1) // 说明上传的是回单,存放的目录不一样
      {
        uploadPath = "workflow\\attachment\\paymentSD\\";
      }
      FileUpload upload = new FileUpload();
      upload.setRequest(request);
      upload.setUploadPath(uploadPath);
      String[] fileNameInfo = upload.uploadFile();

      // 对上传文件的结果做分析,-1为文件格式错误,-2为文件大小超标,-3为产生异常
      String uploadFileName = null;
      String result = null;
      String savedFileName = null;

      if (fileNameInfo == null) {
        result = "-1";
      } else {
        // 上传文件成功
        // 将上传信息插入数据库
        uploadFileName = fileNameInfo[0];
        savedFileName = fileNameInfo[1];
        result = uploadFileName;
        int iresult =
            payMoneyManager.saveUploadInfoForFuHui(
                orderId, uploadFileName, savedFileName, FileTypeID);
        if (iresult != 1) {
          result = "";
        }
      }

      out.print("{\"FileName\":\"" + result + "\",\"SaveFileName\":\"" + savedFileName + "\"}");
      out.close();
    } catch (Exception e) {
      if (out != null) {
        out.print("{\"result\":\"-3\"}");
        out.close();
      } else {
        e.printStackTrace();
      }
    } finally {
      if (null != out) {
        out.flush();
        out.close();
      }
    }
  }
예제 #4
0
  // 删除付汇单
  private String disablePayMoney(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String resultPage = "/ss/bj?disclass=Pay&action=getPayList";
    try {
      String strid = request.getParameter("ID");
      payMoneyManager.disablePayMoney(strid);
    } catch (Exception e) {
      request.setAttribute(Constant.ERROR_EXCEPTION, e);
      resultPage = Constant.ERROR_JSP;
    }

    return resultPage;
  }
예제 #5
0
 // 发送付汇邮件
 private void sendPayMoneyEmail(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   response.setContentType("text/json");
   PrintWriter out = null;
   try {
     String ID = request.getParameter("ID");
     int isSuccess = payMoneyManager.sendPayMoneyEmail(ID);
     out = response.getWriter();
     out.println("{\"result\":" + isSuccess + "}");
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     if (null != out) {
       out.flush();
       out.close();
     }
   }
 }
예제 #6
0
  // 为付汇单添加核销单
  private String updateCustomerPayMoney(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String resultPage = "/ss/bj?disclass=Pay&action=getPayList";
    try {
      String fuHuiID = request.getParameter("fuHuiID");
      String receiveOrderIDS = request.getParameter("receiveOrderIDS");

      int iresult = payMoneyManager.updateCustomerPayMoney(fuHuiID, receiveOrderIDS);
      if (iresult == -1) {
        request.setAttribute(Constant.ERROR_EXCEPTION, "选择单据中有被其他付汇单据付过了!");
        resultPage = Constant.ERROR_PAGE;
      }

    } catch (Exception e) {
      request.setAttribute(Constant.ERROR_EXCEPTION, e);
      resultPage = Constant.ERROR_JSP;
    }
    return resultPage;
  }
예제 #7
0
  // 为模块“付汇到付款”查询付汇管理单据
  private String listFuHuiForPayment(HttpServletRequest request, HttpServletResponse response) {
    String resultPage = "/beijing/finance/FuHui2Payment_list.jsp";
    try {
      int curPage = 1;
      try {
        curPage = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE));
      } catch (Exception ex) {
        curPage = 1;
      }

      // 日期区间查询
      // 获取查询条件
      String colName = "minTime,maxTime,CustomerID,MandatorID,CurrencyID,ReceiverID,PaymentStatus";
      HashMap<String, String> colhm = GlobalFunc.getHashMap4ChooseInfo(request, colName, 1);

      // 获取权限和用户设置
      String menuID = "43";
      int pageRows = GlobalFunc.getSettingAndRight(menuID, request, colhm);

      // 获取数量明细信息
      ArrayList<HashMap<String, String>> Temp_List =
          payMoneyManager.listFuHuiForPayment(pageRows, curPage, colhm);

      request.setAttribute(Constant.PARA_LIST, Temp_List); // 返回查询结果给页面
      request.setAttribute("colhm", colhm); // 返回查询条件和页面信息给页面

      // 获取查询界面的下拉框
      request.setAttribute("ReceiverList", GlobalFunction.getAllReceivers(""));
      request.setAttribute("MandatorList", GlobalFunction.getAllCustomers());
      request.setAttribute("CustomerList", GlobalFunction.getAllCustomers());
      request.setAttribute("CurrencyList", GlobalFunction.getAllCurrency("0"));

    } catch (Exception e) {
      GlobalFunc.printErrorInfo(
          getClass().getName(), request.getParameter("action"), GlobalFunc.getUserName(request));
      e.printStackTrace();
      request.setAttribute(Constant.ERROR_EXCEPTION, e.getMessage().toString());
      resultPage = Constant.ERROR_PAGE;
    }

    return resultPage;
  }
예제 #8
0
  // 添加新的付汇单
  @SuppressWarnings("unused")
  private String saveCustomerFuHui(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String resultPage = "/ss/bj?disclass=Pay&action=getPayList";
    try {
      HashMap<String, String> fuHuiInput = BaseTable.getFuHuiInput(request);
      String receiveOrderIDS = request.getParameter("receiveOrderIDS");

      int iresult = payMoneyManager.saveCustomerFuHui(fuHuiInput, receiveOrderIDS);
      if (iresult == -1) {
        request.setAttribute(Constant.ERROR_EXCEPTION, "选择单据中有被其他付汇单据付过了!");
        resultPage = Constant.ERROR_PAGE;
      } else if (iresult == 0) {
        request.setAttribute(Constant.ERROR_EXCEPTION, "添加付汇单失败!");
        resultPage = Constant.ERROR_PAGE;
      }
    } catch (Exception e) {
      request.setAttribute(Constant.ERROR_EXCEPTION, e);
      resultPage = Constant.ERROR_JSP;
    }
    return resultPage;
  }
예제 #9
0
  // 付汇单据生成付款申请单
  private String createFKCode(HttpServletRequest request, HttpServletResponse response) {
    String resultPage = "/ss/bj?disclass=Pay&action=listFuHuiForPayment";
    try {
      String strIDs = request.getParameter("strID");

      String UserID = GlobalFunc.getUserID(request);
      String DeptID = GlobalFunc.getDeptID(request);

      int iresult = payMoneyManager.createFKCode(strIDs, UserID, DeptID);
      if (iresult == 2) {
        request.setAttribute(Constant.ERROR_EXCEPTION, "生成失败!");
        resultPage = Constant.ERROR_PAGE;
      }

    } catch (Exception e) {
      GlobalFunc.printErrorInfo(
          getClass().getName(), request.getParameter("action"), GlobalFunc.getUserName(request));
      e.printStackTrace();
      request.setAttribute(Constant.ERROR_EXCEPTION, e);
      resultPage = Constant.ERROR_JSP;
    }

    return resultPage;
  }
예제 #10
0
  // 添加付汇单页面查找数据
  @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;
  }
예제 #11
0
  // 添加核销单据之前准备数据
  @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;
  }
예제 #12
0
  // 根据条件获得某一页的付汇数据
  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;
  }