收藏 分销(赏)

超市收银管理系统设计.doc

上传人:天**** 文档编号:3677061 上传时间:2024-07-13 格式:DOC 页数:27 大小:1.27MB
下载 相关 举报
超市收银管理系统设计.doc_第1页
第1页 / 共27页
超市收银管理系统设计.doc_第2页
第2页 / 共27页
超市收银管理系统设计.doc_第3页
第3页 / 共27页
超市收银管理系统设计.doc_第4页
第4页 / 共27页
超市收银管理系统设计.doc_第5页
第5页 / 共27页
点击查看更多>>
资源描述

1、数据库课程设计学 号: 课 程 设 计题 目超市收银管理系统的设计与实现学 院计算机科学与技术专 业班 级姓 名指导教师唐祖锴2013年01月08日目 录摘要 1第一章 绪论 2第二章 需求分析 4 2.1、数据库基本信息 4 2.2 系统的功能 4第三章 数据分析与建模 5 3.1、数据分析 5 3.2、数据模型 5第四章 数据库建立 6 4.1、数据库表的建立 6 4.2、数据库E-R图和关系图的建立 8第五章 数据库应用开发 10 5.1、数据库实时数据 10 5.2、数据库存储过程 11 5.3、数据库触发器 13 5.4、VB前台程序设计 14 5.5、功能操作说明 25第六章 结论

2、与体会 26 致谢 26参考文献 27摘要【摘要】选课系统是针对社会中一些小型超市使用,从消费者的角度来说,结账时应该准确和快速,毕竟时间就金钱。由于传统的超市收银管理给顾客和店主带来很多不便,针对这方面的缺陷,团队开发这个系统可以方便快捷查出顾客结账情况,商品信息情况,每天的售货情况。方便了对超市商品管理、人员管理。大大提高了超市销售速度。进而加速了社会的发展速度,提高了人民的生活水平。本系统还可以给顾客和超市节约更多时间,加快了超市的运转速度。关键词:VB;小型超市收银管理系统;SQL Server 2000AbstractShop-sale- system is aims at in t

3、he school student and the teacher uses, said from students angle, as a result of the school teaching system reform, now the majority of institutions of higher learning started to implement is the student independently chooses the class pattern, the traditional educational model (student to attend cl

4、ass according to curriculum which school arranged) already cannot adapt the new teaching method, if still chose the class through the paper on way, on the one hand wasted massive manpower, physical resource resources, on the other hand wasted the time as well as situation and so on mistake which ine

5、vitably appeared in the artificial statistical process. Along with universities population increasing, this kind of malpractice can more and more many expositions. Therefore, student so long as inputs own in front of the computer candidate class information then to complete the original several time

6、 of work requirements. Said from teachers angle that, similarly has saved the massive work loads, because the teacher proposed served as a substitute teacher the application to complete the work which the curriculum issued to compare the student to choose the class to say even more complex, therefor

7、e through on-line carried on the curriculum to send the Puneng nationality large scale reduction teachers work load, reduced the wrong occurrence probability. As teacher, also so long as operates through own computer then, does not need to rush about again between the school administration office an

8、d the office.【关键词】 小型超市收银管理系统一、绪论 本系统编写目的在于研究城乡式的小型超市销售管理系统软件的可行途径和使用方法。21世纪,超市的竞争也进入到了一个全新的领域,竞争已不再是规模的竞争,而是技术的竞争、管理的竞争、人才的竞争。技术的提升和管理的升级是超市业的竞争核心。零售领域目前呈多元发展趋势,多种业态:超市、仓储店、便利店、特许加盟店、专卖店、货仓等相互并存。如何在激烈的竞争中扩大销售额、降低经营成本、扩大经营规模,成为超市营业者努力追求的目标。 为了提高物资管理的水平和工作效率,尽可能杜绝商品流通中各环节中可能出现的资金流失不明现象,商品进销存领域迫切需要引入信

