?? 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 + -