📄 adjustamount.frm
字号:
Begin VB.CommandButton Command1
Caption = "标记翻转(&F)"
Height = 375
Left = 165
TabIndex = 2
Top = 3510
Width = 2160
End
Begin VB.Image Image1
Height = 1350
Left = 570
Picture = "AdjustAmount.frx":1658
Top = 555
Width = 1350
End
End
Begin MSComctlLib.ListView ListView1
Height = 6075
Left = 105
TabIndex = 0
Top = 60
Width = 8415
_ExtentX = 14843
_ExtentY = 10716
View = 3
LabelEdit = 1
Sorted = -1 'True
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
SmallIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 10
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "用户编码"
Object.Width = 1765
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "电表编码"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "用户名称"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "电表序号"
Object.Width = 1765
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 4
Text = "本期示数"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 5
Text = "上期示数"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 1
SubItemIndex = 6
Text = "调整电量"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 1
SubItemIndex = 7
Text = "本期余额"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(9) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 8
Text = "调整原因"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(10) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 9
Text = "组合编码"
Object.Width = 2540
EndProperty
End
End
Attribute VB_Name = "AdjustAmount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Mrs As Recordset
Private Sub Form_Load()
On Error GoTo LoadE
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
Frame2.Visible = False
Label5.Visible = False
Text5.Visible = False
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 交费情况 From 用户电费 WHERE 用户电费.镇村代码='" & UserSeek & "' order by 用户电费.用户编码,用户电费.多表序号")
Dim itm As ListItem
Dim intRecCount, intCounter As Integer
ListView1.SortKey = 0
ListView1.SortOrder = lvwAscending
ListView1.View = lvwReport
If Not MdbR.eof Then
MdbR.MoveLast
intRecCount = MdbR.RecordCount
MdbR.MoveFirst
For intCounter = 0 To MdbR.RecordCount - 1
If MdbR.Fields!用户类型 = "普通照明" Then
Set itm = ListView1.ListItems.Add(, , CStr(MdbR!用户编码 & ""), , 1)
Else
Set itm = ListView1.ListItems.Add(, , CStr(MdbR!用户编码 & ""), , 3)
End If
itm.SubItems(1) = MdbR!抄表码 & ""
itm.SubItems(2) = MdbR!用户名称 & ""
itm.SubItems(3) = MdbR!多表序号 & ""
itm.SubItems(4) = MdbR!本期示数 & ""
itm.SubItems(5) = MdbR!上期示数 & ""
itm.SubItems(6) = MdbR!调整电量 & ""
itm.SubItems(7) = Format(MdbR!调整金额, "0.00") & ""
itm.SubItems(8) = MdbR!调整原因 & ""
itm.SubItems(9) = MdbR!组合编码 & ""
itm.Tag = Trim(MdbR!用户名称)
MdbR.MoveNext
Next intCounter
ListView1.Sorted = True
Option1(0).Value = True
Else
MsgBox XzName & XcName & GzYue & "月数据纪录为空!", vbCritical
Unload Me
Exit Sub
End If
Exit Sub
LoadE:
MsgBox Err.Description, vbCritical
Exit Sub
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
On Error Resume Next
If Len(ListView1.SelectedItem.SubItems(8)) = 0 Then
Command1.Caption = "标记翻转"
Command2.Enabled = True
Command3.Enabled = True
Else
Command1.Caption = "取消" & ListView1.SelectedItem.SubItems(8) & ""
Command2.Enabled = False
'Command3.Enabled = False
End If
End Sub
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
'排序
On Error Resume Next
ListView1.SortKey = ColumnHeader.Index - 1
ListView1.Sorted = True
End Sub
Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text1 = Format(Text1, "000000")
SendKeys "{tab}"
End If
If KeyAscii = 27 Then
Image1.Visible = True
Frame2.Visible = False
End If
End Sub
Sub Text2_keyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = 13 Then
If Val(Text2) < Val(Text1) Then
MsgBox "输入错误,请重输!", 48
Text2.SetFocus
Else
Text2 = Format(Text2, "000000")
Set MdbR = NdMd.OpenRecordset("SELECT 用户电费.调整原因,用户电费.组合编码,用户电费.抄表码,用户电费.旧表电量 From 用户电费 WHERE trim(用户电费.镇村代码)='" & UserSeek & "' and trim(用户电费.抄表码)='" & ListView1.SelectedItem.ListSubItems(1) & "' order by 用户电费.抄表码 asc")
MdbR.Edit
MdbR.Fields!调整原因 = "换表"
MdbR.Fields!旧表电量 = Val(Text2) - Val(Text1)
MdbR.Update
SendKeys "{tab}"
End If
End If
If KeyAscii = 27 Then
Image1.Visible = True
Frame2.Visible = False
End If
End Sub
Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3 = Format(Text3, "000000")
SendKeys "{tab}"
End If
If KeyAscii = 27 Then
Image1.Visible = True
Frame2.Visible = False
End If
End Sub
'///////////换表////////////////
Sub Text4_keyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = 13 Then
If Val(Text4) < Val(Text3) Then
MsgBox "输入错误,请重输!", 48
Else
Text4 = Format(Text4, "000000")
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 交费情况 From 用户电费 WHERE trim(用户电费.镇村代码)='" & UserSeek & "' and trim(用户电费.抄表码)='" & Format(Trim(ListView1.SelectedItem.SubItems(1)), "000000") & "' order by 用户电费.抄表码 asc")
MdbR.Edit
MdbR.Fields!本期示数 = Format(Text4, "000000")
MdbR.Fields!上期示数 = Format(Text3, "000000")
MdbR.Update
ListView1.SelectedItem.SubItems(4) = Format(Text4, "000000")
ListView1.SelectedItem.SubItems(5) = Format(Text3, "000000")
ListView1.SelectedItem.SubItems(8) = "换表"
Image1.Visible = True
Frame2.Visible = False
Call RecoReg
End If
End If
If KeyAscii = 27 Then
Image1.Visible = True
Frame2.Visible = False
End If
End Sub
Sub Text5_keyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = 13 Then
If Val(Text5) < Val(ListView1.SelectedItem.SubItems(5)) Then
If MsgBox("修改后示数:" & Text5 & "小于上期示数:" & Val(ListView1.SelectedItem.SubItems(5)) & "确定修改吗?", vbYesNo + vbQuestion) = vbYes Then
Set MdbR = NdMd.OpenRecordset("SELECT 用户电费.组合编码,用户电费.用户编码,用户电费.抄表码,用户电费.[" & AA & "] AS 本期示数 FROM 用户电费 WHERE trim(用户电费.镇村代码)='" & UserSeek & "' and trim(用户电费.抄表码)='" & Format(Trim(ListView1.SelectedItem.SubItems(1)), "000000") & "' order by 用户电费.抄表码 asc")
MdbR.Edit
MdbR.Fields!本期示数 = Format(Text5, "000000")
MdbR.Update
ListView1.SelectedItem.SubItems(4) = Format(Text5, "000000")
Image1.Visible = True
Frame2.Visible = False
Else
Text5.SetFocus
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -