CasewareDocs

SmartAging

Properties:

Example

Sub Main()
Dim oDB As Object
Dim oTask As Object
Dim oParameters As Object
Dim oAging As Object
Dim dbname As String
Dim sDateColumnName As String
Dim sAoumntColumnName As String

Set oDB = Client.OpenDatabase(SmartContext.PrimaryInputFile)

'Get parameters from SmartContext.
Set oParameters = SmartContext.Parameters

If oParameters.Contains("SmartAging1") Then
Set oAging = oParameters.Item("SmartAging1")
Set oTask = oDB.Aging

'************************************
'The following lines are only a shortcut.
'The date and the amount fields have to be tagged by the user
'and have to be determined within the macro.
'************************************

sDateColumnName = "DueDate"
sAmountColumnName = "Amount"

oTask.Info oAging.StartDate, sDateColumnName, sAmountColumnName
oTask.IntervalTypeIndex = oAging.IntervalType '0=Days/1=Month/2=Years
oTask.Intervals oAging.Interval1, oAging.Interval2, oAging.Interval3, oAging.Interval4, oAging.Interval5, oAging.Interval6

dbName = Client.UniqueFileName("Aging Result File")
oTask.CreateAgeDB dbName,
oTask.IncludeAllFields
oTask.PerformTask

Set oTask = Nothing
Set oAging = Nothing
End If

Set oParameters = Nothing

oDB.Close
Set oDB = Nothing
End Sub