课程设计实验报告产品订单管理系统.docx
《课程设计实验报告产品订单管理系统.docx》由会员分享,可在线阅读,更多相关《课程设计实验报告产品订单管理系统.docx(15页珍藏版)》请在冰点文库上搜索。
课程设计实验报告产品订单管理系统
数据库课程设计
——产品订单管理系统
二零一二年五月
一、引言
订单管理是每所公司或工厂必须面对的工作,特别这几年,我国加入WTO,随着国家政策的调整,给企业的订单管理,商品的进存销都带来了不少冲击。
但一直以来用传统人手方式管理文件档案,这种管理方式存在许多缺点:
效率低,保密性差,另外随着进货数量的增加,这必然增加了订单管理者的工作量和劳动强度。
同时,将产生大量的文件和数据,这给订单信息的查找,更新和维护都带来了不少困难。
据调查,目前我国还有相当一部分企业的订单还停留在纸介质的基础上,尤其小型工厂或企业对订单的管理更是落后。
这样的管理机制已经不能适应时代发展的需求,其管理方法将浪费人力物力。
随着科技的不断提高,计算机科学与技术日渐成熟,这种传统的手工管理模式必然被以计算机为物质基础的信息管理方式所取代。
二、开发环境
CPU:
IntelPentium双核2.70GHz
内存:
2G
开发软件:
Microsoftofficeaccess2003
操作系统:
MicrosoftwindowXPprofessional版本2002ServicePack3
三、需求分析
我公司为加强订单管理,准备开发一个订单管理系统,该系统包括按客户分类订单管理子系统,其他信息子系统,预览报表子系统。
下面是经需求调查并初步归纳出的相关存储要求:
如下所示
3.1按客户分类订单管理子系统
a.订购情况:
订单标识,职员标识,产品,单价,数量,折扣,总计等信息。
b.付费情况:
包括订单标识,付费方式,付费日期,付费金额,持卡人姓名,信用卡号等信息
c.预览发票:
包括订单标识,发票日期,发票金额,付款条款等信息。
3.2其他信息子系统
a.职员情况:
包括职员姓,名,职务,电话号,邮件地址等信息
b.公司信息:
包括公司全称,地址,邮编,营业税率,电话号,传真号等
c.产品情况:
包括产品标识,产品名称,产品单价等。
d.付费方式:
包括付费方式标识,付费方式,是否使用信用卡等。
e.装运方式:
包括装运方式标识,装运方式。
3.3预览报表子系统
a.按客户情况:
包括客户姓名,电话号,传真号,公司名称等
b.按应收账款:
包括客户姓名,当前应收账款,30-60天后应收账款,61-90天后应收账款,大于90天后应收账款,余额等信息。
c.按客户分类销售额:
包括公司名称,单位总计,总销售额,营业税,运费总计,发票上的金额等信息。
e.按职员分类销售额报表:
包括职员姓名,单位总数,总销售额等信息。
f.按产品分类销售额:
包括产品名称,单位总计,总销售额等信
四、概念结构设计定单
4.1整体ER模型图
4.2子系统ER模型图
4.21订单的职员实体——关系
4.22产品订单系统产品实体——关系
4.23产品订单系统订单实体——关系
4.24产品订单系统订单明细实体——关系
4.25产品订单系统付费实体——关系
4.26产品订单系统付费方式实体——关系
4.27产品订单系统客户实体——关系
4.28产品订单系统我的公司信息实体——关系
五、数据字典(比较多,不一一列出)
六、系统详细设计
6.1数据库表的设计
本系统表一共有十一张,分别为“SwitchboadItems”、“产品”、“订单”、“订单明细”、“付费”、“付费方式”、“客户”、“我的公司信息”、“职员”、“装运方式”。
表6-1
表6-2SwitchboadItems”
注:
表6-2“SwitchboardItems”主要用于对主界面的设置,包括“SwitchboardID”、“项目编号”、“项目文字”、“命令”,“参数”。
表6-3产品
注:
表6-3“产品“主要用于储存产品信息包括产品标识、产品名称、单件等三项信息
表6-4订单
表6-5订单明细表
注:
表6-4“订单”及表6-5“订单明细表”主要用于查看订单的基本内容。
“定单”主要包括“订单标识”、“客户标识”、“职员标识”、“订单编号”、“收货方名称”、“收货方地址”、“收货方城市”、“收货方省/自治区”、“收货方邮政编码”、“收货方国家”、“收货方电话”、“发货日期”、“装运方式标识”、“运费”、“营业税额”;“订单明细”主要包括“订单明细标识”、“点单标识”、“产品标识”、“数量”“单价”、“折扣”等。
表6-6付费
注:
表6-6“付费”只要用于查看付费方式、金额和日期。
只要包括“付费标识”、“订单标识”、“付费金额”、“付费日期”、“信用卡号”、“持卡人”、“信用卡到期日”、“信用卡权限”、“付费方式标识”。
表6-7付费方式
注:
表6-7“付费方式”主要包括“付费方式标识”、“付费方式”、“是否使用信用卡”
表6-8客户
注:
表6-8“客户”主要用于查看客户的基本信息。
表6-9我公司信息
注:
表6-9“我的公司信息”主要用于查看公司的基本信息。
表6-10职员
表6-11装运方式
6.2由表生成各种窗口
图6—1主切换面板
图6-2按客户分类的订单
图6—3产品窗口
图6-4按客户分类的订单
图6-5打印发票窗口
图6-6订单分类窗口
图6-7订单明细窗口
图6-8付费窗口
图6-9付费方式窗口
图6-10我的公司信息窗口
图6-11职员窗口
图6—12装运方式
图6—13装运信息
6.3生成报表
按产品分类销售额生成的报表
注:
输入开始和结束日期点预览后
七、详细设计代表性的SQL语句及结果
7.1.按职员分类的销售额子查询
SELECTDISTINCTROW订单.EmployeeID,订单.OrderDate,订单.FreightCharge,订单.SalesTaxRate,Sum(CLng([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)AS总销售额,Sum([订单明细表].Quantity)AS单位总数
FROM订单LEFTJOIN订单明细表ON订单.OrderID=[订单明细表].OrderID
GROUPBY订单.EmployeeID,订单.OrderDate,订单.FreightCharge,订单.SalesTaxRate;
7.2按客户分类的销售额子查询
SELECTDISTINCTROW订单.CustomerID,订单.OrderDate,订单.FreightCharge,订单.SalesTaxRate,Sum(CLng([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)AS总销售额,Sum([订单明细表].Quantity)AS单位总计
FROM订单LEFTJOIN订单明细表ON订单.OrderID=[订单明细表].OrderID
GROUPBY订单.CustomerID,订单.OrderDate,订单.FreightCharge,订单.SalesTaxRate;
八、设计细节展示
8.1发票窗体设计
8.2结果展示
8.3按产品分类销售额窗体设计
8.4结果展示
九、关键技术及体会
本课程设计中主要用了表操作,查询操作,窗体设计,菜单与工具栏的使用等技术,开始只是模仿书上的例题进行练习,做了几次后,发现利用模板,或着使用数据导入导出,和word,excel等结合使用会更加方便,快捷。
十、课程设计总结
在这次数据库实习的过程中,我们利用课下时间进行学习,对数据库的基本操作和感念有了大体的了解。
能够用用access设计一个简单的订单管理系统,其主要功能是查询与管理。
同时,这次实习培养了我们对数据库的兴趣,有助于我们以后对数据库有进一步的了解和学习,也给了我们一个动手实践的机会,使我们在理论付诸于实践的过程中有了新的能力上的提升
参考文献
1.access2003自学教程中国经济出版社2001.8
2.access2003应用设计教程高等教育出版社2
附录:
主窗体代码:
OptionCompareDatabase
OptionExplicit
ConstconNumButtons=8
ConstconFontWeightBold=700
ConstconFontWeightNormal=400
PrivateSubBox23_Click()
EndSub
PrivateSubcmdExit_Click()
CloseCurrentDatabase
EndSub
SubcmdExit_GotFocus()
DimintOptionAsInteger
'IftheExitButtonhasreceivedthefocus,turnoffthefocusonallthemenuoptions
ForintOption=1ToconNumButtons
Me("Option"&intOption).Visible=False
Me("OptionLabel"&intOption).FontWeight=conFontWeightNormal
NextintOption
ExitLabel.FontUnderline=True
EndSub
PrivateSubcmdExit_LostFocus()
ExitLabel.FontUnderline=False
EndSub
PrivateSubcmdExit_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
ExitLabel.FontWeight=conFontWeightBold
EndSub
PrivateSubcmdExit_MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
ExitLabel.FontWeight=conFontWeightNormal
EndSub
PrivateSubForm_Open(CancelAsInteger)
'Minimizethedatabasewindowandinitializetheform.
OnErrorGoToForm_Open_Err
'Minimizethedatabasewindow.
DoCmd.SelectObjectacForm,"Switchboard",True
DoCmd.Minimize
'Movetotheswitchboardpagethatismarkedasthedefault.
Me.Filter="[ItemNumber]=0AND[Argument]='默认'"
Me.FilterOn=True
Form_Open_Exit:
ExitSub
Form_Open_Err:
MsgBoxErr.Description
ResumeForm_Open_Exit
EndSub
PrivateSubForm_Current()
'Updatethecaptionandfillinthelistofoptions.
Me.Caption=Nz(Me!
[ItemText],"")
FillOptions
EndSub
PrivateSubFillOptions()
'Fillintheoptionsforthisswitchboardpage.
'Thenumberofbuttonsontheform.
DimdbsAsDatabase
DimrstAsRecordset
DimstrSQLAsString
DimintOptionAsInteger
'Setthefocustothefirstbuttonontheform,
'andthenhideallofthebuttonsontheform
'butthefirst.Youcan'thidethefieldwiththefocus.
Me!
[Option1].Visible=True
Me!
[Command1].Enabled=True
Me!
[Command1].SetFocus
WithMe!
[OptionLabel1]
.Visible=True
.FontWeight=conFontWeightBold
EndWith
ForintOption=2ToconNumButtons
Me("Option"&intOption).Visible=False
Me("OptionLabel"&intOption).Visible=False
Me("OptionLabel"&intOption).FontWeight=conFontWeightNormal
Me("Command"&intOption).Enabled=False
NextintOption
'OpenthetableofSwitchboardItems,andfind
'thefirstitemforthisSwitchboardPage.
Setdbs=CurrentDb()
strSQL="SELECT*FROM[SwitchboardItems]"
strSQL=strSQL&"WHERE[ItemNumber]>0AND[SwitchboardID]="&Me!
[SwitchboardID]
strSQL=strSQL&"ORDERBY[ItemNumber];"
Setrst=dbs.OpenRecordset(strSQL)
'IftherearenooptionsforthisSwitchboardPage,
'displayamessage.Otherwise,fillthepagewiththeitems.
If(rst.EOF)Then
Me!
[OptionLabel1].Caption="Therearenoitemsforthisswitchboardpage"
Else
While(Not(rst.EOF))
Me("OptionLabel"&rst!
[ItemNumber]).Visible=True
Me("OptionLabel"&rst!
[ItemNumber]).Caption=rst!
[ItemText]
Me("Command"&rst!
[ItemNumber]).Enabled=True
rst.MoveNext
Wend
EndIf
'Closetherecordsetandthedatabase.
rst.Close
dbs.Close
EndSub
PrivateFunctionHandleFocus(intBtnAsInteger)
'Thisfunctioniscalledwhenamenuoptionreceivesthefocus.
'intBtnindicateswhichbuttonwasclicked.
DimintOptionAsInteger
OnErrorGoToHandleMouseOver_Err
ForintOption=1ToconNumButtons
'Showthatthismenuoptionhasthefocus...
IfintOption=intBtnThen
Me("Option"&intOption).Visible=True
Me("OptionLabel"&intOption).FontWeight=conFontWeightBold
Me("command"&intBtn).SetFocus
'...andturnoffthefocusontheotheroptions
Else
Me("Option"&intOption).Visible=False
Me("OptionLabel"&intOption).FontWeight=conFontWeightNormal
EndIf
NextintOption
HandleMouseOver_Exit:
ExitFunction
HandleMouseOver_Err:
MsgBox"执行该命令时出错。
",vbCritical
ResumeHandleMouseOver_Exit
EndFunction
PrivateFunctionHandleButtonClick(intBtnAsInteger)
'Thisfunctioniscalledwhenabuttonisclicked.
'intBtnindicateswhichbuttonwasclicked.
'Constantsforthecommandsthatcanbeexecuted.
ConstconCmdGotoSwitchboard=1
ConstconCmdOpenFormAdd=2
ConstconCmdOpenFormBrowse=3
ConstconCmdOpenReport=4
ConstconCmdCustomizeSwitchboard=5
ConstconCmdExitApplication=6
ConstconCmdRunMacro=7
ConstconCmdRunCode=8
'Anerrorthatisspecialcased.
ConstconErrDoCmdCancelled=2501
DimdbsAsDatabase
DimrstAsRecordset
OnErrorGoToHandleButtonClick_Err
'FindtheitemintheSwitchboardItemstable
'thatcorrespondstothebuttonthatwasclicked.
Setdbs=CurrentDb()
Setrst=dbs.OpenRecordset("SwitchboardItems",dbOpenDynaset)
rst.FindFirst"[SwitchboardID]="&Me!
[SwitchboardID]&"AND[ItemNumber]="&intBtn
'Ifnoitemmatches,reporttheerrorandexitthefunction.
If(rst.NoMatch)Then
MsgBox"读取SwitchboardItems表时出错。
"
rst.Close
dbs.Close
ExitFunction
EndIf
SelectCaserst!
[Command]
'Gotoanotherswitchboard.
CaseconCmdGotoSwitchboard
Me.Filter="[ItemNumber]=0AND[SwitchboardID]="&rst!
[Argument]
'OpenaforminAddmode.
CaseconCmdOpenFormAdd
DoCmd.OpenFormrst!
[Argument],,,,acAdd
'Openaform.
CaseconCmdOpenFormBrowse
DoCmd.OpenFormrst!
[Argument]
'Openareport.
CaseconCmdOpenReport
DoCmd.OpenReportrst!
[Argument],acPreview
'CustomizetheSwitchboard.
CaseconCmdCustomizeSwitchboard
'HandlethecasewheretheSwitchboardManager
'isnotinstalled(e.g.MinimalInstall).
OnErrorResumeNext
Application.Run"ACWZMAIN.sbm_Entry"
If(Err<>0)ThenMsgBox"命令不可用"
OnErrorGoTo0
'Updatetheform.
Me.Filter="[ItemNumber]=0AND[Argument]='默认'"
Me.Caption=Nz(Me!
[ItemText],"")
FillOptions
'Exittheapplication.
CaseconCmdExitApplication
CloseCurrentDatabase
'Runamacro.
CaseconCmdRunMacro
DoCmd.RunMacrorst!
[Argument]
'Runcode.
CaseconCmdRunCode
Application.Runrst!
[Argument]
'Anyothercommandisunrecognized.
CaseElse
MsgBox"未知选项"
EndSelect
'Closetherecordsetandthedatabase.
rst.Close
dbs.Close
HandleButtonClick_Exit:
ExitFunction
HandleButtonClick_Err:
'Iftheactionwascancelledbytheuserfor
'somereason,don'tdisplayanerrormessage.
'Instead,resumeonthenextline.
If(Err=conErrDoCmdCancelled)Then
ResumeNext
Else
MsgBox"执行