数据库课程设计实验报告-工资管理系统_第1页
数据库课程设计实验报告-工资管理系统_第2页
数据库课程设计实验报告-工资管理系统_第3页
数据库课程设计实验报告-工资管理系统_第4页
数据库课程设计实验报告-工资管理系统_第5页
已阅读5页,还剩23页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

延安大学计算机学院实验报告专用纸实验室: 软件工程实验室 学号: 实验日期: 2013年11月 日姓名班级课程名称数据库系统概论任课教师实验项目名称工资管理系统(课程设计)指导教师实验组别第 组同组者教师评语及成绩:实验成绩: 教师签字: (请按照实验报告的有关要求书写.一般必须包括1.实验目的;2.实验内容;3.实验步骤与方法;4.实验数据与程序清单;5.出现的问题及解决方法;6.实验结果,结果分析与体会等内容.)一.实验目的 (1) 锻炼动手操作能力,以及团队合作意识;(2) 能熟练地运用SQL语句进行各种操作:(3). 掌握Java与SQL server 的连接技术,能将Java知识与数据库的知识熟练掌握并操作:二.实验内容工资管理系统1) 系统功能的基本要求:a) 员工每个工种基本工资的设定b) 加班津贴管理,根据加班时间和类型给予不同的加班津贴;c) 按照不同工种的基本工资情况、员工的考勤情况产生员工的每月的月工资;d) 员工年终奖金的生成,员工的年终奖金计算公式(员工本年度的工资总和津贴的总和)/12;e) 企业工资报表。能够查询单个员工的工资情况、每个部门的工资情况、按月的工资统计,并能够打印;2) 数据库要求:在数据库中至少应该包含下列数据表:a) 员工考勤情况表;b) 员工工种情况表,反映员工的工种、等级,基本工资等信息;c) 员工津贴信息表,反映员工的加班时间,加班类别、加班天数、津贴情况等;d) 员工基本信息表e) 员工月工资表。三.实验步骤与方法第 页, 共 页28(1).需求分析 工资管理信息系统对企业加强工资管理有着极其重要的作用,就一般的大型企业来说,它的设计内容非常复杂而且繁多,比如拥有工资计算功能,工资统计功能,报表输出功能,而且设计的模块也很多,比如工资管理模块,工资统计模块,报表设计模块,打印输出模块,模糊查询模块等等.在做这个管理系统时,我们既咨询了父母又结合了教师等不同行业人士的工资情况,发现该系统受些许因素牵制比如说:公司大小,人员流动性,员工学历等通过我们的了解调查最终总结出系统功能如下:a. 整体结构合理, 模块化结构利于操作.b. 完整的数据输入,输出,维护.c. 拥有不错的自检性,用户输错或误输均有提示.d. 拥有较强的容错性,某个用户的错误操作不会引起系统的瘫痪.e. 程序接口灵活,以便日后操作与维护.f. 在不影响系统功能的前提下,美化操作界面. (2).概念设计E-R图数据流图(3).逻辑设计基本信息(员工编号号,姓名,性别,毕业学校,所学专业,学历,电话,住址,从事岗位).考勤信息表(员工编号,姓名,请假天数,矿工天数,月迟到次数,月份).加班信息表(员工编号,姓名,晚班加班(天),周末加班(天),春节加班(天),节假日加班(天),月份).岗位信息表(员工编号,姓名,从事岗位,基本工资,部门名称). 部门信息表(部门编号,部门名称,部门经理,部门人数) 根据基本表创建了如下视图: 加班津贴(员工编号,姓名,加班薪酬,月份) 缺勤扣除表(员工编号,姓名,扣除工资,月份) 月工资表(员工编号,姓名,基本工资,扣除工资,加班薪酬,实得工资,月份) 年终奖(员工编号,姓名,奖(4).数据字典2.考勤信息表(KQXX)列名(EngliSh)列名数据类型是否空值备注Empno员工编号intNOT NULLForeignkeyLeavedays请假天数intNULLTruancydays旷工天数intNULLLatetimes月迟到次数(t)intNULLThemonth月份intNOT NULL3.加班信息表(OVERTIMEINFORMATION)列名(EngliSh)列名数据类型是否空值备注Empno员工编号intNOT NULLForeignkeyNight晚班加班(天)intNULLWeekend周末加班(天)intNULLFestival节日加班(天)intNULLSpecial春节加班(天)intNULLThemonth月份intNOT NULL4.员工岗位及登录信息表(GWXX)列名(EngliSh)列名数据类型是否空值备注Empno员工编号intNOT NULLForeignkeyJob从事岗位varchar(16)NOT NULLSalary基本工资moneyNOT NULLDept部门名称varchar(16)NOT NULL5.部门信息表(BMXX)列名(EngliSh)列名数据类型是否空值备注Deptno部门编号intNOT NULLPrimarykeyDept部门名称varchar(16)NOT NULLManager部门经理varchar(8)NULLEmpnum部门人数intNULL6.登录信息表(logininformation)列名(EngliSh)列名数据类型是否空值备注Empno员工编号intNOT NULL登录用户名Password密码Varchar(8)NullThegrand权限Varchar(8)Null视图的创建:1).加班津贴表(JBJT)列名(EngliSh)列名数据类型是否空值备注Empno员工编号intNOT NULLEmname姓名varchar(8)NOT NULLOvertimesalary加班薪酬MoneyNULLThemonth月份intNOT NULL2).缺勤扣除表(QQKC)列名(EngliSh)列名数据类型是否空值备注Empno员工编号intNOT NULLEmname姓名varchar(8)NOT NULLDeductions扣除工资MoneyNULLThemonth月份intNOT NULL3).月工资表(SALARY)列名(EngliSh)列名数据类型是否空值备注Empno员工编号intNOT NULLEmname姓名varchar(8)NOT NULLSalary基本工资moneyNOT NULLDeductions扣除工资MoneyNULLOvertimesalary加班薪酬MoneyNULLGainsalary实得工资MoneyNULLThemonth月份intNOT NULL4).年终奖(NZJJ)列名(EngliSh)列名数据类型是否空值备注Empno员工编号intNOT NULLEmname姓名varchar(8)NOT NULLJiangjin奖金moneyNULL(5).系统的实现开发环境:SQL server 2005及eclipse用SQL语言创建数据库2.考勤信息表(KQXX)Create table KQXX(Empno int not null ,Leavedays int null,Truancydays int null,Latetimes int null,Themonth int not null,FOEREIGN KEY Empno REFERENCES JBXX(Empno)1.基本信息表(JBXX)Create table JBXX(Empno int not null primarykey, Emname varchar(8) not null,Sex char(2) check(Sex= 男or Sex=女),School varchar(20) null,Profession varchar(20) null,Education varchar(6) null,Phone char(11) null,Address varchar(15) null)3.加班信息表(OVERTIMEINFORMATION)4.员工岗位及登录信息表(GWXX)Create table GWXX(Empno int not null ,Job varchar(16) not null, Salary money not null,Dept varchar(16) not null,FOEREIGN KEY Empno REFERENCES JBXX(Empno)Create table OVERTIMEINFORMATION(Empno int not null ,Night int null,Weekend int null,Festival int null,Special int null,Themonth int not null,FOEREIGN KEY Empno REFERENCES JBXX(Empno)5.部门信息表(BMXX)6.登录信息表(logininformation)Create table logininformation(Empno int not null ,Password Varchar(8) null ,Thegrand Varchar(8) null)Create table BMXX(Deptno int not null primary key,Dept varchar(16) not null,Manager varchar(8) null,Empnum int null)1).加班津贴表(JBJT)Create view JBJT(Empno, Emname, Overtimesalary,Themonth)Asselect JBXX.Empno,JBXX.Emname,night*70+weekend*80+festival*140+special*210, Themonthfrom OVERTIMEINFORMATION,JBXXwhere OVERTIMEINFORMATION.Empno =JBXX.Empno2).缺勤扣除表(QQKC)Create view QQKC(Empno, Emname, Deductions, Themonth)Asselect JBXX.Empno, JBXX.Emname, Truancydays *80+Leavedays*40+Latetimes*10, Themonth from KQXX, JBXXwhere JBXX.Empno=KQXX.Empno3).月工资表(SALARY)Create view SALARY2(Empno, Emname, Salary, Deductions, Overtimesalary ,Gainsalary,Themonth)Asselect distinct JBXX.Empno, JBXX.Emname, GWXX .Salary, Deductions, Overtimesalary, GWXX .Salary+ Overtimesalary- Deductions , QQKC.Themonthfrom KQXX,GWXX,QQKC,JBJT,JBXX,OVERTIMEINFORMATIONwhere QQKC.Empno= JBJT.Empno and GWXX .Empno= JBXX.Empno and OVERTIMEINFORMATION.Empno=QQKC.Empno and QQKC.Empno=JBXX.Empno and KQXX. Themonth=OVERTIMEINFORMATION. Themonth and JBXX.Empno=KQXX.Empno and QQKC.Emname=JBJT.Emname and JBJT.Emname=JBXX.Emname4).年终奖(NZJJ)Create view NZJJ(Empno,Emname,jiangjin) AsSelect JBXX.Empno,JBXX.Emname,(sum(SALARY.Gainsalary)+sum(SALARY.Overtimesalary)/12From KQXX ,JBJT,JBXX,SALARY,OVERTIMEINFORMATIONGroup by JBXX.Empno,JBXX.Emname,SALARY. Empnohaving JBXX.Empno= SALARY. Empno and JBXX.Empno =SALARY. Empno 在eclipse中连接SQL server数据库编写界面设计的代码运行系统与检验,调试系统四.实验数据与程序清单Connection连接代码import java.sql.*;public class connection public static void main(String srg) String driverName = com.microsoft.sqlserver.jdbc.SQLServerDriver; /加载JDBC驱动 String dbURL = jdbc:sqlserver:/localhost:1433; DatabaseName=工资管理系统(1); /连接服务器和数据库sample String user = sa; /默认用户名 String pass = 7757xiong; /密码 Connection Con = null; try Class.forName(driverName); Con = DriverManager.getConnection(dbURL, user, pass); System.out.println(数据库连接成功!); catch (Exception e) System.out.println(数据库连接失败!); e.printStackTrace(); finallytry Con.close(); catch (SQLException e) / TODO Auto-generated catch blocke.printStackTrace(); 系统进入欢迎界面import java.awt.*;import java.awt.event.*;import javax.swing.*;class DB extends JFrame implements ActionListener JFrame frame = new JFrame(欢迎进入企业工资管理系统);JLabel label = new JLabel(, JLabel.CENTER);JButton button1 = new JButton(进入系统);JButton button2 = new JButton(退出系统);ImageIcon im = new ImageIcon(1.jpg);JLabel a1 = new JLabel(im);void Create() JPanel pcontentPane = (JPanel) frame.getContentPane();pcontentPane.add(a1);pcontentPane.add(label);pcontentPane.setLayout(new FlowLayout();pcontentPane.add(button1);pcontentPane.add(button2);pcontentPane.setVisible(true);button1.addActionListener(this);button2.addActionListener(this);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setBounds(200, 100, 550, 230);frame.setVisible(true);public static void main(String args) DB dome = new DB();dome.Create();public void actionPerformed(ActionEvent e) if (button1.equals(e.getSource() 用户登录 dl = new 用户登录();dl.create();frame.dispose();if (button2.equals(e.getSource() / 退出System.exit(0);登陆界面import java.awt.Color;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.Statement;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;/*-用户与管理员登录-*/class 用户登录 extends JFrame implements ActionListener ImageIcon im = new ImageIcon(2.jpg);JLabel a2 = new JLabel(im);JFrame frame = new JFrame(职工/管理员登陆);JLabel label1 = new JLabel(用户名);JLabel label2 = new JLabel(密码);JButton logonButton1 = new JButton(管理员登录);JButton logonButton2 = new JButton(职工登录);JButton cancelButton = new JButton(退出);JTextField username = new JTextField(9);JPasswordField password = new JPasswordField(9);static String t1;static String t2;void create() JPanel p = (JPanel) frame.getContentPane();JPanel p1 = new JPanel();p.setLayout(new FlowLayout();p.add(a2);p.add(label1);p.setSize(5, 5);p.setLocation(4, 8);p.add(username);p.setSize(100, 200);p.setLocation(800, 800);p.add(label2);p.setSize(50, 20);p.setLocation(40, 80);p.add(password);p.setSize(100, 20);p.setLocation(80, 120);p.add(logonButton1);p.add(logonButton2);p.add(cancelButton);p.setBackground(Color.yellow);p.setVisible(true);logonButton1.addActionListener(this);logonButton2.addActionListener(this);cancelButton.addActionListener(this);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setBounds(200, 100, 500, 260);frame.setVisible(true);public void actionPerformed(ActionEvent e) t1 = username.getText();t2 = password.getText();if(e.getSource()=logonButton1)if( username.getText().equals(admin) = true& (password.getText().equals(admin) = true) JOptionPane.showMessageDialog(this, 登录成功!);GZGLZJM gz = new GZGLZJM();gz.create();frame.dispose(); else JOptionPane.showMessageDialog(null, 输入用户名或密码错误!);if (e.getSource()=logonButton2)try Connection con;Statement ps;ResultSet rs;String sql = null;Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver);String url=jdbc:sqlserver:/localhost:1433; DatabaseName=工资管理系统(1);String user=sa;String pass=7757xiong;con=DriverManager.getConnection(url,user,pass);sql=select * from logininformation where Empno=+t1+ and password=+t2+;Statement sta = con.createStatement();rs=sta.executeQuery(sql);if(rs.next()if(rs.getString(Empno).equals(t1) & rs.getString(password).equals(t2)YGDLJM yg = new YGDLJM();yg.create();frame.dispose();JOptionPane.showMessageDialog(this, 登录成功!);this.dispose();else JOptionPane.showMessageDialog(this, 输入用户名或密码错误!);catch (Exception e1) / TODO Auto-generated catch blocke1.printStackTrace();if (cancelButton.equals(e.getSource() / 退出System.exit(0);管理员可管理选项import java.awt.Color;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;class GZGLZJM extends JFrame implements ActionListener JFrame f = new JFrame(工资管理系统);/*-跳转页面-*/JButton b1 = new JButton(工资管理);JButton b2 = new JButton(员工信息管理);JButton b3 = new JButton(返回);ImageIcon im = new ImageIcon(3.jpg);JLabel a1 = new JLabel(im);void create() JPanel p = (JPanel) f.getContentPane();p.setLayout(new FlowLayout();p.add(a1);p.add(b1);p.add(b2);p.add(b3);p.setBackground(Color.yellow);p.setVisible(true);b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);f.setBounds(200, 100, 500, 200);f.setVisible(true);public void actionPerformed(ActionEvent e) if (b3.equals(e.getSource() / 返回用户登录 d = new 用户登录();d.create();f.dispose();if (b2.equals(e.getSource() / 员工信息管理YGGL yg = new YGGL();yg.create();f.dispose();if (b1.equals(e.getSource() / 工资管理GZGL gz = new GZGL();gz.create();f.dispose();员工基本信息管理import java.awt.Color;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JSplitPane;import javax.swing.JTable;import javax.swing.JTextField;public class YGGL extends JFrame implements ActionListener /*-员工信息管理-*/JFrame f = new JFrame(员工信息管理);JButton b1 = new JButton(添加新员工);JButton b2 = new JButton(修改);JButton b3 = new JButton(删除);JButton b4 = new JButton(查询所有);JButton b5 = new JButton(返回);JTextField tf1 = new JTextField(4);JTextField tf2 = new JTextField(4);JTextField tf3 = new JTextField(4);JTextField tf4 = new JTextField(4);JTextField tf5 = new JTextField(4);JTextField tf6 = new JTextField(4);JTextField tf7 = new JTextField(4);JTextField tf8 = new JTextField(4);JTextField tf9 = new JTextField(4);JTextField tf10 = new JTextField(4);JTextField tf11 = new JTextField(4);JTextField tf12 = new JTextField(4);JTextField tf13 = new JTextField(4);JTextField tf14 = new JTextField(4);String cloum = 编号, 姓名, 性别, 学校,专业,学历,电话,住址,岗位,基本工资,部门,密码;Object row = new Object5012;JTable table = new JTable(row, cloum);JScrollPane scrollpane = new JScrollPane(table);JSplitPane splitpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);void create() JPanel p = (JPanel) f.getContentPane();p.setLayout(new FlowLayout();p.add(scrollpane);p.add(splitpane);JPanel p1 = new JPanel();p1.add(b1);p1.add(b2);p1.add(b3);p1.add(b4);p1.add(b5);JPanel p2 = new JPanel();p2.setBackground(Color.yellow);p2.add(scrollpane);p.setLayout(new FlowLayout();p.add(new JLabel();p.add(new JLabel(编号);p.add(tf1);p.add(new JLabel(姓名);p.add(tf2);p.add(new JLabel(性别);p.add(tf3);p.add(new JLabel(毕业学校);p.add(tf4);p.add(new JLabel(所学专业);p.add(tf5);p.add(new JLabel(学历);p.add(tf6);p.add(new JLabel(电话 );p.add(tf7);p.add(new JLabel(住址);p.add(tf8);p.add(new JLabel(岗位);p.add(tf9);p.add(new JLabel(基本工资);p.add(tf10);p.add(new JLabel(部门名称);p.add(tf11);p.add(new JLabel(登录密码);p.add(tf12);p.add(new JLabel(权限);p.add(tf13);p.add(new JLabel(输入员工编号点击查询/删除);p.add(tf14);/splitpane.add(p1, splitpane.TOP);splitpane.add(p1, splitpane.TOP);splitpane.add(p2, splitpane.BOTTOM);splitpane.setDividerLocation(50);p.setBackground(Color.GREEN);b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);b4.addActionListener(this);b5.addActionListener(this);f.setBounds(200, 100, 530, 630);f.setResizable(true);/ 可以调整界面大小f.setVisible(true);public void actionPerformed(ActionEvent e) /*- 添加新员工信息-*/if (b1.equals(e.getSource() Connection con;Statement sql;try Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver); catch (ClassNotFoundException e1) JOptionPane.showMessageDialog(this, 连接数据库失败!);try String url=jdbc:sqlserver:/localhost:1433; DatabaseName=工资管理系统(1);String user=sa;String pass=7757xiong;con=DriverManager.getConnection(url,user,pass);sql = con.createStatement();String insertStr = INSERT INTO JBXX (Empno,Emname,Sex,School,Profession,Education,Phone,Address)VALUES(+tf1.getText()+,+tf2.getText()+, +tf3.getText()+,+tf4.getText()+,+tf5.getText()+,+tf6.getText()+,+tf7.getText()+,+tf8.getText()+);sql.executeUpdate(insertStr);String insertStr1 = INSERT INTO GWXX (Empno,Job,Salary,Dept)VALUES(+tf1.getText()+,+tf9.getText()+,+tf10.getText()+,+tf11.getText()+);sql.executeUpdate(insertStr1);String insertStr2 = INSERT INTO logininformation (Empno,password,Thegrant)VALUES(+tf1.getText()+,+tf12.getText()+,+tf13.getText()+);sql.executeUpdate(insertStr2);JOptionPane.showMessageDialog(this, 添加成功!);con.close(); catch (SQLException e1) JOptionPane.showMessageDialog(this, 添加失败!);if (b2.equals(e.getSource() /*- 修改员工信息 -*/Connection con;Statement sql;try Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver); catch (ClassNotFoundException e1) JOptionPane.showMessageDialog(this, 连接数据库失败!);try String url=jdbc:sqlserver:/localhost:1433; DatabaseName=工资管理

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论