📄 age.cls
字号:
AgeName = mvarAgeName
End Property
'汇总列
Public Property Let ColGroup(ByVal vData As String)
mvarColGroup = vData
End Property
Public Property Get ColGroup() As String
ColGroup = mvarColGroup
End Property
'分析数据范围
Public Property Let DataType(ByVal vData As Long)
mvarDataType = vData
End Property
Public Property Get DataType() As Long
DataType = mvarDataType
End Property
''两清标志
'Public Property Let IsCleared(ByVal vData As Boolean)
' mvarIsCleared = vData
'End Property
'
'Public Property Get IsCleared() As Boolean
' IsCleared = mvarIsCleared
'End Property
'汇总标志
Public Property Let IsGrouped(ByVal vData As Boolean)
mvarIsGrouped = vData
End Property
Public Property Get IsGrouped() As Boolean
IsGrouped = mvarIsGrouped
End Property
'栏目字段类别:分组,汇总等
Public Property Let ColType(ByVal i As Integer, ByVal vData As Byte)
mvarColType(i) = vData
End Property
Public Property Get ColType(ByVal i As Integer) As Byte
ColType = mvarColType(i)
End Property
'栏目字段名称
Public Property Let ColName(ByVal i As Integer, ByVal vData As String)
mvarColName(i) = vData
End Property
Public Property Get ColName(ByVal i As Integer) As String
ColName = mvarColName(i)
End Property
'栏目字段表名
Public Property Let ColTable(ByVal i As Integer, ByVal vData As String)
mvarColTable(i) = vData
End Property
Public Property Get ColTable(ByVal i As Integer) As String
ColTable = mvarColTable(i)
End Property
'栏目字段描述
Public Property Let colDesc(ByVal i As Integer, ByVal vData As String)
mvarColDesc(i) = vData
End Property
Public Property Get colDesc(ByVal i As Integer) As String
colDesc = mvarColDesc(i)
End Property
'SQL语句
Public Property Let SQLString(ByVal vData As String)
mvarSQLString = vData
End Property
Public Property Get SQLString() As String
SQLString = mvarSQLString
End Property
'报表视图ID
Public Property Let AgeViewID(ByVal vData As Integer)
mvarAgeViewID = vData
End Property
Public Property Get AgeViewID() As Integer
AgeViewID = mvarAgeViewID
End Property
Public Property Let strWhere(ByVal vData As String)
mstrWhere = vData
End Property
Public Property Get strWhere() As String
strWhere = mstrWhere
End Property
'报表ID
'获取报表ID,同时检查是否向导 ( bytPrep=0?)
Public Property Let AgeReportID(ByVal vData As Long)
Dim rstAge As rdoResultset
mvarAgeReportID = vData
Set rstAge = gclsBase.BaseDB.OpenResultset("SELECT * FROM Report WHERE lngReportId=" & mvarAgeReportID, rdOpenStatic)
If Not rstAge.EOF Then
mbytPrep = rstAge!bytPrep
mvarGroupNo = rstAge!bytGroup
' Me.CurrencyID = rstAge!bytExpandStyle
If mvarParentID = 0 Then
mvarParentID = rstAge!lngParentId
mvarParentLevel = rstAge!intLevel
End If
End If
End Property
Public Property Get AgeReportID() As Long
AgeReportID = mvarAgeReportID
End Property
'类模块方法
'调用向导,参数为: intAgeViewID : 2 应收查询 3 应付查询
' lngAgeReportID : 向导对应的报表ID
' lngParentID : 父节点ID
' intParentLevel : 父节点层次
Public Function ShowWizard(ByVal lngReportID As Long, ByVal lngViewId As Long, Optional lngParentId As Long = 0, Optional intParentLevel As Integer = 0, Optional blnNotNew As Boolean = False, Optional clsFromCond As FormCond) As Boolean
Dim strStr As String
Dim strSql1 As String
Dim blnOK As Boolean
If ParentId = 0 Then
mvarParentID = lngParentId
mvarParentLevel = intParentLevel ' mintParentLevel
End If
AgeReportID = lngReportID
If AgeViewID = 0 Then '是一个新类
AgeViewID = lngViewId
GetAgeReportSet AgeReportID, AgeViewID '初始化新类栏目并得出其SQL语句
End If
' blnIsNew = (mbytPrep = 0) Or (mbytPrep = 1)
' mbytPrep = 2
If blnIsNew Then
' AgeName = "未定义"
IsNewWizard = True
GetAgePeriod (lngReportID)
Else
IsNewWizard = False
End If
blnOK = SetAgeWizard(Me, clsFromCond)
ShowWizard = blnOK
If ShowWizard Then
' mbytPrep = 2
GetAgeConditions AgeReportID, AgeViewID '设置条件子句
'在 SetGroups 中同时设置了栏目已选性质,将影响 SetAgeSelect
'在 GetAgeConditions 中同时设置了分析日期和截止日期,将影响 SetAgeSelect
If SetGroups And SetAgeSelect And SetAgeSQLFrom(AgeViewID) Then 'And SetConditions(ReportViewID)
strSql1 = mstrSelect1 & " " & mstrFrom1 & " " & mstrWhere1 & " " & mstrGroupBy1 & " " & mstrOrderBy
SQLString = strSql1
End If
If blnIsNew Then
SaveWizard
If Not blnNotNew Then '当直接调用向导生成报表时则显示
Report.ShowAgeReport 0, 0, Me
End If
End If
End If
End Function
'显示帐龄分析表向导
Private Function SetAgeWizard(ByVal clsAge As Age, Optional clsFromCond As FormCond) As Boolean
Dim AgeWizard As New frmAgeWizard
SetAgeWizard = AgeWizard.SetAge(clsAge, clsFromCond)
End Function
'根据当前“报表ID” 进行区间初始化
Private Function GetAgePeriod(ByVal lngReportID As Long) As Boolean
Dim i As Integer
Dim strSelect, strWhere, strOrder As String
Dim rstRecord As rdoResultset
Dim intCount As Integer
strSelect = "SELECT * FROM AgePeriod where lngreportID=" & lngReportID '帐龄区间表
strOrder = " ORDER BY lngAgePeriodID"
Set rstRecord = gclsBase.BaseDB.OpenResultset(strSelect & strOrder, rdOpenDynamic) '& strWhere
If rstRecord.EOF Then
GetAgePeriod = False
Exit Function
Else
rstRecord.MoveLast
End If
intCount = rstRecord.RowCount
PeriodNumber = intCount + 1
PeriodName(0) = "未过期" '第一个分析区间默认为"未过期"
PeriodDay(0) = -19999
With rstRecord
.MoveFirst
For i = 1 To intCount
PeriodName(i) = IIf(IsNull(!strAgePeriodName), "", !strAgePeriodName) '区间名称
PeriodDay(i) = IIf(IsNull(!intDay), 0, !intDay) '区间天数
.MoveNext
Next i
.Close
End With
blnPeriodIsInited = True
GetAgePeriod = True
End Function
'取当前帐龄表设置,初始化栏目设置
Public Function GetAgeReportSet(ByVal lngReportID As Long, ByVal ReportViewID As Long) As String
Dim rstChoosed As rdoResultset
Dim strSql As String
Dim strOrder As String
Dim intCount As Integer, lngWidth As Long
Dim strTemp As String
Dim strSql1 As String
'Temp Code
' gclsBase.OperatorID = 1
Select Case ReportViewID
Case 610, 1005, 611, 1004
mblnIsARR = True
Case Else
mblnIsARR = False
End Select
#If conVersionType = 1 Then
strCondVersionField = " And (ViewField.bytVersion IN (1,3,7,5,9,11,13,15,17,19,21,23,25,27,29,31))"
#Else
#If conVersionType = 2 Then
#Else
#If conVersionType = 4 Then
strCondVersionField = " And (ViewField.bytVersion IN (4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31))"
#ElseIf conVersionType = 8 Then
strCondVersionField = " And (ViewField.bytVersion IN (8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31))"
#Else
strCondVersionField = " And (ViewField.bytVersion IN (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31))"
#End If
#End If
#End If
If Not blnIsNew Then '不是新建报表则从 Report 表中读取视图ID、报表ID、报表名称和两清标志
strSql = "SELECT * FROM Report WHERE lngReportID = " & lngReportID
Set rstChoosed = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
If rstChoosed.EOF Then
GetAgeReportSet = ""
Exit Function
End If
With rstChoosed
AgeViewID = !lngViewId
AgeReportID = !lngReportID
AgeName = !strReportName
' Divide = !blnIsDivide
' ShowCent = !blnIsShowCent
' ShowZero = !blnIsShowZero
' ShowNegivate = !bytShowNegivate
DataType = !bytRowTotalMethod
PrintID = !lngPrintSetupID
GroupNo = !bytGroup
GridTop = !intGridTop
AgePre = !bytPrep
mvarReportVersionNumber = !bytVersion
CurrencyID = !bytExpandStyle
mvarIsGrouped = IIf(!bytAccountType = 1, True, False)
If (!intDirection = 0) Then
Me.AgeDateDesc = "到期日"
Me.AgeStartDate = "strDueDate"
Else
Me.AgeDateDesc = "开票日"
Me.AgeStartDate = "strReceiptDate"
End If
End With
End If
'从 ViewField 和 ReportField 中读取报表字段及其性质
strSql = "SELECT * FROM ViewField,ReportField WHERE ViewField.lngViewFieldID = ReportField.lngViewFieldID " & _
" and ViewField.blnIsChoose = 1 AND ViewField.lngViewID = " & ReportViewID & _
" AND ReportField.lngReportID = " & AgeReportID & strCondVersionField
strOrder = " Order By lngReportFieldNO"
Set rstChoosed = gclsBase.BaseDB.OpenResultset(strSql & strOrder, rdOpenStatic)
With rstChoosed
If .EOF Then
GetAgeReportSet = ""
Exit Function
End If
.MoveLast
.MoveFirst
ColNumber = .RowCount
For intCount = 0 To .RowCount - 1
colDesc(intCount) = IIf(IsNull(!strReportFieldDesc), !strViewFieldDesc, !strReportFieldDesc) '字段描述
ColName(intCount) = IIf(IsNull(!strFieldName), "", !strFieldName) '字段名
ColTable(intCount) = IIf(IsNull(!strTableName), "", !strTableName) '字段所在表名
ColVersionType(intCount) = IIf(IsNull(.rdoColumns("bytversion")), "", .rdoColumns("bytversion")) '字段版本号
' lngWidth = Utility.GetDisplayWidth(!strViewFieldDesc, !bytFieldSize)
' lngWidth = IIf(lngWidth > IIf(IsNull(!lngDisplayWidth), 0, !lngDisplayWidth), lngWidth, !lngDisplayWidth)
lngWidth = IIf(IsNull(!lngDisplayWidth), 1000, !lngDisplayWidth)
ColWidth(intCount) = lngWidth '字段显示宽度
ColOrderType(intCount) = IIf(IsNull(!bytsort), 0, !bytsort) '字段排序方式
ColIsFixed(intCount) = IIf(!blnIsFixed = 1, True, False) '是否固定字段
colFieldID(intCount) = .rdoColumns("lngViewFieldID") '字段视图ID
ColType(intCount) = IIf(IsNull(!bytReportFieldType), 0, !bytReportFieldType) '字段类型
If ColType(intCount) = 1 Then
ColGrouped(intCount) = True '分组汇总
Else
ColGrouped(intCount) = False
End If
If ColType(intCount) = 5 Then '只显示汇总
' IsGrouped = True
ColGroup = colDesc(intCount)
End If
ColFieldSize(intCount) = IIf(IsNull(!bytFieldSize), 0, !bytFieldSize) '字段宽度
If ColIsFixed(intCount) Then
ColIsChoosed(intCount) = True '字段已选
Else
ColIsChoosed(intCount) = IIf(!blnIsChoosed = 1, True, False)
End If
'**********************************************
'2000-01-26雷宇增加
mblnIsHeadCol(intCount) = IIf(!blnIsHeaded = 1, True, False)
If mblnIsHeadCol(intCount) Then
If ColIsChoosed(intCount) Then
mintDataColumns = mintDataColumns + 1
End If
End If
'**********************************************
.MoveNext
Next intCount
.Close
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -