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

📄 frmresmanage.frm

📁 金算盘软件代码
💻 FRM
📖 第 1 页 / 共 5 页
字号:
                                       rstReportGroup!bytGroup, rstReportGroup!strReportName, 2, 3
                    Else
                        .Nodes.Add , , rstReportGroup!intLevel & "-" & rstReportGroup!lngReportID & "-" & _
                                       rstReportGroup!bytGroup, rstReportGroup!strReportName, 4, 5
                    End If
                Else
                    If rstReportGroup!bytPrep = 1 Then
                        .Nodes.Add (rstReportGroup!intLevel - 1) & "-" & rstReportGroup!lngParentId & "-" & _
                                    rstReportGroup!bytGroup, tvwChild, rstReportGroup!intLevel & "-" & rstReportGroup!lngReportID & _
                                    "-" & rstReportGroup!bytGroup, rstReportGroup!strReportName, 2, 3
                    Else
                        .Nodes.Add (rstReportGroup!intLevel - 1) & "-" & rstReportGroup!lngParentId & "-" & _
                                    rstReportGroup!bytGroup, tvwChild, rstReportGroup!intLevel & "-" & rstReportGroup!lngReportID & _
                                    "-" & rstReportGroup!bytGroup, rstReportGroup!strReportName, 4, 5
                    End If
                End If
             End With
             rstReportGroup.MoveNext
        Loop
        rstLevel.MoveNext
   Loop
End Sub

'设置 ListView 的格式
Private Sub InitDetail()
  Dim clmX As ColumnHeader
    Set clmX = lvwDetail.ColumnHeaders. _
    Add(, , "帐表名称", lvwDetail.width / 2)
    Set clmX = lvwDetail.ColumnHeaders. _
    Add(, , "制表人", lvwDetail.width / 6)
    Set clmX = lvwDetail.ColumnHeaders. _
    Add(, , "制表日期", lvwDetail.width / 6)
    Set clmX = lvwDetail.ColumnHeaders. _
    Add(, , "备注", lvwDetail.width / 6)
    
    lvwDetail.BorderStyle = ccFixedSingle
    lvwDetail.View = lvwReport
End Sub

'初始化帐表明细
Private Sub InitList(lngReportID As Long, Optional bytGroup As Byte)
   Dim strSql As String
   Dim rstReportDetail As rdoResultset
   Dim strOrder As String, strCondVersion As String, strMyCond As String, strControl As String
   Dim itmX As ListItem
   
   If mstrOldParent = tvwReportType.SelectedItem.Key Then
        Exit Sub
   End If
   
   '我的报表
   If bytGroup = 16 Then
       strMyCond = " And Report.lngOperatorID=" & gclsBase.OperatorID
   End If
   strCondVersion = " And Mod (Report.bytVersion ," & gVersionType * 2 & ") >= " & gVersionType
   
   If gclsBase.AccountSys = "3" Then
      strCondVersion = strCondVersion & " And blnNotHospital=0"
   End If
   
   If gclsBase.ControlAccount Then
      strCondVersion = strCondVersion & " And bytControl IN (0,1)"
   Else
      strCondVersion = strCondVersion & " And bytControl IN (0,2)"
   End If
   If gclsBase.Trade = "邮电通信" Then
        strCondVersion = strCondVersion & " And bytPostage IN (0,2)"
   Else
        strCondVersion = strCondVersion & " And bytPostage IN (0,1)"
   End If
   mstrOldParent = tvwReportType.SelectedItem.Key
   
   lvwDetail.ListItems.Clear
   
   If lvwDetail.SortOrder = lvwAscending Then
      strOrder = " Order By blnIsDetail Desc,strReportName"
   Else
      strOrder = " Order By blnIsDetail,strReportName Desc"
   End If
   strSql = "Select * From Report,Operator Where Report.lngOperatorID=Operator.lngOperatorID And lngParentId=" & lngReportID & strMyCond & strCondVersion & strOrder
   Set rstReportDetail = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
   
   With rstReportDetail
       Do While Not .EOF
           If !blnIsDetail = 1 Then
               If !bytPrep = 1 Then
                    Set itmX = lvwDetail.ListItems.Add(, !intLevel & "-" & !lngReportID & "-" & !bytGroup & "-" & !lngViewId & "-" & !bytPrep & "-" & !bytWizard, !strReportName, 1, 1)
               Else
                    If !bytPrep = 2 Then
                        Set itmX = lvwDetail.ListItems.Add(, !intLevel & "-" & !lngReportID & "-" & !bytGroup & "-" & !lngViewId & "-" & !bytPrep & "-" & !bytWizard, !strReportName, 3, 3)
                    Else
                        Set itmX = lvwDetail.ListItems.Add(, !intLevel & "-" & !lngReportID & "-" & !bytGroup & "-" & !lngViewId & "-" & !bytPrep & "-" & !bytWizard, !strReportName, 4, 4)
                    End If
               End If
           Else
               If !bytPrep = 1 Then
                   Set itmX = lvwDetail.ListItems.Add(, !intLevel & "-" & !lngReportID & "-" & !bytGroup, !strReportName, 2, 2)
               Else
                   Set itmX = lvwDetail.ListItems.Add(, !intLevel & "-" & !lngReportID & "-" & !bytGroup, !strReportName, 5, 5)
               End If
           End If
           itmX.SubItems(1) = !strOperatorName
           If !strDate <> "" And Not IsNull(!strDate) Then
              itmX.SubItems(2) = Format(strReplace(!strDate, ".", "-"), "YYYY-MM-DD")
           End If
           .MoveNext
       Loop
   End With
   If lvwDetail.ListItems.Count > 0 Then
      lvwDetail.ListItems(1).Selected = True
   End If
   lblDesc = "共有 " & lvwDetail.ListItems.Count & " 个帐表"
End Sub

Private Sub cmdShow_Click()
   lvwDetail_DblClick
End Sub

Private Sub Form_Activate()
    If Not mblnIsLoadPopMenu Then CallPopMenu
    mclsMainControl_ChildActive
    Utility.SetHelpID 70001
    '置打印为灰
    frmMain.mnuFilePrint.Enabled = False
    frmMain.mnuEditShowList.Enabled = False
    frmMain.SetToolBar
End Sub

Private Sub Form_Deactivate()
    mblnIsLoadPopMenu = False
    frmMain.SetEditUnEnabled
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyEscape Then
        Unload Me
    End If
End Sub

Private Sub Form_Load()
   On Error GoTo ErrHandle
   MsgForm.PleaseWait
   Set mclsMainControl = gclsSys.MainControls.Add(Me)
   mblnIsLoadPopMenu = False
   mstrOldParent = ""
   InitDetail
   InitType
   mintOldItem = 1
   Utility.LoadFormResPicture Me
   Utility.LoadFormSetting Me
   Unload MsgForm
   Exit Sub
ErrHandle:
    Unload Me
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = 0 Then
        Me.MousePointer = vbDefault
    End If
End Sub

Private Sub Form_Resize()
  On Error GoTo ErrHandle
   If Me.WindowState = vbMinimized Then
       Exit Sub
   End If
   If Me.width < lngFormWidth Then
       Me.width = lngFormWidth
   End If
   If Me.Height < lngFormHeight Then
       Me.Height = lngFormHeight
   End If
   picGroup.top = 0
   picReport.top = 0
   picGroup.Left = 0
   picGroup.width = Me.width \ 3
   picReport.Left = picGroup.Left + picGroup.width + 30
   picReport.width = Me.width - picReport.Left - 120
   tvwReportType.top = picGroup.top + picGroup.Height + 10
   tvwReportType.Left = picGroup.Left - 10
   tvwReportType.width = picGroup.width + 30
   lvwDetail.top = tvwReportType.top
   lvwDetail.Left = picReport.Left - 10
   picSep.Left = lvwDetail.Left - 20
   picSep.top = tvwReportType.top
   lvwDetail.width = picReport.width + 30
   picDesc.Left = picGroup.Left
   picDesc.top = Me.Height - picDesc.Height - 400
   picDesc.width = Me.width - 120
   tvwReportType.Height = picDesc.top - tvwReportType.top - 30
   lvwDetail.Height = tvwReportType.Height
   picSep.Height = lvwDetail.Height
ErrHandle:
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error GoTo ErrHandle
   gclsSys.MainControls.Remove Me
   On Error GoTo 0
   Set mclsMainControl = Nothing
   Set tvwReportType.ImageList = Nothing
   Set lvwDetail.SmallIcons = Nothing
   Set lvwDetail.Icons = Nothing
   ImageList1.ListImages.Clear
   ImageList2.ListImages.Clear
   ImageList3.ListImages.Clear
   Utility.UnLoadFormResPicture Me
ErrHandle:
End Sub

Private Sub lvwDetail_AfterLabelEdit(Cancel As Integer, NewString As String)
Dim lngReportID As Long, lngParentId As Long
Dim intLevel As Integer
Dim blnIsFinded As Boolean
Dim strErr As String
     
     If IsNull(NewString) Then Exit Sub
     
     If Report.NameIsErr(NewString, strErr, False) Then
        Utility.ShowMsg Me.hwnd, "报表名称包含非法字符“" & strErr & "”!", vbOKOnly, App.title
        Cancel = True
        Exit Sub
     End If
     intLevel = Val(GetNoXString(lvwDetail.SelectedItem.Key, 1, "-"))
     lngReportID = GetNoXString(lvwDetail.SelectedItem.Key, 2, "-")
     lngParentId = GetNoXString(tvwReportType.SelectedItem.Key, 2, "-")
     
     If NewString = "" Then
        Utility.ShowMsg Me.hwnd, "报表名称不能为空!", vbOKOnly, App.title
        Cancel = True
     ElseIf StrLen(NewString) > 40 Then
        Utility.ShowMsg Me.hwnd, "报表名称太长!", vbOKOnly, App.title
        Cancel = True
     Else
        blnIsFinded = Report.ReportExist(NewString, lngParentId, lngReportID)
        If blnIsFinded Then
            Utility.ShowMsg Me.hwnd, "报表“" & NewString & "”已存在!", vbOKOnly, App.title
            Cancel = True
        Else
            WriteReportName lngReportID, NewString
        End If
     End If
End Sub

'单击 lvwDetail 的标题列进行排序
Private Sub lvwDetail_ColumnClick(ByVal ColumnHeader As ComctlLib.ColumnHeader)
  mstrOldParent = ""
  lvwDetail.Sorted = False
  If ColumnHeader.Index = 1 Then
      lvwDetail.SortOrder = IIf(lvwDetail.SortOrder = 0, 1, 0)
      tvwReportType_NodeClick tvwReportType.Nodes(tvwReportType.SelectedItem.Key)
  Else
      lvwDetail.SortKey = ColumnHeader.Index - 1
      lvwDetail.SortOrder = IIf(lvwDetail.SortOrder = 0, 1, 0)
      lvwDetail.Sorted = True
  End If
End Sub

Private Sub lvwDetail_DblClick()
  Dim strID As String
  
   On Error GoTo ErrHandle
   If lvwDetail.ListItems.Count = 0 Or lvwDetail.SelectedItem.Selected = False Then
        Exit Sub
   End If
   mblnRun = True
   If lvwDetail.SelectedItem.SmallIcon = 2 Or lvwDetail.SelectedItem.Icon = 2 _
      Or lvwDetail.SelectedItem.SmallIcon = 5 Or lvwDetail.SelectedItem.Icon = 5 Then
       
       Set tvwReportType.SelectedItem = tvwReportType.Nodes(lvwDetail.SelectedItem.Key)
       tvwReportType.SetFocus
       strID = GetNoXString(lvwDetail.SelectedItem.Key, 2, "-")
       InitList Val(strID), GetNoXString(lvwDetail.SelectedItem.Key, 3, "-")
       lvwDetail_ItemClick lvwDetail.ListItems(1)
       lvwDetail.SetFocus
   Else
       If GetNoXString(lvwDetail.SelectedItem.Key, 5, "-") = "0" Then
                '显示向导
                Select Case GetNoXString(lvwDetail.SelectedItem.Key, 6, "-")
                   '三栏帐
                   Case 1
                       Report.ShowBookWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-")
                   '多栏帐
                   Case 2
                       Report.ShowMultiBookWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-")
                   '标准表
                   Case 3
                       Report.ShowStandardWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-")
                   '交叉表
                   Case 4
                       Report.ShowCrossWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-")
                   '列表
                   Case 5
                       Report.ShowListWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-")
                   '帐龄分析
                   Case 6
                       Report.ShowAgeWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-")
                   '财务分析
                   Case 7
                       Report.ShowFinanceWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 3, "-")
                   '汇总表
                   Case 8
                       Report.ShowSumWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-")
                   '配宽表向导
                   Case 10
                       Report.ShowQuotaWizard GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 2, "-"), GetNoXString(tvwReportType.SelectedItem.Key, 1, "-")
                End Select
       Else
           '显示帐表
           Select Case GetNoXString(lvwDetail.SelectedItem.Key, 6, "-")
               Case "1"
                  Report.ShowAcntBook GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-")
               Case "2"
                  Report.ShowMultiAcntBook GetNoXString(lvwDetail.SelectedItem.Key, 2, "-"), GetNoXString(lvwDetail.SelectedItem.Key, 4, "-")
               Case "3"

⌨️ 快捷键说明

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