⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statbyid.java

📁 是一个企业的进销存系统。账号问1001密码为123456
💻 JAVA
字号:
package com.jxc.servlet.stat;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.jxc.dao.Conn;
import com.jxc.dao.Stat;
import com.jxc.vo.StatM;
import com.jxc.vo.StatN;

public class StatById extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public StatById() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doPost(request, response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		HttpSession session=request.getSession();
		int in=0;
		int inback=0;
		int out=0;
		int reject=0;
		int outback=0;
		int inN=0;
		int inbackN=0;
		int outN=0;
		int rejectN=0;
		int outbackN=0;
		Connection conn1=Conn.getConnection();
		Connection conn2=Conn.getConnection();
		Connection conn3=Conn.getConnection();
		Connection conn4=Conn.getConnection();
		Connection conn5=Conn.getConnection();
		Connection conn6=Conn.getConnection();
		Connection conn7=Conn.getConnection();
		Connection conn8=Conn.getConnection();
		Connection conn9=Conn.getConnection();
		Connection conn0=Conn.getConnection();
		String dd1=request.getParameter("d1");
		String dd2=request.getParameter("d2");
		String sid=request.getParameter("sid");
		java.sql.Date d1=null;
		java.sql.Date d2=null;
		if("".equals(dd1)||"".equals(dd1)){
			session.setAttribute("erro", "null");
			response.sendRedirect("statbyid.jsp");
		}else{
			try {
				d1=java.sql.Date.valueOf(dd1);
				d2=java.sql.Date.valueOf(dd2);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				session.setAttribute("erro", "erro");
				response.sendRedirect("statall.jsp");
				return;
			}
			in=new Stat().StatInM(conn1, d1, d2,sid);
			inback=new Stat().StatInbackM(conn2, d1, d2,sid);
			out=new Stat().StatOutM(conn3, d1, d2,sid);
			outback=new Stat().StatOutbackM(conn4, d1, d2,sid);
			reject=new Stat().StatRejectM(conn5, d1, d2,sid);
			
			inN=new Stat().StatInN(conn6, d1, d2,sid);
			inbackN=new Stat().StatInbackN(conn7, d1, d2,sid);
			outN=new Stat().StatOutN(conn8, d1, d2,sid);
			outbackN=new Stat().StatOutbackN(conn9, d1, d2,sid);
			rejectN=new Stat().StatRejectN(conn0, d1, d2,sid);
			StatM stat=new StatM();
			stat.setIn(in);
			stat.setInback(inback);
			stat.setOut(out);
			stat.setOutback(outback);
			stat.setReject(reject);
			StatN statN=new StatN();
			statN.setIn(inN);
			statN.setInback(inbackN);
			statN.setOut(outN);
			statN.setOutback(outbackN);
			statN.setReject(rejectN);
			
			int li=(out+inback)-(in+reject+outback);
			int liN=(inN)-(outN+rejectN+outbackN+inbackN);
			session.setAttribute("stat", stat);
			session.setAttribute("lirun", li);
			session.setAttribute("statN", statN);
			session.setAttribute("lirunN", liN);
			session.setAttribute("sid", sid);
			response.sendRedirect("statbyid.jsp");
		}
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -