'******************************************************
'
' [Link] has been updated for HFM 11.1.1 release
' with Sub EquityPickUp example
' as well as changes in Sub NoInput to accomodate
' for the EPU calculations
'
'******************************************************
'*************************************************
'* CALCULATE ROUTINE *
'*************************************************
Sub Calculate()
'=================================================
'= Prior Rates =
'=================================================
[Link] "A#AverateP=A#Averate.P#Last.Y#Prior"
[Link] "A#Operate=A#Clorate.P#Last.Y#Prior"
Value=[Link]
'=================================================
'= ENTITY CURRENCY =
'=================================================
If Value="<Entity Currency>" Then
If [Link]("","") Then
'------------------------------------------------
' Retrieval of opening balance from prior period
'------------------------------------------------
[Link] "C1#Opening=C1#Closing.P#Last.Y#Prior"
'------------------------------------------------
' Calculation of flows for Balance Sheet accounts
'------------------------------------------------
[Link] "C1#Check=C1#Closing-C1#TotFlows"
[Link] "C1#Movement"
[Link] "C1#Movement=C1#Closing-C1#TotFlows"
'------------------------------------------------
' Impact next year
'------------------------------------------------
If [Link] Then [Link] "P#First.Y#Next"
'------------------------------------------------
' Park accounts for ROA
'------------------------------------------------
[Link] "A#AssetsP=(A#Assets+A#Assets.P#Prior)/2"
Select Case [Link]
Case 1,7
[Link] "A#AssetsQ=A#AssetsP"
[Link] "A#AssetsH=A#AssetsQ"
Case 2,8
[Link] "A#AssetsQ=(A#Assets+A#AssetsQ.P#Prior*2)/3"
[Link] "A#AssetsH=A#AssetsQ"
Case 3,9
[Link] "A#AssetsQ=(A#Assets+A#AssetsQ.P#Prior*3)/4"
[Link] "A#AssetsH=A#AssetsQ"
Case 4,10
[Link] "A#AssetsQ=A#AssetsP"
[Link] "A#AssetsH=(A#Assets+A#AssetsH.P#Prior*4)/5"
Case 5,11
[Link] "A#AssetsQ=(A#Assets+A#AssetsQ.P#Prior*2)/3"
[Link] "A#AssetsH=(A#Assets+A#AssetsH.P#Prior*5)/6"
Case 6,12
[Link] "A#AssetsQ=(A#Assets+A#AssetsQ.P#Prior*3)/4"
[Link] "A#AssetsH=(A#Assets+A#AssetsH.P#Prior*6)/7"
End Select
[Link] "A#AssetsY=(A#Assets.Y#Prior.P#Last+A#Assets)"
If [Link]>1 Then
For i=1 to [Link]-1
[Link] "A#AssetsY=A#AssetsY+A#Assets.P#Cur-" & i
Next
End If
[Link] "A#AssetsY=A#AssetsY/([Link]+1)"
Else
'------------------------------------------------
' Earnings per share
'------------------------------------------------
[Link] "A#EPS=A#NetIncG/A#DilSha"
End If
'=================================================
'= ADJ's Value =
'=================================================
ElseIf Value="<Entity Curr Adjs>" or [Link] or Value="[Parent
Adjs]" or Value="[Contribution Adjs]" Then
'-------------------------------------------------
' Retrieval of opening balance from prior period
'-------------------------------------------------
[Link] "C1#Opening=C1#Closing.P#Last.Y#Prior"
'-------------------------------------------------
' Move net income from P&L to BS
'-------------------------------------------------
[Link] "A#NetInc=A#NetIncPL"
'-------------------------------------------------
' Move prior year net income to retained earnings
'-------------------------------------------------
[Link] "A#Retearn.C1#Appropriation=A#NetIncPL.C1#[None].P#Last.Y#Prior"
'-------------------------------------------------
' Calculate Closing
'-------------------------------------------------
[Link] "C1#Closing=C1#TotFlows"
'------------------------------------------------
' Impact next year
'------------------------------------------------
If [Link] Then [Link] "P#First.Y#Next"
'=================================================
'= TRANSLATED CURRENCY =
'=================================================
ElseIf [Link] Then
'-------------------------------------------------
' Retrieval of opening balance from prior period
'-------------------------------------------------
[Link] "C1#Opening=C1#Closing.P#Last.Y#Prior"
'-------------------------------------------------
' Calculate Closing
'-------------------------------------------------
[Link] "C1#Closing=C1#TotFlows"
'=================================================
'= PROPORTION / ELIMINATION =
'=================================================
Else
'-------------------------------------------------
' Calculate Closing
'-------------------------------------------------
[Link] "C1#Closing=C1#TotFlows"
End If
'-------------------------------------------------
' Validation accounts
'-------------------------------------------------
I12=".I#[ICP Top].C1#AllCustom1.C2#AllCustom2"
[Link] "A#ValidAcct1=A#Asstot" & I12 & "-(A#EquityT" & I12 & "+A#Liatot" &
I12 & ")"
'[Link] "A#ValidAcct2=A#NetIncPL.I#[ICP Top]-A#NetInc"
End Sub
'*************************************************
'* TRANSLATE ROUTINE *
'*************************************************
Sub Translate()
'------------------------------------------------------
' Rates variables
'------------------------------------------------------
AVE=[Link]("A#AveRate")
CLO=[Link]("A#CloRate")
AVE_1=[Link]("A#AverateP")
CLO_1=[Link]("A#OpeRate")
'------------------------------------------------------
' Translation of movements not using the default
'------------------------------------------------------
[Link] "C1#Appropriation","",AVE_1,""
'------------------------------------------------------
' FX calculation
'------------------------------------------------------
[Link] "C1#FXOpening","C1#Opening",CLO,CLO_1
[Link] "C1#FXMovement","C1#Closing",CLO,AVE
[Link] "C1#FXMovement","C1#Opening",AVE,CLO
'------------------------------------------------------
' Net income translation
'------------------------------------------------------
[Link] "A#NetInc","",AVE,""
[Link] "A#Cap_Cta.C1#FXMovement","A#NetInc.C1#[None]",CLO,AVE
[Link]
"A#Cap_Cta.C1#FXOpening","A#NetInc.C1#[None].P#Last.Y#Prior",AVE_1,CLO_1
'------------------------------------------------------
' Translation of accounts at historical rate
'------------------------------------------------------
AcctList = [Link]("","[Base]")
For i = Lbound(AcctList) To Ubound(AcctList)
Select Case [Link].UD2(AcctList(i))
'------------------------------------------------------
' Cumulated Translation Adjustment in the balance sheet
'------------------------------------------------------
Case "HIST1"
[Link] "A#Cap_Cta.C1#FXOpening","A#" & AcctList(i) &
".C1#Opening",CLO,CLO_1
[Link] "A#Cap_Cta.C1#FXOpening","A#" & AcctList(i) &
".C1#Appropriation",CLO,AVE_1
[Link] "A#Cap_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Closing",CLO,AVE
[Link] "A#Cap_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Opening",AVE,CLO
[Link] "A#Cap_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Appropriation",AVE,CLO
'------------------------------------------------------
' Cumulated Translation Adjustment in separate account
'------------------------------------------------------
Case "HIST2"
[Link] "A#Inv_Cta.C1#FXOpening","A#" & AcctList(i) &
".C1#Opening",CLO,CLO_1
[Link] "A#Inv_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Closing",CLO,AVE
[Link] "A#Inv_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Opening",AVE,CLO
End Select
Next
End Sub
'*************************************************
'* CONSOLIDATE ROUTINE *
'*************************************************
Sub Consolidate()
Method=[Link]("")
'=====================================================
'= METHODS: HOLDING - GLOBALE - PROPORZ - EQUITY =
'=====================================================
If Method="HOLDING" or Method="GLOBAL" or Method="PROPORTIONAL" or
Method="EQUITY" Then
'-------------------------------------------------
' Current Entity variables
'-------------------------------------------------
Entity=[Link]
PCon=[Link]("")
POwn=[Link]("")
PMin=PCon-POwn
PCon_1=[Link]("P#Last.Y#Prior")
POwn_1=[Link]("P#Last.Y#Prior")
PMin_1=PCon_1-POwn_1
VPCon=PCon-PCon_1
VPOwn=POwn-POwn_1
VPMin=PMin-PMin_1
'-------------------------------------------------
' Technical accounts
'-------------------------------------------------
NiEq="A#EquInc"
IEq="A#Inveq"
Link="A#Linkinv"
RcG="A#ResConG"
RcvG="A#CtaG"
NiG="A#NetIncG"
RcM="A#ResConM"
RcvM="A#CtaM"
NiM="A#NetIncM"
'-------------------------------------------------
' Working variables
'-------------------------------------------------
NInc=".C1#NetIncome"
Var=".C1#Variance"
Elim=".V#[Elimination]"
'=================================================
'= Entity Data Unit =
'=================================================
Set DataUnit=[Link]("")
NumItems=[Link]
For i=0 to NumItems-1
Call
[Link](i,Account,ICP,Custom1,Custom2,Custom3,Custom4,Data)
If Data<>0 and Custom1<>"Closing" Then
Acc="A#" & Account
'-------------------------------------------------
' Variance movement
'-------------------------------------------------
If Custom1="Opening" Then C1Dest=Var Else C1Dest=".C1#" & Custom1
'-------------------------------------------------
' Default consolidation
'-------------------------------------------------
If Method<>"EQUITY" Then [Link] Acc & C1Dest,PCon,""
'-------------------------------------------------
' Automatic elimination
'-------------------------------------------------
Rule=[Link].UD3("")
Audit=Rule
Select Case Rule
'----------------------------------------------------
' Equity Accounts
'----------------------------------------------------
Case "CAPITAL"
If Method<>"HOLDING" Then
Nature=".C2#Equity"
If Custom1="Appropriation" Then
If Method="EQUITY" Then
[Link] IEq & Nature & Elim,PCon_1*(-1),Audit
[Link] IEq & Var & Nature & Elim,VPCon*(-
1),Audit
Else
[Link] Acc & Elim,PCon*(-1),Audit
End If
[Link] RcG & Nature & Elim,POwn_1,Audit
[Link] RcG & Var & Nature & Elim,VPOwn,Audit
[Link] RcM & Nature & Elim,PMin_1,Audit
[Link] RcM & Var & Nature & Elim,VPMin,Audit
Else
If Method="EQUITY" Then
[Link] IEq & C1Dest & Nature & Elim,PCon*(-
1),Audit
Else
[Link] Acc & C1Dest & Elim,PCon*(-1),Audit
End If
[Link] RcG & C1Dest & Nature & Elim,POwn,Audit
[Link] RcM & C1Dest & Nature & Elim,PMin,Audit
End If
End If
'----------------------------------------------------
' Cumulated Translation Adjustment for Equity
'----------------------------------------------------
Case "CAP_CTA"
Nature=".C2#Equity"
If Method="EQUITY" Then
[Link] IEq & C1Dest & Nature & Elim,PCon*(-1),Audit
Else
[Link] Acc & C1Dest & Elim,PCon*(-1),Audit
End If
[Link] RcvG & C1Dest & Nature & Elim,POwn,Audit
[Link] RcvM & C1Dest & Nature & Elim,PMin,Audit
'----------------------------------------------------
' Investments
'----------------------------------------------------
Case "INVEST"
Call SetICP(ICP,ICPMethod)
If ICPMethod="HOLDING" or ICPMethod="GLOBAL" or
ICPMethod="PROPORTIONAL" or ICPMethod="EQUITY" Then
Nature=".C2#Investments"
PElim=".E#" & ICP & ".I#" & Entity & Elim
If Method="EQUITY" Then
[Link] IEq & C1Dest & Nature & Elim,PCon*(-1),Audit
Else
[Link] Acc & C1Dest & Elim,PCon*(-1),Audit
End If
[Link] Link & C1Dest & Elim,PCon,Audit
[Link] Link & C1Dest & PElim,PCon*(-1),Audit
If Custom1="FXOpening" or Custom1="FXMovement" Then
[Link] RcvG & Nature & PElim,POwn,Audit
[Link] RcvM & Nature & PElim,PMin,Audit
Else
[Link] RcG & C1Dest & Nature & PElim,POwn,Audit
[Link] RcM & C1Dest & Nature & PElim,PMin,Audit
End If
End If
'----------------------------------------------------
' Cumulated Translation Adjustment for Investments
'----------------------------------------------------
Case "INV_CTA"
Call SetICP(ICP,ICPMethod)
If ICPMethod="HOLDING" or ICPMethod="GLOBAL" or
ICPMethod="PROPORTIONAL" or ICPMethod="EQUITY" Then
Nature=".C2#Investments"
PElim=".E#" & ICP & ".I#" & Entity & Elim
If Method<>"EQUITY" Then [Link] Acc & C1Dest &
Elim,PCon*(-1),Audit
If Custom1="Opening" Then
[Link] RcG & C1Dest & Nature & PElim,POwn*(-
1),Audit
[Link] RcM & C1Dest & Nature & PElim,PMin*(-
1),Audit
[Link] RcvG & C1Dest & Nature & PElim,POwn,Audit
[Link] RcvM & C1Dest & Nature & PElim,PMin,Audit
End If
End If
'----------------------------------------------------
' Net Income
'----------------------------------------------------
Case "NETINC"
Nature=".C2#Equity"
If Method="EQUITY" Then
[Link] IEq & NInc & Nature & Elim,PCon*(-1),Audit
[Link] NiEq & Elim,PCon,Audit
Else
[Link] Acc & Elim,PCon*(-1),Audit
End If
[Link] NiG & C1Dest & Elim,POwn,Audit
[Link] NiM & C1Dest & Elim,PMin,Audit
'----------------------------------------------------
' Standard Elimination
'----------------------------------------------------
Case "STDELIM"
If Method<>"EQUITY" Then
Call SetICP(ICP,ICPMethod)
If ICPMethod="HOLDING" or ICPMethod="GLOBAL" or
ICPMethod="PROPORTIONAL" Then
Plug = "A#" & [Link]("")
ICPPCon=[Link]("E#" & ICP)
Min=Minimum(PCon,ICPPCon)
[Link] Acc & C1Dest & Elim,Min*(-1),Audit
[Link] Plug & C1Dest & Elim,Min,Audit
End If
End If
End Select
End if
Next
End if
'===============================================================
'= METHODS: HOLDING - GLOBALE - PROPORZ - EQUITY - DISPOSED =
'===============================================================
If Method="HOLDING" or Method="GLOBAL" or Method="PROPORTIONAL" or
Method="EQUITY" or Method="DISPOSED" Then
'=================================================
'= Prior Proportional Data Unit =
'=================================================
Set DataUnit=[Link]("P#Last.Y#Prior.V#[Proportion].C1#Closing")
NumItems=[Link]
For i=0 to NumItems-1
Call
[Link](i,Account,ICP,Custom1,Custom2,Custom3,Custom4,Data)
If Data<>0 Then
[Link] "C1#Opening",1,""
[Link] "C1#Variance",-1,""
End if
Next
'=================================================
'= Prior Elimination Data Unit =
'=================================================
Elim=".V#[Elimination]"
Audit="OpenElim"
Set DataUnit=[Link]("P#Last.Y#Prior.V#[Elimination].C1#Closing")
NumItems=[Link]
For i=0 to NumItems-1
Call
[Link](i,Account,ICP,Custom1,Custom2,Custom3,Custom4,Data)
If Data<>0 Then
[Link] "C1#Opening" & Elim,1,Audit
[Link] "C1#Variance" & Elim,-1,Audit
End if
Next
End If
End Sub
'*************************************************
'* Allocation ROUTINE *
'*************************************************
Sub Allocate()
'-------------------------------------------------
' Admex allocation
'-------------------------------------------------
[Link] "A#Admex","A#Admex.E#Group","[Base]","A#CogsTP" &
"/[Link](A#CogsTP)",""
End Sub
'*************************************************
'* NO INPUT ROUTINE *
'*************************************************
Sub NoInput()
'-------------------------------------------------
' Movement flow for ST accounts
'-------------------------------------------------
[Link] "V#<Entity Currency>.C1#Movement"
'--------------------------------------------------------------------
' Additional changes for EPU calculation for FXOpening and FXMovement
'--------------------------------------------------------------------
[Link] "V#<Entity Currency>.A#EquityPickUp"
[Link] "C1#FXOpening"
[Link] "C1#FXMovement"
End Sub
'*************************************************
'* INPUT ROUTINE *
'*************************************************
Sub Input()
'-------------------------------------------------
' Fully diluted shares
'-------------------------------------------------
[Link] "A#DilSha"
End Sub
'*************************************************
'* DYNAMIC ROUTINE *
'*************************************************
Sub Dynamic()
[Link] "A#GMPct=A#GroMar/A#SalesTP*100"
[Link] "A#ROA.W#Periodic=A#NetIncD*[Link]/A#AssetsP*100"
[Link]
"A#ROA.W#QTD=A#NetIncD*[Link]/[Link]/A#AssetsQ*100"
[Link]
"A#ROA.W#HYTD=A#NetIncD*[Link]/[Link]/A#AssetsH*100"
[Link]
"A#ROA.W#YTD=A#NetIncD*[Link]/[Link]/A#AssetsY*100"
End Sub
'*************************************************
'* Equity Pick Up ROUTINE *
'*************************************************
Sub EquityPickUp()
'----------------------------------------------------------------------------------
---------------------------------------
'In the Run EPU process, we assume that the default POV is the followiing:
'
'Curernt Scenario, Current Year, Current Period
'Entity: Owner of the pair being processed
'Value: <Entity Currency>
'
'The system wil always write to <Entity Currency> of the Owner.
'By default, it will also read from this same entity.
'If we want to read the source data from the owned entity, we will need to use new
Rules functions.
'
'
'The following additional functions are required:
'[Link]: will return the Owned entity of the pair currently processed
'[Link]: will return the Owner of the pair
'Please note that this function is not absolutely necessary because it is
equivalent to [Link]
'
'Default parameters: Blank value for [Link] parameters will return from the EPU
table the percentage of ownership
'for the current pair in the current Scenario, Year, Period
'----------------------------------------------------------------------------------
---------------------------------------
Owner = [Link]
Owned = [Link]
lPown = [Link]("E#" & Owned & ".I#" & Owner & ".V#[None].A#[Shares
%Owned].C1#[None].C2#[None].C3#[None].C4#[None]")
OwnerDefCurr = [Link]("")
EquityPickUpDest = "A#EquityPickUp.I#" & Owned
EquityFromChild = "E#" & Owned & ".A#EquityT.I#[ICP
Top].C2#[None].C3#[None].C4#[None].V#" & OwnerDefCurr & " Total"
EquityFromDescend = "E#" & Owned & ".A#EquityPickUp.I#[ICP
Top].C2#[None].C3#[None].C4#[None].V#" & OwnerDefCurr & " Total"
Factor = lPown /100
TotEquitySubsidiary = "(" & EquityFromChild & "+" & EquityFromDescend & ")"
EquityPickUpCalc = EquityPickUpDest & "=" & TotEquitySubsidiary & "*" & Factor
[Link] EquityPickUpDest
[Link] EquityPickUpCalc
End Sub
'*************************************************
'* Support IC Transactions *
'*************************************************
Sub Transactions()
[Link] "S#ActMon.A#RecltIC.C1#Closing"
[Link] "S#ActMon.A#RecltIC.C1#Increases"
[Link] "S#ActMon.A#RecltIC.C1#Decreases"
[Link] "S#ActMon.A#RecltIC.C1#Other"
[Link] "S#ActMon.A#PayltIC.C1#Closing"
[Link] "S#ActMon.A#PayltIC.C1#Increases"
[Link] "S#ActMon.A#PayltIC.C1#Decreases"
[Link] "S#ActMon.A#PayltIC.C1#Other"
[Link] "S#ActMon.A#RecstIC.C1#Closing"
[Link] "S#ActMon.A#RecstIC.C1#Other"
[Link] "S#ActMon.A#PaystIC.C1#Closing"
[Link] "S#ActMon.A#PaystIC.C1#Other"
[Link] "S#ActMon.A#SalesIC"
[Link] "S#ActMon.A#CogsIC"
' Support for Scenario = ActMonZper
[Link] "S#ActMonZPer.A#RecltIC.C1#Closing"
[Link] "S#ActMonZPer.A#RecltIC.C1#Increases"
[Link] "S#ActMonZper.A#RecltIC.C1#Decreases"
[Link] "S#ActMonZPer.A#RecltIC.C1#Other"
[Link] "S#ActMonZPer.A#PayltIC.C1#Closing"
[Link] "S#ActMonZPer.A#PayltIC.C1#Increases"
[Link] "S#ActMonZPer.A#PayltIC.C1#Decreases"
[Link] "S#ActMonZPer.A#PayltIC.C1#Other"
[Link] "S#ActMonZPer.A#RecstIC.C1#Closing"
[Link] "S#ActMonZPer.A#RecstIC.C1#Other"
[Link] "S#ActMonZper.A#PaystIC.C1#Closing"
[Link] "S#ActMonZper.A#PaystIC.C1#Other"
[Link] "S#ActMonZPer.A#SalesIC"
[Link] "S#ActMonZPer.A#CogsIC"
' Support for Scenario = ActMonZYTD
[Link] "S#ActMonZYTD.A#RecltIC.C1#Closing"
[Link] "S#ActMonZYTD.A#RecltIC.C1#Increases"
[Link] "S#ActMonZYTD.A#RecltIC.C1#Decreases"
[Link] "S#ActMonZYTD.A#RecltIC.C1#Other"
[Link] "S#ActMonZYTD.A#PayltIC.C1#Closing"
[Link] "S#ActMonZYTD.A#PayltIC.C1#Increases"
[Link] "S#ActMonZYTD.A#PayltIC.C1#Decreases"
[Link] "S#ActMonZYTD.A#PayltIC.C1#Other"
[Link] "S#ActMonZYTD.A#RecstIC.C1#Closing"
[Link] "S#ActMonZYTD.A#RecstIC.C1#Other"
[Link] "S#ActMonZYTD.A#PaystIC.C1#Closing"
[Link] "S#ActMonZYTD.A#PaystIC.C1#Other"
[Link] "S#ActMonZYTD.A#SalesIC"
[Link] "S#ActMonZYTD.A#CogsIC"
' Support for Scenario = ActQtdZper
[Link] "S#ActQtdZPer.A#RecltIC.C1#Closing"
[Link] "S#ActQtdZPer.A#RecltIC.C1#Increases"
[Link] "S#ActQtdZper.A#RecltIC.C1#Decreases"
[Link] "S#ActQtdZPer.A#RecltIC.C1#Other"
[Link] "S#ActQtdZPer.A#PayltIC.C1#Closing"
[Link] "S#ActQtdZPer.A#PayltIC.C1#Increases"
[Link] "S#ActQtdZPer.A#PayltIC.C1#Decreases"
[Link] "S#ActQtdZPer.A#PayltIC.C1#Other"
[Link] "S#ActQtdZPer.A#RecstIC.C1#Closing"
[Link] "S#ActQtdZPer.A#RecstIC.C1#Other"
[Link] "S#ActQtdZper.A#PaystIC.C1#Closing"
[Link] "S#ActQtdZper.A#PaystIC.C1#Other"
[Link] "S#ActQtdZPer.A#SalesIC"
[Link] "S#ActQtdZPer.A#CogsIC"
' Support for Scenario = ActQtdZYTD
[Link] "S#ActQtdZYTD.A#RecltIC.C1#Closing"
[Link] "S#ActQtdZYTD.A#RecltIC.C1#Increases"
[Link] "S#ActQtdZYTD.A#RecltIC.C1#Decreases"
[Link] "S#ActQtdZYTD.A#RecltIC.C1#Other"
[Link] "S#ActQtdZYTD.A#PayltIC.C1#Closing"
[Link] "S#ActQtdZYTD.A#PayltIC.C1#Increases"
[Link] "S#ActQtdZYTD.A#PayltIC.C1#Decreases"
[Link] "S#ActQtdZYTD.A#PayltIC.C1#Other"
[Link] "S#ActQtdZYTD.A#RecstIC.C1#Closing"
[Link] "S#ActQtdZYTD.A#RecstIC.C1#Other"
[Link] "S#ActQtdZYTD.A#PaystIC.C1#Closing"
[Link] "S#ActQtdZYTD.A#PaystIC.C1#Other"
[Link] "S#ActQtdZYTD.A#SalesIC"
[Link] "S#ActQtdZYTD.A#CogsIC"
End Sub
'*************************************************
'* SUBROUTINES *
'*************************************************
'-------------------------------------------------
' Retrieves current ICP method
'-------------------------------------------------
Sub SetICP(ICP,ICPMethod)
ICPMethod=""
If ICP<>"[ICP None]" Then
ICPMethod=[Link]("E#" & ICP)
End If
End Sub
'=================================================
'= WRITE TO FILE =
'=================================================
Sub WriteToFile(txtStringToWrite)
'this routine will write to a file and create the file first if it is not there
'the lines 'On Error Resume Next' and 'On Error Goto 0' will let the system
continue processing
'in the case there is an error in the routine. this is desirable because it
would be foolish to
'let the writing to a file routine bring down HFM unnecessarily in the event of
a fatal error
'To call this routine, the following 'template' can be copied and modified
appropriately:
'Call WriteToFile("Replace this text with whatever you would like written to
the file")
'Call WriteToFile("Calculate Cash Flow for:" & [Link] & " " &
[Link] & " " & [Link])
On Error Resume Next
'Set the FileSize Constant to the maximum size you would like the log file to
grow before being deleted
'e.g., 50mb = 52428800bytes
Const FileSize = 2621440
'put the name of the file to write the log to in the FileSpec Constant
Const FileSpec = "c:\temp\[Link]"
'put the name of the file to write a log for when the rules log gets deleted
Const FileDeleteSpec = "c:\temp\[Link]"
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f, s, strTemp
Set fso = CreateObject("[Link]")
Set f = [Link](FileSpec)
s = [Link]
Set f = Nothing
'check if filesize is bigger than we desire
If FileSize < s then
'you can change the directory, file name, and extension (e.g., .htm) to
anything you wish below
Set f = [Link](FileDeleteSpec, ForAppending, True)
[Link] "Log file (" & FileSpec & ") reached size limit of " & FileSize &
" bytes and was deleted at " & Now()
[Link]
Set f = Nothing
'delete file because it surpassed the filesize limitation we desire
[Link](FileSpec)
Else
'continue with processing because filesize is under allotment
End If
Set f = [Link](FileSpec, ForAppending, True)
[Link] txtStringToWrite & " " & Now()
[Link]
Set f = Nothing
On Error Goto 0
End Sub
'*************************************************
'* FUNCTIONS *
'*************************************************
'-------------------------------------------------
' Minimum
'-------------------------------------------------
Function Minimum(Par1,Par2)
If Par1 > Par2 Then Minimum = Par2 Else Minimum = Par1
End Function