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

📄 stat.java

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

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Stat {

	public int StatInM(Connection conn,Date d1,Date d2){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(intprince*innum) from inshopping where intime>=? and intime<=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatInbackM(Connection conn,Date d1,Date d2){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(inprince*ionum) from inbackshopping where iotime>=? and iotime<=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatOutbackM(Connection conn,Date d1,Date d2){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(oiprince*oinum) from sellbackshopping where oitime>=? and oitime<=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatOutM(Connection conn,Date d1,Date d2){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(outprince*outnum) from sellshopping where outtime>=? and outtime<=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatRejectM(Connection conn,Date d1,Date d2){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(bprince*bnum) from rejectshopping where btime>=? and btime<=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	
	public int StatInM(Connection conn,Date d1,Date d2,String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(intprince*innum) from inshopping where intime>=? and intime<=? and sid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatInbackM(Connection conn,Date d1,Date d2,String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(inprince*ionum) from inbackshopping where iotime>=? and iotime<=? and sid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatOutbackM(Connection conn,Date d1,Date d2,String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(oiprince*oinum) from sellbackshopping where oitime>=? and oitime<=? and gid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatOutM(Connection conn,Date d1,Date d2,String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(outprince*outnum) from sellshopping where outtime>=? and outtime<=? and sid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatRejectM(Connection conn,Date d1,Date d2, String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(bprince*bnum) from rejectshopping where btime>=? and btime<=? and sid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	
	public int StatInN(Connection conn,Date d1,Date d2,String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(innum) from inshopping where intime>=? and intime<=? and sid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatInbackN(Connection conn,Date d1,Date d2,String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(ionum) from inbackshopping where iotime>=? and iotime<=? and sid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatOutbackN(Connection conn,Date d1,Date d2,String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(oinum) from sellbackshopping where oitime>=? and oitime<=? and gid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatOutN(Connection conn,Date d1,Date d2,String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(outnum) from sellshopping where outtime>=? and outtime<=? and sid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatRejectN(Connection conn,Date d1,Date d2, String sid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(bnum) from rejectshopping where btime>=? and btime<=? and sid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, sid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
	
	public int StatByYid(Connection conn,Date d1,Date d2,String yid){
		int i=0;
		PreparedStatement pstm=null;
		ResultSet rs=null;
		String sql="select sum(outprince*outnum) from sellshopping where outtime>=? and outtime<=? and yid=?";
		try {
			pstm=conn.prepareStatement(sql);
			pstm.setDate(1, d1);
			pstm.setDate(2, d2);
			pstm.setString(3, yid);
			rs=pstm.executeQuery();
			if(rs.next()){
				i=rs.getInt(1);
			}else{
				i=0;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rs!=null)
					rs.close();
				if(pstm!=null)
					pstm.close();
				if(conn!=null)
					conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		return i;
	}
		
	
}

⌨️ 快捷键说明

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