1、毕业设计电表管理系统班级_姓名_学号_摘 要1Abstract2第一章 引言411 课题背景412 系统简介5第二章 系统的分析621 系统开发的目的和思想622 系统的可行性分析8第三章 系统的设计1831 系统的功能结构设计1832 系统的数据库设计33 界面设计与代码设计2324结束语46致谢47参考文献48摘 要 传统的电费管理都是由工作人员手工查表,抄表完毕的,其中要完毕用户电费的收取,每月抄度,用户购电情况查询,以及列出欠费用户的信息名单,之类的信息.其工作强度大,工作流程繁琐,由于工作人员的不细心,将会导致电费收支的犯错也是经常发生的.鉴于以上因素我们有必要开发一种帮作电费管理人
2、员的软件系统,可以完毕检查用户用电情况,每月抄度,信息录入以及基本数据维护的各项功能.本系统采用visual basic 6.0与微软Access数据库方式.界面尽量做到人性化,数据维护方面做到可靠安全.关键字: 电费管理,visual basic, Access,数据库AbstractElectricity from the traditional management staff are artisanal Chabiao, meter reading completed, which should be completed by the users of electricity per
3、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 result in the tariff revenue is recurring mistakes. Given the above reasons we need to develop a manageme
4、nt 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 system using visual basic Microsoft Access 6.0 database. as far as possible humanization interface, data mai
5、ntenance to reliable security. keyword : tariff management, visual basic, Access, the database第一章 引言11 课题背景传统的电费管理都是由工作人员手工查表,抄表完毕的,其中要完毕用户电费的收取,每月抄度,用户购电情况查询,以及列出欠费用户的信息名单,之类的信息.其工作强度大,工作流程繁琐,由于工作人员的不细心,将会导致电费收支的犯错也是经常发生的.鉴于以上因素我们有必要开发一种帮作电费管理人员的软件系统,可以完毕检查用户用电情况,每月抄度,信息录入以及基本数据维护的各项功能.本系统采用visual
6、basic 6.0与微软Access数据库方式.界面尽量做到人性化,数据维护方面做到可靠安全.12 系统简介 本系统重要由以下几大功能模块组成:一. 用户交费:(交纳电费,本日小节)二. 本月抄度:(单户抄度 多户抄度)三. 资料导出 (所有清单,欠费清单)四. 数据查询 (电费查询与记录,用户欠费查询)五. 信息录入 (资料录入,资料修改, 资料删除)六. 系统数据维护 (数据备份,数据恢复)七. 基本数据维护 (用户类型维护, 操作员维护)八. 帮助九. 退出第二章 系统的分析21 系统开发的目的和思想 本系统重要服务于电费管理人员的平常工作.设计思绪重要参照工作人员抄表,记录资料,资料管
7、理,信息录入等方面的工作流程展开的.22 系统的可行性分析本系统采用visual basic6.0与微软的access作为数据库结合.在系统编写上具有可行性.经济方面:本系统可以服务电厂,电费管理单位,为公司节省人力开支.社会方面:服务于大众,方便抄表人员工作,可靠方便.第三章 系统的设计31 系统的功能结构设计程序登陆主界面用户交费本月抄费资料导出数据查询信息录入系统数据维护基本数据维护帮助退出32 系统的数据库设计1. 用户类型表:字段名称数据类型说明ATypeID自动编号AType文本电费类型UNITPRICE货币Adate日期/时间电费设立日期2. 密码表: 字段名称数据类型姓名文本操
8、作权限文本密码文本3. MaxID表:字段名称数据说明TableName文本MaxID数字33 界面设计与代码设计1.用户登陆界面设计:34 界面设计与代码设计用户登陆界面代码分析:Private Sub Command1_Click()Dim rstpchard As New ADODB.RecordsetDim reHard As StringDim getid As StringreHard = GetpcHard(getid)rstpchard.Open select * from getpchard , gCnn, adOpenKeyset, adLockBatchOptimisti
9、cIf rstpchard.RecordCount = 0 Then rstpchard.AddNew rstpchard.Fields(0) = reHard rstpchard.UpdateBatch adAffectCurrentElse If Trim(reHard) Trim(rstpchard.Fields(0) Then MsgBox 对不起,使用不合法请与开发者联系! , vbInformation End End IfEnd IfIf Check1.Value = 1 ThenSet rec = New ADODB.Recordsetrec.Open select * fro
10、m 记住密码, gCnn, 3, 3rec(标记) = 1If Combo2.Text Thenrec(姓名) = Combo2.TextElserec(姓名) = End IfIf Combo1.Text Thenrec(权限) = Combo1.TextElserec(权限) = End IfIf Text2.Text Thenrec(密码) = Text2.TextElserec(密码) = End Ifrec.Updaterec.CloseElseSet rec = New ADODB.Recordsetrec.Open select * from 记住密码, gCnn, 3, 3re
11、c(标记) = 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 姓名= & Combo2.Text & and 操作权限= & Combo1.Text & and 密码= & Text2.Text & , gCnn, 3, 3If rec.EOF = False Then If
12、 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.XZCK.Enabled = True MDIme.mczy.Enabled = True MDIme.xtwh.Enabled = True CreateNewKey HKEY_CURRENT_USER,
13、ZhiYuanTechnologe SetKeyValue HKEY_CURRENT_USER, ZhiYuanTechnologe, UserName, dlj, REG_SZ SetKeyValue HKEY_CURRENT_USER, ZhiYuanTechnologe, PassWord, dlj, REG_SZ FRMMAIN.DJGL.Enabled = True FRMMAIN.delte.Enabled = True End If rec1(姓名) = Combo2.Text rec1.Update rec1.Close Me.Hide Guser = Combo2.Text
14、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 Command3_Click()EndEnd SubPrivate Sub Command4_Click()Me.HideFRMMMXG.Show 1End Sub Private Sub Form_Act
15、ivate()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 = New ADODB.Recordsetrec.Open select * from 记住密码, gCnn, 3, 3If rec(标记) = 1 ThenCombo2.Text = rec(姓名)Combo
16、1.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 & ;Data Source= & _App.Path & datadbdb.mdb;Persist Security Info=FalsegCnn.CursorLocation = adUseClient
17、gCnn.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 Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)Cancel = TrueSelect Case MsgBox(此操作将退出本系统,继续
18、吗?, vbYesNo, 警告)Case vbYesCancel = FalseEndCase ElseCancel = TrueEnd SelectEnd Sub2.主界面设计:主界面代码设计:Private Sub alllm_Click()frmList.qfFlg = FalsefrmList.ShowEnd SubPrivate Sub backup_Click() frmbeifen.ShowEnd SubPrivate Sub benrixiaojie_Click()frmCount.ShowEnd SubPrivate Sub Command1_Click()frameFee.
19、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, adLockBatchOptimistic If rst.RecordCount 0 Then dcvalue.Text = rst.Fields(2) txtUserName(0) = rst.Fields(1) txtUserNam
20、e(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) txtUserName(6) = Format(rst.Fields!lsFee, #0.00) txtUserName(5) = txtUserName(1) * rst.Fields!lMoney * (
21、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.Fields!nowecount * rst.Fields!bmoney * (1 - rst.Fields!lightScale / 100), #0.00) txtUserName(8) = rst.Fi
22、elds(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 dcNum_Click(Area As Integer) Dim rst As New ADODB.Recordset rst.Open select * from panelinfo where hold
23、erid= & 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!nowecount txtUserName(2) = rst.Fields!cendcode dtpwdate.Value = rst.Fields(4) txtUserName(3) = Format(rst.Field
24、s!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 / 100) + txtUserName(1) * txtUserName(4) * (1 - rst.Fields!lightScale / 100), #0.00) txtUserName(8) = rst.
25、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 * from panelinfo where holderid= & dcvalue.BoundText & and delflagtrue , gCnn, adOpenStatic, adLockBatchO
26、ptimistic 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) txtUserName(3) = Format(rst.Fields!lMoney, #0.00) txtUserName(4) = Format(rst.Fields!bmoney, #0.00) txtU
27、serName(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.Fiel
28、ds!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) End If rst.Close Set rst = NothingEnd SubPrivate Sub dcvalue_KeyPress(KeyAscii As Integer)Key
29、Ascii = 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 = 2frmCuifei.ShowEnd SubPrivate Sub edit_Click()frmEdit.ShowEnd SubPrivate Sub exit_Click()EndEnd SubPrivate Sub
30、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 loadAdd()If rst.State = 1 Then rst.CloseEnd If rst.Open select * from panelinfo where delflagtrue , gCnn
31、, adOpenKeyset, adLockBatchOptimistic If rst.RecordCount 0 Then Set dcvalue.RowSource = rst dcvalue.BoundColumn = holderID dcvalue.ListField = holder Set dcNum.DataSource = rst Set dcNum.RowSource = rst dcNum.ListField = holderid If Not rst.EOF Then dcNum.Text = rst.Fields!holderid dcvalue.Text = rs
32、t.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) txtUserName(6) = rst.Fields!lsFee txtUserName(5) =
33、 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) txtUserName(7) = Val(txtUserName(5) + Val(txtUserName(6) rst.Fields!cFeeMoney = txtUserName(7) rst.UpdateBatch ad
34、AffectCurrent 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 = Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:database password= & DbPassword & ;Data Source= & _ App.Pat
35、h & 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, adOpenStatic, adLockBatchOptimistic Else rst.Open select * from panelinfo where delflagtrue , cnn, adOpenStatic, ad
36、LockBatchOptimistic 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) = rst.Fields!cendcode dtpwdate.Value = rst.Fields(4) txtUserName(3) = Format(rst.Fields!lMoney, #0.00) txtU
37、serName(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(1) * txtUserName(4) * (1 - rst.Fields!lightScale / 100), #0.00) If rst.Fields!Atimes = 0 Then Atimes =
38、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) + Val(txtUserName(6), #0.00) rst.Fields!cFeeMoney = txtUserName(7) rst.UpdateBatch adAffectCurrent End If rs
39、t.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.ShowEn
40、d SubPrivate Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)Select Case Trim(Button.Key)Case afrmFee.Show 1Case b frmCopyP.ShowCase c frmFee.Show 1Case dfrmbeifen.Show 1Case efrmdaoru.Show 1Case ffrmFeefind.Show 1Case gfrmFind1.Show 1Case dhcb1 Case dbcb2Case jX = MsgBox(真的要退出吗?, vbYesNo + vbQuest