📄 main_gzjk.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form main_gzjk
BorderStyle = 1 'Fixed Single
Caption = "挂账结款"
ClientHeight = 5430
ClientLeft = 750
ClientTop = 2220
ClientWidth = 10350
Icon = "main_gzjk.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
ScaleHeight = 5430
ScaleWidth = 10350
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc2
Height = 420
Left = 5340
Top = 5895
Width = 2445
_ExtentX = 4313
_ExtentY = 741
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 2400
Top = 5640
Width = 2535
_ExtentX = 4471
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "main_gzjk.frx":000C
Height = 3735
Left = 75
TabIndex = 12
Top = 1125
Width = 10080
_ExtentX = 17780
_ExtentY = 6588
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Frame Frame2
Caption = "Frame2"
Height = 1080
Left = 120
TabIndex = 10
Top = 5640
Visible = 0 'False
Width = 1950
Begin VB.TextBox khye
Height = 330
Left = 195
TabIndex = 9
Text = "0"
Top = 240
Width = 420
End
End
Begin VB.TextBox czy
BackColor = &H80000004&
BorderStyle = 0 'None
Height = 255
Left = 8685
TabIndex = 8
Top = 45
Width = 1305
End
Begin VB.TextBox Text2
Height = 285
Left = 8055
TabIndex = 6
Top = 5025
Width = 2100
End
Begin VB.Frame Frame1
Caption = "挂账结款"
Height = 720
Left = 60
TabIndex = 0
Top = 330
Width = 10080
Begin VB.ComboBox Combo2
Height = 300
Left = 1050
TabIndex = 13
Top = 255
Width = 2055
End
Begin VB.TextBox Text1
Height = 330
Left = 6045
TabIndex = 11
Top = 240
Width = 2085
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "main_gzjk.frx":0021
Left = 4050
List = "main_gzjk.frx":0031
TabIndex = 4
Text = "现金"
Top = 255
Width = 1080
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 405
Left = 9105
TabIndex = 2
Top = 210
Width = 885
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 405
Left = 8205
TabIndex = 1
Top = 210
Width = 885
End
Begin VB.Label Lab2
BackStyle = 0 'Transparent
Caption = "挂账单位 结款方式 还款金额"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 120
TabIndex = 3
Top = 300
Width = 7380
End
End
Begin VB.Label Lab3
BackStyle = 0 'Transparent
Caption = "结款人"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 330
Left = 7245
TabIndex = 7
Top = 5055
Width = 1185
End
Begin VB.Label Lab1
BackStyle = 0 'Transparent
Caption = "操作员"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 225
Left = 7770
TabIndex = 5
Top = 60
Width = 915
End
End
Attribute VB_Name = "main_gzjk"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim d As String
Dim rs1 As New ADODB.Recordset
Private Sub Form_Load()
d = Format(Date, "YYYY-MM-DD")
t = Format(Time, "HH:MM:SS")
Dim i As Integer
'自动识别数据库路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tb_gzmx"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
rs1.Open "select distinct 挂账单位 from tb_gzmx ", adocon, adOpenKeyset, adLockOptimistic
For i = 1 To rs1.RecordCount
Combo2.AddItem rs1.Fields("挂账单位").Value
rs1.MoveNext
Next i
Adodc2.RecordSource = "select * from tb_gzmx where 摘要='房费已结清'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
For i = 0 To Adodc2.Recordset.RecordCount - 1
Combo2.ListIndex = 0
For j = 0 To Combo2.ListCount
If Combo2.List(j) = Adodc2.Recordset.Fields("挂账单位") Then
Combo2.RemoveItem (j)
End If
Next j
Adodc2.Recordset.MoveNext
Next i
End If
rs1.Close
adocon.Close
End Sub
Private Sub Form_Activate()
czy.text = Main.StatusBar1.Panels(4).text '赋值给czy.text
End Sub
Private Sub Form_Unload(Cancel As Integer)
Main.Enabled = True
End Sub
Private Sub text2_Change()
'查询挂账单位
Adodc1.RecordSource = "select * from tb_gzmx where 挂账单位= '" + Combo2.text + "'"
Adodc1.Refresh
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text1.SetFocus '按回车键text1获得焦点
End Sub
Private Sub Command1_Click()
If Text1.text = "" Or Combo2.text = "" Then
MsgBox "请输入完整信息"
Exit Sub
End If
'查询挂账单位
Adodc1.RecordSource = "select * from tb_gzmx where 挂账单位='" & Combo2.text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveLast
If Val(Adodc1.Recordset.Fields("金额累计")) > 0 Then
khye.text = Adodc1.Recordset.Fields("金额累计")
adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
adoRs.Open "select * from tb_gzmx ", adocon, adOpenKeyset, adLockOptimistic
adoRs.AddNew '添加新记录
adoRs.Fields("日期") = d
adoRs.Fields("时间") = t
adoRs.Fields("摘要") = "客户还款"
adoRs.Fields("姓名") = Text2.text
If Combo2.text <> "" Then adoRs.Fields("挂账单位") = Combo2.text
adoRs.Fields("还款金额") = Format(Val(Text1.text), "0.00")
adoRs.Fields("金额累计") = Format((Val(khye.text) - Val(Text1.text)), "0.00")
If Val(adoRs.Fields("金额累计")) <= 0 Then
MsgBox "房费已结清,找零为" & Trim(-adoRs.Fields("金额累计")) & ""
adoRs.Fields("摘要") = "房费已结清"
Combo2.RemoveItem (Combo2.ListIndex)
End If
rs1.Open "select * from tb_gzmx where 挂账单位='" & Combo2.text & "'", adocon, adOpenKeyset, adLockOptimistic
Do While rs1.EOF = False
rs1.Delete
Loop
rs1.Close
' If Val(adoRs.Fields("金额累计")) < 0 Then
' MsgBox "超出剩余金额,找零为" & Trim(-adoRs.Fields("金额累计")) & ""
' adoRs.Fields("摘要") = "房费已结清"
' End If
adoRs.Update '更新记录
adocon.Close
End If
End If
'清空数据
Text1.text = "": khye.text = "": Text2.text = ""
End Sub
Private Sub Command2_Click()
Main.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -