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

📄 frmlistclass.frm

📁 金算盘软件代码
💻 FRM
📖 第 1 页 / 共 5 页
字号:
End Function
Public Function ShowList(ByVal lngID As Long, Optional intTab As Integer = 0) As Boolean
    Dim intCount As Integer
    Dim strSortField As String
    Dim strSortDec As String
    Dim strSql As String
    Dim recTemp As rdoResultset
    Dim strofFrom As String
    Dim strofWhere As String
'    Me.Show
'    Me.ZOrder 0
    With frmMain.mnuListClass1
        If IsNumeric(.Tag) Then
            If CLng(.Tag) > 0 Then
                BringWindowToTop .Tag
            Else
                Me.BindingResultSet
            End If
        Else
            Me.BindingResultSet
        End If
    End With
    Me.sstTypAct.Tab = intTab
    With mclsList(intTab).ListSet
        '得到排序字段
        For intCount = 1 To .Columns
            If .ColumnOrderType(intCount) <> 0 Then
                strSortField = .ColumnFieldName(intCount)
                strSortDec = .ColumnDesc(intCount)
                Exit For
            End If
        Next
        If intCount > .Columns Then
            ShowList = False
            Exit Function
        End If
        strofFrom = .FromOfSql
        strofWhere = .WhereOfSql
    End With
    '根据lngID得到排序字段值
    strSql = "Select " & strSortField & " As " & strSortDec
    Select Case intTab
        Case 0
            If strofWhere <> "" Then
                strofWhere = " where " & strofWhere & " and Class1.lngClassID=" & lngID
            Else
                strofWhere = " where Class1.lngClassID=" & lngID
            End If
        Case 1
            If strofWhere <> "" Then
                strofWhere = " where " & strofWhere & " and Class2.lngClassID=" & lngID
            Else
                strofWhere = " where Class2.lngClassID=" & lngID
            End If
    End Select
    strSql = strSql & strofFrom & strofWhere
    Set recTemp = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
    With recTemp
        If .RowCount > 0 Then
            txtfind.Text = recTemp(strSortDec)   '查找
            With mclsList(intTab).FlexGrid
                If .TextMatrix(.Row, 0) = lngID Then      '是否找到
                    ShowList = True
                Else
                    ShowList = False
                End If
            End With
        Else
            ShowList = False
        End If
        .Close
    End With
End Function
'卡片
Public Property Let IsShowCard(ByVal Index As Integer, ByVal vNewValue As Boolean)
   mIsShowCard(Index) = vNewValue
End Property
Public Property Get IsShowCard(ByVal Index As Integer) As Boolean
   IsShowCard = mIsShowCard(Index)
End Property
'按照部门职员ID提取记录
Public Function GetbyListID(ByVal intTab As Integer, ByVal lngID As Long) As rdoResultset
    Dim recRecordset As rdoResultset
    Dim strSql As String
    
    Select Case intTab
        Case 0
            strSql = "Select * From Class1 Where lngClassID = " & lngID
        Case 1
            strSql = "Select * From Class2 Where lngClassID = " & lngID
    End Select
    Set recRecordset = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
    Set GetbyListID = recRecordset
End Function

'按照部门职员ID更新停用标志
Private Function UpdateListInActive(ByVal intTab As Integer, ByVal lngID As Long, ByVal blnIsInActive As Boolean) As Boolean
    Dim strSql As String
    
    Select Case intTab
        Case 0
            strSql = "UPDATE Class1 SET blnIsInActive = " & IIf(blnIsInActive, 1, 0) & " WHERE lngClassID = " & lngID
        Case 1
            strSql = "UPDATE Class2 SET blnIsInActive = " & IIf(blnIsInActive, 1, 0) & " WHERE lngClassID = " & lngID
    End Select
    UpdateListInActive = gclsBase.ExecSQL(strSql)
End Function

'删除部门职员ID指定记录
Private Function DelByPaymentMethodID(ByVal lngID As Long, ByVal intTab As Integer) As Boolean
    Dim strSql As String
    
    Select Case intTab
        Case 0
            strSql = "Delete  From Class1 WHERE lngClassID = " & lngID
        Case 1
            strSql = "Delete  From Class2 WHERE lngClassID = " & lngID
    End Select
    DelByPaymentMethodID = gclsBase.ExecSQL(strSql)
End Function

