数据库课程设计商品销售管理系统.docx

上传人:b****8 文档编号:9367088 上传时间:2023-02-04 格式:DOCX 页数:33 大小:74.82KB
下载 相关 举报
数据库课程设计商品销售管理系统.docx_第1页
第1页 / 共33页
数据库课程设计商品销售管理系统.docx_第2页
第2页 / 共33页
数据库课程设计商品销售管理系统.docx_第3页
第3页 / 共33页
数据库课程设计商品销售管理系统.docx_第4页
第4页 / 共33页
数据库课程设计商品销售管理系统.docx_第5页
第5页 / 共33页
点击查看更多>>
下载资源
资源描述

数据库课程设计商品销售管理系统.docx

《数据库课程设计商品销售管理系统.docx》由会员分享,可在线阅读,更多相关《数据库课程设计商品销售管理系统.docx(33页珍藏版)》请在冰豆网上搜索。

数据库课程设计商品销售管理系统.docx

数据库课程设计商品销售管理系统

importjava.awt.event.*;

importjava.awt.*;

importjavax.swing.*;

importjava.sql.*;

importjavax.swing.table.AbstractTableModel;

publicclassLoginBackPanelextendsJFrameimplementsActionListener{

privatestaticfinallongserialVersionUID=1L;

JButtonbutton1,button2;

JTextFieldF1;

Choicec;

Containerct=getContentPane();     

publicLoginBackPanel(Stringstr){

super(str);

setBak();                 

JPanelpanel=newJPanel();        

panel.setOpaque(false);           

ct.add(panel);         

panel.setLayout(newFlowLayout(FlowLayout.CENTER,60,20));

c=newChoice();

c.add("  Boss ");

c.add("  Salesman");

JLabelJ1=newJLabel("验证身份:

");

JLabelJ2=newJLabel("登录密码:

");

F1=newJTextField(9);

button1=newJButton("登录");

button2=newJButton("退出");

button1.addActionListener(this);

button2.addActionListener(this);

panel.add(J1);

panel.add(c);

panel.add(J2);

panel.add(F1);

panel.add(button1);

panel.add(button2);

add(panel);

}

publicvoidsetBak(){                //设置背景方法

((JPanel)this.getContentPane()).setOpaque(false);

ImageIconimg=newImageIcon("e:

//数据库课程设计//六月物语.jpg");

JLabelbackground=newJLabel(img);

this.getLayeredPane().add(background,newInteger(Integer.MIN_VALUE));

background.setBounds(0,0,img.getIconWidth(),img.getIconHeight());

}

publicvoidactionPerformed(ActionEvente){

if(e.getSource()==button1){

if(c.getSelectedItem().equals("  Boss ")&&F1.getText().equals("boss")){

this.dispose();

BSbs=newBS("管理员界面");

bs.setSize(500,250);

bs.setLocation(450,250);

bs.setVisible(true);

}

if(c.getSelectedItem().equals("  Salesman")&&F1.getText().equals("salesman")){

this.dispose();

SLsl=newSL("销售员界面");

sl.setSize(500,250);

sl.setLocation(450,250);

sl.setVisible(true);

}

}

if(e.getSource()==button2){

System.exit(0);

}

}

publicstaticvoidmain(String[]args){

LoginBackPanellgp=newLoginBackPanel("管理系统登录");

lgp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

lgp.setSize(300,200);

lgp.setLocation(550,250);

lgp.setVisible(true);

}

}

classBSextendsJFrameimplementsActionListener{

JButtonB1,B2,B3,B4,B5,B6,B7;

Containerct=getContentPane(); 

publicBS(Stringstr){

super(str);

setBak();                

JPanelJP=newJPanel();        

JP.setOpaque(false);           

ct.add(JP);

JP.setLayout(newFlowLayout(FlowLayout.CENTER,30,50));

B1=newJButton("销售情况");

B2=newJButton("客户退货");

B3=newJButton("销售收款");

B4=newJButton("客户信息");

B5=newJButton("员工管理");

B6=newJButton("进货信息");

B7=newJButton("更换角色");

B1.addActionListener(this);

B2.addActionListener(this);

B3.addActionListener(this);

B4.addActionListener(this);

B5.addActionListener(this);

B6.addActionListener(this);

B7.addActionListener(this);

JP.add(B1);

JP.add(B2);

JP.add(B3);

JP.add(B4);

JP.add(B5);

JP.add(B6);

JP.add(B7);

add(JP);    

}

publicvoidsetBak(){           

((JPanel)this.getContentPane()).setOpaque(false);

ImageIconimg=newImageIcon("e:

//数据库课程设计//六月物语1.jpg");

JLabelbackground=newJLabel(img);

this.getLayeredPane().add(background,newInteger(Integer.MIN_VALUE));

background.setBounds(0,0,img.getIconWidth(),img.getIconHeight());

}

publicvoidactionPerformed(ActionEvente){

if(e.getSource()==B1){

this.dispose();

CXFPXXcxfpxx=newCXFPXX("日常销售—【发票情况】");

cxfpxx.setSize(700,300);

cxfpxx.setLocation(350,250);

cxfpxx.setVisible(true);

}

if(e.getSource()==B2){

this.dispose();

XSTHXXxsthxx=newXSTHXX("日常销售—【销售退货】");

xsthxx.setSize(700,300);

xsthxx.setLocation(350,250);

xsthxx.setVisible(true);

}

if(e.getSource()==B3){

this.dispose();

XSXXCXxsxxcx=newXSXXCX("日常销售—【销售收款】");

xsxxcx.setSize(700,300);

xsxxcx.setLocation(350,250);

xsxxcx.setVisible(true);

}

if(e.getSource()==B4){

this.dispose();

HYXXCXhyxxcx=newHYXXCX("基本信息管理—【会员信息】");

hyxxcx.setSize(700,300);

hyxxcx.setLocation(350,250);

hyxxcx.setVisible(true);

}

if(e.getSource()==B5){

this.dispose();

YGGLyggl=newYGGL("员工管理—【员工信息】");

yggl.setSize(500,200);

yggl.setLocation(450,250);

yggl.setVisible(true);

}

if(e.getSource()==B6){

this.dispose();

JHXXjhxx=newJHXX("商品更新—【进货信息】");

jhxx.setSize(300,150);

jhxx.setLocation(500,250);

jhxx.setVisible(true);

}

if(e.getSource()==B7){

this.dispose();

LoginBackPanelxt=newLoginBackPanel("管理系统登录");

xt.setSize(300,200);

xt.setLocation(550,250);

xt.setVisible(true);

}

}

}

classBG2extendsAbstractTableModel{

Stringrq,ph,mc,bh,dj,sl,je;

finalString[]columnNames={"开票日期","销售票号","商品名称","商品编号","商品单价/元","销售数量/个","销售金额/元"};

Object[][]data=newObject[100][7];

publicBG2(){

intm=0;

Stringurl="jdbc:

microsoft:

sqlserver:

//localhost:

1433;DatabaseName=课程设计";

Connectioncon;

Stringsql;

Statementstmt;

try{

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

}catch(java.lang.ClassNotFoundExceptione){

}

try{

con=DriverManager.getConnection(url,"sa","123456");

stmt=con.createStatement();

sql="SELECT* FROM销售发票";

ResultSetrs=stmt.executeQuery(sql);

while(rs.next()){

rq=rs.getString

(1);

ph=rs.getString

(2);

mc=rs.getString(3);

bh=rs.getString(4);

dj=rs.getString(5);

sl=rs.getString(6);

je=rs.getString(7);

data[m][0]=rq;data[m][1]=ph;data[m][2]=mc;data[m][3]=bh;data[m][4]=dj;data[m][5]=sl;data[m++][6]=je;

}

stmt.close();

con.close();

}catch(SQLExceptione){

System.out.println("0");

}

}

publicintgetColumnCount(){

returncolumnNames.length;

}

publicintgetRowCount(){

returndata.length;

}

publicStringgetColumnName(intcol){

returncolumnNames[col];

}

publicObjectgetValueAt(introw,intcol){

returndata[row][col];

}

publicvoidsetValueAt(Objectvalue,introw,intcol){

intnumRows=getRowCount();

intnumCols=getColumnCount();

for(inti=0;i

for(intj=0;j

System.out.print(""+data[i][j]);

}

}

}

}

classCXFPXXextendsJFrameimplementsActionListener{

BG2bg2;

JTablet;

JButtonb;

JPanelp;

JScrollPanes;

publicCXFPXX(Stringstr){

super(str);

setLayout(newBorderLayout());

b=newJButton("确定");

b.addActionListener(this);

p=newJPanel();

p.add(b);

bg2=newBG2();

t=newJTable(bg2);

s=newJScrollPane(t);

add(s,"Center");

add(p,"South");

}

publicvoidactionPerformed(ActionEvente){

if(e.getSource()==b){

this.dispose();

BScxfpxx=newBS("管理员界面");

cxfpxx.setSize(500,250);

cxfpxx.setLocation(450,250);

cxfpxx.setVisible(true);

}

}

}

classBG3extendsAbstractTableModel{

Stringrq,mc,yy,sl,je;

finalString[]columnNames={"退货日期","商品名称","退货原因","退货数量/件","退货金额/元"};

Object[][]data=newObject[100][5];

publicBG3(){

intm=0;

Stringurl="jdbc:

microsoft:

sqlserver:

//localhost:

1433;DatabaseName=课程设计";

Connectioncon;

Stringsql;

Statementstmt;

try{

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

}catch(java.lang.ClassNotFoundExceptione){

}

try{

con=DriverManager.getConnection(url,"sa","123456");

stmt=con.createStatement();

sql="SELECT* FROM退货记录";

ResultSetrs=stmt.executeQuery(sql);

while(rs.next()){

rq=rs.getString

(1);

mc=rs.getString

(2);

yy=rs.getString(3);

sl=rs.getString(4);

je=rs.getString(5);

data[m][0]=rq;data[m][1]=mc;data[m][2]=yy;data[m][3]=sl;data[m++][4]=je;

}

stmt.close();

con.close();

}catch(SQLExceptione){

System.out.println("0");

}

}

publicintgetColumnCount(){

returncolumnNames.length;

}

publicintgetRowCount(){

returndata.length;

}

publicStringgetColumnName(intcol){

returncolumnNames[col];

}

publicObjectgetValueAt(introw,intcol){

returndata[row][col];

}

publicvoidsetValueAt(Objectvalue,introw,intcol){

intnumRows=getRowCount();

intnumCols=getColumnCount();

for(inti=0;i

for(intj=0;j

System.out.print(""+data[i][j]);

}

}

}

}

classXSTHXXextendsJFrameimplementsActionListener{

BG3bg3;

JTablet;

JButtonb;

JPanelp;

JScrollPanes;

publicXSTHXX(Stringstr){

super(str);

setLayout(newBorderLayout());

b=newJButton("确定");

b.addActionListener(this);

p=newJPanel();

p.add(b);

bg3=newBG3();

t=newJTable(bg3);

s=newJScrollPane(t);

add(s,"Center");

add(p,"South");

}

publicvoidactionPerformed(ActionEvente){

if(e.getSource()==b){

this.dispose();

BScxfpxx=newBS("管理员界面");

cxfpxx.setSize(500,250);

cxfpxx.setLocation(450,250);

cxfpxx.setVisible(true);

}

}

}

classBG4extendsAbstractTableModel{

Stringrq,mc,dj,sl,je;

finalString[]columnNames={"开票日期","商品名称","商品单价/元","销售数量/个","销售金额/元"};

Object[][]data=newObject[100][5];

publicBG4(){

intm=0;

Stringurl="jdbc:

microsoft:

sqlserver:

//localhost:

1433;DatabaseName=课程设计";

Connectioncon;

Stringsql;

Statementstmt;

try{

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

}catch(java.lang.ClassNotFoundExceptione){

}

try{

con=DriverManager.getConnection(url,"sa","123456");

stmt=con.createStatement();

sql="SELECT开票日期,商品名称,[商品单价/元],[销售数量/个],[销售金额/元] FROM销售发票";

ResultSetrs=stmt.executeQuery(sql);

while(rs.next()){

rq=rs.getString

(1);

mc=rs.getString

(2);

dj=rs.getString(3);

sl=rs.getString(4);

je=rs.getString(5);

data[m][0]=rq;data[m][1]=mc;;data[m][2]=dj;data[m][3]=sl;data[m++][4]=je;

}

stmt.close();

con.close();

}catch(SQLExceptione){

System.out.println("0");

}

}

publicintgetColumnCount(){

returncolumnNames.length;

}

publicintgetRowCount(){

returndata.length;

}

publicStringgetColumnName(intcol){

returncolumnNames[col];

}

publicObjectgetValueAt(introw,intcol){

returndata[row][col];

}

publicvoidsetValueAt(Objectvalue,introw,intcol){

intnumRows=getRowCount();

intnumCols=getColumnCount();

for(inti=0;i

for(intj=0;j

System.out.print(""+data[i][j]);

}

}

}

}

classXSXXCXextendsJFrameimplementsActionListener{

BG4bg4;

JTablet;

JButtonb;

JPanelp;

J

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1