📄 frmotherstandardcode.frm
字号:
If Len(g_str4LoginUnit) <> C_BUREAUE_LENGTH Then
Command4Add.Visible = False
Command4Delete.Visible = False
Command4Save.Visible = False
VSFlexGrid4Content.Editable = flexEDNone
End If
m_l4SelectRow = 1
Is_SaveError = False
Is_Edit = False
With Me.VSFlexGrid4Name
.FixedCols = 0
.ColAlignment(0) = flexAlignLeftTop
.ExtendLastCol = True
.AllowUserResizing = flexResizeColumns
.AllowSelection = False
.SelectionMode = flexSelectionByRow
.GridLines = flexGridFlatVert
.Editable = flexEDNone
End With
With VSFlexGrid4Content
.FixedCols = 1
.FixedRows = 1
.Rows = 1
.Cols = 1
.ExtendLastCol = True
If Len(g_str4LoginUnit) = C_BUREAUE_LENGTH Then .Editable = flexEDKbdMouse
.SelectionMode = flexSelectionByRow
.AllowUserResizing = flexResizeColumns
.ExplorerBar = flexExSortShow
.AllowSelection = False
End With
Call SearchCodeName
m_l4Table = Me.VSFlexGrid4Name.TextMatrix(1, 0)
SearchData VSFlexGrid4Name.Row
Call InitForm
Me.Command4Close.Enabled = True
Unload frmSplash
End Sub
Private Sub SearchCodeName()
m_strSQL = "select TABLE_NAME,TABLE_CNAME,COLUMN_NAME,COLUMN_CNAME,STANDARD_MARK,COMLIST_INDEX from DICTIONARY where STANDARD_MARK IS NOT NULL and STANDARD_MARK <>10 and STANDARD_MARK <>0 and IS_KEY=1 order by table_cname "
If oRs4This.State = adStateOpen Then oRs4This.Close
oRs4This.CursorLocation = adUseClient
oRs4This.Open m_strSQL, g_oConnection4This, adOpenKeyset, adLockOptimistic
Set VSFlexGrid4Name.DataSource = oRs4This
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim ifor As Integer
Dim str As String
For ifor = 1 To 60
If g_intArray4ColComboList(ifor) = 1 Then
MakeComboList4Sting VSFlexGrid4Name, ifor
g_intArray4ColComboList(ifor) = 0
End If
Next
MDIfrmMain.SSActiveToolBarsMain.Tools("ID_标准代码").Enabled = True
End Sub
Private Sub VSFlexGrid4Content_AfterDataRefresh()
Dim ifor As Long
Dim jfor As Long
If VSFlexGrid4Content.Row < 1 Then Exit Sub
With VSFlexGrid4Content
m_str4temp = "select COLUMN_CNAME,IS_HIDDEN from DICTIONARY where TABLE_NAME='" & m_l4Table & "'"
If oRs4ColumnName.State = adStateOpen Then oRs4ColumnName.Close
oRs4ColumnName.CursorLocation = adUseClient
oRs4ColumnName.Open m_str4temp, g_oConnection4This, adOpenKeyset, adLockOptimistic
ifor = 1
Do While oRs4ColumnName.EOF = False
.TextMatrix(0, ifor) = oRs4ColumnName.Fields("COLUMN_CNAME").Value
.ColWidth(ifor) = .ClientWidth * 0.25
.ColAlignment(ifor) = flexAlignLeftCenter
.Cell(flexcpForeColor, 0, ifor) = &H8000000D
If oRs4ColumnName.Fields("IS_HIDDEN") = 0 Then .ColHidden(ifor) = True
oRs4ColumnName.MoveNext
ifor = ifor + 1
Loop
For jfor = ifor To .Cols - 1
.ColHidden(jfor) = True
Next
If m_l4Table = "T_REMOVE_SORT" Then
VSFlexGrid4Content.ColComboList(VSFlexGrid4Content.Cols - 1) = "#0;减员(有调入单位)|#1;减员(无调入单位)|#2;增员(有调出单位)|#3;增员(无调出单位)"
End If
If m_l4Table = "T_OLD_SKILL" Then
VSFlexGrid4Content.ColComboList(2) = g_strArray4ColComboList(C_T_OLD_WAGE_RATE)
VSFlexGrid4Content.ColComboList(3) = g_strArray4ColComboList(C_T_AREA_SORT)
End If
For ifor = 1 To .Rows - 1
.RowData(ifor) = C_NoChange
Next
VarCode = .TextMatrix(.Row, 1)
.AutoSize 0, .Cols - 1
End With
End Sub
Private Sub VSFlexGrid4Content_AfterEdit(ByVal Row As Long, ByVal Col As Long)
Is_Edit = True
End Sub
Private Sub VSFlexGrid4Content_AfterRowColChange(ByVal OldRow As Long, ByVal OldCol As Long, ByVal NewRow As Long, ByVal NewCol As Long)
m_l4RowContent = NewRow
If OldRow <> NewRow Then
With VSFlexGrid4Content
If (.RowData(OldRow) = C_Insert Or .RowData(OldRow) = C_Update) And Add_Click = False And Is_SaveError = False Then
If InsertOrUpdate(OldRow) = 0 Then Exit Sub
SearchData m_l4SelectRow
End If
End With
End If
End Sub
Private Function InsertOrUpdate(ByVal OldRow As Variant) As Long
Dim i4for As Long
Dim str As String
Dim ors As New ADODB.Recordset
InsertOrUpdate = 1
If OldRow = 0 Then Exit Function
Is_SaveError = True
With VSFlexGrid4Content
Select Case Me.VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 4)
Case 2, 4, 6
If Trim(.TextMatrix(OldRow, 1)) = "" Then
InsertOrUpdate = 0
MsgBox "请输入代码编号!", vbOKOnly, "警告"
.Select OldRow, 1
.EditCell
Exit Function
End If
If Trim(.TextMatrix(OldRow, 2)) = "" Then
InsertOrUpdate = 0
MsgBox "请输入代码名称!", vbOKOnly, "警告"
.Select OldRow, 2
.EditCell
Exit Function
End If
Case Else
If Trim(.TextMatrix(OldRow, 1)) = "" Or Not IsNumeric(.TextMatrix(OldRow, 1)) Then
MsgBox "请输入数字型代码编号!", vbOKOnly, "警告"
.Select OldRow, 1
.EditCell
Exit Function
End If
If .TextMatrix(OldRow, 2) = "" Then
InsertOrUpdate = 0
MsgBox "请输入代码名称!", vbOKOnly, "警告"
.Select OldRow, 2
.EditCell
Exit Function
End If
End Select
Is_SaveError = False
If .RowData(OldRow) = C_Update Then
m_strSQL = "select * from " & VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 0)
If ors.State = adStateOpen Then ors.Close
ors.CursorLocation = adUseClient
ors.Open m_strSQL, g_oConnection4This, adOpenKeyset, adLockOptimistic
m_strSQL = "update " & VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 0) & " set "
m_strSQL = m_strSQL & ors.Fields(ors.Fields.Count - 1).Name & "='" & .TextMatrix(OldRow, ors.Fields.Count) & "' where "
For i4for = 0 To ors.Fields.Count - 2
If i4for <> ors.Fields.Count - 2 Then
m_strSQL = m_strSQL & ors.Fields(i4for).Name & "='" & .TextMatrix(OldRow, i4for + 1) & "' and "
Else
m_strSQL = m_strSQL & ors.Fields(i4for).Name & "='" & .TextMatrix(OldRow, i4for + 1) & "' "
End If
Next
' m_strSQL = m_strSQL & " where " & ors.Fields(0).name & "='" & VarCode & "'"
If ExcuteSQL(m_strSQL) <> 0 Then
If Trim(Me.VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 5)) <> "" Then
g_intArray4ColComboList(Me.VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 5)) = 1
End If
Is_Init_Edit = True
Exit Function
End If
End If
If .RowData(OldRow) = C_Insert Then
If VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 0) = "T_OLD_SKILL" Then
m_strSQL = "insert into " & VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 0) & "(SKILL_NO,WAGE_RATE_NO,AREA_SORT_NO,SKILL_NAME,SKILL_CODE,SKILL_WAGE) values (" & .TextMatrix(OldRow, 1) & "," & .TextMatrix(OldRow, 2) & ",'" & .TextMatrix(OldRow, 3) & "','" & .TextMatrix(OldRow, 4) & "',''," & .TextMatrix(OldRow, 6) & ")"
If ExcuteSQL(m_strSQL) <> 0 Then
.RowData(OldRow) = .RowData(OldRow) + 1
If Trim(Me.VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 5)) <> "" Then
g_intArray4ColComboList(Me.VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 5)) = 1
End If
InsertOrUpdate = 0
Exit Function
End If
Else
m_strSQL = "insert into " & VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 0) & " values("
For i4for = 1 To .Cols - 2
m_strSQL = m_strSQL & "'" & .TextMatrix(OldRow, i4for) & "',"
Next
m_strSQL = m_strSQL & "'" & .TextMatrix(OldRow, .Cols - 1) & "')"
If ExcuteSQL(m_strSQL) <> 0 Then
If Trim(Me.VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 5)) <> "" Then
g_intArray4ColComboList(Me.VSFlexGrid4Name.TextMatrix(m_l4SelectRow, 5)) = 1
End If
InsertOrUpdate = 0
Exit Function
End If
End If
End If
End With
End Function
Private Sub VSFlexGrid4Content_BeforeEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
Is_Edit = False
End Sub
Private Sub VSFlexGrid4Content_CellChanged(ByVal Row As Long, ByVal Col As Long)
If Me.Command4Close.Enabled = False Then Exit Sub
If VSFlexGrid4Content.Row < 1 Then Exit Sub
With VSFlexGrid4Content
If (.RowData(.Row) = C_Init Or .RowData(.Row) = C_NoChange) And Is_AddError = False And Is_SaveError = False Then
.RowData(.Row) = .RowData(.Row) + 1
End If
If (.RowData(.Row) = C_Init Or .RowData(.Row) = C_NoChange) And Is_AddError = True And .Row = .Rows - 1 Then
.RowData(.Row) = .RowData(.Row) + 1
End If
End With
End Sub
Private Sub VSFlexGrid4Content_Click()
m_l4RowContent = VSFlexGrid4Content.Row
End Sub
Private Sub VSFlexGrid4Content_KeyPress(KeyAscii As Integer)
'Dim lCol As Long
If VSFlexGrid4Content.Row = 0 Then Exit Sub
If KeyAscii = 13 Then
With VSFlexGrid4Content
'lCol = .Col
If .Row < .Rows - 1 Then
.Row = .Row + 1
'.Select .Row, lCol
'.EditCell
End If
End With
End If
End Sub
Private Sub VSFlexGrid4Content_StartEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
If Row = 0 Then Cancel = True: Exit Sub
With VSFlexGrid4Content
If .Col = 1 Then Exit Sub
If Is_Init_Edit = True Then
VarCode = .TextMatrix(Row, 1)
Is_Init_Edit = False
End If
End With
End Sub
Private Sub VSFlexGrid4Name_AfterDataRefresh()
With VSFlexGrid4Name
.TextMatrix(0, 1) = ""
.ColHidden(0) = True
.ColHidden(2) = True
.ColHidden(3) = True
.ColHidden(4) = True
.ColHidden(5) = True
End With
End Sub
Private Sub VSFlexGrid4Name_AfterRowColChange(ByVal OldRow As Long, ByVal OldCol As Long, ByVal NewRow As Long, ByVal NewCol As Long)
If OldRow = NewRow Or NewRow = 0 Then Exit Sub
m_l4SelectRow = NewRow
m_l4Table = VSFlexGrid4Name.TextMatrix(NewRow, 0)
Me.vsElastic4.Caption = VSFlexGrid4Name.TextMatrix(NewRow, 1) & "内容"
Me.vsElastic3.Caption = VSFlexGrid4Name.TextMatrix(NewRow, 1)
SearchData NewRow
End Sub
Private Sub SearchData(ByVal Row As Long)
If VSFlexGrid4Name.TextMatrix(Row, 0) = "T_OLD_SKILL" Then
m_strSQL = "select SKILL_NO,WAGE_RATE_NO,AREA_SORT_NO,SKILL_NAME,SKILL_CODE,SKILL_WAGE from T_OLD_SKILL"
Else
m_strSQL = "select * from " & VSFlexGrid4Name.TextMatrix(Row, 0)
End If
If oRs4That.State = adStateOpen Then oRs4That.Close
oRs4That.CursorLocation = adUseClient
oRs4That.Open m_strSQL, g_oConnection4This, adOpenKeyset, adLockOptimistic
Set VSFlexGrid4Content.DataSource = oRs4That
End Sub
Private Sub InitForm()
Dim str4CheckPermission As String
str4CheckPermission = CheckPermission("标准代码")
If Mid(str4CheckPermission, 2, 1) = 0 Then Command4Add.Enabled = False
If Mid(str4CheckPermission, 3, 1) = 0 Then Command4Save.Enabled = False
If Mid(str4CheckPermission, 4, 1) = 0 Then Command4Delete.Enabled = False
If Len(g_str4LoginUnit) <> C_BUREAUE_LENGTH Then
Command4Add.Enabled = False
Command4Save.Enabled = False
Command4Delete.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -