📄 frmclaimsinformation.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmClaimsInformation
Caption = "理赔信息维护"
ClientHeight = 7620
ClientLeft = 60
ClientTop = 450
ClientWidth = 9285
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7620
ScaleWidth = 9285
Begin VB.Frame frameBottom
Caption = "理赔记录"
Height = 2895
Left = 0
TabIndex = 22
Top = 4680
Width = 9315
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid
Height = 2655
Left = 60
TabIndex = 23
Top = 240
Width = 9255
_ExtentX = 16325
_ExtentY = 4683
_Version = 393216
AllowBigSelection= 0 'False
SelectionMode = 1
AllowUserResizing= 1
End
End
Begin VB.Frame frameCenter
Caption = "理赔录入"
Height = 3915
Left = 0
TabIndex = 5
Top = 720
Width = 9315
Begin VB.ComboBox combCaseType
Height = 300
Left = 1740
Style = 2 'Dropdown List
TabIndex = 25
Top = 1680
Width = 4335
End
Begin VB.TextBox txtRemarks
Height = 675
Left = 1740
TabIndex = 21
Top = 3120
Width = 5595
End
Begin VB.ComboBox combClaimsState
Height = 300
Left = 1740
Style = 2 'Dropdown List
TabIndex = 20
Top = 2760
Width = 2115
End
Begin VB.TextBox txtClaimsAmount
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
Height = 330
Left = 1740
TabIndex = 19
Top = 2340
Width = 2115
End
Begin MSComCtl2.DTPicker dtInsuranceDate
Height = 315
Left = 1740
TabIndex = 18
Top = 2040
Width = 2115
_ExtentX = 3731
_ExtentY = 556
_Version = 393216
Format = 21954561
CurrentDate = 39735
End
Begin VB.TextBox txtCaseLocation
Height = 315
Left = 1740
TabIndex = 17
Top = 1320
Width = 4395
End
Begin MSComCtl2.DTPicker dtHappendDate
Height = 315
Left = 1740
TabIndex = 16
Top = 960
Width = 2055
_ExtentX = 3625
_ExtentY = 556
_Version = 393216
Format = 21954561
CurrentDate = 39735
End
Begin VB.TextBox txtInsurance
Height = 315
Left = 1740
TabIndex = 15
Top = 600
Width = 4395
End
Begin VB.TextBox txtContractId
Height = 315
Left = 1740
TabIndex = 14
Top = 240
Width = 4395
End
Begin VB.Label Label9
Alignment = 1 'Right Justify
Caption = "案件的类型:"
Height = 315
Left = -120
TabIndex = 24
Top = 1680
Width = 1755
End
Begin VB.Label Label8
Alignment = 1 'Right Justify
Caption = "备注:"
Height = 315
Left = 360
TabIndex = 13
Top = 3180
Width = 1215
End
Begin VB.Label Label7
Alignment = 1 'Right Justify
Caption = "理赔状态:"
Height = 315
Left = 420
TabIndex = 12
Top = 2760
Width = 1215
End
Begin VB.Label Label6
Alignment = 1 'Right Justify
Caption = "理赔金额:"
Height = 255
Left = 240
TabIndex = 11
Top = 2340
Width = 1395
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
Caption = "理赔日期:"
Height = 255
Left = 600
TabIndex = 10
Top = 2040
Width = 975
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
Caption = "案件发生地点:"
Height = 255
Left = -840
TabIndex = 9
Top = 1320
Width = 2475
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "案件发生时间:"
Height = 195
Left = -720
TabIndex = 8
Top = 960
Width = 2355
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "投保单位和个人:"
Height = 255
Left = -300
TabIndex = 7
Top = 600
Width = 1935
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "保险合同编号:"
Height = 315
Left = 120
TabIndex = 6
Top = 300
Width = 1515
End
End
Begin VB.Frame frameTop
Height = 675
Left = 0
TabIndex = 0
Top = 0
Width = 9315
Begin VB.CommandButton btnReturn
Caption = "返回"
Height = 315
Left = 2220
TabIndex = 4
Top = 240
Width = 675
End
Begin VB.CommandButton btnSave
Caption = "保存"
Height = 315
Left = 1560
TabIndex = 3
Top = 240
Width = 495
End
Begin VB.CommandButton btnRemove
Caption = "-"
Height = 315
Left = 780
TabIndex = 2
Top = 240
Width = 555
End
Begin VB.CommandButton btnAdd
Caption = "+"
Height = 315
Left = 120
TabIndex = 1
Top = 240
Width = 555
End
End
End
Attribute VB_Name = "frmClaimsInformation"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private id As Integer '主键id
Dim msg As String '提示信息
Dim rs As ADODB.Recordset '通用记录集
Private Sub btnAdd_Click() '添加理赔信息
'转换时间日期格式
Dim DTHappend, DTInsurance As Variant
DTHappend = Format(Trim(dtHappendDate.Value), "yyyy-mm-dd")
DTInsurance = Format(Trim(dtInsuranceDate.Value), "yyyy-mm-dd")
'生成查询字符串
Dim str As String
str = "INSERT INTO TClaims(ContractId,SurrenderedInformation,CaseDate,CaseLocation,CaseType,ClaimsDate,ClaimsAmount,ClaimsState,Remarks) values('" & txtContractId.text & "','" & txtInsurance.text & "','" & DTHappend & "','" & txtCaseLocation.text & "','" & combCaseType.text & "','" & DTInsurance & "','" & txtClaimsAmount.text & "','" & combClaimsState.text & "','" & txtRemarks.text & "')"
'插入数据
Set rs = ExecuteSQL(str, msg)
If (msg <> "Successful") Then
MsgBox msg
End If
'更新MSFlexGrid视图信息
UpdateDataFromDatabase
End Sub
Private Sub btnRemove_Click() '删除理赔信息
'获得用户选择的数据的id
id = CInt(MSFlexGrid.TextMatrix(MSFlexGrid.Row, 0))
Dim rs As ADODB.Recordset
'查询字符串
Dim str As String
str = "delete from TClaims where ClaimsId=" & id
Set rs = ExecuteSQL(str, msg) '删除
If (msg <> "Successful") Then
MsgBox msg
End If
'更新MSFlexGrid视图信息
UpdateDataFromDatabase
End Sub
Private Sub btnReturn_Click() '返回时直接关闭本窗体
Unload Me
End Sub
Private Sub btnSave_Click() '更新数据
'转换时间日期格式
Dim DTHappend, DTInsurance As Variant
DTHappend = Format(Trim(dtHappendDate.Value), "yyyy-mm-dd")
DTInsurance = Format(Trim(dtInsuranceDate.Value), "yyyy-mm-dd")
'生成查询字符串
Dim str As String
str = "update TClaims set ContractId='" & txtContractId.text & "',SurrenderedInformation='" & txtInsurance.text & "',CaseDate='" & DTHappend & "',CaseLocation='" & txtCaseLocation.text & "',CaseType='" & combCaseType.text & "',ClaimsDate='" & DTInsurance & "',ClaimsAmount='" & txtClaimsAmount.text & "',ClaimsState='" & combClaimsState.text & "',Remarks='" & txtRemarks.text & "' where ClaimsId=" & id
'执行
Set rs = ExecuteSQL(str, msg)
If (msg <> "Successful") Then
MsgBox msg
End If
'更新MSFlexGrid视图信息
UpdateDataFromDatabase
End Sub
Private Sub Form_Load()
Dim CaseType, ClaimsState
CaseType = Array("生产事故", "交通事故", "意外事故")
For i = 0 To 2
combCaseType.AddItem CaseType(i)
Next i
combCaseType.text = CaseType(0)
ClaimsState = Array("正在理赔", "未理赔", "已理赔")
For i = 0 To 2
combClaimsState.AddItem ClaimsState(i)
Next i
combClaimsState.text = ClaimsState(0)
'更新MSFlexGrid视图信息
UpdateDataFromDatabase
MSFlexGrid_Click
End Sub
Public Sub UpdateDataFromDatabase() '更新MSFlexGrid视图信息
Dim width, text, Archives
'先清空原有数据
MSFlexGrid.Clear
'字段名和其宽度
width = Array("400", "1100", "1000", "1300", "1000", "800", "1300", "800", "800", "2000")
text = Array("序号", "保险合同编号", "投保单位和个人", "案件发生时间", "案件发生地点", "案件类型", "理赔日期", "理赔金额", "理赔状态", "备注")
With MSFlexGrid
.Rows = 2
.Cols = 10
.FixedCols = 0
.FixedRows = 1
End With
' 表头数据
For i = 0 To 8
MSFlexGrid.ColWidth(i) = width(i)
MSFlexGrid.TextMatrix(0, i) = text(i)
Next i
'查询数据库
Set rs = ExecuteSQL("Select* from TClaims", msg)
If rs.EOF = False Then '如果有数据
rs.MoveFirst
'将数据添加到视图
For i = 0 To rs.RecordCount - 1
If i + 1 >= MSFlexGrid.Rows Then MSFlexGrid.Rows = MSFlexGrid.Rows + 1
For j = 0 To rs.Fields.Count - 1
MSFlexGrid.TextMatrix(i + 1, j) = rs.Fields(j)
Next j
rs.MoveNext
Next i
rs.Close
End If
End Sub
Private Sub Form_Resize() '窗体大小变化时调整控件大小
frameTop.width = Me.width - 120
frameCenter.width = Me.width - 120
frameBottom.width = Me.width - 120
frameBottom.Height = Me.Height - 5200
MSFlexGrid.width = frameBottom.width - 120
MSFlexGrid.Height = frameBottom.Height - 300
End Sub
Private Sub MSFlexGrid_Click() '当用户在视图上选择某行时,更新数据到编辑区
id = CInt(MSFlexGrid.TextMatrix(MSFlexGrid.Row, 0))
txtContractId = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 1)
txtInsurance = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 2)
If (MSFlexGrid.TextMatrix(MSFlexGrid.Row, 3) <> "") Then dtHappendDate.Value = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 3)
txtCaseLocation = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 4)
combCaseType = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 5)
If MSFlexGrid.TextMatrix(MSFlexGrid.Row, 6) <> "" Then dtInsuranceDate.Value = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 6)
txtClaimsAmount = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 7)
combClaimsState = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 8)
txtRemarks = MSFlexGrid.TextMatrix(MSFlexGrid.Row, 9)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -