1、你一定要坚强,即使受过伤,流过泪,也能咬牙走下去。因为,人生,就是你一个人的人生。=-软件工程课程代码:姓名:江国福山东英才学院计算机电子信息工程学院09级计算机及应用试本1班邮编:250104 电话号码:155625959792012.03.14目录摘 要3Abstract4第一章 引言411 课题背景412 系统简介4第二章 系统的分析521 系统开发的目标和思想522 系统的可行性分析6第三章 系统的设计631 系统的功能结构设计732 系统的数据库设计33 界面设计与代码设计739结束语40致谢40参考文献41摘 要 传统的电费管理都是由工作人员手工查表,抄表完成的,其中要完成用户电费
2、的收取,每月抄度,用户购电情况查询,以及列出欠费用户的信息名单,之类的信息.其工作强度大,工作流程繁琐,由于工作人员的不细心,将会造成电费收支的出错也是经常发生的.鉴于以上原因我们有必要开发一种帮作电费管理人员的软件系统,可以完成检查用户用电情况,每月抄度,信息录入以及基本数据维护的各项功能.本系统采用visual basic 6.0与微软Access数据库方式.界面尽量做到人性化,数据维护方面做到可靠安全.关键字: 电费管理,visual basic, Access,数据库AbstractElectricity from the traditional management staff ar
3、e artisanal Chabiao, meter reading completed, which should be completed by the users of electricity per month penalty for users to buy electricity enquiries, and a list of user information channels list such information. Its work-intensive, cumbersome workflow, because staff are not careful. would r
4、esult in the tariff revenue is recurring mistakes. Given the above reasons we need to develop a management software to help make electricity system, the user can complete the inspection of electricity monthly copied degrees, Information includes basic data and the maintenance function. with the syst
5、em using visual basic Microsoft Access 6.0 database. as far as possible humanization interface, data maintenance to reliable security. keyword : tariff management, visual basic, Access, the database第一章 引言11 课题背景传统的电费管理都是由工作人员手工查表,抄表完成的,其中要完成用户电费的收取,每月抄度,用户购电情况查询,以及列出欠费用户的信息名单,之类的信息.其工作强度大,工作流程繁琐,由于工
6、作人员的不细心,将会造成电费收支的出错也是经常发生的.鉴于以上原因我们有必要开发一种帮作电费管理人员的软件系统,可以完成检查用户用电情况,每月抄度,信息录入以及基本数据维护的各项功能.本系统采用visual basic 6.0与微软Access数据库方式.界面尽量做到人性化,数据维护方面做到可靠安全.12 系统简介 本系统主要由以下几大功能模块组成:一. 用户交费:(交纳电费,本日小节)二. 本月抄度:(单户抄度 多户抄度)三. 资料导出 (全部清单,欠费清单)四. 数据查询 (电费查询与统计,用户欠费查询)五. 信息录入 (资料录入,资料修改, 资料删除)六. 系统数据维护 (数据备份,数据
7、恢复)七. 基本数据维护 (用户类型维护, 操作员维护)八. 帮助九. 退出第二章 系统的分析21 系统开发的目标和思想 本系统主要服务于电费管理人员的日常工作.设计思路主要参照工作人员抄表,记录资料,资料管理,信息录入等方面的工作流程展开的.22 系统的可行性分析本系统采用visual basic6.0与微软的access作为数据库结合.在系统编写上具有可行性.经济方面:本系统可以服务电厂,电费管理单位,为企业节省人力开支.社会方面:服务于大众,方便抄表人员工作,可靠方便.第三章 系统的设计31 系统的功能结构设计程序登陆主界面用户交费本月抄费资料导出数据查询信息录入系统数据维护基本数据维护
8、帮助退出32 系统的数据库设计1. 用户类型表:字段名称数据类型说明ATypeID自动编号AType文本电费类型UNITPRICE货币Adate日期/时间电费设置日期2. 密码表: 字段名称数据类型姓名文本操作权限文本密码文本3. MaxID表:字段名称数据说明TableName文本MaxID数字33 界面设计与代码设计1.用户登陆界面设计:34 界面设计与代码设计用户登陆界面代码分析:Private Sub Command1_Click()Dim rstpchard As New ADODB.RecordsetDim reHard As StringDim getid As Stringre
9、Hard = GetpcHard(getid)rstpchard.Open select * from getpchard , gCnn, adOpenKeyset, adLockBatchOptimisticIf rstpchard.RecordCount = 0 Then rstpchard.AddNew rstpchard.Fields(0) = reHard rstpchard.UpdateBatch adAffectCurrentElse If Trim(reHard) Trim(rstpchard.Fields(0) Then MsgBox 对不起,使用不合法请与开发者联系! ,
10、vbInformation End End IfEnd IfIf Check1.Value = 1 ThenSet rec = New ADODB.Recordsetrec.Open select * from 记住密码, gCnn, 3, 3rec(标记) = 1If Combo2.Text Thenrec(姓名) = Combo2.TextElserec(姓名) = End IfIf Combo1.Text Thenrec(权限) = Combo1.TextElserec(权限) = End IfIf Text2.Text Thenrec(密码) = Text2.TextElserec(密
11、码) = End Ifrec.Updaterec.CloseElseSet rec = New ADODB.Recordsetrec.Open select * from 记住密码, gCnn, 3, 3rec(标记) = 0rec.Updaterec.CloseEnd IfDim rec1 As ADODB.RecordsetSet rec1 = New ADODB.Recordsetrec1.Open select * from 登录人员, gCnn, 3, 3Set rec = New ADODB.Recordsetrec.Open select * from 密码表 where 姓名=
12、 & Combo2.Text & and 操作权限= & Combo1.Text & and 密码= & Text2.Text & , gCnn, 3, 3If rec.EOF = False Then If rec(操作权限) 管理员 Then FRMMAIN.XZCK.Enabled = False MDIme.mczy.Enabled = False MDIme.xtwh.Enabled = False MDIme.del.Enabled = False FRMMAIN.DJGL.Enabled = False FRMMAIN.delte.Enabled = False Else Me.
13、XZCK.Enabled = True MDIme.mczy.Enabled = True MDIme.xtwh.Enabled = True CreateNewKey HKEY_CURRENT_USER, ZhiYuanTechnologe SetKeyValue HKEY_CURRENT_USER, ZhiYuanTechnologe, UserName, dlj, REG_SZ SetKeyValue HKEY_CURRENT_USER, ZhiYuanTechnologe, PassWord, dlj, REG_SZ FRMMAIN.DJGL.Enabled = True FRMMAI
14、N.delte.Enabled = True End If rec1(姓名) = Combo2.Text rec1.Update rec1.Close Me.Hide Guser = Combo2.Text MDIme.ShowElse MsgBox 权限或密码不正确,请重试!, vbInformationEnd Ifrec.CloseEnd SubPrivate Sub Command11_Click()End SubPrivate Sub Command2_Click()Combo2.Text = Text2.Text = Combo1.Text = End Sub Private Sub
15、 Command3_Click()EndEnd SubPrivate Sub Command4_Click()Me.HideFRMMMXG.Show 1End Sub Private Sub Form_Activate()Text2.Text = Combo1.Text = Combo2.Text = Set rec = New ADODB.Recordsetrec.Open select * from 记住密码, gCnn, 3, 3If rec(标记) = 0 Or rec(标记) = 1 ThenCheck1.Value = rec(标记)End Ifrec.CloseSet rec =
16、 New ADODB.Recordsetrec.Open select * from 记住密码, gCnn, 3, 3If rec(标记) = 1 ThenCombo2.Text = rec(姓名)Combo1.Text = rec(权限)Text2.Text = rec(密码)End Ifrec.CloseCommand1.SetFocusEnd SubPrivate Sub Form_Load()gCnn.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:database password= & DbPassword
17、 & ;Data Source= & _App.Path & datadbdb.mdb;Persist Security Info=FalsegCnn.CursorLocation = adUseClientgCnn.OpenSet rec = New ADODB.Recordsetrec.Open select distinct 姓名 from 密码表, gCnn, 3, 3With Combo2Do Until rec.EOF.AddItem rec(姓名)rec.MoveNextLoopEnd Withrec.CloseSet rec = NothingEnd SubPrivate Su
18、b Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)Cancel = TrueSelect Case MsgBox(此操作将退出本系统,继续吗?, vbYesNo, 警告)Case vbYesCancel = FalseEndCase ElseCancel = TrueEnd SelectEnd Sub2.主界面设计:主界面代码设计:Private Sub alllm_Click()frmList.qfFlg = FalsefrmList.ShowEnd SubPrivate Sub backup_Click() frmbei
19、fen.ShowEnd SubPrivate Sub benrixiaojie_Click()frmCount.ShowEnd SubPrivate Sub Command1_Click()frameFee.Visible = FalseEnd SubPrivate Sub cmdQuery_Click() Dim rst As New ADODB.Recordset rst.Open select * from panelinfo where holder= & Me.txtUser & and delflagtrue , gCnn, adOpenStatic, adLockBatchOpt
20、imistic If rst.RecordCount 0 Then dcvalue.Text = rst.Fields(2) txtUserName(0) = rst.Fields(1) txtUserName(1) = rst.Fields!nowecount txtUserName(2) = rst.Fields!cendcode dtpwdate.Value = rst.Fields(4) txtUserName(3) = Format(rst.Fields!lMoney, #0.00) txtUserName(4) = Format(rst.Fields!bmoney, #0.00)
21、txtUserName(6) = Format(rst.Fields!lsFee, #0.00) txtUserName(5) = txtUserName(1) * rst.Fields!lMoney * (rst.Fields!lightScale / 100) + txtUserName(1) * txtUserName(4) * (1 - rst.Fields!lightScale / 100) txtUserName(5) = Format(txtUserName(1) * rst.Fields!lMoney * (rst.Fields!lightScale / 100) + rst.
22、Fields!nowecount * rst.Fields!bmoney * (1 - rst.Fields!lightScale / 100), #0.00) txtUserName(8) = rst.Fields(9) txtUserName(7) = Format(Val(txtUserName(5) + Val(txtUserName(6), #0.00) dcNum.Text = rst.Fields(1) Else MsgBox 没有查询到数据! , vbInformation End If rst.Close Set rst = NothingEnd SubPrivate Sub
23、 dcNum_Click(Area As Integer) Dim rst As New ADODB.Recordset rst.Open select * from panelinfo where holderid= & dcNum.Text & and delflagtrue , gCnn, adOpenKeyset, adLockBatchOptimistic If Not rst.EOF Then dcvalue.Text = rst.Fields(2) txtUserName(0) = rst.Fields(1) txtUserName(1) = rst.Fields!nowecou
24、nt txtUserName(2) = rst.Fields!cendcode dtpwdate.Value = rst.Fields(4) txtUserName(3) = Format(rst.Fields!lMoney, #0.00) txtUserName(4) = Format(rst.Fields!bmoney, #0.00) txtUserName(6) = Format(rst.Fields(8), #0.00) txtUserName(5) = Format(txtUserName(1) * txtUserName(3) * (rst.Fields!lightScale /
25、100) + txtUserName(1) * txtUserName(4) * (1 - rst.Fields!lightScale / 100), #0.00) txtUserName(8) = rst.Fields(9) txtUserName(7) = Format(Val(txtUserName(5) + Val(txtUserName(6), #0.00) End If rst.CloseEnd SubPrivate Sub dcvalue_Click(Area As Integer) Dim rst As New ADODB.Recordset rst.Open select *
26、 from panelinfo where holderid= & dcvalue.BoundText & and delflagtrue , gCnn, adOpenStatic, adLockBatchOptimistic If Not rst.EOF Then dcvalue.Text = rst.Fields(2) txtUserName(0) = rst.Fields(1) txtUserName(1) = rst.Fields!nowecount txtUserName(2) = rst.Fields!cendcode dtpwdate.Value = rst.Fields(4)
27、txtUserName(3) = Format(rst.Fields!lMoney, #0.00) txtUserName(4) = Format(rst.Fields!bmoney, #0.00) txtUserName(6) = Format(rst.Fields!lsFee, #0.00) txtUserName(5) = txtUserName(1) * rst.Fields!lMoney * (rst.Fields!lightScale / 100) + txtUserName(1) * txtUserName(4) * (1 - rst.Fields!lightScale / 10
28、0) txtUserName(5) = Format(txtUserName(1) * rst.Fields!lMoney * (rst.Fields!lightScale / 100) + rst.Fields!nowecount * rst.Fields!bmoney * (1 - rst.Fields!lightScale / 100), #0.00) txtUserName(8) = rst.Fields(9) txtUserName(7) = Format(Val(txtUserName(5) + Val(txtUserName(6), #0.00) dcNum.Text = rst
29、.Fields(1) End If rst.Close Set rst = NothingEnd SubPrivate Sub dcvalue_KeyPress(KeyAscii As Integer)KeyAscii = 0End SubPrivate Sub del_Click()frmdel.ShowEnd SubPrivate Sub dhcb_Click()usrcopyP.ShowEnd SubPrivate Sub dhcp_Click()frmCopyP.ShowEnd SubPrivate Sub duohu_Click()frmCuifei.muser1 = 2frmCui
30、fei.ShowEnd SubPrivate Sub edit_Click()frmEdit.ShowEnd SubPrivate Sub exit_Click()EndEnd SubPrivate Sub insert_Click()frmInsert.Show 1End SubPrivate Sub jiaonadianfei_Click()frmFee.ShowEnd SubPrivate Sub M_USERYTPE_Click()FRMUSERTYPE.Show 1End SubPrivate Sub MDIForm_Load() loadAdd End SubPublic Sub
31、loadAdd()If rst.State = 1 Then rst.CloseEnd If rst.Open select * from panelinfo where delflagtrue , gCnn, adOpenKeyset, adLockBatchOptimistic If rst.RecordCount 0 Then Set dcvalue.RowSource = rst dcvalue.BoundColumn = holderID dcvalue.ListField = holder Set dcNum.DataSource = rst Set dcNum.RowSource
32、 = rst dcNum.ListField = holderid If Not rst.EOF Then dcNum.Text = rst.Fields!holderid dcvalue.Text = rst.Fields(2) txtUserName(0) = rst.Fields(1) txtUserName(1) = rst.Fields!nowecount txtUserName(2) = rst.Fields!cendcode dtpwdate.Value = rst.Fields(4) txtUserName(3) = Format(rst.Fields!lMoney, #0.0
33、0) txtUserName(4) = Format(rst.Fields!bmoney, #.0.00) txtUserName(6) = rst.Fields!lsFee txtUserName(5) = Val(txtUserName(1) * Val(txtUserName(3) * (Val(rst.Fields!lightScale) / 100) + Val(txtUserName(1) * Val(txtUserName(4) * (1 - rst.Fields!lightScale / 100) txtUserName(8) = rst.Fields(9) txtUserNa
34、me(7) = Val(txtUserName(5) + Val(txtUserName(6) rst.Fields!cFeeMoney = txtUserName(7) rst.UpdateBatch adAffectCurrent End If End IfEnd SubPublic Sub loadData(Hid As String) Dim rst As New ADODB.Recordset Dim cnn As New ADODB.Connection Dim Atimes As Integer Dim sqlAdd As String cnn.ConnectionString
35、= Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:database password= & DbPassword & ;Data Source= & _ App.Path & datadbdb.mdb;Persist Security Info=False cnn.CursorLocation = adUseClient cnn.Open If Trim(Hid) Then rst.Open select * from panelinfo where holderid= & Hid & and delflagtrue , cnn, adOpenStati
36、c, adLockBatchOptimistic Else rst.Open select * from panelinfo where delflagtrue , cnn, adOpenStatic, adLockBatchOptimistic End If If Not rst.EOF Then dcNum.Text = rst.Fields!holderid dcvalue.Text = rst.Fields(2) txtUserName(0) = rst.Fields(1) txtUserName(1) = rst.Fields!nowecount txtUserName(2) = r
37、st.Fields!cendcode dtpwdate.Value = rst.Fields(4) txtUserName(3) = Format(rst.Fields!lMoney, #0.00) txtUserName(4) = Format(rst.Fields!bmoney, #0.00) txtUserName(6) = Format(rst.Fields!lsFee, #0.00) txtUserName(5) = Format(txtUserName(1) * txtUserName(3) * (rst.Fields!lightScale / 100) + txtUserName
38、(1) * txtUserName(4) * (1 - rst.Fields!lightScale / 100), #0.00) If rst.Fields!Atimes = 0 Then Atimes = 1 Else Atimes = rst.Fields!Atimes End If txtUserName(5) = Format(Val(txtUserName(1) * txtUserName(3) * Atimes, #0.00) txtUserName(8) = rst.Fields(9) txtUserName(7) = Format(Val(txtUserName(5) + Va
39、l(txtUserName(6), #0.00) rst.Fields!cFeeMoney = txtUserName(7) rst.UpdateBatch adAffectCurrent End If rst.Close cnn.Close End SubPrivate Sub MDIForm_Unload(Cancel As Integer)gCnn.CloseSet gcon = NothingEnd SubPrivate Sub mgcf_Click()frmFeefind.ShowEnd SubPrivate Sub mhf_Click()frmdaoru.ShowEnd SubPrivate Sub msf_Click()frmFind1.ShowEnd SubPrivate Sub qianfeilm_Click()frmList.qfFlg = TruefrmList.ShowEnd SubPrivate Sub Toolbar1_ButtonClick(ByVal Button As MSComc