'判断部门职员ID是否使用
Private Function IsUsePaymentMethodID(ByVal lngID As Long) As Boolean
'    Dim recRecordset As Recordset
'    Dim strSql As String
'
'    Select Case sstTypAct.Tab
'           Case 0
'                strSql = "Select lngJobTypeID From Job Where lngJobTypeID = " & lngID
'           Case 1
'                 strSql = "SELECT lngJobID FROM Job" _
'                        & " WHERE EXISTS(SELECT Ab.lngJobID FROM AccountBalance AS Ab WHERE Ab.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT Ad.lngJobID FROM AccountDaily AS Ad WHERE Ad.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT At.lngJobID FROM ACtivitydetail AS At WHERE At.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT Ap.lngJobID FROM ARAPInit AS Ap WHERE Ap.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT Bg.lngJobID FROM BudgetBalance AS Bg WHERE Bg.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT Fa.lngJobID FROM FixedAccount AS Fa WHERE Fa.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT It.lngJobID FROM ItemActivityDetail AS It WHERE It.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT Pc.lngJobID FROM PurchaseorderDetail AS Pc WHERE Pc.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT So.lngJobID FROM SaleOrderDetail AS So WHERE So.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT TV.lngJobID FROM  TransVoucherDetail AS TV WHERE TV.lngJobID=" & lngID & ")" _
'                        & " OR EXISTS (SELECT Vd.lngJobID FROM VoucherDetail AS Vd WHERE Vd.lngJobID=" & lngID & ")"
'                                   'strSQL = "Select lngJobID From JobActivityDetail Where lngJobID = " & lngID
'    End Select
'
'    Set recRecordset = gclsBase.BaseDB.OpenRecordset(strSql, dbOpenSnapshot)
'    IsUsePaymentMethodID = (recRecordset.RecordCount >= 1)
'    recRecordset.Close
End Function

' 部门职员ID
Public Property Get ListID(ByVal intTab As Integer) As Long
    With mclsList(intTab).FlexGrid
    If .TextArray(.Row * .Cols) <> "" And .Row > 0 Then
        ListID = CLng(.TextArray(.Row * .Cols))
    Else
        ListID = 0
    End If
    End With
End Property

' 部门职员停用标志
Public Property Get ListIsInActive(ByVal intTab As Integer) As Boolean
    If chkShowAll.Value Then
        With mclsList(intTab).FlexGrid
            ListIsInActive = Not (.TextArray(.Row * .Cols + 1) = "")
        End With
    Else
        ListIsInActive = False
    End If
End Property

'根据列表中记录数,设置菜单可用属性
Private Sub UpdateMenuStatus()
    Dim blnIsnotEmpty As Boolean
    Dim blnFindNoChange As Boolean
     Dim IsHaveRight As Boolean
    Select Case sstTypAct.Tab
        Case 0
            IsHaveRight = IsCanDo(13, gclsBase.OperatorID)
        Case 1
            IsHaveRight = IsCanDo(14, gclsBase.OperatorID)
    End Select
    With mclsList(sstTypAct.Tab).FlexGrid
        If .Rows > 1 And .ColSel <> 0 And .RowHeight(.Row) > 0 Then
            blnIsnotEmpty = True
        Else
            blnIsnotEmpty = False
        End If
    End With
    With frmMain
        .mnuEditEdit.Caption = "修改(&E)"
        .mnuEditNew.Caption = "新增(&N)"
        .mnuEditDel.Caption = "删除(&D)"
        .mnuEditCopy.Enabled = blnIsnotEmpty
        .mnuEditEdit.Enabled = blnIsnotEmpty And IsHaveRight
        .mnuEditNew.Enabled = True And IsHaveRight
        .mnuEditDel.Enabled = blnIsnotEmpty And IsHaveRight
        .mnuEditInActive.Checked = False
        .mnuEditInActive.Visible = False
        .mnuEditInActive.Enabled = blnIsnotEmpty And IsHaveRight
        .mnuEditShowAll.Checked = chkShowAll.Value
        .mnuEditShowAll.Enabled = True
        .mnuEditUse.Enabled = blnIsnotEmpty
        'If sstTypAct.Tab = 1 Then
            .mnuEditNotepad.Enabled = blnIsnotEmpty
        'Else
         '   .mnuEditNotepad.Enabled = False
        'End If
        .mnuEditSearch.Enabled = True
        .mnuEditColumn.Enabled = True
        .mnuEditFilter.Enabled = True
        .mnuFilePrint.Enabled = True
        .mnuFilePrintSetup.Enabled = True
        .mnuReportQuick.Enabled = blnIsnotEmpty
        .mnuToolRefresh.Enabled = True
    End With
    
    If mclsList(sstTypAct.Tab).FlexGrid.ColSel = 0 Then  '无当前选定行
        blnFindNoChange = mclsList(sstTypAct.Tab).FindNoChange
        mclsList(sstTypAct.Tab).FindNoChange = True
        txtfind.Text = ""
        mclsList(sstTypAct.Tab).FindNoChange = blnFindNoChange
        cmdAgain.Enabled = False
    End If
    frmMain.SetToolBar
End Sub

'重画Form
Private Sub RedrawForm()
    On Error Resume Next
    With sstTypAct
        .Left = ListFormLeft
        .width = Me.ScaleWidth - ListFormLeft - ListFormRight
        .Height = Me.ScaleHeight - ssTabUpAreaHeight - ListDownAreaHeight
    End With
    
    '重画MS FlexGrid 控件
    With mclsList(sstTypAct.Tab).FlexGrid
        .Left = ListGridLeft
        .width = sstTypAct.width - ListGridLeft - ListGridRight
        .Height = sstTypAct.Height - sstTypAct.TabHeight - ListGridTop - ListGridBottom
    End With
    
    '重画其余控件
    txtfind.width = Me.ScaleWidth - txtfind.Left - ListFormBottom - cmdAgain.width - 15
    cmdAgain.Left = txtfind.Left + txtfind.width
    cmdTypact(0).top = Me.ScaleHeight - cmdTypact(0).Height - ListFormBottom
    cmdTypact(1).top = cmdTypact(0).top
    
    chkShowAll.top = cmdTypact(0).top
    chkShowAll.Left = Me.ScaleWidth - chkShowAll.width - ListFormBottom
End Sub


'命令控件数组
Private Sub cmdTypact_Click(Index As Integer)
    Dim PosX, PosY As Integer
    
    PosX = cmdTypact(Index).Left
    PosY = cmdTypact(Index).top + cmdTypact(Index).Height
    With frmMain
        Select Case Index
               Case 0
                    MakeListEditMenu
                    PopupMenu .mnuListEdit, , PosX, PosY
               
               Case 1
                    MakeListReportMenu (getDepEmp())
                    PopupMenu .mnuListReport, , PosX, PosY
        End Select
    End With
End Sub

'取部门职员
Private Function getDepEmp() As String
    Dim strDepEmp As String
    Dim i As Integer
    
    Select Case sstTypAct.Tab
           Case 0
                If msgItemType.Row > 0 And msgItemType.ColSel > 0 Then
                    With msgItemType
                      .Redraw = False
                      For i = 1 To .Cols - 1
                          If .TextMatrix(0, i) = "统计名称" Or .TextMatrix(0, i) = "统计名称↑" Or .TextMatrix(0, i) = "统计名称↓" Then
                             strDepEmp = .TextMatrix(.Row, i)
                             Exit For
                          End If
                      Next
                      .Redraw = True
                    End With
                Else
                   strDepEmp = ""
                   
                End If
           Case 1
                If msgItem.Row > 0 And msgItem.ColSel > 0 Then
                   With msgItem
                        .Redraw = False
                        For i = 1 To .Cols - 1
                            If .TextMatrix(0, i) = "项目名称" Or .TextMatrix(0, i) = "项目名称↑" Or .TextMatrix(0, i) = "项目名称↓" Then
                               strDepEmp = .TextMatrix(.Row, i)
                               Exit For
                            End If
                        Next
                        .Redraw = True
                   End With
                Else
                    strDepEmp = ""
                End If
                
    End Select
    getDepEmp = strDepEmp
    
End Function


Private Sub Form_Deactivate()
    frmMain.SetEditUnEnabled
End Sub

'
'窗体 Form 控件
'
Private Sub Form_Load()
    Dim i As Integer
    Dim intSortCol As Integer
    On Error GoTo ErrHandle
'    Me.Hide
'    Me.Left = -30000
    MsgForm.PleaseWait
    Me.HelpContextID = 30011
    '部门职员列表窗体初始化
    Debug.Print "Load Start: ", Timer
    
    intViewID(0) = 48
    intViewID(1) = 52
    For i = 0 To 1
        Set mclsList(i) = New list
        Set mclsList(i).FindKind = cboFindKind
        'Set mclsList(i).Again = cmdAgain
        Set mclsList(i).Find = txtfind
    Next
    Set mclsList(0).FlexGrid = msgItemType
    Set mclsList(1).FlexGrid = msgItem
     
    '设置钩子对象
    Set mclsSubClass = New SubClass32.SubClass

    mclsSubClass.Messages(WM_PAINT) = True
    mclsSubClass.Messages(WM_LBUTTONUP) = True
    mclsSubClass.Messages(WM_LBUTTONDOWN) = True
    mclsSubClass.Messages(WM_MOUSEMOVE) = True
    
    Set mclsSubClassform = New SubClass32.SubClass
    mclsSubClassform.hwnd = Me.hwnd
    mclsSubClassform.Messages(WM_GETMINMAXINFO) = True
    
'    If sstTypAct.Tab = 0 Then
'        sstTypAct_Click 0
'    Else

⌨️ 快捷键说明

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