2023年7月4日发(作者:)
摘 要…………………………………………………………………………1
Abstract………………………………………………………………………2
第一章 引言…………………………………………………………………4
1.1 课题背景……………………………………………………………………4
1.2 系统简介……………………………………………………………………5
第二章 系统的分析……………………………………………………………6
2.1 系统开发的目标和思想……………………………………………………6
2.2 系统的可行性分析…………………………………………………………8
第三章 系统的设计……………………………………………………………18
3.1 系统的功能结构设计………………………………………………………18
3.2 系统的数据库设计
3.3 界面设计与代码设计……………………………………………………………………23
…………………………………………………………24
结束语………………………………………………………………………………46
致谢…………………………………………………………………………………47
参考文献……………………………………………………………………………48
摘 要
传统的电费管理都是由工作人员手工查表,抄表完成的,其中要完成用户电费的收取,每月抄度,用户购电情况查询,以及列出欠费用户的信息名单,之类的信息.其工作强度大,工作流程繁琐,由于工作人员的不细心,将会造成电费收支的出错也是经常发生的.鉴于以上原因我们有必要开发一种帮作电费管理人员的软件系统,可以完成检查用户用电情况,每月抄度,信息录入以及基本数据维护的各项功能.本系统采用visual basic 6.0与微软Access数据库方式.界面尽量做到人性化,数据维护方面做到可靠安全.
关键字: 电费管理,visual basic, Access,数据库
Abstract
Electricity from the traditional management staff are 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 result 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 system 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
第一章 引言
1.1 课题背景
传统的电费管理都是由工作人员手工查表,抄表完成的,其中要完成用户电费的收取,每月抄度,用户购电情况查询,以及列出欠费用户的信息名单,之类的信息.其工作强度大,工作流程繁琐,由于工作人员的不细心,将会造成电费收支的出错也是经常发生的.鉴于以上原因我们有必要开发一种帮作电费管理人员的软件系统,可以完成检查用户用电情况,每月抄度,信息录入以及基本数据维护的各项功能.本系统采用visual basic 6.0与微软Access数据库方式.界面尽量做到人性化,数据维护方面做到可靠安全.
1.2 系统简介
本系统主要由以下几大功能模块组成:
一. 用户交费:(交纳电费,本日小节)
二. 本月抄度:(单户抄度 多户抄度)
三. 资料导出 (全部清单,欠费清单)
四. 数据查询 (电费查询与统计,用户欠费查询)
五. 信息录入 (资料录入,资料修改, 资料删除)
六. 系统数据维护 (数据备份,数据恢复)
七. 基本数据维护 (用户类型维护, 操作员维护)
八. 帮助
九. 退出
第二章 系统的分析
2.1 系统开发的目标和思想
本系统主要服务于电费管理人员的日常工作.设计思路主要参照工作人员抄表,记录资料,资料管理,信息录入等方面的工作流程展开的.
2.2 系统的可行性分析
本系统采用visual basic6.0与微软的access作为数据库结合.在系统编写上具有可行性.
经济方面:本系统可以服务电厂,电费管理单位,为企业节省人力开支.
社会方面:服务于大众,方便抄表人员工作,可靠方便.
第三章 系统的设计
3.1 系统的功能结构设计
程序登陆
主界面
用户交费
本月抄费
资料导出
数据查询
信息录入
系统数据维护
基本数据维护
帮助
退出
3.2 系统的数据库设计
1. 用户类型表:
字段名称 数据类型
ATypeID 自动编号
AType 文本
UNITPRICE 货币
Adate 日期/时间
2. 密码表:
字段名称 数据类型
姓名 文本
操作权限 文本
密码 文本
说明
电费类型
电费设置日期
3. MaxID表:
字段名称
TableName
MaxID
数据说明
文本
数字
3.3 界面设计与代码设计
1.用户登陆界面设计:
3.4 界面设计与代码设计
用户登陆界面代码分析:
Private Sub Command1_Click()
Dim rstpchard As New set
Dim reHard As String
Dim getid As String
reHard = GetpcHard(getid)
"select * from getpchard ", gCnn, adOpenKeyset,
adLockBatchOptimistic
If Count = 0 Then
(0) = reHard
Batch adAffectCurrent
Else
If Trim(reHard) <> Trim((0)) Then
MsgBox " 对不起,使用不合法请与开发者联系! ", vbInformation
End
End If
End If
If = 1 Then
Set rec = New set
"select * from 记住密码", gCnn, 3, 3
rec("标记") = "1"
If <> "" Then
rec("姓名") =
Else
rec("姓名") = ""
End If
If <> "" Then
rec("权限") =
Else
rec("权限") = ""
End If
If <> "" Then
rec("密码") =
Else
rec("密码") = ""
End If
Else
Set rec = New set
"select * from 记住密码", gCnn, 3, 3
rec("标记") = "0"
End If
Dim rec1 As set
Set rec1 = New set
"select * from 登录人员", gCnn, 3, 3
Set rec = New set
"select * from 密码表 where 姓名='" & & "'and 操作权限='" & & "'and 密码='" & & "'", gCnn, 3, 3
If = False Then
If rec("操作权限") <> "管理员" Then
' d = False
d = False
d = False
d = False
' d = False
' d = False
Else
' d = True
d = True
d = True
CreateNewKey HKEY_CURRENT_USER, "ZhiYuanTechnologe"
SetKeyValue HKEY_CURRENT_USER, "ZhiYuanTechnologe",
"UserName", dlj, REG_SZ
SetKeyValue HKEY_CURRENT_USER, "ZhiYuanTechnologe",
"PassWord", dlj, REG_SZ
' d = True
' d = True
End If
rec1("姓名") =
Guser =
Else
MsgBox "权限或密码不正确,请重试!", vbInformation
End If
End Sub
Private Sub Command11_Click()
End Sub
Private Sub Command2_Click()
= ""
= ""
= ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
1
End Sub
Private Sub Form_Activate()
= ""
= ""
= ""
Set rec = New set
"select * from 记住密码", gCnn, 3, 3
If rec("标记") = "0" Or rec("标记") = "1" Then
= rec("标记")
End If
Set rec = New set
"select * from 记住密码", gCnn, 3, 3
If rec("标记") = 1 Then
= rec("姓名")
= rec("权限")
= rec("密码")
End If
us
End Sub
Private Sub Form_Load()
tionString = "Provider=.4.0;Jet OLEDB:database
password= " & DbPassword & " ;Data Source= " & _
& ";Persist Security Info=False"
Location = adUseClient
Set rec = New set
"select distinct 姓名 from 密码表", gCnn, 3, 3
With Combo2
Do Until
.AddItem rec("姓名")
xt
Loop
End With
Set rec = Nothing
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = True
Select Case MsgBox("此操作将退出本系统,继续吗?", vbYesNo, "警告")
Case vbYes
Cancel = False
End
Case Else
Cancel = True
End Select
End Sub
2.主界面设计:
主界面代码设计:
Private Sub alllm_Click()
= False
End Sub
Private Sub backup_Click()
End Sub
Private Sub benrixiaojie_Click()
End Sub
Private Sub Command1_Click()
e = False
End Sub
Private Sub cmdQuery_Click()
Dim rst As New set
" select * from panelinfo where holder='" & r & "' and
delflag<>true ", gCnn, adOpenStatic, adLockBatchOptimistic
If Count <> 0 Then
= (2)
txtUserName(0) = (1)
txtUserName(1) = !nowecount
txtUserName(2) = !cendcode
= (4)
txtUserName(3) = Format(!lMoney, "###0.00")
txtUserName(4) = Format(!bmoney, "###0.00")
txtUserName(6) = Format(!lsFee, "###0.00")
'txtUserName(5) = txtUserName(1) * !lMoney *
(!lightScale / 100) + txtUserName(1) * txtUserName(4) * (1 -
!lightScale / 100)
txtUserName(5) = Format(txtUserName(1) * !lMoney *
(!lightScale / 100) + !nowecount * !bmoney * (1 -
!lightScale / 100), "###0.00")
txtUserName(8) = (9)
txtUserName(7) = Format(Val(txtUserName(5)) + Val(txtUserName(6)),
"####0.00")
= (1)
Else
MsgBox " 没有查询到数据! ", vbInformation
End If
Set rst = Nothing
End Sub
Private Sub dcNum_Click(Area As Integer)
Dim rst As New set
" select * from panelinfo where holderid='" & & "'and
delflag<>true ", gCnn, adOpenKeyset, adLockBatchOptimistic
If Not Then
= (2)
txtUserName(0) = (1)
txtUserName(1) = !nowecount
txtUserName(2) = !cendcode
= (4)
txtUserName(3) = Format(!lMoney, "###0.00")
txtUserName(4) = Format(!bmoney, "###0.00")
txtUserName(6) = Format((8), "####0.00")
txtUserName(5) = Format(txtUserName(1) * txtUserName(3) *
(!lightScale / 100) + txtUserName(1) * txtUserName(4) * (1 -
!lightScale / 100), "####0.00")
txtUserName(8) = (9)
txtUserName(7) = Format(Val(txtUserName(5)) + Val(txtUserName(6)),
"####0.00")
End If
End Sub
Private Sub dcvalue_Click(Area As Integer)
Dim rst As New set
" select * from panelinfo where holderid='" & ext
& "' and delflag<>true ", gCnn, adOpenStatic, adLockBatchOptimistic
If Not Then
= (2)
txtUserName(0) = (1)
txtUserName(1) = !nowecount
txtUserName(2) = !cendcode
= (4)
txtUserName(3) = Format(!lMoney, "###0.00")
txtUserName(4) = Format(!bmoney, "###0.00")
txtUserName(6) = Format(!lsFee, "###0.00")
'txtUserName(5) = txtUserName(1) * !lMoney *
(!lightScale / 100) + txtUserName(1) * txtUserName(4) * (1 -
!lightScale / 100)
txtUserName(5) = Format(txtUserName(1) * !lMoney *
(!lightScale / 100) + !nowecount * !bmoney * (1 -
!lightScale / 100), "###0.00")
txtUserName(8) = (9)
txtUserName(7) = Format(Val(txtUserName(5)) + Val(txtUserName(6)),
"####0.00")
= (1)
End If
Set rst = Nothing
End Sub
Private Sub dcvalue_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub del_Click()
End Sub
Private Sub dhcb_Click()
End Sub
Private Sub dhcp_Click()
End Sub
Private Sub duohu_Click()
1 = 2
End Sub
Private Sub edit_Click()
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub insert_Click()
1
End Sub
Private Sub jiaonadianfei_Click()
End Sub
Private Sub M_USERYTPE_Click()
1
End Sub
Private Sub MDIForm_Load()
loadAdd
End Sub
Public Sub loadAdd()
If = 1 Then
End If
" select * from panelinfo where delflag<>true ", gCnn, adOpenKeyset,
adLockBatchOptimistic
If Count <> 0 Then
Set rce = rst
olumn = "holderID"
eld = "holder"
Set urce = rst
Set rce = rst
eld = "holderid"
If Not Then
= !holderid
= (2)
txtUserName(0) = (1)
txtUserName(1) = !nowecount
txtUserName(2) = !cendcode
= (4)
txtUserName(3) = Format(!lMoney, "##0.00")
txtUserName(4) = Format(!bmoney, "###.0.00")
txtUserName(6) = !lsFee
txtUserName(5) = Val(txtUserName(1)) * Val(txtUserName(3)) *
(Val(!lightScale) / 100) + Val(txtUserName(1)) * Val(txtUserName(4)) * (1
- !lightScale / 100)
txtUserName(8) = (9)
txtUserName(7) = Val(txtUserName(5)) + Val(txtUserName(6))
!cFeeMoney = txtUserName(7)
Batch adAffectCurrent
End If
End If
End Sub
Public Sub loadData(Hid As String)
Dim rst As New set
Dim cnn As New tion
Dim Atimes As Integer
Dim sqlAdd As String
tionString = "Provider=.4.0;Jet
OLEDB:database password= " & DbPassword & " ;Data Source= " & _
& ";Persist Security Info=False"
Location = adUseClient
If Trim(Hid) <> "" Then
" select * from panelinfo where holderid='" & Hid & "' and
delflag<>true ", cnn, adOpenStatic, adLockBatchOptimistic
Else
" select * from panelinfo where delflag<>true ", cnn,
adOpenStatic, adLockBatchOptimistic
End If
If Not Then
= !holderid
= (2)
txtUserName(0) = (1)
txtUserName(1) = !nowecount
txtUserName(2) = !cendcode
= (4)
txtUserName(3) = Format(!lMoney, "####0.00")
txtUserName(4) = Format(!bmoney, "####0.00")
txtUserName(6) = Format(!lsFee, "####0.00")
'txtUserName(5) = Format(txtUserName(1) * txtUserName(3) *
(!lightScale / 100) + txtUserName(1) * txtUserName(4) * (1 -
!lightScale / 100), "####0.00")
If !Atimes = 0 Then
Atimes = 1
Else
Atimes = !Atimes
End If
txtUserName(5) = Format(Val(txtUserName(1)) * txtUserName(3) *
Atimes, "####0.00")
txtUserName(8) = (9)
txtUserName(7) = Format(Val(txtUserName(5)) + Val(txtUserName(6)),
"####0.00")
!cFeeMoney = txtUserName(7)
Batch adAffectCurrent
End If
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
Set gcon = Nothing
End Sub
Private Sub mgcf_Click()
End Sub
Private Sub mhf_Click()
End Sub
Private Sub msf_Click()
End Sub
Private Sub qianfeilm_Click()
= True
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As )
Select Case Trim()
Case "a"
1
Case "b"
Case "c"
1
Case "d"
1
Case "e"
1
Case "f"
1
Case "g"
1
Case "dhcb1"
Case "dbcb2"
Case "j"
X = MsgBox("真的要退出吗?", vbYesNo + vbQuestion, "警告")
If X = vbYes Then
End
Else
End If
End Select
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As
Menu)
Select Case
Case "dhcb1"
Case "dhcb2"
End Select
End Sub
Private Sub weihu_Click()
End Sub
Private Sub yihu_Click()
1 = 1
End Sub
4. 备份界面设计:
:
备份代码设计:
Private Sub Command1_Click()
Dim a As String
a =
a = a & ""
b =
'On Error GoTo errhandle:
Dim filename As String
filename = "" & & ""
If a = Then
MsgBox "备份目录与原文件目录相同,请重新选择!"
Exit Sub
End If
If Dir("" & b & "") <> "" Then
Dim llp As String
llp = MsgBox("此目录下已有该文件,要覆盖吗?", vbYesNo, "备份文件")
If llp = vbYes Then
Kill ("" & b & "")
FileCopy "" & a & "", "" & b & ""
Dim l
l = MsgBox(" 备份成功! ", vbOKOnly, "提示")
Else
Exit Sub
End If
Else
FileCopy "" & a & "", "" & b & ""
Dim ll
ll = MsgBox(" 备份成功! ", vbOKOnly, "提示")
End If
Exit Sub
'errhandle:
'MsgBox "出现错误,不能复制", vbOKOnly + vbCritical, "复制文件"
'Resume Next
End Sub
Private Sub Command2_Click()
'dy
'
Unload Me
End Sub
Private Sub Dir1_Change()
' = Dir1
If Right(, 1) <> "" Then
= + ""
Else
=
End If
d = True
End Sub
Private Sub Dir1_Click()
If Right(, 1) <> "" Then
= + ""
Else
=
End If
d = True
End Sub
Private Sub Drive1_Change()
=
End Sub
Private Sub Form_Activate()
d = False
ChDrive
ChDir
'us
' = "c:"
= CurDir()
d = False
End Sub
Private Sub Form_Load()
ChDrive
ChDir
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
dy
End Sub
Private Sub Form_Unload(Cancel As Integer)
If = 0 Then
tionString = "Provider=.4.0;Jet OLEDB:database
password= " & DbPassword & " ;Data Source= " & _
& ";Persist Security Info=False"
Location = adUseClient
End If
d
End Sub
5. 单户抄表界面设计:
单户抄表代码设计:
Private Sub Command2_Click()
Dim cnn As New tion
Dim rstE As New set
Dim cmdExe As New d
Dim nowEv As Double
Dim sqlAdd As String
If Trim(txtUserName(0).Text) = "" Then
MsgBox " 没有要抄表用户,请先添加用户! ", vbInformation
Exit Sub
End If
If Trim(txtUserName(9).Text) = "" Then
MsgBox " 请先输入数据! ", vbInformation
Exit Sub
End If
If Trim(txtUserName(9).Text) < Trim(txtUserName(2).Text) Then
MsgBox " 输入数据错误,当前止码太小! ", vbInformation
Exit Sub
End If
tionString = "Provider=.4.0;Jet
OLEDB:database password= " & DbPassword & " ;Data Source= " & _
& ";Persist Security Info=False"
Location = adUseClient
Connection = cnn
"select nowecount from panelinfo where holderID= '" &
Trim(txtUserName(0)) & "'", cnn, adOpenStatic, adLockBatchOptimistic
nowEv = Val((0).Value) + (Val(txtUserName(9)) -
Val(txtUserName(2)))
sqlAdd = "update panelinfo set LEndPCode=" & Val(txtUserName(2).Text)
& ",cEndCode=" & Val(txtUserName(9).Text) & ",nowEcount=" & nowEv &
" ,writedate=#" & dtpwdate(1) & "# where holderID= '" & Trim(txtUserName(0))
& "'"
dText = sqlAdd
e sqlAdd
' e sqlAdd
txtUserName(2).Text = txtUserName(9)
txtUserName(9) = ""
MsgBox " 数据保存完成! ", vbInformation
Unload Me
End Sub
Private Sub Form_Load()
Dim rst As New set
Dim sqlEdit As String
dtpwdate(1).Value = Format(Now, "yyyy-mm-dd")
sqlEdit = "select * from panelinfo "
sqlEdit = sqlEdit & " where holderid='" & Trim(rName(0)) & "'and
delflag<>true"
sqlEdit, gCnn, adOpenStatic, adLockBatchOptimistic
If Not Then
txtUserName(0) = (1)
txtUserName(1) = (2)
txtUserName(2) = !cendcode
dtpwdate(0).Value = (4)
End If
buttontime = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
ta (txtUserName(0))
Cancel = 0
End Sub
Private Sub nextuser_Click()
Dim rst As New set
Dim sqlEdit As String
sqlEdit = "select * from panelinfo "
sqlEdit = sqlEdit & " where holderid<>'" & Trim(txtUserName(0)) & "'and
delflag<>true "
sqlEdit, gCnn, adOpenStatic, adLockBatchOptimistic
If buttontime = False Then
If Not Then
txtUserName(0) = (1)
txtUserName(1) = (2)
txtUserName(2) = !cendcode
dtpwdate(0).Value = (4)
buttontime = True
End If
Else
xt
If Not Then
txtUserName(0) = (1)
txtUserName(1) = (2)
txtUserName(2) = !cendcode
dtpwdate(0).Value = (4)
buttontime = True
End If
End If
End Sub
Private Sub txtUserName_KeyPress(Index As Integer, KeyAscii As Integer)
If Index = 9 Then
If KeyAscii <> 8 And KeyAscii <> 46 And KeyAscii < 48 Or KeyAscii > 57
Then KeyAscii = 0
End If
End Sub
6. 数据导入界面设计:
数据导入代码设计:
Private Sub Command1_Click()
On Error GoTo errhandle:
Dim a As String
a =
a = a & ""
b =
Dim filename As String
If Dir("" & a & "计费系统数据库.mdb") <> "" Then
Dim ll As String
ll = MsgBox("此目录下有此文件要覆盖吗", vbYesNo, "复制文件")
If ll = vbYes Then
Kill ("" & a & "计费系统数据库.mdb")
FileCopy "" & & "", "" & a & "计费系统数据库.mdb"
Dim l
l = MsgBox("数据导入成功", vbOKOnly, "提示")
Else
Exit Sub
End If
Else
FileCopy "" & & "", "" & a & "计费系统数据库.mdb"
Dim llp
llp = MsgBox("数据导入成功", vbOKOnly, "提示")
End If
Exit Sub
errhandle:
MsgBox "出现错误,不能复制", vbOKOnly + vbCritical, "复制文件"
End Sub
Private Sub Command2_Click()
dy
Unload Me
End Sub
Private Sub Dir1_Change()
If Right(, 1) <> "" Then
= + ""
Else
=
End If
=
End Sub
Private Sub Drive1_Change()
If = "a:" Then
MsgBox "不能从A盘导入"
Exit Sub
End If
=
End Sub
Private Sub File1_Click()
= + me
d = True
End Sub
Private Sub Form_Activate()
d = False
' = "c:"
= CurDir()
d = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
dy
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
If = 0 Then
tionString = "Provider=.4.0;Jet OLEDB:database
password= " & DbPassword & " ;Data Source= " & _
& ";Persist Security Info=False"
Location = adUseClient
End If
d
End Sub
7. 数据删除界面设计:
数据删除代码设计:
Private Sub cmdAsure_Click()
If MsgBox(" 你确定要删除该数据吗? ", vbInformation + vbYesNo) <> vbYes
Then
Exit Sub
End If
If Trim(ext) <> "" Then
Dim cnn As New tion
Dim sqlAdd As String
tionString = "Provider=.4.0;Jet
OLEDB:database password= " & DbPassword & " ;Data Source= " & _
& ";Persist Security Info=False"
Location = adUseClient
sqlAdd = "update panelinfo set delflag=true"
sqlAdd = sqlAdd & " where holderid='" &
Trim(ext) & "'"
e sqlAdd
MsgBox " 数据删除完成! ", vbInformation
End If
End Sub
Private Sub Command1_Click()
For i = 0 To 10
If i <> 9 Then
rName(i) = ""
End If
Next
= ""
e = ""
Unload Me
End Sub
Private Sub Form_Load()
Dim rst As New set
Dim sqlEdit As String
sqlEdit = "select * from panelinfo "
sqlEdit = sqlEdit & " where holderid='" & Trim(rName(0)) & "' and
delflag<>true "
sqlEdit, gCnn, adOpenKeyset, adLockBatchOptimistic
If Not Then
txtUserName(0) = (1)
txtUserName(1) = (2)
txtUserName(2) = (3)
= (4)
txtUserName(3) = (5)
txtUserName(4) = Format((6), "####0.00")
txtUserName(5) = Format((7), "####0.00")
txtUserName(6) = (8)
txtUserName(7) = (9)
txtUserName(8) = (10)
txtUserName(9) = !cendcode
changeE = !cendcode
cEcount = !nowecount
If (14) <> Null Then
= (14)
End If
txtUserName(10) = !cFeeMoney
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
d
End Sub
8. 数据修改界面设计:
数据修改代码设计:
Dim changeE As Double
Dim cEcount As Double
Private Sub cmdAsure_Click()
If Trim(ext) <> "" Then
Dim cnn As New tion
Dim sqlAdd As String
tionString = "Provider=.4.0;Jet
OLEDB:database password= " & DbPassword & " ;Data Source= " & _
& ";Persist Security Info=False"
Location = adUseClient
sqlAdd = "update panelinfo set holderid='" & txtUserName(0) &
"',holder='" & txtUserName(1) & "',LEndPCode='" & txtUserName(2) &
"',CopyDate=# " & & "# ,lightscale=" & txtUserName(3) & ",lsfee="
& txtUserName(4) & ",lmoney=" & txtUserName(5) & ",bmoney=" &
txtUserName(6) & ",cname='" & txtUserName(7) & "',memotext='" &
txtUserName(8) & "',cEndCode=" & txtUserName(9) & ",cFeeMoney=" &
Val(txtUserName(10)) & " ,nowecount=" & changeE & ",atimes=" & 1 & ""
sqlAdd = sqlAdd & " where holderid='" &
Trim(ext) & "'"
e sqlAdd
sqlAdd = "update 用户类型 set UNITPRICE=" & rName(5)
& " where ATypeID=" & dcob用途.BoundText
MsgBox " 数据修改完成! ", vbInformation
End If
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub dcob用途_Click(Area As Integer)
Dim rst As New set
If dcob用途.BoundText <> "" Then
"select * from 用户类型 where ATypeID=" & dcob用途.BoundText & "",
gCnn, adOpenStatic, adLockBatchOptimistic
rName(5) = Format((2), "###0.00")
Else
MsgBox " 请先添加用户电表类型信息! ", vbInformation
Exit Sub
End If
End Sub
Private Sub Form_Load()
Dim rst As New set
Dim sqlEdit As String
sqlEdit = "select * from panelinfo "
sqlEdit = sqlEdit & " where holderid='" & Trim(rName(0)) & "' and
delflag<>true "
sqlEdit, gCnn, adOpenKeyset, adLockBatchOptimistic
If Not Then
txtUserName(0) = (1)
txtUserName(1) = (2)
txtUserName(2) = (3)
= (4)
txtUserName(3) = Format((5), "####0.00")
txtUserName(4) = Format((6), "####0.00")
txtUserName(5) = Format((7), "####0.00")
txtUserName(6) = Format((8), "####0.00")
txtUserName(7) = (9)
txtUserName(8) = (10)
txtUserName(9) = !cendcode
= !Atimes
changeE = !cendcode
cEcount = !nowecount
If (14) <> Null Then
= (14)
End If
txtUserName(10) = !cFeeMoney
End If
Dim rstJB As New set
Set Connection = gCnn
Location = adUseClient
pe = adLockBatchOptimistic
Type = adOpenKeyset
"select * from 用户类型 where atypeid=" & !AtypeID
Set dcob用途.DataSource = rstJB
Set dcob用途.RowSource = rstJB
dcob用途.BoundColumn = "ATYPEID"
dcob用途.ListField = "ATYPE"
If Count <> 0 Then
dcob用途.Text = (1)
rName(5) = Format((2), "###0.00")
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
ta (txtUserName(0))
End Sub
Private Sub txtUserName_Change(Index As Integer)
If Index = 9 Then
changeE = cEcount + (Val(txtUserName(9)) - changeE)
End If
End Sub
Private Sub UpDown1_Change()
1 =
End Sub
9. 开始收费界面设计:
开始收费代码设计:
Private Sub CmdPrint_Click()
On Error GoTo l
Dim LongColor As Long
If MsgBox("打印机准备好了吗?", vbYesNo + vbInformation) <> vbYes Then
Exit Sub
End If
e = False
LongColor = lor
lor = vbWhite
lor = vbWhite
orm
lor = LongColor
e = True
Exit Sub
l: MsgBox ption
End Sub
Private Sub Command1_Click()
Dim rstFeeEnd As New set
Dim cmdExe As New d
Dim reMoney As String
Dim sqlString As String
If Trim(txtFee) = "" Or Trim(txtM) = "" Then
MsgBox " 请先输入数据! ", vbInformation
Exit Sub
End If
reMoney = ConvertMe(Trim(txtFee))
Dim Change As String
Change = Val(txtM) - Val(txtFee)
If Change < 0 Then
If MsgBox(" 实收电费比应收现金大,您确定要这样收取? ", vbYesNo +
vbInformation) = vbNo Then
Exit Sub
End If
End If
dernum = rName(0)
Name =
ount = rName(1) & "度"
= rName(2) & "度"
dInMoney = "¥" & Format(txtFee, "####0.00")
= "¥" & Format(, "####0.00")
aldate = Date
If Change >= 0 Then
eyOfCard = "¥" & Format(Change, "####0.00")
Else
eyOfCard = 0
End If
"select * from panelinfo where holderid='" &
rName(0) & "' and delflag<>true ", gCnn, adOpenStatic,
adLockBatchOptimistic
Dim rusrType As New set
If Count <> 0 Then
"select * from 用户类型 where AtypeID=" &
!AtypeID, gCnn, adOpenStatic, adLockBatchOptimistic
If Count <> 0 Then
Yype = !AType
Else
MsgBox " 用户类型不能为空! ", vbCritical
Unload Me
End If
End If
11 = !Atimes
11 = 11 & "/" & Format(!lMoney, "##0.00")
!nowecount = 0
= !LEndPCode & "度"
!lecount = !lecount + !nowecount
'MsgBox rName(7)
!lsFee = Val(rName(7)) - Val(txtM)
Batch adAffectCurrent
sqlString = "insert into feels
(holderid,holder,feemoney,qianfee,feedate,zhinajin,memols,cname,Ecount) values('"
& rName(0) & "','" & & "'," & Val()
& "," & Val() & ",#" & Format(Now, "yyyy-mm-dd") & "#," & Val(txtznj)
& ",'" & txtPrint & "','" & Guser & "'," & rName(1) & ")"
Connection = gCnn
dText = sqlString
e
e = True
e = True
e = False
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
n = & "用户(住户编号:" & rName(0)
& " ) 开始交费"
= rName(7)
End Sub
Private Sub Form_Unload(Cancel As Integer)
ta (rName(0))
End Sub
Private Sub txtFee_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 And KeyAscii <> 46 And KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End Sub
Private Sub txtM_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 And KeyAscii <> 46 And KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End Sub
Private Sub txtznj_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 And KeyAscii <> 46 And KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End Sub
10:数据查询界面设计:
数据查询代码设计:
Private Sub cmdExport_Click()
'导出网格数据到EXCEL中
Export rsdg, , " 数据查询", "日期:" & Format(Now, "yyyy-mm-dd"),
" 总电量:" & txtCountA & " 度 总金额:" & txtCount & " 元"
End Sub
Private Sub cmdQuery_Click()
Dim Sqlstr As String
Dim whrStr As String
Dim feeC As Double
Dim znjC As Double
Dim rstRg As New set
'拼Where 语句
whrStr = getWhrStr()
'取得网格的数据
Sqlstr = "select * from feels " & whrStr & " "
'MsgBox Sqlstr
If = 1 Then
End If
Sqlstr, gCnn, adOpenStatic, adLockOptimistic
' Sqlstr
Set rsdg = getQueryData(Sqlstr)
Set urce = rsdg
Sqlstr = " select sum(feeMoney),sum(Ecount) from feels " & whrStr & " "
If = 1 Then
End If
Sqlstr, gCnn, adOpenStatic, adLockBatchOptimistic
txtCount = Format((0), "####0.00") & " "
txtCountA = (1) & " "
MsgBox " 数据查询完成,共" & Count & " 条纪录!", vbInformation
End Sub
Private Function getWhrStr() As String
'功能描述:拼凑Where语句
'返回串值
Dim whrStr As String
'拼Where 语句
whrStr = "where 1 = 1 "
If Trim() <> "" Then
whrStr = whrStr & " and holderid ='" & Trim() & "' "
End If
If Trim(r) <> "" Then
whrStr = whrStr + " and holder like '%" & txtUser & "%'"
End If
If Trim(ey) <> "" Then
whrStr = whrStr + " and qianFee>= " & ey & ""
End If
whrStr = whrStr + " and Feedate>= #" & & "# and Feedate<= #" &
& "# "
getWhrStr = whrStr
End Function
Private Sub cmdReturn_Click()
Unload Me
End Sub
Private Sub Form_Load()
= Format(Now, "yyyy-mm-dd")
End Sub
Private Sub Form_Unload(Cancel As Integer)
If = 1 Then
End If
End Sub
11:费用查询界面设计:
费用查询代码设计:
Private Sub cmdExport_Click()
'导出网格数据到EXCEL中
Export rsdg, , " 数据查询", Format(Now, "yyyy-mm-dd")
End Sub
Private Sub cmdQuery_Click()
Dim Sqlstr As String
Dim whrStr As String
Dim feeC As Double
Dim znjC As Double
'拼Where 语句
whrStr = getWhrStr()
'取得网格的数据 '2957387
Sqlstr = "select * from panelInfo " & whrStr & " "
'MsgBox Sqlstr
If = 1 Then
End If
Sqlstr, gCnn, adOpenStatic, adLockOptimistic
Set rsdg = getQueryData(Sqlstr)
Set urce = rsdg
MsgBox " 数据查询完成,共" & Count & " 条纪录!", vbInformation
End Sub
Private Function getWhrStr() As String
'功能描述:拼凑Where语句
'返回串值
Dim whrStr As String
'拼Where 语句
whrStr = "where 1 = 1 "
If Trim() <> "" Then
whrStr = whrStr & " and holderid ='" & Trim() & "' "
End If
If Trim(r) <> "" Then
whrStr = whrStr + " and holder like '%" & txtUser & "%'"
End If
If Trim(ey) <> "" Then
whrStr = whrStr + " and cFeeMoney>= " & ey & ""
End If
getWhrStr = whrStr
End Function
Private Sub cmdReturn_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
If = 1 Then
End If
End Sub
结束语
本软件的设计目的是在电表收费管理维护方面为企事业单位和管理人员提供方便和帮助。通过这几个月的毕业设计,我学到很多以前没有学到的visual
basic开发技术,在软件工程学上更是取得了很大的进步。经过大量的测试和试用,作者深信本软件达到了方便和实用的设计目的,并在软件界面和易用实用等方面有着独到之处。
虽然软件基本达到设计要求并且达到同行的先进水平,但由于作者水平有限,软件存在bug也是在所难免的 ,您的意见和建议将极大的帮助我改进并完善软件。真诚的希望你的参与。
致谢
我首先感谢我的指导老师老师,在他严格的要求下我懂得了开发软件要有一种极其认真负责的态度。无论做什么事都要大胆的去想去做,这样会有好的创意,才能更有作为。
在这里我还要感谢我们宿舍的其它5个同学。他们和我共同生活了四年,在生活和学习上给了我很大的帮助。
参 考 文 献
1陈明 . 软件工程学教程 .科技出版社,2002
2 萨师煊,王珊 . 数据库系统概论 . 第三版 . 高等教育出版社,2000
3 飞思科技产品研发中心 . visual basic 6.0数据库应用开发 .电子工业出版社,2003
4 飞思科技产品研发中心 . visual basic 6.0开发者手册 . 电子工业出版社, 2002
5 申旻 . visual basic 6.0高手突破 . 清华大学出版社,2002,302
6 Steve Teixeira,Xaviver Pacheco著,龙劲松,王瑜,谢尚书译 . visual
basic 6.0开发人员指南 . 机械工业出版社 .2003
7 乔林 .参透Delphi/Kylix . 中国铁道出版社 .2003
8 李维 .Inside 深入核心 VCL 架构剖析 . 电子工业出版社 .2004
9 张立科编写组 .Windows API 函数参考手册 .人民邮电出版社 .2002
严蔚敏,吴伟民 .数据结构 .第二版 .清华大学出版社 .2001
10 王珍玲 。实用软件工程教程 高等教育出版社 2004
11 (英)Ian Sommerville 机械工业出版社 2003
12 美Cantu,U. 王辉等译visual basic 6.0 从入门到精通 电子工业出版社 2003
13 李维 面向对象开发实践之路(visual basic 6.0版)(BORLAND资深顾问著名visual basic 6.0专家李维最新力作) 电子工业出版社 2005.4
14 秦斌 等 visual basic 6.0数据库系统开发与应用 中国水利水电出版社 2006 .1
15 刘艺 visual basic 6.0面向对象编程思想 机械工业出版社 2003
basic 程序设计第二版 谭浩强 清华大学出版社 2003
17. visual basic6.0 程序设计教程. 胡同森 赵剑锋等. 浙江科学技术出版社,2002.1
18.软件工程学教程 (第二版) 周苏 王文 著 科学出版社 2003
Basic 6.0 程序设计与开发技术 求是科技 人民邮电出版社
2004.9
1.1 常用网址收藏
发布者:admin,转转请注明出处:http://www.yc00.com/web/1688435786a137491.html
评论列表(0条)