public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    String support = "support"; // valid username

    HttpSession session = null;
    session = req.getSession(false); // Get user's session object (no new one)
    if (session == null) {

      invalidUser(out); // Intruder - reject
      return;
    }

    String userName = (String) session.getAttribute("user"); // get username

    if (!userName.equals(support)) {

      invalidUser(out); // Intruder - reject
      return;
    }

    String action = "";
    if (req.getParameter("todo") != null) action = req.getParameter("todo");

    if (action.equals("update")) {

      doUpdate(out);
      return;
    }

    out.println("<p>Nothing to do.</p>todo=" + action);
  }
Esempio n. 2
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    ServletContext application;
    HttpSession session = request.getSession();
    nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);

    try {

      if (finance_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String finance_cheque_id = request.getParameter("finance_cheque_id");
        String sql = "delete from finance_bill where id='" + finance_cheque_id + "'";
        finance_db.executeUpdate(sql);
        finance_db.commit();
        finance_db.close();

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 3
0
  public void doPost(HttpServletRequest req, HttpServletResponse res)
      throws IOException, ServletException {

    res.setContentType("text/html");
    PrintWriter out = res.getWriter();

    /* Get Session */
    HttpSession s = req.getSession(true);
    /* Make sure user is logged in */
    if (s.getAttribute("login") == null || (String) s.getAttribute("login") != "go") {
      req.getRequestDispatcher("login.jsp").forward(req, res);
    }

    try {
      String dbuser = this.getServletContext().getInitParameter("dbuser");
      String dbpassword = this.getServletContext().getInitParameter("dbpassword");

      Class.forName("com.mysql.jdbc.Driver");
      Connection conn =
          DriverManager.getConnection("jdbc:mysql://localhost/project", dbuser, dbpassword);

      Statement stmt = conn.createStatement();
      stmt.execute(
          "INSERT INTO songs VALUES(null, '"
              + req.getParameter("song_name")
              + "', '"
              + req.getParameter("artist")
              + "', '"
              + req.getParameter("album")
              + "', '"
              + req.getParameter("genre")
              + "', 0)");

      stmt.close();
      conn.close();

      // delete memcache since new song is now added
      MemcachedClient c = new MemcachedClient(new InetSocketAddress("127.0.0.1", 11211));
      c.delete("master");

      req.getRequestDispatcher("add_song_success.jsp").forward(req, res);

    } catch (Exception e) {
      out.println(e.getMessage());
    }
  }
Esempio n. 4
0
  /**
   * Get a populated User object from the request passed in.
   *
   * @param The request object to check for the user
   * @return The user object, or null if no user object was found
   */
  public static User getUser(HttpServletRequest request) {
    HttpSession session = request.getSession();
    if (session == null) {
      return null;
    }

    return (User) (session.getAttribute("user"));
  }
Esempio n. 5
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);

    try {
      if (stock_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        int i;
        int intRowCount;
        String sqll =
            "select * from stock_config_public_char where describe1='\u51fa\u5165\u5e93\u7406\u7531'";
        ResultSet rs = stock_db.executeQuery(sqll);
        rs.next();
        rs.last();
        intRowCount = rs.getRow();
        String[] del = new String[intRowCount];
        del = (String[]) dbSession.getAttribute("del");
        if (del != null) {
          for (i = 1; i <= intRowCount; i++) {
            String sql = "delete from stock_config_public_char where id='" + del[i - 1] + "'";
            stock_db.executeUpdate(sql);
          }
        }
        stock_db.commit();
        stock_db.close();
        response.sendRedirect("stock/config/apply_gather_pay/reason.jsp");
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 6
0
  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter toClient = res.getWriter();
    toClient.println("<!DOCTYPE HTML>");
    toClient.println("<html>");
    toClient.println("<head><title>Books</title></head>");
    toClient.println("<body>");
    toClient.println("<a href=\"index.html\">Home</A>");
    toClient.println("<h2>List of books</h2>");

    HttpSession session = req.getSession(false);
    if (session != null) {
      String name = (String) session.getAttribute("name");
      if (name != null) {
        toClient.println("<h2>name: " + name + "</h2>");
      }
    }

    toClient.print("<form action=\"bookOpinion\" method=GET>");
    toClient.println("<table border='1'>");

    String sql = "Select code, title, author FROM books";
    System.out.println(sql);
    try {
      Statement statement = connection.createStatement();
      ResultSet result = statement.executeQuery(sql);
      while (result.next()) {
        toClient.println("<tr>");
        String codeStr = result.getString("code");
        toClient.println(
            "<td><input type=\"radio\" name=\"book" + "\" value=\"" + codeStr + "\"></td>");
        toClient.println("<td>" + codeStr + "</td>");
        toClient.println("<td>" + result.getString("title") + "</td>");
        toClient.println("<td>" + result.getString("author") + "</td>");
        toClient.println("</tr>");
      }
    } catch (SQLException e) {
      e.printStackTrace();
      System.out.println("Resulset: " + sql + " Exception: " + e);
    }
    toClient.println("</table>");
    toClient.println("<textarea rows=\"8\" cols=\"60\" name=\"comment\"></textarea><BR>");
    toClient.println("<input type=submit>");
    toClient.println("</form>");
    toClient.println("</body>");
    toClient.println("</html>");
    toClient.close();
  }
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    String support = "support"; // valid username

    HttpSession session = null;
    session = req.getSession(false); // Get user's session object (no new one)

    if (session == null) {

      invalidUser(out); // Intruder - reject
      return;
    }

    String userName = (String) session.getAttribute("user"); // get username

    if (!userName.equals(support)) {

      invalidUser(out); // Intruder - reject
      return;
    }

    out.println("<HTML><HEAD><TITLE>Database Upgrade</TITLE></HEAD>");
    out.println("<BODY><CENTER>");
    out.println(
        "<BR><BR><H3>This job will check all clubs' session logs for caller=clubster.</H3>");
    out.println("<BR><BR>Click 'Continue' to start the job.");
    out.println("<BR><BR> <A HREF=\"/v5/servlet/Support_main\">Return</A><BR><BR>");

    out.println(
        "<form method=post><input type=submit value=\"Continue\" onclick=\"return confirm('Are you sure?')\">");
    out.println(" <input type=hidden value=\"update\" name=\"todo\"></form>");
    /*
    out.println("<form method=post><input type=submit value=\"  Test  \">");
    out.println(" <input type=hidden value=\"test\" name=\"todo\"></form>");
    *
    */

    out.println("</CENTER></BODY></HTML>");

    out.close();
  }
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/xml;charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("\n");

      HttpSession user = request.getSession(true);
      Notification newNotice = (Notification) user.getAttribute("newNotice");
      List exclude = new ArrayList();
      exclude.add(NotificationWizardServlet.WT_VENDOR_NAME); // Exclude WebTelemetry

      out.print(buildTree(newNotice, exclude));
      out.write("\n");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0) out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }
 public void doPost(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   // I use "session" in order to throws the object named user bean.
   HttpSession session = request.getSession(true);
   response.setContentType("text/html");
   request.setCharacterEncoding("UTF-8");
   UserBean ub = (UserBean) session.getAttribute("user");
   if (ub == null) {
     String haveLogin = "******";
     session.setAttribute("haveLogin", haveLogin);
     response.sendRedirect("cart");
   } else {
     String mID = ub.getmID();
     String iID = (String) request.getParameter("iID");
     // String idx = (String)request.getParameter("idx");
     Connection conn = null;
     try {
       // Getting the connection from database.
       Class.forName("com.mysql.jdbc.Driver");
       /*conn = DriverManager
       .getConnection("jdbc:mysql://localhost/se?"
       		+ "user=root");*/
       conn =
           DriverManager.getConnection(
               "jdbc:mysql://localhost/user_register?"
                   + "user=sqluser&password=sqluserpw&useUnicode=true&characterEncoding=UTF-8");
       String sql = "delete from cart_item_mapping where mID=? and iID = ?";
       PreparedStatement pst = conn.prepareStatement(sql);
       // Using preparedstatement by set the parameter related to "?" symbol.
       pst.setString(1, mID);
       pst.setString(2, iID);
       pst.executeUpdate();
       pst.close();
       response.sendRedirect("ShowCartController");
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }
Esempio n. 10
0
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    String support = "support"; // valid username

    HttpSession session = null;
    session = req.getSession(false); // Get user's session object (no new one)
    if (session == null) {

      invalidUser(out); // Intruder - reject
      return;
    }

    String userName = (String) session.getAttribute("user"); // get username

    if (!userName.equals(support)) {

      invalidUser(out); // Intruder - reject
      return;
    }

    Connection con1 = null; // init DB objects
    Connection con2 = null;
    Statement stmt1 = null;
    Statement stmt2 = null;
    ResultSet rs1 = null;
    ResultSet rs2 = null;

    out.println("<HTML><HEAD><TITLE>Database Query</TITLE></HEAD>");
    out.println("<BODY><H3>List Each Club With a Custom Style Sheet</H3>");
    out.println(
        "<table border=1><tr><td><b>Site</b></td><td><b>Club Name</b></td><td><b>Style Sheet</b></td></tr>");
    out.flush();

    String club = "";
    String fullname = "";
    String styles = "";

    try {

      con1 = Connect.getCon(rev); // connect to v5

    } catch (Exception exc) {

      // Error connecting to db....
      out.println("<BR><BR>Unable to connect to the DB.");
      out.println("<BR>Exception: " + exc.getMessage());
      out.println("<BR><BR> <A HREF=\"/v5/servlet/Support_main\">Return</A>.");
      out.println("</BODY></HTML>");
      return;
    }

    //
    // Get the club names from the 'clubs' table
    //
    //  Process each club in the table
    //
    try {

      stmt1 = con1.createStatement();
      rs1 =
          stmt1.executeQuery(
              "SELECT clubname, fullname FROM v5.clubs WHERE inactive=0 ORDER BY clubname");

      while (rs1.next()) {

        club = rs1.getString(1); // get a club name
        fullname = rs1.getString(2); // get club's full name

        if (!club.startsWith("demo")) { // if NOT a demo site

          con2 = Connect.getCon(club); // get a connection to this club's db
          stmt2 = con2.createStatement(); // create a statement

          try {

            rs2 = stmt2.executeQuery("SELECT custom_styles FROM club5");

            if (rs2.next()) {

              styles = rs2.getString("custom_styles"); // get the custom styles name, if any

              if (!styles.equals("")) {

                out.println(
                    "<tr><td>"
                        + club
                        + "</td><td>"
                        + fullname
                        + "</td><td>"
                        + styles
                        + "</td></tr>");
              }
            }

          } catch (Exception exc) {
            out.println(club + " failed!!!!!!!!!!!!!!!!!!!! " + exc.toString());
          }

          stmt2.close();
          con2.close();
        }
      } // end if WHILE clubs

      out.println("</table>");

    } catch (Exception exc) {

      // Error connecting to db....
      out.println("<BR><BR>Unable to connect to the DB.");
      out.println("<BR>Exception: " + exc.getMessage());
      out.println("<BR><BR> <A HREF=\"/v5/servlet/Support_main\">Return</A>.");
      out.println("</BODY></HTML>");
      return;
    }

    try {
      stmt1.close();
      con1.close();
    } catch (Exception ignore) {
    }

    out.println("<BR><BR> <A HREF=\"/v5/servlet/Support_main\">Return</A>.");
    out.println("</BODY></HTML>");
    out.close();
  }
Esempio n. 11
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    try {
      HttpSession dbSession = request.getSession();
      ServletContext dbApplication = dbSession.getServletContext();
      nseer_db_backup1 design_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 design_db1 = new nseer_db_backup1(dbApplication);
      ValidataNumber validata = new ValidataNumber();
      ValidataTag vt = new ValidataTag();
      counter count = new counter(dbApplication);

      if (design_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && design_db1.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String config_id = request.getParameter("config_id");
        String product_ID = request.getParameter("product_ID");
        String choice = request.getParameter("choice");
        String checker_ID = request.getParameter("checker_ID");
        String checker = request.getParameter("checker");
        String check_time = request.getParameter("check_time");
        String sql6 =
            "select id from design_workflow where type_id='02' and object_ID='"
                + product_ID
                + "' and ((check_tag='0' and config_id<'"
                + config_id
                + "') or (check_tag='1' and config_id='"
                + config_id
                + "'))";
        ResultSet rs6 = design_db.executeQuery(sql6);
        if (!rs6.next()
            && vt.validata(
                    (String) dbSession.getAttribute("unit_db_name"),
                    "design_file",
                    "product_ID",
                    product_ID,
                    "excel_tag")
                .equals("1")) {
          if (choice != null) {
            if (choice.equals("")) {
              String sql =
                  "update design_file set price_change_tag='9' where product_ID='"
                      + product_ID
                      + "'";
              design_db.executeUpdate(sql);

              sql =
                  "delete from design_workflow where type_id='02' and object_ID='"
                      + product_ID
                      + "'";
              design_db.executeUpdate(sql);

            } else {

              sql6 =
                  "select id from design_workflow where type_id='02' and object_ID='"
                      + product_ID
                      + "' and config_id<'"
                      + config_id
                      + "' and config_id>='"
                      + choice
                      + "'";
              rs6 = design_db.executeQuery(sql6);
              while (rs6.next()) {
                String sql =
                    "update design_workflow set check_tag='0' where type_id='02' and id='"
                        + rs6.getString("id")
                        + "'";
                design_db1.executeUpdate(sql);
              }
            }
            response.sendRedirect("design/price_change/check_delete_ok.jsp?finished_tag=0");
          } else {
            response.sendRedirect("design/price_change/check_delete_ok.jsp?finished_tag=1");
          }
        } else {
          response.sendRedirect("design/price_change/check_delete_ok.jsp?finished_tag=2");
        }
        design_db.commit();
        design_db1.commit();
        design_db.close();
        design_db1.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      // 实例化

      HttpSession session = request.getSession();
      ServletContext context = session.getServletContext();
      String path = context.getRealPath("/");
      counter count = new counter(dbApplication);
      SmartUpload mySmartUpload = new SmartUpload();
      mySmartUpload.setCharset("UTF-8");
      nseer_db_backup1 qcs_db = new nseer_db_backup1(dbApplication);

      if (qcs_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        mySmartUpload.initialize(pageContext);
        String file_type = getFileLength.getFileType((String) session.getAttribute("unit_db_name"));
        long d = getFileLength.getFileLength((String) session.getAttribute("unit_db_name"));
        mySmartUpload.setMaxFileSize(d);
        mySmartUpload.setAllowedFilesList(file_type);

        try {
          mySmartUpload.upload();
          String qcs_id = mySmartUpload.getRequest().getParameter("qcs_id");
          String config_id = mySmartUpload.getRequest().getParameter("config_id");

          String[] item = mySmartUpload.getRequest().getParameterValues("item");
          if (item != null) {
            String[] file_name = new String[mySmartUpload.getFiles().getCount()];
            String[] not_change = new String[mySmartUpload.getFiles().getCount()];
            java.util.Date now = new java.util.Date();
            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
            String time = formatter.format(now);
            String standard_id = mySmartUpload.getRequest().getParameter("standard_id");
            String sqla =
                "select attachment1 from qcs_intrmanufacture where qcs_id='"
                    + qcs_id
                    + "' and (check_tag='5' or check_tag='9')";
            ResultSet rs = qcs_db.executeQuery(sqla);
            if (!rs.next()) {
              response.sendRedirect("draft/qcs/intrmanufacture_ok.jsp?finished_tag=1");
            } else {
              String[] attachment = mySmartUpload.getRequest().getParameterValues("attachment");
              String[] delete_file_name = new String[0];
              if (attachment != null) {
                delete_file_name = new String[attachment.length];
                for (int i = 0; i < attachment.length; i++) {
                  delete_file_name[i] = rs.getString(attachment[i]);
                }
              }
              for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
                com.jspsmart.upload.SmartFile file = mySmartUpload.getFiles().getFile(i);
                if (file.isMissing()) {
                  file_name[i] = "";
                  int q = i + 1;
                  String field_name = "attachment" + q;
                  if (!rs.getString(field_name).equals("")) not_change[i] = "yes";
                  continue;
                }
                int filenum =
                    count.read(
                        (String) dbSession.getAttribute("unit_db_name"), "qcsAttachmentcount");
                count.write(
                    (String) dbSession.getAttribute("unit_db_name"), "qcsAttachmentcount", filenum);
                file_name[i] = filenum + file.getFileName();
                file.saveAs(path + "qcs/file_attachments/" + filenum + file.getFileName());
              }
              String apply_id = mySmartUpload.getRequest().getParameter("apply_id");
              String product_id = mySmartUpload.getRequest().getParameter("product_id");
              String product_name = mySmartUpload.getRequest().getParameter("product_name");
              String qcs_amount = mySmartUpload.getRequest().getParameter("qcs_amount");
              String qcs_time = mySmartUpload.getRequest().getParameter("qcs_time");
              String quality_way = mySmartUpload.getRequest().getParameter("quality_way");
              String quality_solution = mySmartUpload.getRequest().getParameter("quality_solution");
              String sampling_standard =
                  mySmartUpload.getRequest().getParameter("sampling_standard");
              String sampling_amount = mySmartUpload.getRequest().getParameter("sampling_amount");
              String accept = mySmartUpload.getRequest().getParameter("accept");
              String reject = mySmartUpload.getRequest().getParameter("reject");
              String qualified = mySmartUpload.getRequest().getParameter("qualified");
              String unqualified = mySmartUpload.getRequest().getParameter("unqualified");
              String qcs_result = mySmartUpload.getRequest().getParameter("qcs_result");
              String checker = mySmartUpload.getRequest().getParameter("checker");
              String checker_id = mySmartUpload.getRequest().getParameter("checker_id");
              String check_time = mySmartUpload.getRequest().getParameter("check_time");
              String changer = mySmartUpload.getRequest().getParameter("changer");
              String changer_id = mySmartUpload.getRequest().getParameter("changer_id");
              String change_time = mySmartUpload.getRequest().getParameter("change_time");
              String bodyab =
                  new String(
                      mySmartUpload.getRequest().getParameter("remark").getBytes("UTF-8"), "UTF-8");
              String remark = exchange.toHtml(bodyab);

              sqla =
                  "update qcs_intrmanufacture set apply_id='"
                      + apply_id
                      + "',product_id='"
                      + product_id
                      + "',product_name='"
                      + product_name
                      + "',qcs_amount='"
                      + qcs_amount
                      + "',qcs_time='"
                      + qcs_time
                      + "',quality_way='"
                      + quality_way
                      + "',quality_solution='"
                      + quality_solution
                      + "',sampling_standard='"
                      + sampling_standard
                      + "',sampling_amount='"
                      + sampling_amount
                      + "',accept='"
                      + accept
                      + "',reject='"
                      + reject
                      + "',qualified='"
                      + qualified
                      + "',unqualified='"
                      + unqualified
                      + "',changer_id='"
                      + changer_id
                      + "',qcs_result='"
                      + qcs_result
                      + "',changer='"
                      + changer
                      + "',change_time='"
                      + change_time
                      + "',remark='"
                      + remark
                      + "',check_tag='5'";
              String sqlb = " where qcs_id='" + qcs_id + "'";
              if (attachment != null) {
                for (int i = 0; i < attachment.length; i++) {
                  sqla = sqla + "," + attachment[i] + "=''";
                  java.io.File file =
                      new java.io.File(path + "qcs/file_attachments/" + delete_file_name[i]);
                  file.delete();
                }
              }
              for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
                if (not_change[i] != null && not_change[i].equals("yes")) continue;
                int p = i + 1;
                sqla = sqla + ",attachment" + p + "='" + file_name[i] + "'";
              }
              String sql = sqla + sqlb;
              qcs_db.executeUpdate(sql);

              sql = "delete from qcs_intrmanufacture_details where qcs_id='" + qcs_id + "'";
              qcs_db.executeUpdate(sql);

              String[] default_basis =
                  mySmartUpload.getRequest().getParameterValues("default_basis");
              String[] ready_basis = mySmartUpload.getRequest().getParameterValues("ready_basis");
              String[] quality_method =
                  mySmartUpload.getRequest().getParameterValues("quality_method");
              String[] analyse_method =
                  mySmartUpload.getRequest().getParameterValues("analyse_method");
              String[] standard_value =
                  mySmartUpload.getRequest().getParameterValues("standard_value");
              String[] standard_max = mySmartUpload.getRequest().getParameterValues("standard_max");
              String[] standard_min = mySmartUpload.getRequest().getParameterValues("standard_min");
              String[] quality_value =
                  mySmartUpload.getRequest().getParameterValues("quality_value");
              String[] sampling_amount_d =
                  mySmartUpload.getRequest().getParameterValues("sampling_amount_d");
              String[] qualified_d = mySmartUpload.getRequest().getParameterValues("qualified_d");
              String[] unqualified_d =
                  mySmartUpload.getRequest().getParameterValues("unqualified_d");
              String[] quality_result =
                  mySmartUpload.getRequest().getParameterValues("quality_result");
              String[] unqualified_reason =
                  mySmartUpload.getRequest().getParameterValues("unqualified_reason");
              for (int i = 0; i < item.length; i++) {
                if (!item[i].equals("")) {
                  sql =
                      "insert into qcs_intrmanufacture_details(qcs_id,item,default_basis,ready_basis,quality_method,analyse_method,standard_value,standard_max,standard_min,quality_value,sampling_amount_d,qualified_d,unqualified_d,quality_result,unqualified_reason,details_number) values('"
                          + qcs_id
                          + "','"
                          + item[i]
                          + "','"
                          + default_basis[i]
                          + "','"
                          + ready_basis[i]
                          + "','"
                          + quality_method[i]
                          + "','"
                          + analyse_method[i]
                          + "','"
                          + standard_value[i]
                          + "','"
                          + standard_max[i]
                          + "','"
                          + standard_min[i]
                          + "','"
                          + quality_value[i]
                          + "','"
                          + sampling_amount_d[i]
                          + "','"
                          + qualified_d[i]
                          + "','"
                          + unqualified_d[i]
                          + "','"
                          + quality_result[i]
                          + "','"
                          + unqualified_reason[i]
                          + "','"
                          + i
                          + "')";
                  qcs_db.executeUpdate(sql);
                }
              }
              response.sendRedirect("draft/qcs/intrmanufacture_ok.jsp?finished_tag=0");
            }
            qcs_db.commit();
            qcs_db.close();
          } else {
            response.sendRedirect("draft/qcs/intrmanufacture_ok.jsp?finished_tag=7");
          }

        } catch (Exception ex) {
          response.sendRedirect("draft/qcs/intrmanufacture_ok.jsp?finished_tag=6");
        }

      } else {
        response.sendRedirect("error_conn.htm");
      }

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();
    try {
      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();
      nseer_db_backup1 fund_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 fund_db1 = new nseer_db_backup1(dbApplication);
      if (fund_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && fund_db1.conn((String) dbSession.getAttribute("unit_db_name"))) {
        counter count = new counter(dbApplication);
        ValidataRecordNumber vrn = new ValidataRecordNumber();
        ValidataTag vt = new ValidataTag();
        ValidataNumber validata = new ValidataNumber();
        try {
          String time = "";
          java.util.Date now = new java.util.Date();
          SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
          time = formatter.format(now);

          String apply_pay_ID = request.getParameter("apply_pay_ID");
          String register_time = request.getParameter("register_time");
          String register = request.getParameter("register");
          String register_ID = request.getParameter("register_ID");
          String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
          String remark = exchange.toHtml(bodyc);
          String amount = request.getParameter("amount");
          String[] file_kind = request.getParameterValues("file_kind");
          String[] cost_price_subtotal = request.getParameterValues("cost_price_subtotal");
          int p = 0;
          String file_kinda = ",";
          for (int j = 1; j < file_kind.length; j++) {
            file_kinda += file_kind[j] + ",";
            if (cost_price_subtotal[j].equals("")) cost_price_subtotal[j] = "0";
            StringTokenizer tokenTO4 = new StringTokenizer(cost_price_subtotal[j], ",");
            String cost_price_subtotal1 = "";
            while (tokenTO4.hasMoreTokens()) {
              cost_price_subtotal1 += tokenTO4.nextToken();
            }
            if (!validata.validata(cost_price_subtotal1)) {
              p++;
            }
          }
          int n = 0;
          for (int i = 1; i <= Integer.parseInt(amount); i++) {
            String tem_file_kind = "file_kind" + i;
            String file_kind2 = request.getParameter(tem_file_kind);
            if (file_kinda.indexOf(file_kind2) != -1) n++;
          }
          if (n == 0) {
            if (p == 0) {
              if (vt.validata(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "fund_apply_pay",
                          "apply_pay_ID",
                          apply_pay_ID,
                          "check_tag")
                      .equals("5")
                  || vt.validata(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "fund_apply_pay",
                          "apply_pay_ID",
                          apply_pay_ID,
                          "check_tag")
                      .equals("9")) {
                String currency_name = "";
                String personal_unit = "";
                String chain_ID = "";
                String chain_name = "";
                String funder = "";
                String funder_ID = "";
                String sql11 =
                    "select * from fund_apply_pay where apply_pay_ID='" + apply_pay_ID + "'";
                ResultSet rs11 = fund_db.executeQuery(sql11);
                while (rs11.next()) {
                  chain_ID = rs11.getString("chain_ID");
                  chain_name = rs11.getString("chain_name");
                  funder = rs11.getString("human_name");
                  funder_ID = rs11.getString("human_ID");
                  currency_name = rs11.getString("currency_name");
                  personal_unit = rs11.getString("personal_unit");
                }
                int expenses_amount = 0;
                String sql6 =
                    "select count(*) from fund_apply_pay_details where apply_pay_ID='"
                        + apply_pay_ID
                        + "'";
                ResultSet rs6 = fund_db.executeQuery(sql6);
                if (rs6.next()) {
                  expenses_amount = rs6.getInt("count(*)");
                }
                double demand_cost_price_sum = 0.0d;
                for (int i = 1; i <= expenses_amount; i++) {
                  String tem_cost_price_subtotal = "cost_price_subtotal" + i;
                  String cost_price_subtotal2 = request.getParameter(tem_cost_price_subtotal);
                  demand_cost_price_sum += Double.parseDouble(cost_price_subtotal2);
                  sql6 =
                      "update fund_apply_pay_details set cost_price_subtotal='"
                          + cost_price_subtotal2
                          + "' where apply_pay_ID='"
                          + apply_pay_ID
                          + "' and details_number='"
                          + i
                          + "'";
                  fund_db.executeUpdate(sql6);
                }
                for (int i = 1; i < file_kind.length; i++) {
                  StringTokenizer tokenTO1 = new StringTokenizer(file_kind[i], "/");
                  String file_chain_ID = "";
                  String file_chain_name = "";
                  while (tokenTO1.hasMoreTokens()) {
                    file_chain_ID = tokenTO1.nextToken();
                    file_chain_name = tokenTO1.nextToken();
                  }
                  StringTokenizer tokenTO4 = new StringTokenizer(cost_price_subtotal[i], ",");
                  String cost_price_subtotal1 = "";
                  while (tokenTO4.hasMoreTokens()) {
                    cost_price_subtotal1 += tokenTO4.nextToken();
                  }
                  demand_cost_price_sum += Double.parseDouble(cost_price_subtotal1);
                  expenses_amount++;
                  String sql1 =
                      "insert into fund_apply_pay_details(apply_pay_ID,details_number,file_chain_ID,file_chain_name,cost_price_subtotal) values ('"
                          + apply_pay_ID
                          + "','"
                          + expenses_amount
                          + "','"
                          + file_chain_ID
                          + "','"
                          + file_chain_name
                          + "','"
                          + cost_price_subtotal1
                          + "')";
                  fund_db.executeUpdate(sql1);
                }

                String sql =
                    "update fund_apply_pay set demand_cost_price_sum='"
                        + demand_cost_price_sum
                        + "',check_tag='2',register_time='"
                        + register_time
                        + "',register='"
                        + register
                        + "',remark='"
                        + remark
                        + "' where apply_pay_ID='"
                        + apply_pay_ID
                        + "'";
                fund_db.executeUpdate(sql);

                response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=2");
              } else {
                response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=3");
              }
            } else {
              response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=6");
            }
          } else {
            response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=7");
          }
        } catch (Exception ex) {
          ex.printStackTrace();
        }
        fund_db.commit();
        fund_db1.commit();
        fund_db.close();
        fund_db1.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 14
0
  /**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
   *
   * @param request servlet request
   * @param response servlet response
   */
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    HttpSession session = request.getSession();

    try {
      db.connectDB();
      String query =
          "SELECT * FROM Account_Information WHERE AI_ID='" + session.getAttribute("id") + "'";

      ResultSet r = db.get_query(query);
      AccountInfoBean account = new AccountInfoBean();

      while (r.next()) {
        String login = "******" + r.getString("AI_ID");
        String password = "******" + r.getString("AI_Password");
        String type = " " + r.getString("AI_Type");
        String firstName = " " + r.getString("AI_First_Name");
        String middleName = " " + r.getString("AI_Mid_Name");
        String lastName = " " + r.getString("AI_Last_Name");
        String email = " " + r.getString("AI_EMail");
        String phone = " " + r.getString("AI_Phone");
        String age = " " + r.getString("AI_Age");
        String address1 = " " + r.getString("AI_Address1");
        String address2 = " " + r.getString("AI_Address2");
        String city = " " + r.getString("AI_City");
        String state = " " + r.getString("AI_State");
        String zip = " " + r.getInt("AI_Zip");

        account.setLogin(login.trim());
        account.setPassword(password.trim());
        account.setPassword2(password.trim());
        account.setType(type.trim());
        account.setFirstName(firstName.trim());
        account.setMiddleName(middleName.trim());
        account.setLastName(lastName.trim());
        account.setEmail(email.trim());
        account.setPhone(phone.trim());
        account.setAge(age.trim());
        account.setAddress1(address1.trim());
        account.setAddress2(address2.trim());
        account.setCity(city.trim());
        account.setState(state.trim());
        account.setZip(zip.trim());
        session.setAttribute("account", account);
      }
    } catch (Exception e) {
      System.out.println(e);
    }

    response.sendRedirect("accountedit.jsp");

    /* TODO output your page here
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet</title>");
    out.println("</head>");
    out.println("<body>");

    out.println("</body>");
    out.println("</html>");
     */
    out.close();
  }
 public AbstractList generateCollection(HttpSession session) {
   Product prod = (Product) session.getAttribute("record");
   String query = "select * from tbl_version where product = " + prod.getId();
   return DatabaseRecord.loadRecords(query, Version.class);
 }
Esempio n. 16
0
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    response.setContentType("text/html");
    HttpSession session = request.getSession(false);
    String reseller = null;
    if (session != null && session.getAttribute("reseller") != null)
      reseller = "%" + session.getAttribute("reseller") + "%";
    List<LicenseData> searchResult = null;
    if (reseller != null) {
      /*  session.setAttribute("fieldsearch", true);
      session.removeAttribute("datesearch");*/

      if (request.getParameter("so") != null && !request.getParameter("so").isEmpty()) {

        log.info(
            "Search Fields : Sales Order Search "
                + request.getParameter("so")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("so"), "so");

        session.setAttribute("so", request.getParameter("so"));
        session.removeAttribute("enduser");
        session.removeAttribute("ek");
        session.setAttribute("label", "Sales Order");
        session.setAttribute("value", request.getParameter("so"));

      } else if (request.getParameter("enduser") != null
          && !request.getParameter("enduser").isEmpty()) {

        log.info(
            "Search Fields : End User Search "
                + request.getParameter("enduser")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult =
            getSearchByFieldResults(reseller, request.getParameter("enduser"), "enduser");
        session.setAttribute("enduser", request.getParameter("enduser"));
        session.removeAttribute("so");
        session.removeAttribute("sno");
        session.removeAttribute("ek");
        session.setAttribute("label", "End User");
        session.setAttribute("value", request.getParameter("enduser"));

      } else if (request.getParameter("ek") != null && !request.getParameter("ek").isEmpty()) {

        log.info(
            "Search Fields : Entitlement Key Search "
                + request.getParameter("ek")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("ek"), "ek");
        session.setAttribute("ek", request.getParameter("ek"));
        session.removeAttribute("so");
        session.removeAttribute("sno");
        session.removeAttribute("enduser");
        session.setAttribute("label", "Entitlement Key");
        session.setAttribute("value", request.getParameter("ek"));

      } else if (request.getParameter("sno") != null && !request.getParameter("sno").isEmpty()) {

        log.info(
            "Search Fields : Serial Number Search "
                + request.getParameter("sno")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("sno"), "sno");
        session.setAttribute("sno", request.getParameter("sno"));
        session.removeAttribute("ek");
        session.removeAttribute("so");
        session.removeAttribute("enduser");
        request.setAttribute("sno", 1);
        session.setAttribute("label", "Serial Number");
        session.setAttribute("value", request.getParameter("sno"));

      } else if (request.getParameter("po") != null && !request.getParameter("po").isEmpty()) {

        log.info(
            "Search Fields : Purchase Order Search "
                + request.getParameter("po")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("po"), "po");
        session.setAttribute("po", request.getParameter("po"));
        session.setAttribute("label", "Purchase Order");
        session.setAttribute("value", request.getParameter("po"));

      } else if (request.getParameter("hm") != null && !request.getParameter("hm").isEmpty()) {

        log.info(
            "Search Fields : HM ID Search "
                + request.getParameter("hm")
                + " for reseller "
                + session.getAttribute("hm"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("hm"), "hm");
        session.setAttribute("hm", request.getParameter("hm"));
        session.setAttribute("label", "Hive Manager ID");
        session.setAttribute("value", request.getParameter("hm"));
      }

      session.setAttribute("fieldSearchList", searchResult);
      String nextJSP = "/viewFieldSearchResult.jsp";
      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
      dispatcher.forward(request, response);
    } else {

      log.info("Search Fields : Reseller Blank  ");
      String nextJSP = "/login.jsp";
      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
      dispatcher.forward(request, response);
    }
  }
Esempio n. 17
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      // 实例化

      HttpSession session = request.getSession();
      ServletContext context = session.getServletContext();
      String path = context.getRealPath("/");
      counter count = new counter(dbApplication);
      SmartUpload mySmartUpload = new SmartUpload();
      mySmartUpload.setCharset("UTF-8");
      nseer_db_backup1 oa_db = new nseer_db_backup1(dbApplication);
      if (oa_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        getAttachmentLength getAttachmentLength = new getAttachmentLength();
        getAttachmentType getAttachmentType = new getAttachmentType();
        double d =
            getAttachmentLength.getAttachmentLength(
                (String) dbSession.getAttribute("unit_db_name"), "document_config_public_char");
        String ee =
            getAttachmentType.getAttachmentType(
                (String) dbSession.getAttribute("unit_db_name"), "document_config_public_char");
        mySmartUpload.initialize(pageContext);
        mySmartUpload.upload();
        String[] file_name = new String[mySmartUpload.getFiles().getCount()];
        int j = 0;

        int filenum1 =
            count.read((String) dbSession.getAttribute("unit_db_name"), "oaMessagecount");
        String message_ID = filenum1 + "";
        count.write((String) dbSession.getAttribute("unit_db_name"), "oaMessagecount", filenum1);
        String sql1 = "select * from oa_message where message_ID='" + message_ID + "'";
        ResultSet rs = oa_db.executeQuery(sql1);
        if (j != 0 || rs.next()) {

          response.sendRedirect("oa/message/register_ok_a.jsp");
        } else {

          String subject = mySmartUpload.getRequest().getParameter("subject");
          String message_type = mySmartUpload.getRequest().getParameter("message_type");
          String register = mySmartUpload.getRequest().getParameter("register");
          String register_ID = mySmartUpload.getRequest().getParameter("register_ID");
          String register_time = mySmartUpload.getRequest().getParameter("register_time");
          String bulletin = mySmartUpload.getRequest().getParameter("bulletin");

          String content = exchange.toHtmlFCK(mySmartUpload.getRequest().getParameter("content"));

          String bodyab =
              new String(
                  mySmartUpload.getRequest().getParameter("remark").getBytes("UTF-8"), "UTF-8");
          String remark = exchange.toHtml(bodyab);
          if (j != 0) {

            response.sendRedirect("oa/message/register_ok_c.jsp");
          } else {
            String sqla = "";
            String sqlb = "";
            if (bulletin == null) {
              sqla =
                  "insert into oa_message(register,register_ID,register_time,message_ID,subject,type,content,remark";
              sqlb =
                  ") values ('"
                      + register
                      + "','"
                      + register_ID
                      + "','"
                      + register_time
                      + "','"
                      + message_ID
                      + "','"
                      + subject
                      + "','"
                      + message_type
                      + "','"
                      + content
                      + "','"
                      + remark
                      + "'";
            } else {
              sqla =
                  "insert into oa_message(register,register_ID,register_time,message_ID,subject,type,content,remark,check_tag";
              sqlb =
                  ") values ('"
                      + register
                      + "','"
                      + register_ID
                      + "','"
                      + register_time
                      + "','"
                      + message_ID
                      + "','"
                      + subject
                      + "','"
                      + message_type
                      + "','"
                      + content
                      + "','"
                      + remark
                      + "','2'";
            }

            String sql = sqla + sqlb + ")";
            oa_db.executeUpdate(sql);

            response.sendRedirect("oa/message/register_ok_b.jsp");
          }
        }
        oa_db.commit();
        oa_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 18
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;
      _jspx_resourceInjector =
          (org.glassfish.jsp.api.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write("\n");
      out.write("    \n");
      out.write("    \n");
      out.write("    \n");
      Class.forName("com.mysql.jdbc.Driver");
      out.write("\n");
      out.write("    \n");
      out.write("    \n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write(" <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\n");
      out.write("        <!-- Bootstrap css online -->\n");
      out.write(
          "        <link rel=\"stylesheet\" href=\"http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css\">\n");
      out.write("        <link  href=\"css/customcss.css\" rel=\"stylesheet\">\n");
      out.write(
          "        <script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n");
      out.write("        <script src=\"js/bootstrap.min.js\"></script>\n");
      out.write("\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");
      out.write("<title>Analysis of Algorithms : D.B.Phatak</title>\n");
      out.write("</head>\n");
      out.write("<body>\n");
      out.write("\n");
      out.write("<!--Header-->\n");
      out.write("\n");
      out.write("  ");

      String name = (String) session.getAttribute("pass");

      out.write("\n");
      out.write("    <div class=\"container\">\n");
      out.write("             <br>\n");
      out.write("            <!--HEADER -->\n");
      out.write("            <div class=\"header\">\n");
      out.write(
          "                <a href=\"index.jsp\" style=\"color: #000;\"> <ul class=\"nav nav-pills pull-left\" >\n");
      out.write(
          "                    <li id=\"brand_icon\">       <img src=\"Images/mic_logo.png\" alt=\"\" width=\"80px\" height=\"80px\"/></li>\n");
      out.write(
          "                    <li id=\"brand_name\"> <p class=\"title\"><span style=\"font-size: 70px;\">|</span> iClass <strong>Forum</strong></p></li>\n");
      out.write("\n");
      out.write("                </ul></a>\n");
      out.write(
          "                <!--   <p class=\"title1\">iClass</p>&nbsp;&nbsp;<p class=\"title2\">Forum</p> \n");
      out.write("                -->\n");
      out.write("                <form action=\"Login\" method=\"post\">\n");
      out.write("\n");
      out.write(
          "                    <ul class=\"nav nav-pills pull-right\" style=\"margin-top: 35px\">\n");
      out.write("                        <li><a href=\"index.jsp\">Home</a></li>\n");
      out.write("                        <li><a href=\"contactus.jsp\">Contact Us</a></li>\n");
      out.write("\n");
      out.write("                        ");
      if (name != null) {
        try {
          out.write("\n");
          out.write("\n");
          out.write("                        <li><a href=\"logout.jsp\">Logout</a></li>\n");
          out.write("                        <li style=\"margin-top: 10px\">Welcome ");
          out.print(name);
          out.write("</li>\n");
          out.write("\n");
          out.write("                        ");
        } catch (Exception e) {

          System.out.println("Problem :" + e);
        }

      } else {

        out.write("\n");
        out.write("\n");
        out.write("                        <li><a href=\"signup.jsp\">Login</a></li>\n");
        out.write("\n");
        out.write("                        ");
      }
      out.write("\n");
      out.write("\n");
      out.write("                    </ul>\n");
      out.write("                </form>\n");
      out.write("\n");
      out.write("\n");
      out.write("            </div>\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("            <br>\n");
      out.write("         \n");
      out.write("      \n");
      out.write("\n");
      out.write("        <!-- MODAL -->\n");
      out.write("        <form action=\"\" name=\"batti\" method=\"post\">\n");
      out.write("\n");
      out.write(
          "        <div class=\"modal fade\" id=\"myModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n");
      out.write("          <div class=\"modal-dialog\">\n");
      out.write("            <div class=\"modal-content\">\n");
      out.write("              <div class=\"modal-header\">\n");
      out.write(
          "                <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button>\n");
      out.write("                <h4 class=\"modal-title\" id=\"myModalLabel\">Answer here</h4>\n");
      out.write("              </div>\n");
      out.write("              <div class=\"modal-body\">\n");
      out.write("                                <div class=\"input-group input-group-lg\">\n");
      out.write("                                <span class=\"input-group-addon\">\n");
      out.write(
          "                                <span class=\"glyphicon glyphicon-pencil\"></span>\n");
      out.write("                                </span>\n");
      out.write(
          "                                <textarea class=\"form-control\" id=\"currentans\" name=\"mainanswer\" rows=\"10\" style=\"resize: vertical;\">\n");
      out.write("                                </textarea>\n");
      out.write("                                </div>\n");
      out.write("              </div>\n");
      out.write("              <div class=\"modal-footer\">\n");
      out.write(
          "              <input type=\"text\" id=\"hidden\" name=\"maindata\" value=\"JAI HO\"/>\n");
      out.write(
          "                <button type=\"button\" class=\"btn btn-primary\" onClick=\"saveAns()\">Save Answer</button>\n");
      out.write("              </div>\n");
      out.write("            </div>\n");
      out.write("          </div>\n");
      out.write("        </div>\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("    </form>\n");
      out.write("    <!-- MODAL ENDS HERE -->\n");
      out.write("\n");
      out.write("<div class=\"page1\" >          \n");
      out.write("                <center>\n");
      out.write("\n");
      out.write(
          "                    <font face=\"myFontThin\" size=\"6\" class=\"title\">Department of  </font><font face=\"myFontThick\" size=\"8\"><b>Computer Science</b></font>\n");
      out.write("                <br>\n");
      out.write("                   <font face=\"myFontThick\" size=\"5\">Prof. sunil</font>\n");
      out.write("                \n");
      out.write("                </center>\n");
      out.write(
          "                <br> <br>  <font face=\"myFontThick\" size=\"6\"><b> bbbbbb </b></font>\n");
      out.write("<br><br><br>\n");
      out.write("                        \n");
      out.write("\n");
      out.write("\n");
      out.write("            ");

      Connection connection =
          DriverManager.getConnection("jdbc:mysql://localhost/aakash", "root", "lavikothari");
      Statement statement = connection.createStatement();
      ResultSet resultset = statement.executeQuery("select * from qa27;");

      int i = 0, no, ct = 0;
      String qid, bid, ansdivid, buttonid, delbuttonid, userid, answerid;

      while (resultset.next()) {
        ct++;
        no = resultset.getInt(1);
        if (i < no) {
          i = no;
        }
        qid = "q" + no;
        ansdivid = "ans" + no;
        bid = "b" + no;
        buttonid = "button" + no;
        delbuttonid = "delbutton" + no;
        userid = "user" + no;
        answerid = "answer" + no;

        out.write("\n");
        out.write("        <!--  <form action=\"\" method=\"get\" name=\"batti\" > -->\n");
        out.write("\t    \n");
        out.write("\t<div class=\"panel panel-default\">\n");
        out.write("            <div class=\"panel-heading\">\n");
        out.write("                <h3 class=\"panel-title\">\n");
        out.write("                <div id=");
        out.print(userid);
        out.write(
            " style=\"font-style:bold ;font-size:15px; padding-left:0.5px ;text-shadow: 2px 2px 8px #6E6E6E\">\n");
        out.write("\t    \t");
        out.print(resultset.getString(4));
        out.write("\n");
        out.write("                </div>\n");
        out.write("                </h3>\n");
        out.write("            </div>\n");
        out.write("            <div class=\"panel-body\">\n");
        out.write("                <div id=");
        out.print(qid);
        out.write(" style=\"text-align:left ;font-size:20px;font-style:italic\">\n");
        out.write("\t\t\t");
        out.print(resultset.getString(2));
        out.write("<br><br>\n");
        out.write("\t\t</div>\n");
        out.write("\t    \t<div class=\"panel panel-default\" id=");
        out.print(ansdivid);
        out.write(" >\n");
        out.write("  \t\t\t\t<div class=\"panel-body\" >\n");
        out.write("   \t\t\t \t\t<p id=");
        out.print(answerid);
        out.write('>');
        out.print(resultset.getString(3));
        out.write("</p>\n");
        out.write(" \t\t \t\t</div>\n");
        out.write("\t\t</div>\n");
        out.write("\t\t<div id=");
        out.print(bid);
        out.write(" >\n");
        out.write("\t\t\t ");
        String condition = (String) session.getAttribute("pass");
        String prof1 = (String) session.getAttribute("Prof");
        String prof2 = (String) session.getAttribute("Prof2");

        // out.println("Lec="+condition);

        // out.println("prof1="+prof1);
        // out.println("prof2="+prof2);
        // System.out.println("Lec="+condition);
        if (condition != null && prof1.equals(prof2)) {

          out.write("       \n");
          out.write("\n");
          out.write(
              "                                <input type=\"button\" class=\"btn btn-primary btn-sm\" style=\"float:right;display:inline\" value=\"Delete\" onClick=\"delQues(this.id)\" id=");
          out.print(delbuttonid);
          out.write(" />\n");
          out.write(
              "                                <input type=\"button\" class=\"btn btn-primary btn-sm\" style=\"float:left;display:inline\" data-toggle=\"modal\" value=\"Answer\" data-target=\"#myModal\" onClick=\"myfunc(this.id)\" id=");
          out.print(buttonid);
          out.write(" />\n");
          out.write("                                ");
        }

        out.write("\n");
        out.write("         \n");
        out.write("\t\t</div>\n");
        out.write("            </div>\n");
        out.write("        </div>\n");
        out.write("\t\n");
        out.write("\t   \n");
        out.write("\t\t\n");
        out.write("        ");
      }
      out.write("\n");
      out.write("\n");
      out.write(
          "               <form action=\"\" name=\"delform\" method=\"post\" style=\"visibility:hidden\">\n");
      out.write("\n");
      out.write(
          "               <input type=\"text\" id= \"delfieldid\" name=\"delfield\" value=\"Namastey\" />\n");
      out.write(
          "               <input type=\"text\" id= \"futureid\" name=\"futurefield\" value=\"London\" />\n");
      out.write("               </form>\n");
      out.write("\n");
      out.write("\n");
      out.write("        <span id =\"debug\" style=\"visibility:hidden\">Hello </span>\n");
      out.write("\n");
      out.write("    </div>\n");
      out.write("</div>    \n");
      out.write("\t    \n");
      out.write(" \n");
      out.write("</div>\n");
      out.write(" \n");
      out.write(" </div>\n");
      out.write("        \n");
      out.write(" \n");
      out.write(" <script type=\"text/javascript\">\n");
      out.write("\t count=");
      out.print(ct);
      out.write(";\n");
      out.write("\t debugging=document.getElementById(\"debug\");\n");
      out.write("\t debugging.innerHTML=\"Count is\"+count;\n");
      out.write("\t hid=document.getElementById(\"hidden\");\n");
      out.write("\t hid.style.display='none';\n");
      out.write("\t \n");
      out.write("\t for (x=1;x<=count;x++)\n");
      out.write("\t {\t\n");
      out.write("\t\t y=document.getElementById(\"answer\"+x);\n");
      out.write("\t\t debug.innerHTML+=y.innerHTML;\n");
      out.write("\t\t z=document.getElementById(\"button\"+x);\n");
      out.write("\t\t if(y!=null && y.innerHTML==\"\")\n");
      out.write("\t\t {\n");
      out.write("\t\t document.getElementById(\"ans\"+x).style.display='none';\n");
      out.write("\t\t }\n");
      out.write("\t\t \n");
      out.write("\t\t else\n");
      out.write("\t\t\t {\n");
      out.write("\t\t\t if(z!=null){\n");
      out.write("\t\t\t z.value=\"Edit Answer\";\n");
      out.write("\t\t\t }\n");
      out.write("\t\t\t }\n");
      out.write("\t }\n");
      out.write("\n");
      out.write("\t function myfunc(clicked_id){\n");
      out.write("\t\t \n");
      out.write("\t\t hid.value=clicked_id;\n");
      out.write("\t\t quesid=clicked_id.replace(\"button\",\"q\");\n");
      out.write("\t\t ansid=clicked_id.replace(\"button\",\"answer\");\n");
      out.write("\t\t \n");
      out.write("\t\t question=document.getElementById(quesid).innerHTML;\n");
      out.write("\t\t answer=document.getElementById(ansid).innerHTML;\n");
      out.write("\t\t \n");
      out.write("\t\t answer.replace(\"  \",\"\");\n");
      out.write("\t\t question.replace(\"  \",\"\");\n");
      out.write("\t\t \n");
      out.write("\t\t document.getElementById(\"myModalLabel\").innerHTML=question;\n");
      out.write("\t\t document.getElementById(\"currentans\").value=answer;\n");
      out.write("\t\t \n");
      out.write("\t }\n");
      out.write("\t \n");
      out.write("\t\n");
      out.write("\t function saveAns()\n");
      out.write("\t {\n");
      out.write("\t\t document.batti.submit();\n");
      out.write("\t\t \n");
      out.write("\t\t ");

      String clid = request.getParameter("maindata");
      if (clid != null) {
        String tobeanswered = clid.replace("button", "");
        System.out.println(tobeanswered);
        String answer = request.getParameter("mainanswer");

        Statement stmt = connection.createStatement();
        String query = "update qa27 set ans ='" + answer + "' where id='" + tobeanswered + "';";

        stmt.executeUpdate(query);

        response.sendRedirect("lec.jsp#user" + tobeanswered);
      }

      out.write("\n");
      out.write("\t }\n");
      out.write("\t \n");
      out.write("\t \n");
      out.write("\n");
      out.write("\t function delQues(clicked_id)\n");
      out.write("\t {\n");
      out.write("\t\t \n");
      out.write("\t\t document.getElementById(\"delfieldid\").value=clicked_id;\n");
      out.write("\t\t \n");
      out.write("\t\t \n");
      out.write("\t\t\t document.getElementById(\"futureid\").value=\"yesssssssss\";\n");
      out.write("\t\t  v=parseInt(clicked_id.replace(\"delbutton\",\"\"))+1;\n");
      out.write("\t\t while(document.getElementById(\"user\"+v)==null && v<count)\n");
      out.write("\t\t\t {\n");
      out.write("\t\t\t v++;\n");
      out.write("\t\t\t document.getElementById(\"futureid\").value=\"user\"+v;\n");
      out.write("\t\t\t }\n");
      out.write("\t\t if(clicked_id==\"delbutton\"+count)\n");
      out.write("\t\t\t {\n");
      out.write("\t\t\t v=parseInt(clicked_id.replace(\"delbutton\",\"\"))-1;\n");
      out.write("\t\t\t }\n");
      out.write("\t\tdocument.getElementById(\"futureid\").value=\"user\"+v;\n");
      out.write("\t\t\t \n");
      out.write("\t\t document.delform.submit();\n");
      out.write("\t\t \n");
      out.write("\t\t ");

      String delid = request.getParameter("delfield");
      if (delid != null) {
        String tobedel = delid.replace("delbutton", "");
        System.out.println("Deleting " + tobedel);

        Statement stmt1 = connection.createStatement();
        String query1 = "delete from qa27 where id='" + tobedel + "';";

        stmt1.executeUpdate(query1);
        String futid = request.getParameter("futurefield");
        response.sendRedirect("lec.jsp#" + futid);
      }

      out.write("\n");
      out.write("\t\t \n");
      out.write("\t }\n");
      out.write("\t \n");
      out.write("\t \n");
      out.write("\t </script>\n");
      out.write("\t\n");
      out.write("\n");
      out.write("</body>\n");
      out.write("</html> \n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Esempio n. 19
0
  public synchronized void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      PrintWriter out = response.getWriter();

      nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 crm_db = new nseer_db_backup1(dbApplication);
      if (stock_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && crm_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        FileKind FileKind = new FileKind();
        ValidataNumber validata = new ValidataNumber();
        ValidataRecord vr = new ValidataRecord();

        counter count = new counter(dbApplication);
        ValidataTag vt = new ValidataTag();
        String register_ID = (String) dbSession.getAttribute("human_IDD");
        String config_id = request.getParameter("config_id");
        String pay_ID = request.getParameter("pay_ID");
        String product_amount = request.getParameter("product_amount");
        int num = Integer.parseInt(product_amount);
        String payer_name = request.getParameter("payer_name");
        String payer_ID = request.getParameter("payer_ID");
        String reason = request.getParameter("reason");
        String not_return_tag = request.getParameter("not_return_tag");
        String register = request.getParameter("register");
        String register_time = request.getParameter("register_time");
        String demand_return_time = request.getParameter("demand_return_time");
        String sales_name = request.getParameter("sales_name");
        String sales_ID = request.getParameter("sales_ID");
        String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
        String remark = exchange.toHtml(bodyc);
        String time = "";
        java.util.Date now = new java.util.Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        time = formatter.format(now);
        String[] product_IDn = request.getParameterValues("product_ID");
        String[] amountn = request.getParameterValues("amount");
        if (num == 0 && product_IDn.length == 1) {
          response.sendRedirect("draft/crm/credit_ok_a.jsp?pay_ID=" + pay_ID);
        } else {
          int p = 0;
          for (int i = 1; i <= num; i++) {
            String tem_amount = "amount" + i;
            String amount = request.getParameter(tem_amount);
            if (amount.equals("")) amount = "0";
            if (!validata.validata(amount)) {
              p++;
            }
          }
          int n = 0;
          String product_ID_group = "";
          for (int j = 1; j < product_IDn.length; j++) {
            product_ID_group += product_IDn[j] + ",";
            if (amountn[j].equals("")) amountn[j] = "0";
            if (!validata.validata(amountn[j])) {
              p++;
            }
          }
          for (int i = 1; i <= num; i++) {
            String tem_product_ID = "product_ID" + i;
            String product_ID = request.getParameter(tem_product_ID);
            if (product_ID_group.indexOf(product_ID) != -1) n++;
          }
          if (vt.validata(
                      (String) dbSession.getAttribute("unit_db_name"),
                      "stock_apply_pay",
                      "pay_ID",
                      pay_ID,
                      "check_tag")
                  .equals("9")
              || vt.validata(
                      (String) dbSession.getAttribute("unit_db_name"),
                      "stock_apply_pay",
                      "pay_ID",
                      pay_ID,
                      "check_tag")
                  .equals("5")) {

            if (p == 0) {
              try {
                if (n == 0) {
                  boolean flag = false;
                  List rsList = GetWorkflow.getList(crm_db, "crm_config_workflow", "05");
                  String[] elem = new String[3];
                  if (rsList.size() == 0) {
                    flag = true;
                  }
                  String sqll = "";
                  String[] aaa1 =
                      FileKind.getKind(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "crm_file",
                          "customer_ID",
                          payer_ID);

                  String stock_pay_ID =
                      NseerId.getId("stock/pay", (String) dbSession.getAttribute("unit_db_name"));
                  double demand_amount = 0.0d;
                  double list_price_sum = 0.0d;
                  double cost_price_sum = 0.0d;

                  for (int i = 1; i <= num; i++) {
                    String tem_product_name = "product_name" + i;
                    String tem_product_ID = "product_ID" + i;
                    String tem_available_amount = "available_amount" + i;
                    String tem_amount = "amount" + i;
                    String tem_list_price = "list_price" + i;
                    String tem_cost_price = "cost_price" + i;
                    String tem_type = "type" + i;
                    String tem_amount_unit = "amount_unit" + i;
                    String product_name = request.getParameter(tem_product_name);
                    String product_ID = request.getParameter(tem_product_ID);
                    String available_amount = request.getParameter(tem_available_amount);
                    String amount = request.getParameter(tem_amount);
                    if (amount.equals("")) amount = "0";
                    String list_price2 = request.getParameter(tem_list_price);
                    String cost_price = request.getParameter(tem_cost_price);
                    String type = request.getParameter(tem_type);
                    StringTokenizer tokenTO3 = new StringTokenizer(list_price2, ",");
                    String list_price = "";
                    while (tokenTO3.hasMoreTokens()) {
                      String list_price1 = tokenTO3.nextToken();
                      list_price += list_price1;
                    }
                    String amount_unit = request.getParameter(tem_amount_unit);
                    double list_price_subtotal =
                        Double.parseDouble(list_price) * Double.parseDouble(amount);
                    list_price_sum += list_price_subtotal;
                    double cost_price_subtotal =
                        Double.parseDouble(cost_price) * Double.parseDouble(amount);
                    cost_price_sum += cost_price_subtotal;
                    demand_amount += Double.parseDouble(amount);
                    String sql1 =
                        "update stock_apply_pay_details set amount='"
                            + amount
                            + "',list_price='"
                            + list_price
                            + "',list_price_subtotal='"
                            + list_price_subtotal
                            + "',cost_price='"
                            + cost_price
                            + "',subtotal='"
                            + cost_price_subtotal
                            + "' where pay_ID='"
                            + pay_ID
                            + "' and details_number='"
                            + i
                            + "'";
                    stock_db.executeUpdate(sql1);
                    if (flag) {
                      if (type.equals("物料") || type.equals("外购商品")) {
                        String sql2 =
                            "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                + stock_pay_ID
                                + "','"
                                + i
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + type
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','0','"
                                + amount
                                + "')";
                        stock_db.executeUpdate(sql2);
                      } else if (type.equals("商品") || type.equals("部件") || type.equals("委外部件")) {
                        String sql2 =
                            "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                + stock_pay_ID
                                + "','"
                                + i
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + type
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','0')";
                        stock_db.executeUpdate(sql2);
                      }

                      String sql97 =
                          "select * from crm_salecredit_balance_details where crediter_ID='"
                              + payer_ID
                              + "' and product_ID='"
                              + product_ID
                              + "'";
                      ResultSet rs97 = crm_db.executeQuery(sql97);
                      if (rs97.next()) {
                        double balance_amount =
                            rs97.getDouble("amount") + Double.parseDouble(amount);
                        double balance_cost_price_subtotal =
                            rs97.getDouble("subtotal") + cost_price_subtotal;
                        double balance_list_price_subtotal =
                            rs97.getDouble("list_price_subtotal") + list_price_subtotal;

                        String sql96 =
                            "update crm_salecredit_balance_details set amount='"
                                + balance_amount
                                + "',check_tag='1',subtotal='"
                                + balance_cost_price_subtotal
                                + "',list_price_subtotal='"
                                + balance_list_price_subtotal
                                + "' where crediter_ID='"
                                + payer_ID
                                + "' and product_ID='"
                                + product_ID
                                + "'";
                        crm_db.executeUpdate(sql96);
                      } else {
                        String[] aaa =
                            FileKind.getKind(
                                (String) dbSession.getAttribute("unit_db_name"),
                                "design_file",
                                "product_ID",
                                product_ID);
                        String sql95 =
                            "insert into crm_salecredit_balance_details(chain_ID,chain_name,crediter_chain_ID,crediter_chain_name,product_ID,product_name,list_price,list_price_subtotal,cost_price,subtotal,amount,crediter_ID,crediter_name) values('"
                                + aaa[0]
                                + "','"
                                + aaa[1]
                                + "','"
                                + aaa1[0]
                                + "','"
                                + aaa1[1]
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + payer_ID
                                + "','"
                                + payer_name
                                + "')";
                        crm_db.executeUpdate(sql95);
                      }
                    }
                  }
                  String[] cost_pricen = request.getParameterValues("cost_price");
                  String[] list_pricen = request.getParameterValues("list_price");
                  String[] product_namen = request.getParameterValues("product_name");
                  String[] product_describen = request.getParameterValues("product_describe");
                  String[] amount_unitn = request.getParameterValues("amount_unit");
                  String[] typen = request.getParameterValues("type");
                  for (int i = 1; i < product_IDn.length; i++) {
                    StringTokenizer tokenTO3 = new StringTokenizer(list_pricen[i], ",");
                    String list_price = "";
                    while (tokenTO3.hasMoreTokens()) {
                      String list_price1 = tokenTO3.nextToken();
                      list_price += list_price1;
                    }
                    if (!amountn[i].equals("") && Double.parseDouble(amountn[i]) != 0) {
                      double list_price_subtotal =
                          Double.parseDouble(list_price) * Double.parseDouble(amountn[i]);
                      list_price_sum += list_price_subtotal;
                      double subtotal =
                          Double.parseDouble(cost_pricen[i]) * Double.parseDouble(amountn[i]);
                      cost_price_sum += subtotal;
                      demand_amount += Double.parseDouble(amountn[i]);
                      num++;
                      String sql1 =
                          "insert into stock_apply_pay_details(payer_chain_ID,payer_chain_name,sales_ID,sales_name,payer_ID,payer_name,payer_type,pay_ID,details_number,product_ID,product_name,product_describe,amount,amount_unit,list_price,list_price_subtotal,cost_price,subtotal,type) values ('"
                              + aaa1[0]
                              + "','"
                              + aaa1[1]
                              + "','"
                              + sales_ID
                              + "','"
                              + sales_name
                              + "','"
                              + payer_ID
                              + "','"
                              + payer_name
                              + "','销售赊货','"
                              + pay_ID
                              + "','"
                              + num
                              + "','"
                              + product_IDn[i]
                              + "','"
                              + product_namen[i]
                              + "','"
                              + product_describen[i]
                              + "','"
                              + amountn[i]
                              + "','"
                              + amount_unitn[i]
                              + "','"
                              + list_price
                              + "','"
                              + list_price_subtotal
                              + "','"
                              + cost_pricen[i]
                              + "','"
                              + subtotal
                              + "','"
                              + typen[i]
                              + "')";
                      stock_db.executeUpdate(sql1);
                      // **********************
                      if (rsList.size() == 0) {
                        if (typen[i].equals("物料") || typen[i].equals("外购商品")) {
                          String sql2 =
                              "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                  + stock_pay_ID
                                  + "','"
                                  + num
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + typen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','0','"
                                  + amountn[i]
                                  + "')";
                          stock_db.executeUpdate(sql2);
                        } else if (typen[i].equals("商品")
                            || typen[i].equals("部件")
                            || typen[i].equals("委外部件")) {
                          String sql2 =
                              "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                  + stock_pay_ID
                                  + "','"
                                  + num
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + typen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','0')";
                          stock_db.executeUpdate(sql2);
                        }

                        String sql97 =
                            "select * from crm_salecredit_balance_details where crediter_ID='"
                                + payer_ID
                                + "' and product_ID='"
                                + product_IDn[i]
                                + "'";
                        ResultSet rs97 = crm_db.executeQuery(sql97);
                        if (rs97.next()) {
                          double balance_amount =
                              rs97.getDouble("amount") + Double.parseDouble(amountn[i]);
                          double balance_cost_price_subtotal =
                              rs97.getDouble("subtotal") + subtotal;
                          double balance_list_price_subtotal =
                              rs97.getDouble("list_price_subtotal") + list_price_subtotal;

                          String sql96 =
                              "update crm_salecredit_balance_details set amount='"
                                  + balance_amount
                                  + "',check_tag='1',subtotal='"
                                  + balance_cost_price_subtotal
                                  + "',list_price_subtotal='"
                                  + balance_list_price_subtotal
                                  + "' where crediter_ID='"
                                  + payer_ID
                                  + "' and product_ID='"
                                  + product_IDn[i]
                                  + "'";
                          crm_db.executeUpdate(sql96);
                        } else {
                          String[] aaa =
                              FileKind.getKind(
                                  (String) dbSession.getAttribute("unit_db_name"),
                                  "design_file",
                                  "product_ID",
                                  product_IDn[i]);
                          String sql95 =
                              "insert into crm_salecredit_balance_details(chain_ID,chain_name,crediter_chain_ID,crediter_chain_name,product_ID,product_name,list_price,list_price_subtotal,cost_price,subtotal,amount,crediter_ID,crediter_name) values('"
                                  + aaa[0]
                                  + "','"
                                  + aaa[1]
                                  + "','"
                                  + aaa1[0]
                                  + "','"
                                  + aaa1[1]
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + payer_ID
                                  + "','"
                                  + payer_name
                                  + "')";
                          crm_db.executeUpdate(sql95);
                        }
                      }
                      // ***************************
                    }
                  }
                  String sql =
                      "update stock_apply_pay set reason='"
                          + reason
                          + "',register='"
                          + register
                          + "',register_time='"
                          + register_time
                          + "',demand_return_time='"
                          + demand_return_time
                          + "',register_time='"
                          + register_time
                          + "',register='"
                          + register
                          + "',remark='"
                          + remark
                          + "',demand_amount='"
                          + demand_amount
                          + "',list_price_sum='"
                          + list_price_sum
                          + "',cost_price_sum='"
                          + cost_price_sum
                          + "',not_return_tag='"
                          + not_return_tag
                          + "' where pay_ID='"
                          + pay_ID
                          + "'";
                  stock_db.executeUpdate(sql);
                  if (flag) {
                    sql = "update stock_apply_pay set check_tag='1' where pay_ID='" + pay_ID + "'";
                    stock_db.executeUpdate(sql);
                    if (!vr.validata(
                        (String) dbSession.getAttribute("unit_db_name"),
                        "stock_pay",
                        "reasonexact",
                        pay_ID)) {
                      String sql4 =
                          "insert into stock_pay(pay_ID,reason,reasonexact,reasonexact_details,demand_amount,list_price_sum,cost_price_sum,register,register_time) values('"
                              + stock_pay_ID
                              + "','"
                              + reason
                              + "','"
                              + pay_ID
                              + "','"
                              + payer_name
                              + "','"
                              + demand_amount
                              + "','"
                              + list_price_sum
                              + "','"
                              + cost_price_sum
                              + "','"
                              + register
                              + "','"
                              + register_time
                              + "')";
                      stock_db.executeUpdate(sql4);
                    }

                    String sql98 = "select * from crm_file where customer_ID='" + payer_ID + "'";
                    ResultSet rs98 = crm_db.executeQuery(sql98);
                    if (rs98.next()) {
                      double salecredit_list_price_sum =
                          rs98.getDouble("salecredit_list_price_sum") + list_price_sum;
                      double salecredit_cost_price_sum =
                          rs98.getDouble("salecredit_cost_price_sum") + cost_price_sum;

                      String sql99 =
                          "update crm_file set credit_yes_or_not_tag='1',salecredit_list_price_sum='"
                              + salecredit_list_price_sum
                              + "',salecredit_cost_price_sum='"
                              + salecredit_cost_price_sum
                              + "' where customer_ID='"
                              + payer_ID
                              + "' ";
                      crm_db.executeUpdate(sql99);
                    }
                  } else {
                    sql = "update stock_apply_pay set check_tag='0' where pay_ID='" + pay_ID + "'";
                    stock_db.executeUpdate(sql);
                    Iterator ite = rsList.iterator();
                    while (ite.hasNext()) {
                      elem = (String[]) ite.next();
                      sql =
                          "insert into crm_workflow(config_id,object_ID,describe1,describe2) values ('"
                              + elem[0]
                              + "','"
                              + pay_ID
                              + "','"
                              + elem[1]
                              + "','"
                              + elem[2]
                              + "')";
                      crm_db.executeUpdate(sql);
                    }
                  }

                  response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=8");
                } else {

                  response.sendRedirect(
                      "draft/crm/credit_ok.jsp?finished_tag=7&pay_ID=" + pay_ID + "");
                }
              } catch (Exception ex) {
                ex.printStackTrace();
              }
            } else {

              response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=6&pay_ID=" + pay_ID + "");
            }
          } else {

            response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=9");
          }
        }
        stock_db.commit();
        crm_db.commit();
        stock_db.close();
        crm_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 20
0
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    PreparedStatement pstmt = null;
    Statement stmt = null;
    ResultSet rs = null;

    HttpSession session = SystemUtils.verifyMem(req, out); // check for intruder

    if (session == null) return;

    Connection con = Connect.getCon(req); // get DB connection

    if (con == null) {

      resp.setContentType("text/html");

      out.println(SystemUtils.HeadTitle("DB Connection Error"));
      out.println("<BODY><CENTER><BR>");
      out.println("<BR><BR><H3>Database Connection Error</H3>");
      out.println("<BR><BR>Unable to connect to the Database.");
      out.println("<BR>Please try again later.");
      out.println("<BR><BR>If problem persists, contact customer support.");
      out.println("<BR><BR>");
      out.println("<a href=\"javascript:history.back(1)\">Return</a>");
      out.println("</CENTER></BODY></HTML>");
      out.close();
      return;
    }

    //
    // Get needed vars out of session obj
    //
    String club = (String) session.getAttribute("club");
    String user = (String) session.getAttribute("user");
    String caller = (String) session.getAttribute("caller");

    int activity_id = (Integer) session.getAttribute("activity_id");

    int foretees_mode = 0;

    String stype_id = req.getParameter("type_id");
    int type_id = 0;

    String sgroup_id = req.getParameter("group_id");
    int group_id = 0;

    String sitem_id = req.getParameter("item_id");
    int item_id = 0;

    try {
      type_id = Integer.parseInt(stype_id);
    } catch (NumberFormatException ignore) {
    }

    try {
      group_id = Integer.parseInt(sgroup_id);
    } catch (NumberFormatException ignore) {
    }

    try {
      item_id = Integer.parseInt(sitem_id);
    } catch (NumberFormatException ignore) {
    }

    out.println(
        "<!-- type_id=" + type_id + ", group_id=" + group_id + ", item_id=" + item_id + " -->");

    //
    // START PAGE OUTPUT
    //
    out.println(SystemUtils.HeadTitle("Member Acivities"));
    out.println("<style>");
    out.println(".actLink { color: black }");
    out.println(".actLink:hover { color: #336633 }");
    // out.println(".playerTD {width:125px}");
    out.println("</style>");
    out.println(
        "<body bgcolor=\"#CCCCAA\" text=\"#000000\" link=\"#336633\" vlink=\"#8B8970\" alink=\"#8B8970\">");
    SystemUtils.getMemberSubMenu(req, out, caller); // required to allow submenus on this page

    //
    // DISPLAY A LIST OF AVAILABLE ACTIVITIES
    //
    out.println(
        "<p align=center><b><font size=5 color=#336633><BR><BR>Available Activities</font></b></p>");

    out.println(
        "<p align=center><b><font size=3 color=#000000>Select your desired activity from the list below.<br>NOTE: You can set your default activity under <a href=\"Member_services\" class=actLink>Settings</a>.</font></b></p>");

    out.println("<table align=center>");

    try {

      stmt = con.createStatement();

      rs = stmt.executeQuery("SELECT foretees_mode FROM club5 WHERE clubName <> '';");

      if (rs.next()) {
        foretees_mode = rs.getInt(1);
      }

      // if they have foretees then give a link in to the golf system
      if (foretees_mode != 0) {

        out.println(
            "<tr><td align=center><b><a href=\"Member_jump?switch&activity_id=0\" class=linkA style=\"color:#336633\" target=_top>Golf</a></b></td></tr>"); // ForeTees
      }

      // build a link to any activities they have access to
      rs =
          stmt.executeQuery(
              "SELECT * FROM activities " + "WHERE parent_id = 0 " + "ORDER BY activity_name");

      while (rs.next()) {

        out.println(
            "<tr><td align=center><b><a href=\"Member_jump?switch&activity_id="
                + rs.getInt("activity_id")
                + "\" class=linkA style=\"color:#336633\" target=_top>"
                + rs.getString("activity_name")
                + "</a></b></td></tr>");
      }

      stmt.close();

    } catch (Exception exc) {

      out.println("<p>ERROR:" + exc.toString() + "</p>");

    } finally {

      try {
        rs.close();
      } catch (Exception ignore) {
      }

      try {
        stmt.close();
      } catch (Exception ignore) {
      }
    }

    out.println("</table>");

    out.println("</body></html>");

    /*

        out.println("<script>");

        out.println("function load_types() {");
        out.println(" try {document.forms['frmSelect'].item_id.selectedIndex = -1; } catch (err) {}");
        out.println(" document.forms['frmSelect'].group_id.selectedIndex = -1;");
        out.println(" document.forms['frmSelect'].submit();");
        out.println("}");

        out.println("function load_groups() {");
        out.println(" document.forms['frmSelect'].submit();");
        out.println("}");

        out.println("function load_times(id) {");
        out.println(" top.bot.location.href='Member_gensheets?id=' + id;");
        out.println("}");

        out.println("</script>");

        out.println("<form name=frmSelect>");

        // LOAD ACTIVITY TYPES
        out.println("<select name=type_id onchange=\"load_types()\">");

        if (type_id == 0) {

            out.println("<option>CHOOSE TYPE</option>");

        }

        try {

            stmt = con.createStatement();

            rs = stmt.executeQuery("SELECT * FROM activities WHERE parent_id = 0");

            while (rs.next()) {

                Common_Config.buildOption(rs.getInt("activity_id"), rs.getString("activity_name"), type_id, out);

            }
            stmt.close();

        } catch (Exception exc) {

            out.println("<p>ERROR:" + exc.toString() + "</p>");

        }

        out.println("");
        out.println("</select>");


        // LOAD ACTIVITIES BY GROUP TYPE
        out.println("<select name=group_id onchange=\"load_groups()\">");

        if (type_id == 0) {

            out.println("<option>CHOOSE TYPE</option>");

        } else {

            try {

                stmt = con.createStatement();
                rs = stmt.executeQuery("SELECT activity_id, activity_name FROM activities WHERE parent_id = " + type_id);

                rs.last();
                if (rs.getRow() == 1) {
                    group_id = rs.getInt("activity_id");
                    out.println("<!-- ONLY FOUND 1 GROUP -->");
                } else {
                    out.println("<option value=\"0\">CHOOSE...</option>");
                }

                rs.beforeFirst();

                while (rs.next()) {

                    Common_Config.buildOption(rs.getInt("activity_id"), rs.getString("activity_name"), group_id, out);

                }
                stmt.close();

            } catch (Exception exc) {

                out.println("<p>ERROR:" + exc.toString() + "</p>");

            }

        }

        out.println("");
        out.println("</select>");

        boolean do_load = false;

        if (group_id > 0 ) { //|| sitem_id != null

            // LOAD ACTIVITIES BY ITEM TYPE

            try {

                stmt = con.createStatement();
                rs = stmt.executeQuery("SELECT activity_id, activity_name FROM activities WHERE parent_id = " + group_id);

                rs.last();
                if (rs.getRow() == 0) {

                    // no sub groups found
                    do_load = true;
                    item_id = group_id;

                } else if (rs.getRow() == 1) {

                    // single sub group found (pre select it)
                    item_id = rs.getInt("activity_id");
                    out.println("<!-- ONLY FOUND 1 ITEM -->");

                } else {

                    out.println("<select name=item_id onchange=\"load_times(this.options[this.selectedIndex].value)\">");
                    out.println("<option value=\"0\">CHOOSE...</option>");

                }

                if (!do_load) {

                    rs.beforeFirst();

                    while (rs.next()) {

                        Common_Config.buildOption(rs.getInt("activity_id"), rs.getString("activity_name"), item_id, out);

                    }

                }
                stmt.close();

                out.println("");
                out.println("</select>");

            } catch (Exception exc) {

                out.println("<p>ERROR:" + exc.toString() + "</p>");

            }


        }

        out.println("</form>");

        out.println("<p><a href=\"Member_genrez\">Reset</a></p>");

        try {
            con.close();
        } catch (Exception ignore) {}


        if (do_load) out.println("<script>load_times(" + item_id + ")</script>");


        //out.println("<iframe name=ifSheet src=\"\" style=\"width:640px height:480px\"></iframe>");
    */

    out.close();
  }
Esempio n. 21
0
  // *****************************************************
  // Process the request from Member_sheet
  // *****************************************************
  //
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    PreparedStatement pstmt3 = null;
    Statement stmt = null;
    ResultSet rs = null;

    HttpSession session = SystemUtils.verifyMem(req, out); // check for intruder

    if (session == null) {

      return;
    }

    Connection con = SystemUtils.getCon(session); // get DB connection

    if (con == null) {

      out.println(SystemUtils.HeadTitle("DB Connection Error"));
      out.println(
          "<BODY bgcolor=\"#ccccaa\"><CENTER><img src=\"/" + rev + "/images/foretees.gif\"><BR>");
      out.println("<hr width=\"40%\">");
      out.println("<BR><BR><H3>Database Connection Error</H3>");
      out.println("<BR><BR>Unable to connect to the Database.");
      out.println("<BR>Please try again later.");
      out.println("<BR><BR>If problem persists, please contact customer support.");
      out.println("<BR><BR>");
      out.println("<font size=\"2\">");
      out.println("<form method=\"get\" action=\"javascript:history.back(1)\">");
      out.println("<input type=\"submit\" value=\"Return\" style=\"text-decoration:underline;\">");
      out.println("</form></font>");
      out.println("</CENTER></BODY></HTML>");
      out.close();
      return;
    }

    // Create Json response for later use
    Gson gson_obj = new Gson();
    // HashMap for later use by gson
    Map<String, Object> hashMap = new HashMap<String, Object>();
    // Check if we will only be return json data
    boolean json_mode = (req.getParameter("jsonMode")) != null;

    //
    // See if we are here to VIEW a wait list
    //
    if (req.getParameter("view") != null && req.getParameter("waitListId") != null) {

      if (json_mode) {
        out.print(gson_obj.toJson(viewSignups(req, out, con, true)));
      } else {
        viewSignups(req, out, con);
      }
      return;
    }

    String jump = "0"; // jump index - default to zero (for _sheet)

    if (req.getParameter("jump") != null) { // if jump index provided

      jump = req.getParameter("jump");
    }

    //
    //  Get this session's username
    //
    String club = (String) session.getAttribute("club");
    String user = (String) session.getAttribute("user");
    String name = (String) session.getAttribute("name"); // get users full name

    String sindex =
        req.getParameter("index"); //  index value of day (needed by Member_sheet when returning)
    String course = req.getParameter("course"); //  Name of Course
    String id = req.getParameter("waitListId"); //  uid of the wait list we are working with

    String returnCourse = "";

    if (req.getParameter("returnCourse") != null) { // if returnCourse provided

      returnCourse = req.getParameter("returnCourse");
    }

    String sdate = req.getParameter("date"); //  date of the request (yyyymmdd)
    String day_name = req.getParameter("day"); //  name of the day
    String p5 = req.getParameter("p5"); //  5-somes supported

    int index = 0;
    int wait_list_id = 0;
    int count = 0;

    int mm = 0;
    int dd = 0;
    int yy = 0;
    int date = 0;

    int time = SystemUtils.getTime(con);

    //
    //  Convert the values from string to int
    //
    try {

      wait_list_id = Integer.parseInt(id);
      index = Integer.parseInt(sindex);
      date = Integer.parseInt(sdate);
    } catch (NumberFormatException e) {
    }

    // get our date parts
    yy = date / 10000;
    mm = date - (yy * 10000);
    dd = mm - (mm / 100) * 100;
    mm = mm / 100;

    //
    //  parm block to hold the wait list parameters
    //
    parmWaitList parmWL = new parmWaitList(); // allocate a parm block

    parmWL.wait_list_id = wait_list_id;

    try {

      getWaitList.getParms(con, parmWL); // get the wait list config

      // if members can see the wait list then get the count
      if (parmWL.member_view == 1) {
        count = getWaitList.getListCount(wait_list_id, date, index, time, true, con);
      }

    } catch (Exception exp) {
      out.println(exp.getMessage());
    }

    int onlist = 0;

    try {

      onlist = getWaitList.onList(user, wait_list_id, date, con);

    } catch (Exception exp) {

      out.println(exp.toString());
    }

    String waitlist_notice = "";

    if (onlist == 0) {

      // not on the list

      try {

        // out.println("<pre>");
        waitlist_notice = getWaitList.getNotice(wait_list_id, con);
        // out.println("</pre>");

      } catch (Exception exp) {
      }
    }

    if (json_mode) {

      // If in json mode, add data to hashmap
      // New skin uses Member_waitlist in json mode exclusively.

      // Group the data we want to send to javascript in a hash map
      hashMap.put("wait_list_id", wait_list_id);
      hashMap.put("waitlist_notice", waitlist_notice);
      hashMap.put("date", "" + mm + "/" + dd + "/" + yy);
      hashMap.put("start_time", SystemUtils.getSimpleTime(parmWL.start_time));
      hashMap.put("end_time", SystemUtils.getSimpleTime(parmWL.end_time));
      hashMap.put("member_access", parmWL.member_access);
      hashMap.put("member_view", parmWL.member_view);
      hashMap.put("onlist", onlist);
      hashMap.put("index", index);
      hashMap.put("course", course);
      hashMap.put("count", count);
      hashMap.put("name", parmWL.name);

      out.print(gson_obj.toJson(hashMap));

      return;

    } else {
      // If not in json mode, output data directly to user

      out.println(
          "<!-- wait_list_id=" + wait_list_id + ", date=" + date + ", count=" + count + " -->");

      //
      // ********************************************************************
      //   Build a page to display Wait List details to member
      // ********************************************************************
      //
      out.println("<html>");
      out.println("<head>");
      out.println(
          "<link rel=\"stylesheet\" href=\"/"
              + rev
              + "/web utilities/foretees2.css\" type=\"text/css\">");
      out.println("<title>Member Wait List Registration Page</title>");
      out.println("</head>");

      out.println(
          "<body bgcolor=\"#ccccaa\" text=\"#000000\" link=\"#FFFFFF\" vlink=\"#FFFFFF\" alink=\"#FF0000\" topmargin=\"0\">");
      out.println("<font face=\"Arial, Helvetica, Sans-serif\"><center>");

      out.println(
          "<table border=\"0\" width=\"100%\" align=\"center\" valign=\"top\">"); // large table for
                                                                                  // whole page
      out.println("<tr><td valign=\"top\" align=\"center\">");

      out.println(
          "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#336633\" align=\"center\" valign=\"top\">");
      out.println("<tr><td align=\"left\" width=\"300\">&nbsp;");
      out.println("<img src=\"/" + rev + "/images/foretees.gif\" border=0>");
      out.println("</td>");

      out.println("<td align=\"center\">");
      out.println("<font color=\"ffffff\" size=\"5\">Member Wait List Registration</font>");
      out.println("</font></td>");

      out.println("<td align=\"center\" width=\"300\">");
      out.println("<font size=\"1\" color=\"#ffffff\">Copyright&nbsp;</font>");
      out.println("<font size=\"2\" color=\"#ffffff\">&#169;&nbsp;</font>");
      out.println(
          "<font size=\"1\" color=\"#ffffff\">ForeTees, LLC <br> 2009 All rights reserved.");
      out.println("</font><font size=\"3\">");
      out.println(
          "<br><br><a href=\"/" + rev + "/member_help.htm\" target=\"_blank\"><b>Help</b></a>");
      out.println("</font></td>");
      out.println("</tr></table>");

      out.println("<br>");

      out.println("<table border=\"1\" cols=\"1\" bgcolor=\"#f5f5dc\" cellpadding=\"3\">");
      out.println("<tr>");
      out.println("<td width=\"620\" align=\"center\">");
      out.println("<font size=\"3\">");
      out.println("<b>Wait List Registration</b><br></font>");
      out.println("<font size=\"2\">");

      out.println(
          "The golf shop is running a wait list "
              + ((index == 0) ? "today" : "on this day")
              + ". ");
      out.println(
          "The wait list you've selected is running from <nobr>"
              + SystemUtils.getSimpleTime(parmWL.start_time)
              + "</nobr> till <nobr>"
              + SystemUtils.getSimpleTime(parmWL.end_time)
              + ".</nobr> ");

      out.println("Review the information below and click on 'Continue With Request' to continue.");
      out.println(
          "<br>OR click on 'Cancel Request' to delete the request. To return without changes click on 'Go Back'.");

      // out.println("<br><br><b>NOTE:</b> Only the person that originates the request will be
      // allowed to cancel it or change these values.");

      out.println("</font></td></tr>");
      out.println("</table>");

      out.println("<br><br>");

      out.println("<table border=0>");

      out.println("<tr><td><font size=\"2\">");
      out.println(
          "Date:&nbsp;&nbsp;<b>"
              + day_name
              + "&nbsp;&nbsp;"
              + mm
              + "/"
              + dd
              + "/"
              + yy
              + "</b></td>");
      out.println("<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</td><td>");
      if (!course.equals("")) {
        out.println("<font size=\"2\">Course:&nbsp;&nbsp;<b>" + course + "</b></font>");
      }
      out.println("</td></tr>");

      out.println(
          "<tr><td><font size=\"2\">Wait List:&nbsp;&nbsp;<b>"
              + SystemUtils.getSimpleTime(parmWL.start_time)
              + " to "
              + SystemUtils.getSimpleTime(parmWL.end_time)
              + "</b></font></td>");

      out.println("<td></td>");

      out.println("<td><font size=\"2\">Signups:<b>");
      out.print(((parmWL.member_view == 1) ? count : "N/A"));
      out.println("</b></font></td>");

      out.println("</table>");

      out.println("<br>");

      out.println("<table border=\"0\" align=\"center\">"); // table to contain 2 tables below

      out.println("<tr>");

      out.println("<td align=\"center\" valign=\"top\">");

      out.println(
          "<table border=\"1\" bgcolor=\"#f5f5dc\" align=\"center\" width=\"500\" cellpadding=\"5\" cellspacing=\"5\">"); // table for request details
      out.println("<tr bgcolor=\"#336633\"><td align=\"center\">");
      out.println("<font color=\"ffffff\" size=\"3\">");
      out.println(
          "<b>" + ((!parmWL.name.equals("")) ? parmWL.name : "Wait List Information") + "</b>");
      out.println("</font></td></tr>");

      out.println("<tr>");

      out.println("<form action=\"Member_waitlist_slot\" method=\"post\">");
      out.println("<input type=\"hidden\" name=\"waitListId\" value=\"" + wait_list_id + "\">");
      out.println("<input type=\"hidden\" name=\"sdate\" value=\"" + date + "\">");
      out.println("<input type=\"hidden\" name=\"day\" value=\"" + day_name + "\">");
      out.println("<input type=\"hidden\" name=\"index\" value=\"" + sindex + "\">");
      out.println("<input type=\"hidden\" name=\"course\" value=\"" + course + "\">");
      out.println("<input type=\"hidden\" name=\"returnCourse\" value=\"" + returnCourse + "\">");
      out.println("<input type=\"hidden\" name=\"jump\" value=\"" + jump + "\">");

      out.println("<td><font size=\"2\"><br>");

      // see if they are already on the wait list
      out.println("<input type=\"hidden\" name=\"signupId\" value=\"" + onlist + "\">");

      if (onlist == 0) {

        // not on the list

        // out.println("The golf shop is running a wait list " + ((index == 0) ? "today": "on this
        // day") + ". ");
        // out.println("The wait list you've selected is running from " +
        // SystemUtils.getSimpleTime(parmWL.start_time) + " till " +
        // SystemUtils.getSimpleTime(parmWL.end_time) + ". ");

        // try {

        // out.println("<pre>");
        // out.print(getWaitList.getNotice(wait_list_id, con));
        // out.println("</pre>");
        out.print(waitlist_notice);

        // } catch (Exception exp) { }

        if (parmWL.member_access == 1) {
          out.println(
              "<br><p align=center><input type=submit value=\"Continue With Sign-up\" name=\"continue\"></p>");
        } else {
          out.println("<p align=center><b>Contact the golf shop to get on the wait list.</b></p>");
        }

      } else {

        // already on this list

        out.println(
            "<p align=center><b><i>You are already signed up for this wait list.</b></i></p>");

        if (parmWL.member_access == 1) {
          out.println(
              "<br><p align=center><input type=submit value=\"Modify Your Sign-up\" name=\"continue\"></p>");
        } else {
          out.println(
              "<p align=center><b>Contact the golf shop to make changes or cancel your entry.</b></p>");
        }
      }

      if (parmWL.member_view == 1 && count > 0) {

        out.println(
            "<p align=center><input type=button value=\"View Wait List\" name=\"view\" onclick=\"document.forms['frmView'].submit();\"></p>");
      }

      out.println("<br></font></td>");

      out.println("</table>");
      out.println("</form>");

      out.println("<br>");

      if (index == 999) {

        // out.println("<form action=\"Member_teelist\" method=\"GET\">");
        out.println("<form action=\"/" + rev + "/member_teemain.htm\" method=\"GET\">");

      } else if (index == 995) {

        // out.println("<form action=\"Member_teelist_list\" method=\"GET\">");
        out.println("<form action=\"/" + rev + "/member_teemain2.htm\" method=\"GET\">");

      } else {

        out.println("<form action=\"Member_jump\" method=\"POST\">");
        out.println("<input type=\"hidden\" name=\"jump\" value=" + jump + ">");
        out.println("<input type=\"hidden\" name=\"index\" value=" + index + ">");
        out.println(
            "<input type=\"hidden\" name=\"course\" value=\""
                + ((!returnCourse.equals("")) ? returnCourse : course)
                + "\">");
      }
      out.println("<font size=2>Return w/o Changes:</font><br>");
      out.println("<input type=\"submit\" value=\"Go Back\" name=\"cancel\"></form>");

      out.println("<form action=\"Member_waitlist\" method=\"GET\" name=frmView>");
      out.println("<input type=\"hidden\" name=\"view\" value=\"current\">");
      out.println("<input type=\"hidden\" name=\"waitListId\" value=\"" + wait_list_id + "\">");
      out.println("<input type=\"hidden\" name=\"sdate\" value=\"" + date + "\">");
      out.println("<input type=\"hidden\" name=\"name\" value=\"" + parmWL.name + "\">");
      // out.println("<input type=\"hidden\" name=\"day\" value=\"" + day_name + "\">");
      out.println("<input type=\"hidden\" name=\"index\" value=\"" + sindex + "\">");
      out.println("<input type=\"hidden\" name=\"course\" value=\"" + parmWL.course + "\">");
      out.println("<input type=\"hidden\" name=\"returnCourse\" value=\"" + returnCourse + "\">");
      out.println("<input type=\"hidden\" name=\"jump\" value=\"" + jump + "\">");
      ;
      out.println(
          "<input type=\"hidden\" name=\"start_time\" value=\"" + parmWL.start_time + "\">");
      out.println("<input type=\"hidden\" name=\"end_time\" value=\"" + parmWL.end_time + "\">");
      out.println("<input type=\"hidden\" name=\"day_name\" value=\"" + day_name + "\">");
      // out.println("<input type=submit value=\"View Sign-ups\" name=\"view\">");
      out.println("</form>");
    } // end json check
  } // end doPost
Esempio n. 22
0
  // *****************************************************
  // Process the initial request from Proshop_main
  // *****************************************************
  //
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    //
    //  Prevent caching so sessions are not mangled
    //
    resp.setHeader("Pragma", "no-cache"); // for HTTP 1.0
    resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // for HTTP 1.1
    resp.setDateHeader("Expires", 0); // prevents caching at the proxy server

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    HttpSession session = SystemUtils.verifyHotel(req, out); // check for intruder

    if (session == null) {

      return;
    }

    String club = (String) session.getAttribute("club"); // get club name
    String user = (String) session.getAttribute("user");

    if (req.getParameter("clubswitch") != null
        && req.getParameter("clubswitch").equals("1")
        && req.getParameter("club") != null) {

      //
      //  Request is to switch clubs - switch the db (TPC or Demo sites)
      //
      String newClub = req.getParameter("club");

      Connection con = null;

      //
      //  release the old connection
      //
      ConnHolder holder = (ConnHolder) session.getAttribute("connect");

      if (holder != null) {

        con = holder.getConn(); // get the connection for previous club
      }

      if (con != null) {
        /*
                   // abandon any unfinished transactions
                   try { con.rollback(); }
                   catch (Exception ignore) {}
        */
        // close/release the connection
        try {
          con.close();
        } catch (Exception ignore) {
        }
      }

      //
      //  Connect to the new club
      //
      try {
        con = dbConn.Connect(newClub); // get connection to this club's db
      } catch (Exception ignore) {
      }

      holder = new ConnHolder(con);

      session.setAttribute("club", newClub);
      session.setAttribute("connect", holder);

      out.println("<HTML><HEAD><Title>Switching Sites</Title>");
      out.println("<meta http-equiv=\"Refresh\" content=\"0; url=/" + rev + "/hotel_home.htm\">");
      out.println("</HEAD>");
      out.println("<BODY><CENTER><BR>");
      out.println("<BR><H2>Switching Sites</H2><BR>");
      out.println("<a href=\"/" + rev + "/hotel_home.htm\" target=_top>Continue</a><br>");
      out.println("</CENTER></BODY></HTML>");
      out.close();
      return;
    }

    //
    //  Call is to display the Home page.
    //
    out.println("<html><head>");
    out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">");
    out.println("<meta http-equiv=\"Content-Language\" content=\"en-us\">");
    out.println("<title> \"ForeTees Hotel Home Page\"</title>");
    out.println(
        "<script language=\"JavaScript\" src=\"/" + rev + "/web utilities/foretees.js\"></script>");

    out.println(
        "<style type=\"text/css\"> body {text-align: center} </style>"); // so body will align on
                                                                         // center

    out.println("</head>");

    out.println("<body bgcolor=\"#CCCCAA\" text=\"#000000\">");

    out.println("<div style=\"align:center; margin:0px auto;\">");

    if (club.startsWith("tpc") && user.startsWith("passport")) { // if TPC Passport user

      out.println("<br><H3>Welcome to ForeTees</H3><br>");

      String clubname = "";
      String fullname = "";

      Connection con = null;

      try {
        con = dbConn.Connect(rev); // get connection to the Vx db

        //
        //  Get the club names for each TPC club
        //
        PreparedStatement pstmt =
            con.prepareStatement("SELECT fullname FROM clubs WHERE clubname=?");

        pstmt.clearParameters();
        pstmt.setString(1, club);
        ResultSet rs = pstmt.executeQuery();

        if (rs.next()) {

          fullname = rs.getString("fullname"); // get the club's full name
        }

        out.println("<p>You are currently connected to: <b>" + fullname + "</b><br><br>");
        out.println("To continue with this site, simply use the navigation menus above.<br><br>");
        out.println("To switch sites, click on the desired club name below.</p><br>");

        //
        //  Get the club names for each TPC club
        //
        pstmt =
            con.prepareStatement(
                "SELECT clubname, fullname FROM clubs WHERE inactive=0 AND clubname LIKE 'tpc%' ORDER BY fullname");

        pstmt.clearParameters();
        rs = pstmt.executeQuery();

        while (rs.next()) {

          clubname = rs.getString("clubname"); // get a club name

          if (clubname.startsWith("tpc")) {

            fullname = rs.getString("fullname"); // get the club's full name

            out.println(
                "<a href=\"Hotel_home?clubswitch=1&club="
                    + clubname
                    + "\" target=_top>"
                    + fullname
                    + "</a><br>");
          }
        }
        pstmt.close();

      } catch (Exception e) {

        // Error connecting to db....
        out.println(
            "<BR><BR>Sorry, we encountered an error while trying to connect to the database.");
        // out.println("<br><br>Error: " + e.toString() + "<br>");
        out.println("<BR><BR> <A HREF=\"Hotel_home\">Return</A>.");
        out.println("</BODY></HTML>");
        return;
      }

    } else {

      out.println(
          "<BR><BR> You have entered here by mistake. Please contact ForeTees Support at 651-765-6006.");
      out.println("</BODY></HTML>");
    }
    out.println("</div></BODY></HTML>");
  } // end of doGet
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<!--%@ page errorPage=\"/error.jsp\" %-->\n");

      response.setHeader("Pragma", "no-cache"); // HTTP 1.0
      response.setDateHeader("Expires", 0);
      response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1

      String _adminid = "";
      String _adminname = "";
      String _admintype = "";
      String _admingroup = "";
      String _approval = "";
      String _adminclass = "";
      String _adminmail = "";

      try {

        _adminid = (String) session.getAttribute("adminid");

        if (_adminid == null || _adminid.length() == 0 || _adminid.equals("null")) {
          response.sendRedirect("/admin/login_first.html");
          return;
        }

        _adminname = (String) session.getAttribute("adminname");
        _admintype = (String) session.getAttribute("admintype");
        _admingroup = (String) session.getAttribute("admingroup");
        _approval = (String) session.getAttribute("approval");
        _adminclass = (String) session.getAttribute("adminclass");
        _adminmail = (String) session.getAttribute("admin_email");
        // session.setMaxInactiveInterval(60*60);

      } catch (Exception e) {
        response.sendRedirect("/admin/login_first.html");
        return;
      }

      out.write('\n');
      out.write('\n');
      out.write('\n');

      String password = request.getParameter("password");
      String fromURL = request.getParameter("fromURL");
      String oldPassword = "";

      String sql = "";
      int iCnt = 0;
      boolean isSucceeded = false;
      String strMsg = "";
      Connection conn = null;
      MatrixDataSet matrix = null;
      DataProcess dataProcess = null;
      PreparedStatement pstmt = null;

      String targetUrl = "";

      try {

        if (password.equals("1111")) {
          throw new UserDefinedException(
              "The new password is not acceptable. Change your password.");
        }

        Context ic = new InitialContext();
        DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/scm");
        conn = ds.getConnection();
        matrix = new dbconn.MatrixDataSet();
        dataProcess = new DataProcess();

        sql =
            " select  password " + " from    admin_01t " + " where   adminid = '" + _adminid + "' ";

        iCnt = dataProcess.RetrieveData(sql, matrix, conn);

        if (iCnt > 0) {
          oldPassword = matrix.getRowData(0).getData(0);
        } else {
          throw new UserDefinedException("Can't find User Information.");
        }

        if (password.equals(oldPassword)) {
          throw new UserDefinedException(
              "The new password is not acceptable. Change your password.");
        }

        // update ó¸®...
        int idx = 0;
        conn.setAutoCommit(false);

        sql =
            " update  admin_01t "
                + " set     password = ?, pw_date = sysdate() "
                + " where   adminid = ? ";

        pstmt = conn.prepareStatement(sql);
        pstmt.setString(++idx, password);
        pstmt.setString(++idx, _adminid);

        iCnt = pstmt.executeUpdate();

        if (iCnt != 1) {
          throw new UserDefinedException("Password update failed.");
        }

        conn.commit();
        isSucceeded = true;

      } catch (UserDefinedException ue) {
        try {
          conn.rollback();
        } catch (Exception ex) {
        }

        strMsg = ue.getMessage();
      } catch (Exception e) {
        try {
          conn.rollback();
        } catch (Exception ex) {
        }

        System.out.println("Exception /admin/resetAdminPasswd : " + e.getMessage());
        throw e;
      } finally {
        if (pstmt != null) {
          try {
            pstmt.close();
          } catch (Exception e) {
          }
        }

        if (conn != null) {
          try {
            conn.setAutoCommit(true);
          } catch (Exception e) {
          }
          conn.close();
        }
      }

      // °á°ú ¸Þ½ÃÁö ó¸®
      if (isSucceeded) {
        // where to go?
        if (fromURL.equals("menu")) {
          targetUrl = "";
        } else {
          targetUrl = "/admin/index2.jsp";
        }
        strMsg = "The data are successfully processed.";
      } else {
        strMsg = "The operation failed.\\n" + strMsg;
        targetUrl = "/admin/resetAdminPasswdForm.jsp";
      }

      out.write("\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<title></title>\n");
      out.write("<link href=\"/common/css/style.css\" rel=\"stylesheet\" type=\"text/css\">\n");
      out.write("</head>\n");
      out.write("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>\n");
      out.write("<form name=\"form1\" method=\"post\" action=\"");
      out.print(targetUrl);
      out.write("\">\n");
      out.write("<input type='hidden' name='fromURL' value='");
      out.print(fromURL);
      out.write("'>\n");
      out.write("</form>\n");
      out.write("<script language=\"javascript\">\n");
      if (targetUrl.length() > 0) {
        out.write("\n");
        out.write("  alert('");
        out.print(strMsg);
        out.write("');\n");
        out.write("  document.form1.submit();\n");
      }
      out.write("\n");
      out.write("</script>\n");
      out.write("<table width='840' border='0' cellspacing='0' cellpadding='0'><tr><td>\n");
      out.write("\n");
      out.write("<table width='99%' border='0' cellspacing='0' cellpadding='0'>\n");
      out.write("<tr>\n");
      out.write("  <td height='15' colspan='2'></td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td width='3%'><img src='/img/title_icon.gif'></td>\n");
      out.write("  <td width='*' class='left_title'>Password Change</td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td width='100%' height='2' colspan='2'><hr width='100%'></td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td height='10' colspan='2'></td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("\n");
      out.write("<table width='90%' border='0' cellspacing='0' cellpadding='0' align='center'>\n");
      out.write("<tr>\n");
      out.write("  <td width='100%' align='center'><img border=\"0\" src=\"/img/pass.jpg\">\n");
      out.write("    <br><br>\n");
      out.write("    <b>The Password has been changed successfully.</b></td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");

      out.println(CopyRightLogo());

      out.write("\n");
      out.write("</tr></td></table>\n");
      out.write("</body>\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            out.clearBuffer();
          } catch (java.io.IOException e) {
          }
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Esempio n. 24
0
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    server svr = new server();
    response.setContentType("text/html");
    HttpSession session = request.getSession(true);
    PrintWriter out = response.getWriter();
    String email = request.getParameter("email");
    String pw1 = request.getParameter("pw1");
    String pw2 = request.getParameter("pw2");
    String error = null;
    String username = session.getAttribute("username").toString();
    if (pw1.compareTo(pw2) != 0) {
      error = "Passwords do not match";
      session.setAttribute("ErrorMessage", error);
      response.sendRedirect("home.jsp");
    }
    try {
      Statement st = null;
      String strQuery = null;
      if ((pw1.length() == 0) && (email.length() == 0)) {
        session.setAttribute("ErrorMessage", "Nothing to change!");
        response.sendRedirect("home.jsp");
      } else if ((pw1.length() != 0) && (email.length() != 0)) {
        strQuery =
            "UPDATE `twitter2012`.`users` SET `password`='"
                + pw1
                + "', `email_address`='"
                + email
                + "' WHERE `username`='"
                + username
                + "'";
        session.setAttribute("email", email);
      } else if ((pw1.length() == 0) && (email.length() != 0)) {
        strQuery =
            "UPDATE `twitter2012`.`users` SET `email_address`='"
                + email
                + "' WHERE `username`='"
                + username
                + "'";
        session.setAttribute("email", email);
      } else if ((pw1.length() != 0) && (email.length() == 0)) {
        strQuery =
            "UPDATE `twitter2012`.`users` SET `password`='"
                + pw1
                + "' WHERE `username`='"
                + username
                + "'";
      }
      Connection dbcon = null;
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      dbcon = DriverManager.getConnection(svr.getURL(), svr.getUN(), svr.getPW());
      st = dbcon.createStatement();
      st.executeUpdate(strQuery);
      session.setAttribute("ErrorMessage", "Details Changed");
      dbcon.close();
      session.setAttribute("ErrorMessage", "Details Changed");
      response.sendRedirect("home.jsp");
    } catch (Exception ex) {
      out.println(ex);
    }
  }
Esempio n. 25
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();
    PrintWriter out = response.getWriter();
    ServletContext application;
    HttpSession session = request.getSession();
    nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);
    ValidataNumber validata = new ValidataNumber();
    try {

      if (finance_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String file_id = request.getParameter("file_id");
        String balance_sum = request.getParameter("balance_sum");
        String balance_sum1 = request.getParameter("balance_sum1");
        if (validata.validata(balance_sum) && validata.validata(balance_sum1)) {
          String sql2 = "select id from finance_bill where tag='1' and file_id='" + file_id + "'";
          ResultSet rs2 = finance_db.executeQuery(sql2);
          String sql = "";
          if (rs2.next()) {
            sql =
                "update finance_bill set debit_subtotal='"
                    + balance_sum1
                    + "' where tag='1' and file_id='"
                    + file_id
                    + "'";
          } else {

            sql =
                "insert into finance_bill(debit_subtotal,file_id,tag) values('"
                    + balance_sum1
                    + "','"
                    + file_id
                    + "','1')";
          }
          finance_db.executeUpdate(sql);

          sql2 =
              "select id from finance_voucher where account_period='18' and chain_id='"
                  + file_id
                  + "'";
          rs2 = finance_db.executeQuery(sql2);
          if (rs2.next()) {
            sql =
                "update finance_voucher set debit_subtotal='"
                    + balance_sum
                    + "' where account_period='18' and chain_id='"
                    + file_id
                    + "'";
          } else {

            sql =
                "insert into finance_voucher(debit_subtotal,chain_id,account_period) values('"
                    + balance_sum
                    + "','"
                    + file_id
                    + "','18')";
          }
          finance_db.executeUpdate(sql);

          finance_db.commit();
          finance_db.close();
        } else {
          out.println("1");
        }
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 26
0
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      PrintWriter out = response.getWriter();
      session = request.getSession();
      counter count = new counter(dbApplication);
      ValidataNumber validata = new ValidataNumber();
      ValidataRecord vr = new ValidataRecord();
      ValidataTag vt = new ValidataTag();
      getNameFromID getNameFromID = new getNameFromID();
      getRateFromID getRateFromID = new getRateFromID();

      nseer_db_backup1 purchase_db = new nseer_db_backup1(dbApplication);

      if (purchase_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String register_ID = (String) session.getAttribute("human_IDD");
        String config_id = request.getParameter("config_id");
        String discussion_ID = request.getParameter("discussion_ID");
        String provider_ID = request.getParameter("provider_ID");
        String provider_name = request.getParameter("provider_name");
        String demand_contact_person = request.getParameter("demand_contact_person");
        String demand_contact_person_tel = request.getParameter("demand_contact_person_tel");
        String demand_contact_person_fax = request.getParameter("demand_contact_person_fax");
        String demand_pay_time = request.getParameter("demand_pay_time");
        String check_time = request.getParameter("check_time");
        String checker = request.getParameter("checker");
        String checker_ID = request.getParameter("checker_ID");
        String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
        String remark = exchange.toHtml(bodyc);
        String modify_tag = request.getParameter("modify_tag");
        String product_amount = request.getParameter("product_amount");
        int num = Integer.parseInt(product_amount);

        int n = 0;
        for (int i = 1; i <= num; i++) {
          String tem_amount = "amount" + i;
          String tem_off_discount = "off_discount" + i;
          String tem_list_price = "list_price" + i;
          String amount = request.getParameter(tem_amount);
          String off_discount = request.getParameter(tem_off_discount);
          String list_price2 = request.getParameter(tem_list_price);
          StringTokenizer tokenTO2 = new StringTokenizer(list_price2, ",");

          String list_price = "";
          while (tokenTO2.hasMoreTokens()) {
            String list_price1 = tokenTO2.nextToken();
            list_price += list_price1;
          }
          if (!validata.validata(amount)
              || !validata.validata(off_discount)
              || !validata.validata(list_price)) {
            n++;
          }
        }

        String sql6 =
            "select id from purchase_workflow where object_ID='"
                + discussion_ID
                + "' and ((check_tag='0' and config_id<'"
                + config_id
                + "') or (check_tag='1' and config_id='"
                + config_id
                + "'))";
        ResultSet rs6 = purchase_db.executeQuery(sql6);
        if (!rs6.next()) {
          if (vt.validata(
                  (String) dbSession.getAttribute("unit_db_name"),
                  "purchase_discussion",
                  "discussion_ID",
                  discussion_ID,
                  "check_tag")
              .equals("0")) {
            if (n == 0) {
              String time = "";
              java.util.Date now = new java.util.Date();
              SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
              time = formatter.format(now);

              String sql =
                  "update purchase_discussion set discussion_ID='"
                      + discussion_ID
                      + "',provider_ID='"
                      + provider_ID
                      + "',provider_name='"
                      + provider_name
                      + "',demand_contact_person='"
                      + demand_contact_person
                      + "',demand_contact_person_tel='"
                      + demand_contact_person_tel
                      + "',demand_contact_person_fax='"
                      + demand_contact_person_fax
                      + "',check_time='"
                      + check_time
                      + "',checker='"
                      + checker
                      + "',checker_ID='"
                      + checker_ID
                      + "',remark='"
                      + remark
                      + "' where discussion_ID='"
                      + discussion_ID
                      + "'";
              purchase_db.executeUpdate(sql);

              try {

                int service_count = 0;
                int stock_number = 0;
                int pay_amount_sum = 0;
                double sale_price_sum = 0.0d;
                double cost_price_sum = 0.0d;
                double real_cost_price_sum = 0.0d;
                for (int i = 1; i <= num; i++) {
                  String tem_product_name = "product_name" + i;
                  String tem_product_ID = "product_ID" + i;
                  String tem_product_describe = "product_describe" + i;
                  String tem_amount = "amount" + i;
                  String tem_off_discount = "off_discount" + i;
                  String tem_list_price = "list_price" + i;
                  String tem_cost_price = "cost_price" + i;
                  String tem_real_cost_price = "real_cost_price" + i;
                  String tem_amount_unit = "amount_unit" + i;
                  String product_name = request.getParameter(tem_product_name);
                  String product_ID = request.getParameter(tem_product_ID);
                  String product_describe = request.getParameter(tem_product_describe);
                  String amount1 = request.getParameter(tem_amount);
                  String off_discount = request.getParameter(tem_off_discount);
                  String list_price2 = request.getParameter(tem_list_price);
                  StringTokenizer tokenTO2 = new StringTokenizer(list_price2, ",");
                  String list_price = "";
                  while (tokenTO2.hasMoreTokens()) {
                    String list_price1 = tokenTO2.nextToken();
                    list_price += list_price1;
                  }
                  String cost_price2 = request.getParameter(tem_cost_price);
                  StringTokenizer tokenTO3 = new StringTokenizer(cost_price2, ",");
                  String cost_price = "";
                  while (tokenTO3.hasMoreTokens()) {
                    String cost_price1 = tokenTO3.nextToken();
                    cost_price += cost_price1;
                  }
                  String real_cost_price2 = request.getParameter(tem_real_cost_price);
                  StringTokenizer tokenTO4 = new StringTokenizer(real_cost_price2, ",");
                  String real_cost_price = "";
                  while (tokenTO4.hasMoreTokens()) {
                    String real_cost_price1 = tokenTO4.nextToken();
                    real_cost_price += real_cost_price1;
                  }
                  String amount_unit = request.getParameter(tem_amount_unit);
                  double amount = 0.0d;
                  double subtotal =
                      Double.parseDouble(list_price)
                          * (1 - Double.parseDouble(off_discount) / 100)
                          * Double.parseDouble(amount1);
                  double cost_price_after_discount_sum =
                      Double.parseDouble(cost_price) * Double.parseDouble(amount1);
                  double real_cost_price_after_discount_sum =
                      Double.parseDouble(real_cost_price) * Double.parseDouble(amount1);
                  sale_price_sum += subtotal;
                  cost_price_sum += cost_price_after_discount_sum;
                  real_cost_price_sum += real_cost_price_after_discount_sum;

                  double order_sale_bonus_subtotal =
                      getRateFromID.getRateFromID(
                              (String) dbSession.getAttribute("unit_db_name"),
                              "design_file",
                              "product_ID",
                              product_ID,
                              "order_sale_bonus_rate")
                          * subtotal
                          / 100;
                  double order_profit_bonus_subtotal = 0.0d;

                  String sql1 =
                      "update purchase_discussion_details set product_ID='"
                          + product_ID
                          + "',product_name='"
                          + product_name
                          + "',product_describe='"
                          + product_describe
                          + "',list_price='"
                          + list_price
                          + "',amount='"
                          + amount1
                          + "',cost_price='"
                          + cost_price
                          + "',off_discount='"
                          + off_discount
                          + "',subtotal='"
                          + subtotal
                          + "' where discussion_ID='"
                          + discussion_ID
                          + "' and details_number='"
                          + i
                          + "'";
                  purchase_db.executeUpdate(sql1);

                  String product_type = "";
                  String sql16 = "select * from design_file where product_ID='" + product_ID + "'";
                  ResultSet rs16 = purchase_db.executeQuery(sql16);
                  if (rs16.next()) {
                    product_type = rs16.getString("type");
                  }
                  if (product_type.equals("物料") || product_type.equals("外购商品")) {
                    stock_number += 1;
                  } else if (product_type.equals("商品")
                      || product_type.equals("部件")
                      || product_type.equals("委外部件")) {
                    stock_number += 1;
                  } else if (product_type.equals("服务型产品")) {
                    service_count++;
                  }
                }
                String sql2 =
                    "update purchase_workflow set checker='"
                        + checker
                        + "',checker_ID='"
                        + checker_ID
                        + "',check_time='"
                        + check_time
                        + "',check_tag='1' where object_ID='"
                        + discussion_ID
                        + "' and config_id='"
                        + config_id
                        + "'";
                purchase_db.executeUpdate(sql2);
                sql2 =
                    "select id from purchase_workflow where object_ID='"
                        + discussion_ID
                        + "' and check_tag='0'";
                ResultSet rset = purchase_db.executeQuery(sql2);
                if (!rset.next()) {
                  sql2 =
                      "update purchase_discussion set sale_price_sum='"
                          + sale_price_sum
                          + "',cost_price_sum='"
                          + cost_price_sum
                          + "',modify_tag='0',discussion_tag='1',discussion_status='等待',check_tag='1' where discussion_ID='"
                          + discussion_ID
                          + "'";
                  purchase_db.executeUpdate(sql2);
                } else {
                  sql2 =
                      "update purchase_discussion set sale_price_sum='"
                          + sale_price_sum
                          + "',cost_price_sum='"
                          + cost_price_sum
                          + "',modify_tag='0' where discussion_ID='"
                          + discussion_ID
                          + "'";
                  purchase_db.executeUpdate(sql2);
                }
              } catch (Exception ex) {
                ex.printStackTrace();
              }
              response.sendRedirect(
                  "purchase/discussion/check_choose_attachment.jsp?discussion_ID="
                      + discussion_ID
                      + "");
            } else {
              response.sendRedirect("purchase/discussion/check_ok.jsp?finished_tag=0");
            }
          } else {
            response.sendRedirect("purchase/discussion/check_ok.jsp?finished_tag=1");
          }
        } else {
          response.sendRedirect("purchase/discussion/check_ok.jsp?finished_tag=2");
        }
        purchase_db.commit();
        purchase_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 27
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {

      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();

      nseer_db_backup1 security_db = new nseer_db_backup1(dbApplication);
      if (security_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        getRecordCount query = new getRecordCount();

        String tablename = request.getParameter("tablename");
        String[] cols = request.getParameterValues("col");

        if (cols == null) {

          response.sendRedirect("hr/config/key/key_register_ok_a.jsp");

        } else {
          String column_group = "";
          for (int i = 0; i < cols.length; i++) {
            column_group += cols[i] + ",";
          }
          column_group = column_group.substring(0, column_group.length() - 1);
          String sql1 =
              "select * from security_publicconfig_key where tablename='" + tablename + "'";
          ResultSet rs = security_db.executeQuery(sql1);
          if (rs.next()) {
            String sql =
                "update security_publicconfig_key set column_group='"
                    + column_group
                    + "' where tablename='"
                    + tablename
                    + "'";
            security_db.executeUpdate(sql);
          } else {
            String sql =
                "insert into security_publicconfig_key(tablename,column_group) values('"
                    + tablename
                    + "','"
                    + column_group
                    + "')";
            security_db.executeUpdate(sql);
          }

          response.sendRedirect("hr/config/key/key_register_ok_b.jsp");
        }
        security_db.commit();
        security_db.close();

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
    }
  }
Esempio n. 28
0
  public synchronized void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      ValidataNumber validata = new ValidataNumber();
      nseer_db_backup1 crm_db = new nseer_db_backup1(dbApplication);
      if (crm_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        counter count = new counter(dbApplication);
        PrintWriter out = response.getWriter();
        String product_amount = request.getParameter("product_amount");
        String reasonexact = request.getParameter("reasonexact");
        String which_time = request.getParameter("which_time");
        int num = Integer.parseInt(product_amount);
        String reason = request.getParameter("reason");
        String customer_ID = request.getParameter("customer_ID");
        String customer_name = request.getParameter("customer_name");
        String real_customer_mailing_address =
            request.getParameter("real_customer_mailing_address");
        String real_contact_person = request.getParameter("real_contact_person");
        String real_contact_person_tel = request.getParameter("real_contact_person_tel");
        String real_contact_person_fax = request.getParameter("real_contact_person_fax");
        String real_invoice_time = request.getParameter("real_invoice_time");
        String real_invoice_type = request.getParameter("real_invoice_type");
        String register = request.getParameter("register");
        String register_ID = request.getParameter("register_ID");
        String invoice_group = request.getParameter("invoice_group");
        String register_time = request.getParameter("register_time");
        double invoiced_subtotal_sum = 0.0d;
        double invoiced_subtotal_sum_all = 0.0d;
        int p = 0;
        for (int i = 1; i <= num; i++) {
          String tem_invoice_sum = "invoice_sum" + i;
          String invoice_sum2 = request.getParameter(tem_invoice_sum);
          if (invoice_sum2.equals("")) invoice_sum2 = "0";
          StringTokenizer tokenTO2 = new StringTokenizer(invoice_sum2, ",");
          String invoice_sum = "";
          while (tokenTO2.hasMoreTokens()) {
            String invoice_sum1 = tokenTO2.nextToken();
            invoice_sum += invoice_sum1;
          }
          if (!validata.validata(invoice_sum)) {
            p++;
          }
        }
        if (p == 0) {
          int n = 0;

          if (n == 0) {
            String sql8 =
                "select * from crm_order where order_id='"
                    + reasonexact
                    + "' and (invoice_check_tag='9' or invoice_check_tag='5') and which_time='"
                    + which_time
                    + "'";
            ResultSet rs8 = crm_db.executeQuery(sql8);
            if (rs8.next()) {

              for (int j = 1; j <= num; j++) {
                String tem_details_number = "details_number" + j;
                String tem_id = "id" + j;
                String id = request.getParameter(tem_id);
                String details_number = request.getParameter(tem_details_number);
              }
              String product_ID_control1 = request.getParameter("product_ID1");
              String subtotal_control1 = request.getParameter("invoiced_subtotal1");
              double subtotal_control = Double.parseDouble(subtotal_control1);
              for (int j = 1; j <= num; j++) {
                invoiced_subtotal_sum = 0;
                String tem_details_number = "details_number" + j;
                String tem_product_name = "product_name" + j;
                String tem_product_ID = "product_ID" + j;
                String tem_subtotal = "subtotal" + j;
                String tem_invoice_sum = "invoice_sum" + j;
                String tem_invoiced_subtotal = "invoiced_subtotal" + j;
                String tem_remark = "remark" + j;
                String tem_id = "id" + j;
                String id = request.getParameter(tem_id);
                String product_name = request.getParameter(tem_product_name);
                String product_ID = request.getParameter(tem_product_ID);
                String details_number = request.getParameter(tem_details_number);
                String subtotal = request.getParameter(tem_subtotal);
                String invoiced_subtotal = request.getParameter(tem_invoiced_subtotal);
                String invoice_sum2 = request.getParameter(tem_invoice_sum);
                if (invoice_sum2.equals("")) invoice_sum2 = "0";
                StringTokenizer tokenTO1 = new StringTokenizer(invoice_sum2, ",");
                String invoice_sum = "";
                while (tokenTO1.hasMoreTokens()) {
                  String invoice_sum1 = tokenTO1.nextToken();
                  invoice_sum += invoice_sum1;
                }
                String remark = request.getParameter(tem_remark);
                if (product_ID.equals(product_ID_control1)) {
                  if (invoice_sum != null && Double.parseDouble(invoice_sum) != 0) {
                    subtotal_control += Double.parseDouble(invoice_sum);
                    invoiced_subtotal_sum_all += Double.parseDouble(invoice_sum);
                    String sql1 =
                        "update crm_ordering set reason='"
                            + reason
                            + "',customer_ID='"
                            + customer_ID
                            + "',customer_name='"
                            + customer_name
                            + "',real_customer_mailing_address='"
                            + real_customer_mailing_address
                            + "',real_contact_person='"
                            + real_contact_person
                            + "',real_contact_person_tel='"
                            + real_contact_person_tel
                            + "',real_contact_person_fax='"
                            + real_contact_person_fax
                            + "',real_invoice_time='"
                            + real_invoice_time
                            + "',real_invoice_type='"
                            + real_invoice_type
                            + "',register='"
                            + register
                            + "',register_ID='"
                            + register_ID
                            + "',register_time='"
                            + register_time
                            + "',product_ID='"
                            + product_ID
                            + "',product_name='"
                            + product_name
                            + "',invoice_sum='"
                            + invoice_sum
                            + "',remark='"
                            + remark
                            + "',invoice_group='"
                            + invoice_group
                            + "' where id='"
                            + id
                            + "'";
                    crm_db.executeUpdate(sql1);
                    if (subtotal_control == Double.parseDouble(subtotal)) {
                      String sql2 =
                          "update crm_order_details set invoiced_subtotal='"
                              + subtotal_control
                              + "',invoice_tag='1' where order_ID='"
                              + reasonexact
                              + "' and details_number='"
                              + details_number
                              + "'";
                      crm_db.executeUpdate(sql2);
                    } else {
                      String sql3 =
                          "update crm_order_details set invoiced_subtotal='"
                              + subtotal_control
                              + "' where order_ID='"
                              + reasonexact
                              + "' and details_number='"
                              + details_number
                              + "'";
                      crm_db.executeUpdate(sql3);
                    }

                  } else if (Double.parseDouble(invoice_sum) == 0) {
                    String sql7 = "delete from crm_ordering where id='" + id + "'";
                    crm_db.executeUpdate(sql7);
                  }
                } else {
                  if (invoice_sum != null && Double.parseDouble(invoice_sum) != 0) {
                    product_ID_control1 = product_ID;
                    subtotal_control =
                        Double.parseDouble(invoiced_subtotal) + Double.parseDouble(invoice_sum);
                    invoiced_subtotal_sum_all += Double.parseDouble(invoice_sum);
                    String sql1 =
                        "update crm_ordering set reason='"
                            + reason
                            + "',customer_ID='"
                            + customer_ID
                            + "',customer_name='"
                            + customer_name
                            + "',real_customer_mailing_address='"
                            + real_customer_mailing_address
                            + "',real_contact_person='"
                            + real_contact_person
                            + "',real_contact_person_tel='"
                            + real_contact_person_tel
                            + "',real_contact_person_fax='"
                            + real_contact_person_fax
                            + "',real_invoice_time='"
                            + real_invoice_time
                            + "',real_invoice_type='"
                            + real_invoice_type
                            + "',register='"
                            + register
                            + "',register_ID='"
                            + register_ID
                            + "',register_time='"
                            + register_time
                            + "',product_ID='"
                            + product_ID
                            + "',product_name='"
                            + product_name
                            + "',invoice_sum='"
                            + invoice_sum
                            + "',remark='"
                            + remark
                            + "',invoice_group='"
                            + invoice_group
                            + "' where id='"
                            + id
                            + "'";
                    crm_db.executeUpdate(sql1);
                    if (subtotal_control == Double.parseDouble(subtotal)) {
                      String sql2 =
                          "update crm_order_details set invoiced_subtotal='"
                              + subtotal_control
                              + "',invoice_tag='1' where order_ID='"
                              + reasonexact
                              + "' and details_number='"
                              + details_number
                              + "'";
                      crm_db.executeUpdate(sql2);
                    } else {
                      String sql3 =
                          "update crm_order_details set invoiced_subtotal='"
                              + subtotal_control
                              + "' where order_ID='"
                              + reasonexact
                              + "' and details_number='"
                              + details_number
                              + "'";
                      crm_db.executeUpdate(sql3);
                    }

                  } else if (Double.parseDouble(invoice_sum) == 0) {
                    String sql7 = "delete from crm_ordering where id='" + id + "'";
                    crm_db.executeUpdate(sql7);
                  }
                }
              }
              String sql2 =
                  "update crm_order set invoice_check_tag='2' where order_ID='" + reasonexact + "'";
              crm_db.executeUpdate(sql2);
              response.sendRedirect("draft/crm/invoice_ok.jsp?finished_tag=2");
            } else {
              response.sendRedirect("draft/crm/invoice_ok.jsp?finished_tag=1");
            }
          } else {
            response.sendRedirect("draft/crm/invoice_ok_a.jsp?order_ID=" + reasonexact + "");
          }
        } else {
          response.sendRedirect("draft/crm/invoice_ok_b.jsp?order_ID=" + reasonexact + "");
        }
        crm_db.commit();
        crm_db.close();

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
    }
  }
Esempio n. 29
0
  // *****************************************************
  // Process the initial request from Proshop_main
  // *****************************************************
  //
  @SuppressWarnings("deprecation")
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    //
    //  Prevent caching so sessions are not mangled
    //
    resp.setHeader("Pragma", "no-cache"); // for HTTP 1.0
    resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // for HTTP 1.1
    resp.setDateHeader("Expires", 0); // prevents caching at the proxy server

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    HttpSession session = SystemUtils.verifyPro(req, out); // check for intruder

    if (session == null) {

      return;
    }

    String club = (String) session.getAttribute("club"); // get club name
    String templott = (String) session.getAttribute("lottery"); // get lottery support indicator
    int lottery = Integer.parseInt(templott);

    //
    //  Call is to display the new features page.
    //
    //  Display a page to provide a link to the new feature page
    //
    out.println("<html><head>");
    out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">");
    out.println("<meta http-equiv=\"Content-Language\" content=\"en-us\">");
    out.println("<title> \"ForeTees Proshop Announcement Page\"</title>");
    //   out.println("<link rel=\"stylesheet\" href=\"/" +rev+ "/web utilities/foretees.css\"
    // type=\"text/css\"></link>");
    out.println(
        "<script language=\"JavaScript\" src=\"/" + rev + "/web utilities/foretees.js\"></script>");
    out.println("</head>");
    out.println("<body bgcolor=\"#FFFFFF\" text=\"#000000\">");

    SystemUtils.getProshopSubMenu(req, out, lottery);

    File f;
    FileReader fr;
    BufferedReader br;
    String tmp = "";
    String path = "";

    try {
      path = req.getRealPath("");
      tmp = "/proshop_features.htm"; // "/" +rev+
      f = new File(path + tmp);
      fr = new FileReader(f);
      br = new BufferedReader(fr);
      if (!f.isFile()) {
        // do nothing
      }
    } catch (FileNotFoundException e) {
      out.println("<br><br><p align=center>Missing New Features Page.</p>");
      out.println("</BODY></HTML>");
      out.close();
      return;
    } catch (SecurityException se) {
      out.println("<br><br><p align=center>Access Denied.</p>");
      out.println("</BODY></HTML>");
      out.close();
      return;
    }

    while ((tmp = br.readLine()) != null) out.println(tmp);

    br.close();

    out.println("</BODY></HTML>");
    out.close();
  } // end of doGet
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

      try {
        Connection dbconnection = null;
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        dbconnection = DriverManager.getConnection("jdbc:odbc:ets", "db2", "vicky");

        Statement st;
        String username = (String) session.getAttribute("uname");
        st = dbconnection.createStatement();
        ResultSet rs = st.executeQuery("select * from Tag where username='******'");

        out.write("\r\n");
        out.write("\r\n");
        out.write("<html>\r\n");
        out.write("<head>\r\n");
        out.write(
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n");
        out.write("<title>Company | Leading India</title>\r\n");
        out.write("<link rel=\"stylesheet\" href=\"css/style.css\">\r\n");
        out.write("</head>\r\n");
        out.write("<body\r\n");
        out.write(
            "\tstyle=\"background-image: url('images/header2.png'); background-repeat: no-repeat;\">\r\n");
        out.write("<div id=\"container\">\r\n");
        out.write("<div id=\"heading\">\r\n");
        out.write("<h1 style=\"margin-left: 30px;\">Company | Leading India</h1>\r\n");
        out.write("\r\n");
        out.write("<div id=\"menu\"\r\n");
        out.write("\tstyle=\"float: right; margin-right: 50px; margin-top: -50px;\">\r\n");
        out.write("<ul>\r\n");
        out.write("\t<li><a href=\"home_op_out.jsp\">Home</a></li>\r\n");
        out.write("\t<li><a href=\"search_op.jsp\">Search</a></li>\r\n");
        out.write("\t<li><a href=\"org_details_op.jsp\">Org. Details</a></li>\r\n");
        out.write("\t<li><a href=\"hierarchy_op.jsp\">Hierarchy</a></li>\r\n");
        out.write("</ul>\r\n");
        out.write("</div>\r\n");
        out.write("</div>\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("<div id=\"emp-left-content\"><img src=\"images/male_user.png\" /> <img\r\n");
        out.write("\tsrc=\"images/line1.png\"\r\n");
        out.write(
            "\tstyle=\"margin-top: -80px; margin-left: -20px; height: 175px; width: 200px;\" />\r\n");
        out.write("<br />\r\n");
        out.write("<br />\r\n");
        out.write("<div id=\"lmenu\" style=\"margin-top: -80px; margin-left: 20px;\">\r\n");
        out.write("<ul>\r\n");
        out.write("\r\n");
        out.write("\t<li><a href=\"update_details_op.jsp\"> Update Details</a></li>\r\n");
        out.write("\t<li><a href=\"rfid_out_op.jsp\"> Go out</a></li>\r\n");
        out.write("\t<li><a href=\"account_details_op.jsp\"> Account Details</a></li>\r\n");
        out.write(
            "\t<li><a href=\"#\" onclick=\"alert('You should go out of reader in order to log out');\"> Log out</a></li>\r\n");
        out.write("</ul>\r\n");
        out.write("</div>\r\n");
        out.write("</div>\r\n");
        out.write("<img src=\"images/line.png\"\r\n");
        out.write(
            "\tstyle=\"float: left; margin-left: 70px; margin-top: -420px; height: 550px; width: 200px;\" />\r\n");
        out.write("<div id=\"emp-right-content\">\r\n");
        out.write("<form action=\"http://localhost:8080/TGMC/home_op_out.jsp\" method=\"get\"\r\n");
        out.write("\tonSubmit=\"validate()\" style=\"font-size:20px;\">\r\n");
        while (rs.next()) {

          out.write("\r\n");
          out.write("<table>\r\n");
          out.write("\r\n");
          out.write("\t<tr>\r\n");
          out.write("\t\t<td>Tag Name</td>\r\n");
          out.write("\t\t<td>");
          out.print(rs.getString(1));
          out.write("</td>\r\n");
          out.write("\t</tr>\r\n");
          out.write("\t<tr>\r\n");
          out.write("\t\t<td>Join Date</td>\r\n");
          out.write("\t\t<td>");
          out.print(rs.getString(2));
          out.write("  <br />\r\n");
          out.write("\t\t</td>\r\n");
          out.write("\t</tr>\r\n");
          out.write("\t<tr>\r\n");
          out.write("\t\t<td>Join Time</td>\r\n");
          out.write("\t\t<td>");
          out.print(rs.getString(3));
          out.write("  <br />\r\n");
          out.write("\t\t</td>\r\n");
          out.write("\t</tr>\r\n");
          out.write("\t<tr>\r\n");
          out.write("\t\t<td>Last Log</td>\r\n");
          out.write("\t\t<td>");
          out.print(rs.getString(4));
          out.write("</td>\r\n");
          out.write("\t\t<td>");
          out.print(rs.getString(5));
          out.write(" </td>\r\n");
          out.write("\t</tr>\r\n");
          out.write("\r\n");
          out.write("\t<tr>\r\n");
          out.write("\t\t<td>Employee ID</td>\r\n");
          out.write("\t\t<td>");
          out.print(rs.getString("empid"));
          out.write("</td>\r\n");
          out.write("\t\t\r\n");
          out.write("\t</tr>\r\n");
          out.write("\r\n");
          out.write("You have worked for ");
          out.print(rs.getString("nohr"));
          out.write(" hours and ");
          out.print(rs.getString("nomin"));
          out.write(" minutes\r\n");
          out.write("\r\n");
          out.write("\r\n");
          out.write("\t\r\n");
          out.write("\t\r\n");
          out.write(
              "\t<tr><td colspan=\"4\"><center><input type=\"submit\" value=\"OK\" style=\"background-color: #5C92E9; color: #fff;\" /></center></td></tr>\r\n");
          out.write("\r\n");
          out.write("</table>\r\n");
        }
      } catch (Exception e) {
        out.print(e);
      }
      out.write("\r\n");
      out.write("</form>\r\n");
      out.write("</div>\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            out.clearBuffer();
          } catch (java.io.IOException e) {
          }
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }