📄 manypricemeter.frm
字号:
SubItemIndex = 8
Text = "比率2"
Object.Width = 1235
EndProperty
BeginProperty ColumnHeader(10) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 9
Text = "比率2名称"
Object.Width = 2117
EndProperty
BeginProperty ColumnHeader(11) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 1
SubItemIndex = 10
Text = "比率2电价"
Object.Width = 2117
EndProperty
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "定比定量对特殊用户进行多种电价分比计算,操作员要先把需分比用户登记比率和电价类别,这样系统才会自行计算。"
ForeColor = &H00000000&
Height = 855
Left = 8055
TabIndex = 16
Top = 420
Width = 2715
End
Begin VB.Image Image1
Height = 480
Left = 6930
Picture = "ManyPriceMeter.frx":014A
Top = 315
Width = 480
End
Begin VB.Label Label6
BackColor = &H00CCB400&
BorderStyle = 1 'Fixed Single
Caption = " 提示:"
ForeColor = &H0000FFFF&
Height = 1200
Left = 6870
TabIndex = 11
Top = 210
Width = 4125
End
End
End
Attribute VB_Name = "ManyPriceMeter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Txobj As Integer
Private Sub Form_Load()
Dim itm As ListItem
Dim intRecCount, intCounter As Integer
On Error Resume Next
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
OpenMdb
Set MdbR = NdMd.OpenRecordset("SELECT 用户电费.用户编码,用户电费.抄表码,用户电费.用户类型,用户电费.全称,用户电费.用户名称,用户电费.多价表,用户电费.[" & AAA & "] AS 上期示数, 用户电费.[" & AA & "] AS 本期示数,用户电费.表损, 用户电费.倍率,用户电费.[" & BB & "] AS 调整电量,用户电费.[" & CC & "] AS 本次电量, 用户电费.[" & DD & "] AS 合计电量,用户电费.电价,用户电费.[" & EE & "] AS 调整金额, 用户电费.[" & FF & "] AS 滞纳金, 用户电费.[" & GG & "] AS 本次电费, 用户电费.[" & HH & "] AS 合计电费,用户电费.[" & JJ & "] AS 发票打印,用户电费.[" & KK & "] AS 交费情况,用户电费.组合编码,用户电费.比率1代码,用户电费.比率2代码,用户电费.比率1,用户电费.比率2,用户电费.比率1名称,用户电费.比率2名称,用户电费.比率1电价,用户电费.比率2电价 From 用户电费 WHERE 用户电费.镇村代码='" & UserSeek & "'order by 用户电费.抄表码 asc")
ListView1.SortKey = 0
ListView1.SortOrder = lvwAscending
ListView1.View = lvwReport
Combo1.Visible = False
Command1.Enabled = False
If Not MdbR.eof Then
MdbR.MoveLast
intRecCount = MdbR.RecordCount
MdbR.MoveFirst
For intCounter = 0 To MdbR.RecordCount - 1
Set itm = ListView1.ListItems.Add(, , CStr(MdbR!用户编码 & ""))
itm.SubItems(1) = MdbR!抄表码 & ""
itm.SubItems(2) = MdbR!用户类型 & ""
itm.SubItems(3) = MdbR!用户名称 & ""
itm.SubItems(4) = IIf(MdbR!多价表 = "True", "是", "")
itm.SubItems(5) = IIf(MdbR!比率1 = 0, "", (MdbR!比率1 * 100) & "%")
itm.SubItems(6) = MdbR!比率1名称
itm.SubItems(7) = IIf(MdbR!比率1电价 = 0, "", Format(MdbR!比率1电价, "0.000"))
itm.SubItems(8) = IIf(MdbR!比率2 = 0, "", (MdbR!比率2 * 100) & "%")
itm.SubItems(9) = MdbR!比率2名称
itm.SubItems(10) = IIf(MdbR!比率2电价 = 0, "", Format(MdbR!比率2电价, "0.000"))
MdbR.MoveNext
Next intCounter
ListView1.Sorted = True
Else
MsgBox XzName & XcName & GzYue & "月数据纪录为空!", vbCritical
Unload Me
Exit Sub
End If
'加载电价类别
Set MdbR = NdMd.OpenRecordset("select * from 电价档案 where 电价档案.标记 ='当前电价'")
With MdbR
While Not .eof
Combo1.AddItem .Fields!电价代码 & .Fields!电价名称 & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "|" & Format(.Fields!当前电价, "0.000")
.MoveNext
Wend
End With
If GetSetting(App.EXEName, "PriceSetup", "Opti", "") = "True" Then
Option1.Value = True
Label4.Visible = False
Else
Option1.Value = True
Label4.Visible = True
End If
End Sub
Private Sub Command1_Click()
On Error GoTo 0
If pbUserPermission <> "系统管理员" Then
MsgBox "您的权限不够,请于系统管理员联系!", vbInformation
Exit Sub
End If
If Command1.Caption = "登记(&O)" Then
If Option1 Then
If Val(Text1(0)) + Val(Text1(1)) <> 100 Then
MsgBox "比例分配有误,请检查!", vbCritical
Exit Sub
Else
NdMd.Execute "update 用户电费 set 多价表=1,旧价名称=电价类别,旧价=电价,比率1代码='" & Left(Text2(0).Text, 2) & "',比率2代码='" & Left(Text2(1).Text, 2) & "',比率1='" & Format(Val(Text1(0)) / 100, "0.00") & "',比率2='" & Format(Val(Text1(1)) / 100, "0.00") & "',比率1名称='" & conv_str(Trim(Mid(Text2(0).Text, 3, Val(InStr(Text2(0).Text, "|")) - 3))) & "',比率2名称='" & conv_str(Trim(Mid(Text2(1).Text, 3, Val(InStr(Text2(1).Text, "|")) - 3))) & "',比率1电价='" & PriceStr(Text2(0).Text, ".") & "',比率2电价='" & PriceStr(Text2(1).Text, ".") & "' WHERE 用户电费.镇村代码='" & XzCode & XcCode & "' and 用户电费.用户编码 ='" & ListView1.SelectedItem & "'"
ListView1.SelectedItem.SubItems(4) = "是"
ListView1.SelectedItem.SubItems(5) = Format(Format(Val(Text1(0)) / 100, "0.00") * 100, "0#") & "%"
ListView1.SelectedItem.SubItems(6) = conv_str(Trim(Mid(Text2(0).Text, 3, Val(InStr(Text2(0).Text, "|")) - 3)))
ListView1.SelectedItem.SubItems(7) = PriceStr(Text2(0).Text, ".")
ListView1.SelectedItem.SubItems(8) = Format(Format(Val(Text1(1)) / 100, "0.00") * 100, "0#") & "%"
ListView1.SelectedItem.SubItems(9) = conv_str(Trim(Mid(Text2(1).Text, 3, Val(InStr(Text2(1).Text, "|")) - 3)))
ListView1.SelectedItem.SubItems(10) = PriceStr(Text2(1).Text, ".")
End If
Else
If Val(Text1(0)) + Val(Text1(1)) + Val(Text1(2)) <> 100 Then
MsgBox "比例分配有误,请检查!", vbCritical
Exit Sub
Else
NdMd.Execute "update 用户电费 set 多价表=1,旧价名称=电价类别,旧价=电价,比率1='" & Format(Val(Text1(0)) / 100, "0.00") & "',比率2='" & Format(Val(Text1(1)) / 100, "0.00") & "',比率1名称='" & PriceName(Text2(0).Text, ".") & "',比率2名称='" & PriceName(Text2(1).Text, ".") & "',比率1电价='" & PriceStr(Text2(0).Text, ".") & "',比率2电价='" & PriceStr(Text2(1).Text, ".") & "' WHERE 用户电费.镇村代码='" & XzCode & XcCode & "' and 用户电费.用户编码 ='" & ListView1.SelectedItem & "'"
End If
End If
Command1.Caption = "注销(&D)"
Frame2.Enabled = False
Else
NdMd.Execute "update 用户电费 set 多价表=0,电价类别=旧价名称,电价=旧价,比率1=0,比率2=0,比率1代码=' ',比率2代码=' ',比率1名称=' ',比率2名称=' ',比率1电价=0,比率2电价=0,比率1电量=0,比率2电量=0,比率1电费=0,比率2电费=0 WHERE 用户电费.镇村代码='" & UserSeek & "' and 用户电费.用户编码 ='" & ListView1.SelectedItem & "' and 用户电费.抄表码 ='" & ListView1.SelectedItem.ListSubItems(1) & "'"
ListView1.SelectedItem.SubItems(3) = ""
ListView1.SelectedItem.SubItems(4) = ""
ListView1.SelectedItem.SubItems(5) = ""
ListView1.SelectedItem.SubItems(6) = ""
ListView1.SelectedItem.SubItems(7) = ""
ListView1.SelectedItem.SubItems(8) = ""
ListView1.SelectedItem.SubItems(9) = ""
Command1.Caption = "登记(&O)"
Frame2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
SaveSetting App.EXEName, "PriceSetup", "Opti", Option1.Value
NdMd.Close
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
On Error Resume Next
If ListView1.SelectedItem.SubItems(4) = "" Then
Frame2.Enabled = True
Command1.Caption = "登记(&O)"
If Len(Text1(0)) <> 0 Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
Else
Frame2.Enabled = False
Command1.Caption = "注销(&D)"
Command1.Enabled = True
End If
End Sub
Private Sub Option1_Click()
Label4.Visible = False
Text2(2).Visible = False
Text1(2).Visible = False
End Sub
Private Sub Option2_Click()
Label4.Visible = True
Text1(2).Visible = True
Text2(2).Visible = True
End Sub
Private Sub Option3_Click(Index As Integer)
Select Case Index
Case 0
If Option3(Index).Value = True Then
Text3 = ""
Text3.MaxLength = 4
Text3.SetFocus
End If
Case 1
If Option3(Index).Value = True Then
Text3 = ""
Text3.MaxLength = 6
Text3.SetFocus
End If
Case 2
If Option3(Index).Value = True Then
Text3 = ""
Text3.MaxLength = 50
Text3.SetFocus
End If
End Select
End Sub
Private Sub Text1_Change(Index As Integer)
If Len(Trim(Text1(Index))) > 0 Then
Call CheckIsNumber(Text1(Index))
If Val(Text1(Index)) > 100 Then
MsgBox "输入错误!", vbCritical
Text1(Index).SetFocus
Exit Sub
Else
Command1.Enabled = True
End If
Else
Command1.Enabled = False
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = &HFFFF80
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
If Val(Text1(0)) = 0 Or Val(Text1(1)) > 100 Then
MsgBox "输入错误!", vbCritical
Exit Sub
Else
SendKeys "{tab}"
End If
End If
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = vbWhite
If Val(Text1(0).Text) > 0 Then
If Option1 Then
Text1(1) = 100 - Val(Text1(0).Text)
End If
Else
Text1(0) = ""
Text1(1) = ""
Text1(2) = ""
End If
End Sub
Private Sub Text2_click(Index As Integer)
Text2(Index).Text = Combo1.Text
End Sub
Private Sub Text2_GotFocus(Index As Integer)
Text2(Index).BackColor = &HFFFF80
Combo1.Visible = True
Combo1.Top = Text2(Index).Top
Txobj = Index
End Sub
Private Sub Text2_keyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
End If
End Sub
Private Sub Text2_LostFocus(Index As Integer)
Text2(Index).BackColor = vbWhite
End Sub
Private Sub Combo1_Click()
Text2(Txobj).Text = Combo1.Text
Combo1.Visible = False
End Sub
Private Sub Command3_Click()
Dim Seleitm As ListItem
Dim strFindMe As String
Dim intSelectedOption As Integer
If Option3(0).Value = True Then
strFindMe = Format(Trim(Text3), "0000")
intSelectedOption = lvwText
End If
If Option3(1).Value = True Then
strFindMe = Format(Trim(Text3), "000000")
intSelectedOption = lvwSubItem
End If
If Option3(2).Value = True Then
strFindMe = Text3
intSelectedOption = lvwSubItem
End If
Set Seleitm = ListView1.FindItem(strFindMe, intSelectedOption, , 1)
If Not (Seleitm Is Nothing) Then
Seleitm.EnsureVisible
Seleitm.Selected = True
ListView1.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command3_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -