传统的电费管理都是由工作人员手工查表,抄表完成的,其中要完成用户电费的收取,每月抄度,用户购电情况查询,以及列出欠费用户的信息名单,之类的信息.其工作强度大,工作流程繁琐,由于工作人员的不细心,将会造成电费收支的出错也是经常发生的.鉴于以上原因我们有必要开发一种帮作电费管理人员的软件系统,可以完成检查用户用电情况,每月抄度,信息录入以及基本数据维护的各项功能.本系统采用visual basic 6.0与微软Access数据库方式.界面尽量做到人性化,数据维护方面做到可靠安全。
本系统主要由以下几大功能模块组成:
本系统主要服务于电费管理人员的日常工作.设计思路主要参照工作人员抄表,记录资料,资料管理,信息录入等方面的工作流程展开的.
本系统采用visual basic6.0与微软的access作为数据库结合.在系统编写上具有可行性.
经济方面:本系统可以服务电厂,电费管理单位,为企业节省人力开支.
社会方面:服务于大众,方便抄表人员工作,可靠方便。
字段名称 |
数据类型 |
说明 |
ATypeID |
自动编号 |
|
AType |
文本 |
电费类型 |
UNITPRICE |
货币 |
|
Adate |
日期/时间 |
电费设置日期 |
字段名称 |
数据类型 |
姓名 |
文本 |
操作权限 |
文本 |
密码 |
文本 |
字段名称 |
数据说明 |
TableName |
文本 |
MaxID |
数字 |
1.用户登陆界面设计:
用户登陆界面代码分析:
Private Sub Command1_Click()
Dim rstpchard As New ADODB.Recordset
Dim reHard As String
Dim getid As String
reHard = GetpcHard(getid)
rstpchard.Open "select * from getpchard ", gCnn, adOpenKeyset, adLockBatchOptimistic
If rstpchard.RecordCount = 0 Then
rstpchard.AddNew
rstpchard.Fields(0) = reHard
rstpchard.UpdateBatch adAffectCurrent
Else
If Trim(reHard) <> Trim(rstpchard.Fields(0)) Then
MsgBox " 对不起,使用不合法请与开发者联系! ", vbInformation
End
End If
End If
If Check1.Value = 1 Then
Set rec = New ADODB.Recordset
rec.Open "select * from 记住密码", gCnn, 3, 3
rec("标记") = "1"
If Combo2.Text <> "" Then
rec("姓名") = Combo2.Text
Else
rec("姓名") = ""
End If
If Combo1.Text <> "" Then
rec("权限") = Combo1.Text
Else
rec("权限") = ""
End If
If Text2.Text <> "" Then
rec("密码") = Text2.Text
Else
rec("密码") = ""
End If
rec.Update
rec.Close
Else
Set rec = New ADODB.Recordset
rec.Open "select * from 记住密码", gCnn, 3, 3
rec("标记") = "0"
rec.Update
rec.Close
End If
Dim rec1 As ADODB.Recordset
Set rec1 = New ADODB.Recordset
rec1.Open "select * from 登录人员", gCnn, 3, 3
Set rec = New ADODB.Recordset
rec.Open "select * from 密码表 where 姓名='" & Combo2.Text & "'and 操作权限='" & Combo1.Text & "'and 密码='" & Text2.Text & "'", gCnn, 3, 3
If 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.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
' FRMMAIN.delte.Enabled = True
End If
rec1("姓名") = Combo2.Text
rec1.Update
rec1.Close
Me.Hide
Guser = Combo2.Text
MDIme.Show
Else
MsgBox "权限或密码不正确,请重试!", vbInformation
End If
rec.Close
End Sub
Private Sub Command11_Click()
End Sub
Private Sub Command2_Click()
Combo2.Text = ""
Text2.Text = ""
Combo1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
Me.Hide
FRMMMXG.Show 1
End Sub
Private Sub Form_Activate()
Text2.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Set rec = New ADODB.Recordset
rec.Open "select * from 记住密码", gCnn, 3, 3
If rec("标记") = "0" Or rec("标记") = "1" Then
Check1.Value = rec("标记")
End If
rec.Close
Set rec = New ADODB.Recordset
rec.Open "select * from 记住密码", gCnn, 3, 3
If rec("标记") = 1 Then
Combo2.Text = rec("姓名")
Combo1.Text = rec("权限")
Text2.Text = rec("密码")
End If
rec.Close
Command1.SetFocus
End Sub
Private Sub Form_Load()
gCnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:database password= " & DbPassword & " ;Data Source= " & _
App.Path & "\data\dbdb.mdb;Persist Security Info=False"
gCnn.CursorLocation = adUseClient
gCnn.Open
Set rec = New ADODB.Recordset
rec.Open "select distinct 姓名 from 密码表", gCnn, 3, 3
With Combo2
Do Until rec.EOF
.AddItem rec("姓名")
rec.MoveNext
Loop
End With
rec.Close
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
主界面代码设计:
Private Sub alllm_Click()
frmList.qfFlg = False
frmList.Show
End Sub
Private Sub backup_Click()
frmbeifen.Show
End Sub
Private Sub benrixiaojie_Click()
frmCount.Show
End Sub
Private Sub Command1_Click()
frameFee.Visible = False
End Sub
Private Sub cmdQuery_Click()
Dim rst As New ADODB.Recordset
rst.Open " select * from panelinfo where holder='" & Me.txtUser & "' and delflag<>true ", gCnn, adOpenStatic, adLockBatchOptimistic
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")
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.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 = Nothing
End Sub
Private Sub dcNum_Click(Area As Integer)
Dim rst As New ADODB.Recordset
rst.Open " select * from panelinfo where holderid='" & dcNum.Text & "'and delflag<>true ", 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.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 / 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.Close
End Sub
Private Sub dcvalue_Click(Area As Integer)
Dim rst As New ADODB.Recordset
rst.Open " select * from panelinfo where holderid='" & dcvalue.BoundText & "' and delflag<>true ", 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)
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 / 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.Fields(9)
txtUserName(7) = Format(Val(txtUserName(5)) + Val(txtUserName(6)), "####0.00")
dcNum.Text = rst.Fields(1)
End If
rst.Close
Set rst = Nothing
End Sub
Private Sub dcvalue_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub del_Click()
frmdel.Show
End Sub
Private Sub dhcb_Click()
usrcopyP.Show
End Sub
Private Sub dhcp_Click()
frmCopyP.Show
End Sub
Private Sub duohu_Click()
frmCuifei.muser1 = 2
frmCuifei.Show
End Sub
Private Sub edit_Click()
frmEdit.Show
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub insert_Click()
frmInsert.Show 1
End Sub
Private Sub jiaonadianfei_Click()
frmFee.Show
End Sub
Private Sub M_USERYTPE_Click()
FRMUSERTYPE.Show 1
End Sub
Private Sub MDIForm_Load()
loadAdd
End Sub
Public Sub loadAdd()
If rst.State = 1 Then
rst.Close
End If
rst.Open " select * from panelinfo where delflag<>true ", 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 = 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.00")
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)
txtUserName(7) = Val(txtUserName(5)) + Val(txtUserName(6))
rst.Fields!cFeeMoney = txtUserName(7)
rst.UpdateBatch adAffectCurrent
End If
End If
End Sub
Public 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.Path & "\data\dbdb.mdb;Persist Security Info=False"
cnn.CursorLocation = adUseClient
cnn.Open
If Trim(Hid) <> "" Then
rst.Open " select * from panelinfo where holderid='" & Hid & "' and delflag<>true ", cnn, adOpenStatic, adLockBatchOptimistic
Else
rst.Open " select * from panelinfo where delflag<>true ", 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) = 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) = 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 = 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
rst.Close
cnn.Close
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
gCnn.Close
Set gcon = Nothing
End Sub
Private Sub mgcf_Click()
frmFeefind.Show
End Sub
Private Sub mhf_Click()
frmdaoru.Show
End Sub
Private Sub msf_Click()
frmFind1.Show
End Sub
Private Sub qianfeilm_Click()
frmList.qfFlg = True
frmList.Show
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Trim(Button.Key)
Case "a"
frmFee.Show 1
Case "b"
frmCopyP.Show
Case "c"
frmFee.Show 1
Case "d"
frmbeifen.Show 1
Case "e"
frmdaoru.Show 1
Case "f"
frmFeefind.Show 1
Case "g"
frmFind1.Show 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 MSComctlLib.ButtonMenu)
Select Case ButtonMenu.Key
Case "dhcb1"
frmCopyP.Show
Case "dhcb2"
usrcopyP.Show
End Select
End Sub
Private Sub weihu_Click()
FRMYHSD.Show
End Sub
Private Sub yihu_Click()
frmCuifei.muser1 = 1
frmCuifei.Show
End Sub
未完待续。。。