📄 main_rsgl_htgl.frm
字号:
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column05
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 Column06
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 Column07
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 Column08
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 Column09
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 Column10
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 Column11
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
MarqueeStyle = 4
BeginProperty Column00
ColumnWidth = 915.024
EndProperty
BeginProperty Column01
ColumnWidth = 1365.165
EndProperty
BeginProperty Column02
ColumnWidth = 1814.74
EndProperty
BeginProperty Column03
ColumnWidth = 2085.166
EndProperty
BeginProperty Column04
ColumnWidth = 2085.166
EndProperty
BeginProperty Column05
ColumnWidth = 2085.166
EndProperty
BeginProperty Column06
ColumnWidth = 1365.165
EndProperty
BeginProperty Column07
ColumnWidth = 2085.166
EndProperty
BeginProperty Column08
ColumnWidth = 1365.165
EndProperty
BeginProperty Column09
ColumnWidth = 2085.166
EndProperty
BeginProperty Column10
ColumnWidth = 2085.166
EndProperty
BeginProperty Column11
ColumnWidth = 824.882
EndProperty
EndProperty
End
End
Attribute VB_Name = "main_rsgl_htgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Dim i As Integer
Private Sub SetButtons()
For i = 5 To 12
Toolbar1.Buttons(i).Enabled = True
Next i
End Sub
Private Sub DataGrid1_DblClick()
If Adodc1.Recordset.RecordCount > 0 Then
blnAddHT = False
Load main_rsgl_htgl_lr
main_rsgl_htgl_lr.Show 1
End If
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
With Adodc1.Recordset
If .RecordCount > 0 Then
On Error Resume Next
SetButtons
Select Case .Fields("状态")
Case "到期"
For i = 9 To 12
Toolbar1.Buttons(i).Enabled = False
Next i
Case "生效"
Toolbar1.Buttons(8).Enabled = False
Toolbar1.Buttons(9).Enabled = False
Toolbar1.Buttons(12).Enabled = False
Case "解除"
Toolbar1.Buttons(8).Enabled = False
Toolbar1.Buttons(10).Enabled = False
Case "试用"
Toolbar1.Buttons(8).Enabled = False
Toolbar1.Buttons(11).Enabled = False
End Select
End If
End With
End Sub
Private Sub Form_Activate()
If sql1 <> "" Then
Adodc1.RecordSource = sql1
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Else
MsgBox "没有找到符合条件的记录!", , "提示窗口"
End If
End If
End Sub
Private Sub Form_Load()
Me.Caption = text
DataGrid1_RowColChange 0, 0
Dim fld
For Each fld In Adodc1.Recordset.Fields
'如果字段类型为"货币",则格式化该列
If fld.Type = 6 Then
Dim f1 As StdDataFormat
Set f1 = DataGrid1.Columns(fld.Name).DataFormat
f1.Format = "##,##0.00"
End If
Next
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
sql1 = ""
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim newsql As String
If sql1 <> "" And tb1 <> "" Then
newsql = Mid(sql1, Len(tb1), Len(sql1))
End If
Select Case Button.Key
Case "add"
blnAddHT = True
main_yyxx.Tag = 3
Load main_yyxx
main_yyxx.Show 1
Case "modify"
If Adodc1.Recordset.RecordCount > 0 Then
blnAddHT = False
Load main_rsgl_htgl_lr
main_rsgl_htgl_lr.Show 1
Else
MsgBox "系统没有要修改的数据!", , "提示窗口"
End If
Case "delete"
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Else
For i = 5 To 15
Toolbar1.Buttons(i).Enabled = False
Next i
MsgBox "系统没有要删除的数据!", , "提示窗口"
End If
Case "find"
tb1 = "合同表"
Load main_fzfind
main_fzfind.Show 1
Case "all"
Adodc1.RecordSource = "合同表 order by 合同编号"
Adodc1.Refresh
Case "addpact"
Load main_htxy
main_htxy.Show 1
Case "takee"
If newsql <> "" Then
Cnn.Execute ("update 合同表 set 状态='生效' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'")
Else
Cnn.Execute ("update 合同表 set 状态='生效'where 员工编号='" + DataGrid1.Columns(0) + "'")
End If
Adodc1.Refresh
Case "undo"
If newsql <> "" Then
Cnn.Execute ("update 合同表 set 状态='解除' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'")
Else
Cnn.Execute ("update 合同表 set 状态='解除'where 员工编号='" + DataGrid1.Columns(0) + "'")
End If
Adodc1.Refresh
Case "test"
If newsql <> "" Then
Cnn.Execute ("update 合同表 set 状态='试用' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'")
Else
Cnn.Execute ("update 合同表 set 状态='试用' where 员工编号='" + DataGrid1.Columns(0) + "'")
End If
Adodc1.Refresh
Case "change"
If newsql <> "" Then
Cnn.Execute ("update 合同表 set 状态='生效' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'")
Else
Cnn.Execute ("update 合同表 set 状态='生效' where 员工编号='" + DataGrid1.Columns(0) + "'")
End If
Adodc1.Refresh
Case "atterm"
If newsql <> "" Then
Cnn.Execute ("update 合同表 set 状态='到期' " & newsql & " and 员工编号='" + DataGrid1.Columns(0) + "'and 合同结束日期>" & Date)
Else
Cnn.Execute ("update 合同表 set 状态='到期' where 员工编号='" + DataGrid1.Columns(0) + "'and 合同结束日期>" & Date)
End If
Adodc1.Refresh
Case "excel"
Dim r As Integer, c As Integer
Dim newxls As Excel.Application
Dim newbook As Excel.Workbook
Dim newsheet As Excel.Worksheet
Set newxls = CreateObject("Excel.Application") '创建excel应用程序,打开excel2000
Set newbook = newxls.Workbooks.Add '创建工作簿
Set newsheet = newbook.Worksheets(1) '创建工作表
If sql1 <> "" Then
Adodc1.RecordSource = sql1
Adodc1.Refresh
End If
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
newxls.Visible = True
For i = 0 To DataGrid1.Columns.Count - 1
newsheet.Cells(1, i + 1) = DataGrid1.Columns(i).Caption
Next i
'指定表格内容
Do While Adodc1.Recordset.EOF = False
r = Adodc1.Recordset.AbsolutePosition
For c = 0 To DataGrid1.Columns.Count - 1
newsheet.Cells(r + 1, c + 1) = DataGrid1.Columns(c)
Next c
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF = True Then
Exit Do
Adodc1.Recordset.MoveLast
DataGrid1.SetFocus
End If
Loop
ErrSave:
Exit Sub
MsgBox Err.Description, , "提示窗口"
End If
Case "close"
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -