Hi Guys…hope some one will help me out with this script and let me know exactly what this script does.ill be very grateful if someone let me know step by step how this script works.Thanks in advance!
Function calcDebtTurn(days() As Integer, TurnOver() As Double, SLBal() As Double, result() As Double ) As Integer
On Error Goto errhandle
Dim nRows As Integer,nDays As Integer, nkeepgoing As Integer, i As Integer, x As Double, tempi As Integer
Dim nOSBal As Double
calcDebtTurn = 1
nRows = Ubound(days)
If Ubound(TurnOver) < nRows Or Ubound(SLBal) < nRows Then
calcDebtTurn = -2
Else
Redim Preserve result(nRows)
For i = nRows To 0 Step -1
nosBal = SLBal(i)
nkeepgoing = True
ndays = 0
tempi = i
’ tempi = i-1
’ If tempi >= 0 Then
Do While nkeepgoing = True
If TurnOver(tempi) >=nosBal Then
x = nosbal * days(tempi)/Turnover(tempi)
If tempi = 0 Then
ndays = 0
Else
ndays = ndays + x
End If
nkeepgoing = False
Else
If tempi = 0 Then
calcDebtTurn = -1
ndays = 0
nkeepgoing = False
Else
ndays = ndays+days(tempi)
End If
End If
nOSBal = nOSBal-Turnover(tempi)
tempi =tempi-1
Loop
’ End If
Result(i) = nDays
Next
End If
Exit Function
errhandle:
Resume Next
End Function
Function calcTriggerBite() As Integer
Dim ws As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Dim item As notesitem
Dim i As Integer, nRows As Integer
Dim result() As String
Set uidoc = ws.currentdocument
Set doc = uidoc.document
Set item = doc.getFirstItem("FStats_nDebtTurn")
If Not item Is Nothing Then
nRows = Ubound(item.values)
Redim result(nrows)
For i = 0 To nrows
If item.values(i) > doc.FStats_nTotTrigger(0) Then
result(i) = "§"
Else
result(i) = "."
End If
Next
End If
Call doc.replaceItemValue("FStats_tTrigger",Result)
Exit Function
errhandle:
Resume Next
End Function