⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmpolicy.frm

📁 本公司开发得大请油田人事管理系统c/s结构
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         _ExtentX        =   3545
         _ExtentY        =   582
         _Version        =   393216
         CheckBox        =   -1  'True
         Format          =   69206016
         CurrentDate     =   37176
      End
      Begin MSComCtl2.DTPicker DTPicker4StartDate 
         Height          =   330
         Left            =   1230
         TabIndex        =   2
         Top             =   675
         Width           =   1890
         _ExtentX        =   3334
         _ExtentY        =   582
         _Version        =   393216
         CalendarTitleBackColor=   -2147483635
         CalendarTitleForeColor=   -2147483624
         CalendarTrailingForeColor=   16761024
         CheckBox        =   -1  'True
         Format          =   69206016
         CurrentDate     =   37099
      End
      Begin VB.Label Label1 
         Caption         =   "政策分类"
         Height          =   315
         Left            =   90
         TabIndex        =   14
         Top             =   300
         Width           =   1080
      End
      Begin VB.Label Label4Index 
         Caption         =   "政策文件文号"
         Height          =   315
         Left            =   6465
         TabIndex        =   11
         Top             =   300
         Width           =   1170
      End
      Begin VB.Label Label4Mind 
         Caption         =   "    介于"
         Height          =   330
         Left            =   3180
         TabIndex        =   9
         Top             =   675
         Width           =   1155
      End
      Begin VB.Label Label4PolicyFileName 
         Caption         =   "政策文件名称"
         Height          =   315
         Left            =   3180
         TabIndex        =   8
         Top             =   300
         Width           =   1155
      End
      Begin VB.Label Label4Date 
         Caption         =   "政策制订日期"
         Height          =   330
         Left            =   90
         TabIndex        =   1
         Top             =   675
         Width           =   1080
      End
   End
End
Attribute VB_Name = "frmPolicy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private m_oRs4policy As New ADODB.Recordset
Private m_strSQL As String
Private m_oRs4Delete As New ADODB.Recordset
Private m_oRs4DeletePolicy As New ADODB.Recordset

Private Sub Command4Edit_Click()
    Dim ifor As Long
    With Me.VSFlexGrid4This
        g_int4rowstate = 0
        For ifor = 1 To .Rows - 1
            If .TextMatrix(ifor, 0) = "True" Then
                g_int4rowstate = g_int4rowstate + 1
                g_array4WorkerType(1, g_int4rowstate) = .TextMatrix(ifor, 5)
            End If
        Next
        If g_int4rowstate = 0 Then
            MsgBox "请选择至少一条记录!", vbOKOnly, "提示"
            Exit Sub
        Else
            g_int4statuse = 1
            frmPolicyEdit.Show 1
            If m_oRs4policy.State = adStateOpen Then m_oRs4policy.Requery
        End If
    End With
End Sub

Private Sub Command4Delete_Click()
    With Me.VSFlexGrid4This
        If .Row <= 0 Then MsgBox "当前没有可供删除的记录", vbOKOnly, "警告": Exit Sub
        If vbYes = MsgBox("确认删除该记录吗?", vbYesNo + vbDefaultButton2, "警告") Then
            ExcuteSQL "begin transaction"
            m_strSQL = "delete from t_policy_file_detail where detail_id =" & .TextMatrix(.Row, 8)
            If ExcuteSQL(m_strSQL) <> 0 Then
                ExcuteSQL "rollback transaction"
                Exit Sub
            End If
            If m_oRs4Delete.State = adStateOpen Then m_oRs4Delete.Close
            m_strSQL = "select * from t_policy_file ,t_policy_file_detail where t_policy_file_detail.policy_file_no=t_policy_file.policy_file_no and t_policy_file.policy_file_name like '%" & .TextMatrix(.Row, 2) & "%'"
            m_oRs4Delete.Open m_strSQL, g_oConnection4This, 1, 3
            If m_oRs4Delete.EOF Then
                m_strSQL = "delete from T_policy_file where policy_file_name like '%" & .TextMatrix(.Row, 2) & "%'"
                If ExcuteSQL(m_strSQL) <> 0 Then
                    ExcuteSQL "rollback transaction"
                    Exit Sub
                End If
                If m_oRs4Delete.State = adStateOpen Then m_oRs4Delete.Close
                m_oRs4Delete.Open ("select * from t_policy_file ,t_policy where t_policy.policy_no=t_policy_file.policy_no and t_policy.policy_name like '%" & .TextMatrix(.Row, 1) & "%'"), g_oConnection4This, 1, 3
                If m_oRs4Delete.EOF Then
'                    If m_oRs4Delete.State = adStateOpen Then m_oRs4Delete.Close
                    m_strSQL = "delete from t_policy where policy_name not in ( '综合类','人事管理','党组织管理','劳动组织','劳动报酬','劳动关系','职工培训','职业技能鉴定','劳动保障','人才交流') and policy_name like '%" & .TextMatrix(.Row, 1) & "%'"
'                    m_oRs4Delete.Open m_strSQL, g_oConnection4This, 1, 3
                    If ExcuteSQL(m_strSQL) <> 0 Then
                        ExcuteSQL "rollback transaction"
                        Exit Sub
                    End If
                End If
            End If
            ExcuteSQL "commit transaction"
            .RemoveItem .Row
        End If
    End With
    vsElastic4This.Caption = "查询结果(总计" & VSFlexGrid4This.Rows - 1 & "条记录)"
End Sub

Private Sub Command4Add_Click()
    g_int4statuse = 0
    frmPolicyEdit.Show 1
    If m_oRs4policy.State = adStateOpen Then m_oRs4policy.Requery
    FillComboBoxByBxm Me.Combo4PolicyName, "T_policy", "policy_no ", "policy_name", 1
    FillComboBoxByBxm Me.Combo4PolicyFileCode, "T_policy_file", " ", "policy_file_code", 1
    FillComboBoxByBxm Me.Combo4PolicyFileName, "T_policy_file", "policy_file_no ", "policy_file_name", 1
End Sub

Private Sub Command4Close_Click()
    Unload Me
End Sub

Private Sub Command4Search_Click()
'____________________________________________________________________________________________
'    m_strSQL = "select POLICY_INDEX,POLICY_NAME,cast(policy_start_date/10000 as varchar(4))+'年'+cast(policy_start_date%10000/100 as varchar(2))+'月'+cast(policy_start_date%100 as varchar(2))+'日', POLICY_NOTE,POLICY_NO" _
'            & " from t_policy where policy_no>=1 "
'    If Trim(Text4PolicyName.text) <> "" Then
'        m_strSQL = m_strSQL & " and policy_name like '%" & Trim(Text4PolicyName.text) & "%'"
'    End If
'    If Trim(Text4Index.text) <> "" Then
'        m_strSQL = m_strSQL & " and policy_index like '%" & Trim(Text4Index.text) & "%'"
'    End If
'    If Not IsNull(DTPicker4StartDate.Value) Then
'        m_strSQL = m_strSQL & " and policy_start_date>" & ConvertDate2Int(Me.DTPicker4StartDate.Value)
'    End If
'    If Not IsNull(Me.DTPicker4EndDate.Value) Then
'        m_strSQL = m_strSQL & " and policy_start_date<=" & ConvertDate2Int(Me.DTPicker4EndDate.Value)
'    End If
'------------------------------------------------------------------------------------------------
    m_strSQL = ""
    m_strSQL = "select POLICY_name,POLICY_file_name ,POLICY_file_code,POLICY_file_TIME,file_path ,POLICY_FILE_NOTE,T_POLICY_file.POLICY_file_NO ,detail_id,policy_name  from T_policy,T_policy_File,T_policy_File_Detail where T_policy.POLICY_NO=T_policy_file.POLICY_NO  and T_POLICY_file.POLICY_file_NO= T_policy_file_detail.POLICY_file_no"
    If Trim(Me.Combo4PolicyName) <> "" Then
        m_strSQL = m_strSQL & " and policy_name like '%" & Me.Combo4PolicyName & "%'"
    End If
    If Trim(Me.Combo4PolicyFileName) <> "" Then
        m_strSQL = m_strSQL & " and Policy_File_Name like '%" & Me.Combo4PolicyFileName & "%'"
    End If
    If Trim(Me.Combo4PolicyFileCode) <> "" Then
        m_strSQL = m_strSQL & " and Policy_File_Code like '%" & Me.Combo4PolicyFileCode & "%'"
    End If
    If Not IsNull(DTPicker4StartDate.Value) Then
        m_strSQL = m_strSQL & " and policy_file_time>" & Me.DTPicker4StartDate.Value
    End If
    If Not IsNull(Me.DTPicker4EndDate.Value) Then
        m_strSQL = m_strSQL & " and policy_file_time<=" & Me.DTPicker4EndDate.Value
    End If
    If m_oRs4policy.State = adStateOpen Then m_oRs4policy.Close
    m_oRs4policy.CursorLocation = adUseClient
    m_oRs4policy.Open m_strSQL, g_oConnection4This
    Set VSFlexGrid4This.DataSource = m_oRs4policy
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        SendKeys "{tab}"
    End If
End Sub

Private Sub Form_Load()
    Me.Height = 5460
    Me.Width = 9540
    If Len(g_str4LoginUnit) <> C_BUREAUE_LENGTH Then
        Command4Add.Visible = False
        Command4Delete.Visible = False
        Me.Command4Edit.Visible = False
    End If
    With VSFlexGrid4This
        .Rows = 1
        .ColWidth(0) = .RowHeight(0)
        .AllowUserResizing = flexResizeColumns
        .AllowBigSelection = False
        .AllowSelection = False
        .ExplorerBar = flexExSort
        .SelectionMode = flexSelectionByRow
        .ExtendLastCol = True
    End With
    VSFlexGrid4This_AfterDataRefresh
    Call InitForm
    
    Me.DTPicker4EndDate.Format = dtpLongDate
    Me.DTPicker4EndDate.Value = Null
    Me.DTPicker4StartDate.Value = Null
    Me.DTPicker4EndDate.CustomFormat = "yyyy年mm月dd日"
    Me.DTPicker4StartDate.Format = dtpLongDate
    Me.DTPicker4StartDate.CustomFormat = "yyyy年mm月dd日"
    Unload frmSplash
    FillComboBoxByBxm Me.Combo4PolicyName, "T_policy", "policy_no ", "policy_name", 1
    FillComboBoxByBxm Me.Combo4PolicyFileCode, "T_policy_file", " ", "policy_file_code", 1
    FillComboBoxByBxm Me.Combo4PolicyFileName, "T_policy_file", "policy_file_no ", "policy_file_name", 1
End Sub

Private Sub VSFlexGrid4This_AfterDataRefresh()
    Dim ifor As Long
    With VSFlexGrid4This
        .Cols = 9
        .FixedCols = 0
        .ColWidth(0) = .RowHeight(0)
        '以下均是政策文件的内容
        .TextMatrix(0, 1) = "政策文件名"
        .TextMatrix(0, 2) = "政策文件文号"
        .TextMatrix(0, 3) = "政策制定日期"
        .TextMatrix(0, 4) = "政策存放路径"
        .TextMatrix(0, 5) = "备注"
        .TextMatrix(0, 6) = "POLICY_file_NO"
        .TextMatrix(0, 7) = "detail_id"
        .TextMatrix(0, 8) = "policy_name"
        .ColHidden(6) = True
        .ColHidden(7) = True
        .ColHidden(8) = True
        .AutoSize 1, .Cols - 1
        .ColDataType(3) = flexDTDate
        .ColDataType(0) = flexDTBoolean
        For ifor = 1 To .Rows - 1
            .TextMatrix(ifor, 0) = "False"
        Next
    End With
    vsElastic4This.Caption = "查询结果(总计" & VSFlexGrid4This.Rows - 1 & "条记录)"
End Sub
  
Private Sub Form_Unload(Cancel As Integer)
    MDIfrmMain.SSActiveToolBarsMain.Tools("ID_政策信息").Enabled = True
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 Command4Edit.Enabled = False
    If Mid(str4CheckPermission, 4, 1) = 0 Then Command4Delete.Enabled = False
End Sub

Private Sub VSFlexGrid4This_BeforeDataRefresh(Cancel As Boolean)
    VSFlexGrid4This.FixedCols = 1
End Sub

Private Sub VSFlexGrid4This_Click()
    Dim i4Click As Long
    With Me.VSFlexGrid4This
        If .Row > 0 And .Col = 0 Then
            If .TextMatrix(.Row, 0) = "True" Then
                For i4Click = 1 To .Rows - 1
                    If i4Click <> .Row Then
                        .TextMatrix(i4Click, 0) = "False"
                    End If
                Next
            End If
        End If
    End With
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -