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

📄 +i

📁 VB开发的ERP系统
💻
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Attend_FrmDept 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "选择部门"
   ClientHeight    =   4980
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3645
   Icon            =   "日常处理_考勤选择部门.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4980
   ScaleWidth      =   3645
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   120
      Top             =   4605
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   4
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "日常处理_考勤选择部门.frx":1042
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "日常处理_考勤选择部门.frx":2094
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "日常处理_考勤选择部门.frx":30E6
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "日常处理_考勤选择部门.frx":3538
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton Cmd_Cancel 
      Caption         =   "取消(&C)"
      Height          =   300
      Left            =   2400
      TabIndex        =   4
      Top             =   4620
      Width           =   1120
   End
   Begin VB.CommandButton Cmd_OK 
      Caption         =   "确定(&O)"
      Height          =   300
      Left            =   1200
      TabIndex        =   3
      Top             =   4620
      Width           =   1120
   End
   Begin MSComctlLib.TreeView Tre_Dept 
      Height          =   4065
      Left            =   75
      TabIndex        =   2
      Top             =   480
      Width           =   3465
      _ExtentX        =   6112
      _ExtentY        =   7170
      _Version        =   393217
      HideSelection   =   0   'False
      LabelEdit       =   1
      LineStyle       =   1
      Style           =   7
      ImageList       =   "ImageList1"
      Appearance      =   1
   End
   Begin VB.TextBox Txt_Dept 
      Height          =   285
      Left            =   585
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   120
      Width           =   2955
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "部门:"
      Height          =   180
      Left            =   60
      TabIndex        =   0
      Top             =   180
      Width           =   450
   End
End
Attribute VB_Name = "Attend_FrmDept"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*******************************************************
'*    模 块 名 称 :考勤选择部门
'*    功 能 描 述 :选择录入考勤的部门,
'*    程序员姓名  :田建秀
'*    最后修改人  :田建秀
'*    最后修改时间:2001/12/24
'*    备        注:
'*******************************************************
Option Explicit
Dim Sql As String
Dim NodX As Node
Dim i As Integer
Dim Rsc As New ADODB.Recordset
Public DeptCode As String
Public DeptName As String

Private Sub Cmd_Cancel_Click()
    Unload Me
End Sub

Private Sub Cmd_OK_Click()
    With Txt_Dept
        If Trim(.Text) = "" Then
            Call Xtxxts("部门不能空!", 0, 1)
            Exit Sub
        End If
        If Rsc.State = 1 Then Rsc.Close
        Sql = "select * from Gy_Department where DeptCode='" & Trim(.Text) & "'"
        Set Rsc = Cw_DataEnvi.DataConnect.Execute(Sql)
        If Rsc.EOF Then
            If Rsc.State = 1 Then Rsc.Close
            Sql = "select * from Gy_Department where DeptName='" & Trim(.Text) & "'"
            Set Rsc = Cw_DataEnvi.DataConnect.Execute(Sql)
            If Rsc.EOF Then
                Call Xtxxts("部门“" & Trim(.Text) & "”不存在", 0, 1)
                Exit Sub
            End If
        End If
        '判断操作员是否对部门有权限
        If Rsc.State = 1 Then Rsc.Close
        Sql = "select * from Gy_Department g inner join  PM_OpeDept p " & _
            "on g.DeptCode=p.DeptCode where  (g.DeptCode='" & _
            Trim(.Text) & "' or g.DeptName='" & Trim(.Text) & "')" & _
            " and  Czybm='" & Xtczybm & "'"
        Set Rsc = Cw_DataEnvi.DataConnect.Execute(Sql)
        If Rsc.EOF Then
            Call Xtxxts("操作员对部门“" & Trim(.Text) & "”没有操作权限!", 0, 1)
            Exit Sub
        End If
    End With
    With Tre_Dept
        DeptCode = Right(Trim(.SelectedItem.Key), Len(Trim(.SelectedItem.Key)) - 1)
        DeptName = Trim(.SelectedItem.Text)
    End With
    If Rsc.State = 1 Then Rsc.Close
    Sql = "select * from Rs_BasicInfo r inner join Gy_Department g on" & _
        " r.DeptCode=g.DeptCode where r.DeptCode like '" & DeptCode & "%'"
    Set Rsc = Cw_DataEnvi.DataConnect.Execute(Sql)
    If Rsc.EOF Then
        Call Xtxxts("“" & DeptName & "”没有人员,不必录入考勤!", 0, 1)
        Exit Sub
    End If
    If Rsc.State = 1 Then Rsc.Close
    Sql = "select * from Rs_items where Sid=4 "
    Set Rsc = Cw_DataEnvi.DataConnect.Execute(Sql)
    If Rsc.EOF Then
        Call Xtxxts("请先设置考勤项目,再录入考勤!", 0, 1)
        Exit Sub
    End If
    Attend_FrmInput.Show 1
End Sub

Private Sub Form_Load()
    '选择操作员有权限的、不停用的、人事工资用的部门
    Txt_Dept.Text = ""
    Sql = "select * from gy_Department where " & _
        " RsPmFlag=1 order by DeptCode"
    Set Rsc = Cw_DataEnvi.DataConnect.Execute(Sql)
    With Tre_Dept
        .HideSelection = False
        Do While Not Rsc.EOF
            If Rsc!CodeLevel = 1 Then
                Set NodX = .Nodes.Add(, , "D" & Trim(Rsc!DeptCode), Trim(Rsc!DeptName), 1, 4)
            Else
                Set NodX = .Nodes.Add("D" & Trim(Rsc!ParentCode), 4, "D" & Trim(Rsc!DeptCode), Trim(Rsc!DeptName), 2, 4)
            End If
            Rsc.MoveNext
        Loop
    End With
    With Tre_Dept
        For i = 1 To .Nodes.Count
            If .Nodes(i).Children = 0 Then
                .Nodes(i).Image = 3
            End If
        Next
    End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set Rsc = Nothing
End Sub

Private Sub Tre_Dept_click()
    With Tre_Dept
        Txt_Dept.Text = Trim(.SelectedItem.Text)
    End With
End Sub

Private Sub Txt_Dept_change()
    '根据文本框中的内容判断部门(编码、名称)
    Dim Df As Boolean
    With Tre_Dept
        If Trim(Txt_Dept) = "" Then
            Set .SelectedItem = Nothing
        End If
        Df = False
        For i = 1 To .Nodes.Count
            If Trim(Txt_Dept) = Right(Trim(.Nodes(i).Key), Len(Trim(.Nodes(i).Key)) - 1) Then
                Set .SelectedItem = .Nodes(i)
                .SelectedItem.EnsureVisible
                Df = True
                Exit For
            End If
        Next
        
        For i = 1 To .Nodes.Count
            If Trim(Txt_Dept) = Trim(.Nodes(i).Text) Then
                Set .SelectedItem = .Nodes(i)
                .SelectedItem.EnsureVisible
                Df = True
                Exit For
            End If
        Next
        If Df = False Then
            Set .SelectedItem = Nothing
        End If
    End With
End Sub

⌨️ 快捷键说明

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