9、息系统来加以管理。而商品销售管理系统是当前应用于超市或者公司管理系统的典型代表。 本组设计的超市销售管理系统主要完成的功能有:商品基本信息维护、人员管理信息维护、销售管理等,以及这一系列过程中涉及商品的数据修改、查询统计、删除等多种操作。此外,具有很多的优点,其中包括易于使用,熟悉的界面,高严谨及较低的内存空间战胜。本系统的开发使用的是方式来开发数据库。要使用这种访问方式,必须在工程里面引用Microsoft ActiveX Data Objects库。使用本系统大大提高超市的运作效率;通过全面的信息采集和处理,辅助提高超市的决策水平;还可以迅速提升超市的管理水平,为降低经营成本,提高效益,增

10、强超市扩张力,提供有效的技术保障。二、需求分析2.1、数据库基本信息(1) 销售员工表(2) 商品表(3) 销售表(4) 登录表 2.2、系统的功能(1) 添加员工、商品等基本信息如可添加每个员工的职工号、姓名、性别、用户类型;(2) 查询员工、商品的信息和查询商品销售情况,查询的原理是首先在系统库内销售员工表、商品表、销售表都有自己的主码信息,若没有,则必须通过添加功能模块来给系统添加它们信息。然后根据此唯一特性来查出它们的所有信息。例如在商品表界面中,只要我们输入商品号,然后单击查询按钮,就可以出此商品的商品名称、商品类型、库存量和厂商即产地。(3) 删除员工、商品表、销售表的基本信息,根

11、据其主码,查询出此商品的信息,然后删除它们所包含的所有信息。(4) 修改员工、商品表、销售表的基本信息,通过根据它们的主码号,查出它们的基本信息,然后根据需要对其作出相应的信息进行修改。(5) 对于登录表,其有三个功能:注册、登陆、退出;有两个字段:用户名、密码。注册实质上就是向登录表内插入用户信息。如:在登陆界面的用户名窗口中输入“罗春”,在密码窗口内输入“123”,再点击“注册”按钮,此时,系统会告诉:“注册成功”。这时,你就可以看见登录表中有一条信息:用户名:罗春,密码123。这就是注册的效果。然后通过登录按钮进入系统。 三、数据分析与建模3.1、数据分析 小型超市收银管理系统是一个针对

12、超市收银员管理的一个简单系统。数据库中主要含有四张表,登陆表中字段有用户名,密码。销售表中字段有销售号、职工号、商品号、销售时间、销售数量。销售员工表:职工号、姓名、性别、用户类型。商品表:商品号、商品名称、商品类型、单价、库存量、厂商。3.2、 数据建模 小型超市收银管理系统登陆表销售表销售员工表商品表登录注册退出查询添加删除退出查询添加退出删除查询删除添加退出 四、数据库建立4.1、数据库中表的建立通过对数据库德数据分析阐述出系统中表的信息如下: 登陆表:用户名、密码 销售表:销售号、职工号、商品号、销售时间、销售数量 小型超市收银管理系统 销售员工表:职工号、姓名、性别、用户类型 商品表

13、:商品号、商品名称、商品类型、单价、库存量、厂商 (登录表) (商品表) (销售人员表) (销售表)4.2、数据库中E-R图和关系图的建立由上述表的信息得出E-R图如下(1) 登陆表登陆表用户名密码(2)销售员工表销售员工表职工号姓名性别用户类型(3)销售表销售表销售号职工号商品号销售时间销售数量(4)商品表商品表商品号厂商单价库存量商品类型商品名称(5)各实体E-R图销售表销售数量销售号职工号商品号销售时间销售员工表决定用户类型姓名性别职工号商品表决定商品号商品名称商品类型单价厂商库存量登陆表用户名密码登陆(6)关系图五、数据库应用和开发5.1、数据库中实时数据(1)商品表中的实时数据(2)

14、销售表中的实时数据(3)登陆表中的实时数据(4)销售员工表中的实时数据5.2、数据库中存储过程源码(1) 商品表删除CREATE PROCEDURE spb_deletesph varchar(50),flag int outputasif exists(select *from 商品表 where 商品号=sph and 库存量=0)begindelete from 商品表 where 商品号=sph and 库存量=0set flag=0endelse set flag=1GO(2) 商品表插入CREATE PROCEDURE spb_insertsph varchar(50),spmc

15、varchar(50),splx varchar(50),dj float,kcl char(10),cs varchar(50)asinsert into 商品表 (商品号,商品名称,库存量,商品类型,厂商,单价)values (sph,spmc,kcl,splx,cs,dj)GO(3) 商品表修改CREATE PROCEDURE spb_updatesph varchar(50),spmc varchar(50),kcl char(50),dj float ,splx varchar(50),cs varchar (50)asdelete xs where 商品号=sphinsert in

16、to 商品表(商品号,商品名称,库存量,单价 ,商品类型,厂商)values (sph,spmc,kcl,dj,splx,cs)GO(4) 销售表插入CREATE PROCEDURE xsb_insertxsh varchar(50),zgh varchar(50),sph varchar(50),xssl float,xssj datetime,flag int output asset flag=(select 库存量 from 商品表 where 商品号=sph)if flag0begin insert into 销售表(销售号,职工号,商品号,销售数量,销售时间) values (xs

17、h,zgh,sph,xssl,xssj)endelse set flag=0GO(5) 员工表插入CREATE PROCEDURE ygb_insertzgh varchar(50),xm char(8),xb char(8),yhlx varchar(50)asinsert into 销售人员表 (职工号,姓名,性别,用户类型)values (zgh,xm,xb,yhlx)GO5.3、数据库中触发器源码(1) 销售表添加触发器CREATE TRIGGER xsb1_insert ON 销售表 FOR INSERTasbegin update 销售表 set 销售数量=销售数量+1where

18、销售表.销售号 in (select inserted.销售号 from inserted)update 商品表 set 库存量=库存量-1where 商品表.商品号 in (select inserted.商品号 from inserted)end(2) 销售表删除触发器(3) CREATE TRIGGER xsb1_delete ON 销售表 (4) FOR DELETE (5) AS(6) begin (7) update 销售表 set 销售数量=销售数量-1(8) where 销售表.销售号 in (select 销售表.销售号 from deleted )(9) update 商品

19、表 set 库存量=库存量+1(10) where 商品表.商品号 in (select 商品表 .销售号 from deleted )(11) end5.4、VB前台程序设计源码(1) 登陆界面源码Dim cn As New ADODB.ConnectionDim rs As New ADODB.RecordsetPrivate Sub Command1_Click()strsql = select * from 登录表 where 用户名= & Text1.Text & & and 密码= & Text2.Text & rs.Open strsql, cn, 1, 3If rs.EOF T

20、henMsgBox 用户名或密码错了, 32, 警告ElseForm5.ShowUnload MeEnd IfEnd SubPrivate Sub Command2_Click() EndEnd SubPrivate Sub Image1_Click()End SubPrivate Sub 注册_Click()If Text1.Text = Or Text2.Text = ThenMsgBox 用户名和密码不能为空, 16 + 4, 警告ElseDim rs As New ADODB.Recordsetstr1 = select * from 登录表 where 用户名= & Text1.Te

21、xt & rs.Open str1, cn, 1, 3rs.AddNewrs(用户名) = Text1.Textrs(密码) = Text2.Textrs.UpdateMsgBox 注册成功, 64, 信息提示End IfEnd SubPrivate Sub Form_Load()cn.ConnectionString = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=超市管理cn.OpenEnd Sub(2)商品表界面源代码Public cn As New AD

22、ODB.ConnectionPublic rs As New ADODB.RecordsetPrivate Sub Command1_Click()str1 = select * from 商品表 where 商品号= & Text1.Text & If rs.State = 1 Thenrs.CloseEnd Ifrs.Open str1, cn, 1, 3If rs.EOF Then MsgBox 该商品不存在 Adodc1.CommandType = adCmdText Adodc1.RecordSource = str1 Adodc1.Refresh Else Text1.Text =

23、 rs(商品号)Text2.Text = rs(商品名称)Text3.Text = rs(库存量)Text4.Text = rs(商品类型)Text5.Text = rs(厂商)Text6.Text = rs(单价) End IfEnd SubPrivate Sub Command2_Click()str1 = select * from 商品表 where 商品号= & Text1.Text & If rs.State = 1 Thenrs.CloseEnd Ifrs.Open str1, cn, 1, 3If rs.EOF Then rs.AddNew rs(商品号) = Text1.Te

24、xt rs(商品名称) = Text2.Text rs(库存量) = Text3.Text rs(商品类型) = Text4.Text rs(厂商) = Text5.Text rs(单价) = Text6.Text rs.Update MsgBox 数据添加成功, 64, 信息提示 Adodc1.CommandType = adCmdText Adodc1.RecordSource = select * from 商品表 Adodc1.Refresh Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.T

25、ext = Else MsgBox 该商品已经存在了, 16, 警告 End If End SubPrivate Sub Command3_Click()Form5.ShowUnload MeEnd SubPrivate Sub Command4_Click()Dim rs As New ADODB.RecordsetDim rs1 As New ADODB.RecordsetIf rs.State = 1 Thenrs.CloseEnd If If rs1.State = 1 Thenrs1.CloseEnd Ifrs1.Open select * from 商品表 where 商品号= &

26、 Text1.Text & and 商品名称= & Text2.Text & , cn, 1, 3If rs1.EOF ThenMsgBox 没有此种商品不能删除!Elsers.Open delete 商品表 where 商品号= & Text1.Text & and 商品名称= & Text2.Text & , cn, 1, 3MsgBox 确定删除吗, 32 + 4, 警告 Adodc1.CommandType = adCmdText Adodc1.RecordSource = select * from 商品表 Adodc1.Refresh End If Text1.Text = Tex

27、t2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = End SubPrivate Sub DataGrid1_Click()If Adodc1.Recordset.RecordCount = 0 ThenMsgBox 当前表是空表, 16, 信息提示ElseText1.Text = Adodc1.Recordset.Fields(0)Text2.Text = Adodc1.Recordset.Fields(1)End IfEnd SubPrivate Sub Form_Load()cn.ConnectionString =

28、 Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=超市管理cn.OpenEnd SubPrivate Sub Image1_Click()End Sub(3)销售商品信息表界面源代码Public cn As New ADODB.ConnectionPublic rs As New ADODB.RecordsetPrivate Sub Command1_Click()str1 = select * from 销售表 where 销售号= & Text1.Text &

29、If rs.State = 1 Thenrs.CloseEnd Ifrs.Open str1, cn, 1, 3If rs.EOF Then MsgBox 该销售商品不存在 Adodc1.CommandType = adCmdText Adodc1.RecordSource = str1 Adodc1.Refresh Else Text1.Text = rs(销售号)Text2.Text = rs(职工号)Text3.Text = rs(商品号)Text4.Text = rs(销售数量)Text6.Text = rs(销售时间) End IfEnd SubPrivate Sub Command

30、2_Click()str1 = select * from 销售表 where 销售号= & Text1.Text & If rs.State = 1 Thenrs.CloseEnd Ifrs.Open str1, cn, 1, 3If rs.EOF Then rs.AddNew rs(销售号) = Text1.Text rs(职工号) = Text2.Text rs(商品号) = Text3.Text rs(销售数量) = Text4.Text rs(销售时间) = Text6.Text rs.Update MsgBox 数据添加成功, 64, 信息提示 Adodc1.CommandType

31、 = adCmdText Adodc1.RecordSource = select * from 销售表 Adodc1.Refresh Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text6.Text = Else MsgBox 该种销售商品已经存在了, 16, 警告 End If End SubPrivate Sub Command3_Click()If Adodc1.Recordset.EOF = False Then c = MsgBox(您确认要删除该记录吗?, 32 + 4, 特别提示) X = Adodc1.Records

32、et.Fields(0) If c = vbYes Then str1 = select * from 销售表 where 销售号=x & If rs.State = 1 Then rs.Close End If rs.Open str1, cn, 1, 3 Adodc1.Recordset.Delete Adodc1.CommandType = adCmdText Adodc1.RecordSource = select * from 销售表 Adodc1.Refresh MsgBox 销售商品的所有信息成功删除, 64, 信息提示 Adodc1.Refresh Text1.Text = T

33、ext2.Text = Text3.Text = Text4.Text = Text6.Text = End If Else MsgBox 当前数据库中已经没有可删除的记录, 64, 警告 End IfEnd SubPrivate Sub Command4_Click() Form5.ShowUnload MeEnd SubPrivate Sub DataGrid1_Click() If Adodc1.Recordset.RecordCount = 0 Then MsgBox 当前表是空表, 16, 信息提示ElseText1.Text = Adodc1.Recordset.Fields(0)

34、Text2.Text = Adodc1.Recordset.Fields(1)End IfEnd SubPrivate Sub Form_Load()cn.ConnectionString = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=超市管理cn.OpenEnd SubPrivate Sub Image1_Click()End Sub(4)销售员工信息表Public cn As New ADODB.ConnectionPublic rs As New ADO

35、DB.RecordsetPrivate Sub Command1_Click()str1 = select * from 销售人员表 where 职工号= & Text1.Text & If rs.State = 1 Thenrs.CloseEnd Ifrs.Open str1, cn, 1, 3If rs.EOF Then rs.AddNew rs(职工号) = Text1.Text rs(姓名) = Text2.Text rs(性别) = Text3.Text rs(用户类型) = Text4.Text rs.Update MsgBox 用户添加成功, 64, 信息提示 Adodc1.Co

36、mmandType = adCmdText Adodc1.RecordSource = select * from 销售人员表 Adodc1.Refresh Text1.Text = Text2.Text = Text3.Text = Text4.Text = Else MsgBox 该职工已经存在了, 16, 警告 End If End SubPrivate Sub Command2_Click()str1 = select * from 销售人员表 where 职工号= & Text1.Text & If rs.State = 1 Thenrs.CloseEnd Ifrs.Open str

37、1, cn, 1, 3If rs.EOF Then MsgBox 这个职工不存在 Adodc1.CommandType = adCmdText Adodc1.RecordSource = str1 Adodc1.Refresh Else Text1.Text = rs(职工号)Text2.Text = rs(姓名)Text3.Text = rs(性别)Text4.Text = rs(用户类型) Adodc1.CommandType = adCmdText Adodc1.RecordSource = str1 Adodc1.Refresh End If End SubPrivate Sub Co

38、mmand3_Click()Form5.ShowUnload MeEnd SubPrivate Sub Command4_Click()If Adodc1.Recordset.EOF = False Then c = MsgBox(您确认要删除该记录吗?, 32 + 4, 特别提示) X = Adodc1.Recordset.Fields(0) If c = vbYes Then str1 = select * from 销售人员表 where 职工号=x & If rs.State = 1 Then rs.Close End If rs.Open str1, cn, 1, 3 Adodc1.Recordset.Delete Adodc1.CommandType = adCmdText Adodc1.RecordSource = select * from 销售人员表 Adodc1.Refresh MsgBox 职工信息成功删除, 64, 信息提示 Adodc1.Refresh Text1.Text = Text2.Text = Text3.Text = Text4.Text = End If Else

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服