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

📄 rptgroup.cls

📁 本系统是一个报表分析查询系统
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "RptGroup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

'//本类属性
Public Js_GroupID As Long
Public Js_ParentID As Long
Public Js_Number As String
Public Js_GroupName As String
Public Js_RptList As String
Public Js_Desc As String
Public Js_Level As Long
Public Js_Detail As Long
Public Js_UseSign As Long
Public Js_UserID As Long
Public Js_Date As String
Public Js_Time As String
Public Js_Ico As String
Public Js_Sel As String

'//本类方案

'//保存用户 成功返回:True 失败返回False
Public Function Save(ByRef MsgInfo As String) As Boolean
 On Error GoTo ErrHandle
 Dim BaseObj As New StdRptBase.StdRptBaseCls
 Dim DaCn As New ADODB.Connection
 Dim Sql As String
 DaCn.ConnectionString = BaseObj.getConStr
 DaCn.Open
 DaCn.BeginTrans
 Sql = "delete from Js_RptGroup where Js_GroupID=" & Js_GroupID
 DaCn.Execute Sql
 Sql = "exec NewRptGroup "
 Sql = Sql & Js_GroupID & ","
 Sql = Sql & Js_ParentID & ","
 Sql = Sql & "'" & Js_Number & "',"
 Sql = Sql & "'" & Js_GroupName & "',"
 Sql = Sql & "'" & Js_RptList & "',"
 Sql = Sql & "'" & Js_Desc & "',"
 Sql = Sql & Js_Level & ","
 Sql = Sql & Js_Detail & ","
 Sql = Sql & Js_UseSign & ","
 Sql = Sql & Js_UserID & ","
 Sql = Sql & "'" & Js_Date & "',"
 Sql = Sql & "'" & Js_Time & "',"
 Sql = Sql & "'" & Js_Ico & "',"
 Sql = Sql & "'" & Js_Sel & "'"
 DaCn.Execute Sql
 DaCn.CommitTrans
 DaCn.Close
 Set DaCn = Nothing
 Set BaseObj = Nothing
 MsgInfo = "保存报表组成功"
 Save = True
 Exit Function
ErrHandle:
 MsgInfo = "保存报表组,错误:" & Err.Description
 If DaCn.State = adStateOpen Then DaCn.Close
 Set DaCn = Nothing
 Set BaseObj = Nothing
 Save = False
End Function

'//装载用户信息 成功返回True 失败返回False
Public Function Load(ByVal lgRptID As Long, ByRef MsgInfo As String) As Boolean
 On Error GoTo ErrHandle
 Dim BaseObj As New StdRptBase.StdRptBaseCls
 Dim DaCn As New ADODB.Connection
 Dim DaRs As New ADODB.Recordset
 Dim Sql As String
 Sql = "select Js_GroupID,Js_ParentID,Js_Number,Js_GroupName,Js_RptList,Js_Desc,Js_Level,Js_Detail,Js_UseSign,Js_UserID,Js_Date,Js_Time,Js_Ico,Js_Sel from Js_RptGroup where Js_GroupID=" & lgRptID
 DaCn.ConnectionString = BaseObj.getConStr
 DaCn.Open
 DaRs.CursorLocation = adUseClient
 DaRs.Open Sql, DaCn, adOpenStatic, adLockReadOnly
 If Not DaRs.EOF Then
  If Not IsNull(DaRs("Js_GroupID")) Then Js_GroupID = DaRs("Js_GroupID")
  If Not IsNull(DaRs("Js_ParentID")) Then Js_ParentID = DaRs("Js_ParentID")
  If Not IsNull(DaRs("Js_Number")) Then Js_Number = Trim(DaRs("Js_Number"))
  If Not IsNull(DaRs("Js_GroupName")) Then Js_GroupName = Trim(DaRs("Js_GroupName"))
  If Not IsNull(DaRs("Js_RptList")) Then Js_RptList = Trim(DaRs("Js_RptList"))
  If Not IsNull(DaRs("Js_Desc")) Then Js_Desc = Trim(DaRs("Js_Desc"))
  If Not IsNull(DaRs("Js_Level")) Then Js_Level = DaRs("Js_Level")
  If Not IsNull(DaRs("Js_Detail")) Then Js_Detail = DaRs("Js_Detail")
  If Not IsNull(DaRs("Js_UseSign")) Then Js_UseSign = DaRs("Js_UseSign")
  If Not IsNull(DaRs("Js_UserID")) Then Js_UserID = DaRs("Js_UserID")
  If Not IsNull(DaRs("Js_Date")) Then Js_Date = Trim(DaRs("Js_Date"))
  If Not IsNull(DaRs("Js_Time")) Then Js_Time = Trim(DaRs("Js_Time"))
  If Not IsNull(DaRs("Js_Ico")) Then Js_Ico = Trim(DaRs("Js_Ico"))
  If Not IsNull(DaRs("Js_Sel")) Then Js_Sel = Trim(DaRs("Js_Sel"))
 Else
  MsgInfo = "错误的报表组"
  DaRs.Close
  DaCn.Close
  Set DaRs = Nothing
  Set DaCn = Nothing
  Set BaseObj = Nothing
  Load = False
  Exit Function
 End If
 DaRs.Close
 DaCn.Close
 Set DaRs = Nothing
 Set DaCn = Nothing
 Set BaseObj = Nothing
 MsgInfo = "装载数据成功"
 Load = True
 Exit Function
ErrHandle:
 MsgInfo = "装载报表,错误:" & Err.Description
 If DaRs.State = adStateOpen Then DaRs.Close
 If DaCn.State = adStateOpen Then DaCn.Close
 Set DaRs = Nothing
 Set DaCn = Nothing
 Set BaseObj = Nothing
 Load = False
End Function

'//删除用户
Public Function Del(ByVal lgRptID As Long, ByRef MsgInfo As String) As Boolean
 On Error GoTo ErrHandle
 Dim DelSign As Long
 Dim BaseObj As New StdRptBase.StdRptBaseCls
 Dim DaCn As New ADODB.Connection
 Dim Sql As String
 '//
 If Load(lgRptID, MsgInfo) = False Then
  Del = False
  Exit Function
 End If
 '//
 If getRptCount(lgRptID) > 0 Then
  Set DaCn = Nothing
  Set BaseObj = Nothing
  MsgInfo = "本报表组下包括了报表,拒绝删除"
  Del = False
  Exit Function
 End If
 '//
 DelSign = MsgBox("删除[" & Js_GroupName & "]?", vbQuestion + vbYesNo + vbDefaultButton2, BaseObj.getMsgInfo)
 If DelSign <> 6 Then
  Set DaCn = Nothing
  Set BaseObj = Nothing
  MsgInfo = "用户取消删除操作"
  Del = False
  Exit Function
 End If
 '//
 Sql = "delete from Js_RptGroup where Js_GroupID=" & lgRptID
 DaCn.ConnectionString = BaseObj.getConStr
 DaCn.Open
 DaCn.Execute Sql
 DaCn.Close
 Set DaCn = Nothing
 Set BaseObj = Nothing
 MsgInfo = "删除[" & Js_GroupName & "]成功"
 Del = True
 Exit Function
ErrHandle:
 If DaCn.State = adStateOpen Then DaCn.Close
 Set DaCn = Nothing
 Set BaseObj = Nothing
 MsgInfo = "删除用户组,错误:" & Err.Description
 Del = False
End Function

'//计算指定的用户下面属于多少个用户组
Public Function getRptCount(ByVal lgRptID As Long) As Long
 On Error GoTo ErrHandle
 Dim BaseObj As New StdRptBase.StdRptBaseCls
 Dim DaCn As New ADODB.Connection
 Dim DaRs As New ADODB.Recordset
 Dim Sql As String
 Dim RetValue As Long
 RetValue = 0
 Sql = "select count(*) as RptCount from Js_Rpt where Js_GroupID=" & lgRptID
 DaCn.ConnectionString = BaseObj.getConStr
 DaCn.Open
 DaRs.Open Sql, DaCn, adOpenStatic, adLockReadOnly
 If Not DaRs.EOF And Not IsNull(DaRs("RptCount")) Then
  RetValue = DaRs("RptCount")
 End If
 DaRs.Close
 DaCn.Close
 Set DaRs = Nothing
 Set DaCn = Nothing
 getRptCount = RetValue
 Exit Function
ErrHandle:
 If DaRs.State = adStateOpen Then DaRs.Close
 If DaCn.State = adStateOpen Then DaCn.Close
 Set DaRs = Nothing
 Set DaCn = Nothing
 Set BaseObj = Nothing
 getRptCount = 0
End Function

'//统计当前用户组的数量
Public Function getSum() As Long
 On Error GoTo ErrHandle
 Dim BaseObj As New StdRptBase.StdRptBaseCls
 Dim DaCn As New ADODB.Connection
 Dim DaRs As New ADODB.Recordset
 Dim Sql As String
 Dim RetValue As Long
 Sql = "select count(*) as RptSum from Js_RptGroup"
 DaCn.ConnectionString = BaseObj.getConStr
 DaCn.Open
 DaRs.Open Sql, DaCn, adOpenStatic, adLockReadOnly
 If Not DaRs.EOF And Not IsNull(DaRs("RptSum")) Then
  RetValue = DaRs("RptSum")
 End If
 DaRs.Close
 DaCn.Close
 Set DaRs = Nothing
 Set DaCn = Nothing
 getSum = RetValue
 Exit Function
ErrHandle:
 If DaRs.State = adStateOpen Then DaRs.Close
 If DaCn.State = adStateOpen Then DaCn.Close
 Set DaRs = Nothing
 Set DaCn = Nothing
 Set BaseObj = Nothing
 getSum = 0
End Function


⌨️ 快捷键说明

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