📄 frmchargingedit.frm
字号:
VERSION 5.00
Begin VB.Form FrmChargingEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑收费信息"
ClientHeight = 3705
ClientLeft = 45
ClientTop = 345
ClientWidth = 5415
Icon = "FrmChargingEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3705
ScaleWidth = 5415
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 975
Left = 240
TabIndex = 12
Top = 120
Width = 4935
Begin VB.TextBox txtRoom
Enabled = 0 'False
Height = 270
Left = 3720
MaxLength = 20
TabIndex = 16
Top = 605
Width = 1095
End
Begin VB.TextBox txtUnit
Enabled = 0 'False
Height = 270
Left = 1200
MaxLength = 20
TabIndex = 15
Top = 605
Width = 1095
End
Begin VB.TextBox txtBuilding
Enabled = 0 'False
Height = 270
Left = 1200
MaxLength = 20
TabIndex = 14
Top = 195
Width = 1095
End
Begin VB.CommandButton Cmd_RoomSel
Caption = "选择房间"
Height = 285
Left = 3720
MouseIcon = "FrmChargingEdit.frx":0CCA
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 13
Top = 240
Width = 1065
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "房间号码"
Height = 180
Left = 2760
TabIndex = 19
Top = 650
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "楼房编号"
Height = 180
Left = 240
TabIndex = 18
Top = 240
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "楼房单元"
Height = 180
Left = 240
TabIndex = 17
Top = 650
Width = 720
End
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 400
Left = 977
MouseIcon = "FrmChargingEdit.frx":0FD4
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 7
Top = 3120
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 3137
MouseIcon = "FrmChargingEdit.frx":12DE
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 8
Top = 3120
Width = 1300
End
Begin VB.Frame Frame2
Height = 1695
Left = 240
TabIndex = 0
Top = 1200
Width = 4935
Begin VB.TextBox txtPayDate
Height = 270
Left = 3720
MaxLength = 10
TabIndex = 6
Top = 1200
Width = 1095
End
Begin VB.TextBox txtReceiver
Height = 270
Left = 1200
MaxLength = 20
TabIndex = 5
Top = 1245
Width = 1095
End
Begin VB.TextBox txtAmount
Enabled = 0 'False
Height = 270
Left = 3720
MaxLength = 20
TabIndex = 4
Top = 720
Width = 1095
End
Begin VB.TextBox txtUnitPrice
Enabled = 0 'False
Height = 270
Left = 3720
MaxLength = 20
TabIndex = 2
Top = 285
Width = 1095
End
Begin VB.TextBox txtUnitNum
Enabled = 0 'False
Height = 270
Left = 1200
MaxLength = 20
TabIndex = 3
Top = 765
Width = 1095
End
Begin VB.ComboBox ComboItem
Height = 300
Left = 1200
Style = 2 'Dropdown List
TabIndex = 1
Top = 270
Width = 1095
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费日期"
Height = 180
Left = 2760
TabIndex = 22
Top = 1245
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收款人"
Height = 180
Left = 240
TabIndex = 21
Top = 1290
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费金额"
Height = 180
Left = 2760
TabIndex = 20
Top = 765
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费单价"
Height = 180
Left = 2760
TabIndex = 11
Top = 330
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费数量"
Height = 180
Left = 240
TabIndex = 10
Top = 810
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "收费项目"
Height = 180
Left = 240
TabIndex = 9
Top = 330
Width = 720
End
End
End
Attribute VB_Name = "FrmChargingEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OriId As Long
Private Sub Fill_Table()
Dim TmpId As Integer
'Num1是最后一次交费的刻度,Num2是最后一次未交费的刻度
Dim Num1, Num2 As Integer
With MyChargeItem
'根据用户选择的交费项目,读取项目编号
TmpId = .GetId(ComboItem.Text)
'读取收费项目信息
.GetInfo (TmpId)
'根据收费类型决定如何收费
Select Case .Unit
Case "按建筑面积"
'收费单价
txtUnitPrice = .UnitPrice
'读取建筑面积
MyStyle.GetInfo (CurHouse.StyleId)
txtUnitNum = MyStyle.Area1
'总金额
txtAmount = Val(txtUnitPrice) * Val(txtUnitNum)
Case "按抄表刻度"
'收费单价
txtUnitPrice = .UnitPrice
'根据收费项目读取刻度
Num1 = MyRecord.GetMaxNum(TmpId, CurHouse.HouseId, 0)
Num2 = MyRecord.GetMaxNum(TmpId, CurHouse.HouseId, 1)
'设计刻度差
If Num1 > Num2 Then
txtUnitNum = Num1 - Num2
Else
txtUnitNum = 0
End If
'总金额
txtAmount = Val(txtUnitPrice) * Val(txtUnitNum)
Case "收取总费用"
txtUnitPrice = 0
txtUnitNum = 0
'总金额
txtAmount = .UnitPrice
End Select
End With
End Sub
Private Function Check() As Boolean
'检查用户录入的数据是否有效
If CurHouse.HouseId <= 0 Then
MsgBox "请选择收费住户"
Check = False
Exit Function
End If
If Trim(ComboItem.Text) = "" Then
MsgBox "请选择收费项目"
ComboItem.SetFocus
Check = False
Exit Function
End If
If Trim(txtAmount.Text) = "" Then
MsgBox "请输入收费金额"
txtAmount.SetFocus
Check = False
Exit Function
End If
If Trim(txtReceiver.Text) = "" Then
MsgBox "请输入收费人"
txtReceiver.SetFocus
Check = False
Exit Function
End If
If Trim(txtPayDate.Text) = "" Then
MsgBox "请输入收费日期"
txtPayDate.SetFocus
Check = False
Exit Function
End If
'如果全部数据都有效,则返回True
Check = True
End Function
Private Sub Cmd_OK_Click()
'检查数据的有效性
If Check = False Then
Exit Sub
End If
'把用户录入的数据赋值到MyCharging中
With MyCharging
'房屋编号
.HouseId = CurHouse.HouseId
'收费项目编号
.ItemId = MyChargeItem.GetId(ComboItem.Text)
'单价
.UnitPrice = Val(txtUnitPrice)
'数量
.UnitNum = Val(txtUnitNum)
'收费金额
.Amount1 = Val(txtAmount)
'收款人
.Receiver = MakeStr(txtReceiver)
'收费日期
.PayDate = MakeStr(txtPayDate)
'如果是按抄表刻度收费,则要更新抄表记录表RecordItem
MyChargeItem.GetInfo (.ItemId)
If MyChargeItem.Unit = "按抄表刻度" Then
Call MyRecord.SetFlag1(.ItemId, .HouseId)
End If
'插入新数据
.Insert
End With
'关闭窗体
Unload Me
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_RoomSel_Click()
FrmHouseSel.Show 1
MyBuilding.GetInfo (CurHouse.BuildingId)
txtBuilding = MyBuilding.BuildingNo
txtUnit = CurHouse.HouseUnit
txtRoom = CurHouse.RoomNo
Fill_Table
End Sub
Private Sub ComboItem_Click()
Fill_Table
End Sub
Private Sub Form_Load()
Dim i As Integer
'把所有楼房号读取到数组Arr_Building()中
MyBuilding.GetInfo (CurHouse.BuildingId)
'显示房间信息
txtBuilding = MyBuilding.BuildingNo
txtUnit = CurHouse.HouseUnit
txtRoom = CurHouse.RoomNo
'读取收费项目
MyChargeItem.Load_ChargeItem ("")
'把收费项目添加到ComboItem中
i = 0
Do While Arr_ChargeItem(i) <> ""
ComboItem.AddItem Arr_ChargeItem(i)
i = i + 1
Loop
If ComboItem.ListCount > 0 Then
ComboItem.ListIndex = 0
End If
'计算收费金额
Fill_Table
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -