Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 16

'******************************************************

'
' Stat.Rle 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 =
'=================================================
HS.Exp "A#AverateP=A#Averate.P#Last.Y#Prior"
HS.Exp "A#Operate=A#Clorate.P#Last.Y#Prior"

Value=HS.Value.Member
'=================================================
'= ENTITY CURRENCY =
'=================================================
If Value="<Entity Currency>" Then

If HS.Entity.isBase("","") Then

'------------------------------------------------
' Retrieval of opening balance from prior period
'------------------------------------------------
HS.Exp "C1#Opening=C1#Closing.P#Last.Y#Prior"

'------------------------------------------------
' Calculation of flows for Balance Sheet accounts
'------------------------------------------------
HS.Exp "C1#Check=C1#Closing-C1#TotFlows"
HS.Clear "C1#Movement"
HS.Exp "C1#Movement=C1#Closing-C1#TotFlows"

'------------------------------------------------
' Impact next year
'------------------------------------------------
If HS.Period.isLast Then HS.ImpactStatus "P#First.Y#Next"

'------------------------------------------------
' Park accounts for ROA
'------------------------------------------------
HS.Exp "A#AssetsP=(A#Assets+A#Assets.P#Prior)/2"

Select Case Hs.Period.Number


Case 1,7
HS.Exp "A#AssetsQ=A#AssetsP"
HS.Exp "A#AssetsH=A#AssetsQ"
Case 2,8
HS.Exp "A#AssetsQ=(A#Assets+A#AssetsQ.P#Prior*2)/3"
HS.Exp "A#AssetsH=A#AssetsQ"
Case 3,9
HS.Exp "A#AssetsQ=(A#Assets+A#AssetsQ.P#Prior*3)/4"
HS.Exp "A#AssetsH=A#AssetsQ"
Case 4,10
HS.Exp "A#AssetsQ=A#AssetsP"
HS.Exp "A#AssetsH=(A#Assets+A#AssetsH.P#Prior*4)/5"
Case 5,11
HS.Exp "A#AssetsQ=(A#Assets+A#AssetsQ.P#Prior*2)/3"
HS.Exp "A#AssetsH=(A#Assets+A#AssetsH.P#Prior*5)/6"
Case 6,12
HS.Exp "A#AssetsQ=(A#Assets+A#AssetsQ.P#Prior*3)/4"
HS.Exp "A#AssetsH=(A#Assets+A#AssetsH.P#Prior*6)/7"
End Select

HS.Exp "A#AssetsY=(A#Assets.Y#Prior.P#Last+A#Assets)"
If Hs.Period.Number>1 Then
For i=1 to HS.Period.Number-1
HS.Exp "A#AssetsY=A#AssetsY+A#Assets.P#Cur-" & i
Next
End If
HS.Exp "A#AssetsY=A#AssetsY/(Hs.Period.Number+1)"

Else

'------------------------------------------------
' Earnings per share
'------------------------------------------------
HS.Exp "A#EPS=A#NetIncG/A#DilSha"

End If

'=================================================
'= ADJ's Value =
'=================================================
ElseIf Value="<Entity Curr Adjs>" or HS.Value.IsTransCurAdj or Value="[Parent
Adjs]" or Value="[Contribution Adjs]" Then

'-------------------------------------------------
' Retrieval of opening balance from prior period
'-------------------------------------------------
HS.Exp "C1#Opening=C1#Closing.P#Last.Y#Prior"

'-------------------------------------------------
' Move net income from P&L to BS
'-------------------------------------------------
HS.Exp "A#NetInc=A#NetIncPL"

'-------------------------------------------------
' Move prior year net income to retained earnings
'-------------------------------------------------
HS.Exp "A#Retearn.C1#Appropriation=A#NetIncPL.C1#[None].P#Last.Y#Prior"

'-------------------------------------------------
' Calculate Closing
'-------------------------------------------------
HS.Exp "C1#Closing=C1#TotFlows"

'------------------------------------------------
' Impact next year
'------------------------------------------------
If HS.Period.isLast Then HS.ImpactStatus "P#First.Y#Next"

'=================================================
'= TRANSLATED CURRENCY =
'=================================================
ElseIf HS.Value.IsTransCur Then

'-------------------------------------------------
' Retrieval of opening balance from prior period
'-------------------------------------------------
HS.Exp "C1#Opening=C1#Closing.P#Last.Y#Prior"

'-------------------------------------------------
' Calculate Closing
'-------------------------------------------------
HS.Exp "C1#Closing=C1#TotFlows"

'=================================================
'= PROPORTION / ELIMINATION =
'=================================================
Else

'-------------------------------------------------
' Calculate Closing
'-------------------------------------------------
HS.Exp "C1#Closing=C1#TotFlows"

End If

'-------------------------------------------------
' Validation accounts
'-------------------------------------------------

I12=".I#[ICP Top].C1#AllCustom1.C2#AllCustom2"
HS.AbsExp "A#ValidAcct1=A#Asstot" & I12 & "-(A#EquityT" & I12 & "+A#Liatot" &
I12 & ")"
'HS.AbsExp "A#ValidAcct2=A#NetIncPL.I#[ICP Top]-A#NetInc"

End Sub

'*************************************************
'* TRANSLATE ROUTINE *
'*************************************************

Sub Translate()

'------------------------------------------------------
' Rates variables
'------------------------------------------------------
AVE=HS.GetRate("A#AveRate")
CLO=HS.GetRate("A#CloRate")
AVE_1=HS.GetRate("A#AverateP")
CLO_1=HS.GetRate("A#OpeRate")

'------------------------------------------------------
' Translation of movements not using the default
'------------------------------------------------------
HS.Trans "C1#Appropriation","",AVE_1,""

'------------------------------------------------------
' FX calculation
'------------------------------------------------------
HS.Trans "C1#FXOpening","C1#Opening",CLO,CLO_1
HS.Trans "C1#FXMovement","C1#Closing",CLO,AVE
HS.Trans "C1#FXMovement","C1#Opening",AVE,CLO

'------------------------------------------------------
' Net income translation
'------------------------------------------------------
HS.Trans "A#NetInc","",AVE,""
HS.Trans "A#Cap_Cta.C1#FXMovement","A#NetInc.C1#[None]",CLO,AVE
HS.Trans
"A#Cap_Cta.C1#FXOpening","A#NetInc.C1#[None].P#Last.Y#Prior",AVE_1,CLO_1

'------------------------------------------------------
' Translation of accounts at historical rate
'------------------------------------------------------
AcctList = HS.Account.List("","[Base]")

For i = Lbound(AcctList) To Ubound(AcctList)

Select Case HS.Account.UD2(AcctList(i))

'------------------------------------------------------
' Cumulated Translation Adjustment in the balance sheet
'------------------------------------------------------
Case "HIST1"

HS.Trans "A#Cap_Cta.C1#FXOpening","A#" & AcctList(i) &


".C1#Opening",CLO,CLO_1
HS.Trans "A#Cap_Cta.C1#FXOpening","A#" & AcctList(i) &
".C1#Appropriation",CLO,AVE_1
HS.Trans "A#Cap_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Closing",CLO,AVE
HS.Trans "A#Cap_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Opening",AVE,CLO
HS.Trans "A#Cap_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Appropriation",AVE,CLO

'------------------------------------------------------
' Cumulated Translation Adjustment in separate account
'------------------------------------------------------
Case "HIST2"

HS.Trans "A#Inv_Cta.C1#FXOpening","A#" & AcctList(i) &


".C1#Opening",CLO,CLO_1
HS.Trans "A#Inv_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Closing",CLO,AVE
HS.Trans "A#Inv_Cta.C1#FXMovement","A#" & AcctList(i) &
".C1#Opening",AVE,CLO

End Select

Next

End Sub

'*************************************************
'* CONSOLIDATE ROUTINE *
'*************************************************

Sub Consolidate()

Method=HS.Node.Method("")
'=====================================================
'= METHODS: HOLDING - GLOBALE - PROPORZ - EQUITY =
'=====================================================
If Method="HOLDING" or Method="GLOBAL" or Method="PROPORTIONAL" or
Method="EQUITY" Then

'-------------------------------------------------
' Current Entity variables
'-------------------------------------------------
Entity=HS.Entity.Member
PCon=HS.Node.PCon("")
POwn=HS.Node.POwn("")
PMin=PCon-POwn
PCon_1=HS.Node.PCon("P#Last.Y#Prior")
POwn_1=HS.Node.POwn("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=HS.OpenDataUnit("")

NumItems=DataUnit.GetNumItems

For i=0 to NumItems-1

Call
DataUnit.GetItem(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 HS.Con Acc & C1Dest,PCon,""

'-------------------------------------------------
' Automatic elimination
'-------------------------------------------------
Rule=HS.Account.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
HS.Con IEq & Nature & Elim,PCon_1*(-1),Audit
HS.Con IEq & Var & Nature & Elim,VPCon*(-
1),Audit
Else
HS.Con Acc & Elim,PCon*(-1),Audit
End If
HS.Con RcG & Nature & Elim,POwn_1,Audit
HS.Con RcG & Var & Nature & Elim,VPOwn,Audit
HS.Con RcM & Nature & Elim,PMin_1,Audit
HS.Con RcM & Var & Nature & Elim,VPMin,Audit

Else
If Method="EQUITY" Then
HS.Con IEq & C1Dest & Nature & Elim,PCon*(-
1),Audit
Else
HS.Con Acc & C1Dest & Elim,PCon*(-1),Audit
End If
HS.Con RcG & C1Dest & Nature & Elim,POwn,Audit
HS.Con 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
HS.Con IEq & C1Dest & Nature & Elim,PCon*(-1),Audit
Else
HS.Con Acc & C1Dest & Elim,PCon*(-1),Audit
End If
HS.Con RcvG & C1Dest & Nature & Elim,POwn,Audit
HS.Con 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
HS.Con IEq & C1Dest & Nature & Elim,PCon*(-1),Audit
Else
HS.Con Acc & C1Dest & Elim,PCon*(-1),Audit
End If
HS.Con Link & C1Dest & Elim,PCon,Audit
HS.Con Link & C1Dest & PElim,PCon*(-1),Audit

If Custom1="FXOpening" or Custom1="FXMovement" Then


HS.Con RcvG & Nature & PElim,POwn,Audit
HS.Con RcvM & Nature & PElim,PMin,Audit
Else
HS.Con RcG & C1Dest & Nature & PElim,POwn,Audit
HS.Con 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 HS.Con Acc & C1Dest &


Elim,PCon*(-1),Audit

If Custom1="Opening" Then
HS.Con RcG & C1Dest & Nature & PElim,POwn*(-
1),Audit
HS.Con RcM & C1Dest & Nature & PElim,PMin*(-
1),Audit
HS.Con RcvG & C1Dest & Nature & PElim,POwn,Audit
HS.Con RcvM & C1Dest & Nature & PElim,PMin,Audit
End If

End If

'----------------------------------------------------
' Net Income
'----------------------------------------------------
Case "NETINC"

Nature=".C2#Equity"

If Method="EQUITY" Then
HS.Con IEq & NInc & Nature & Elim,PCon*(-1),Audit
HS.Con NiEq & Elim,PCon,Audit
Else
HS.Con Acc & Elim,PCon*(-1),Audit
End If
HS.Con NiG & C1Dest & Elim,POwn,Audit
HS.Con 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#" & HS.Account.PlugAcct("")


ICPPCon=HS.Node.PCon("E#" & ICP)
Min=Minimum(PCon,ICPPCon)

HS.Con Acc & C1Dest & Elim,Min*(-1),Audit


HS.Con 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=HS.OpenDataUnit("P#Last.Y#Prior.V#[Proportion].C1#Closing")

NumItems=DataUnit.GetNumItems

For i=0 to NumItems-1

Call
DataUnit.GetItem(i,Account,ICP,Custom1,Custom2,Custom3,Custom4,Data)

If Data<>0 Then

HS.Con "C1#Opening",1,""
HS.Con "C1#Variance",-1,""

End if

Next

'=================================================
'= Prior Elimination Data Unit =
'=================================================
Elim=".V#[Elimination]"
Audit="OpenElim"

Set DataUnit=HS.OpenDataUnit("P#Last.Y#Prior.V#[Elimination].C1#Closing")

NumItems=DataUnit.GetNumItems

For i=0 to NumItems-1

Call
DataUnit.GetItem(i,Account,ICP,Custom1,Custom2,Custom3,Custom4,Data)

If Data<>0 Then

HS.Con "C1#Opening" & Elim,1,Audit


HS.Con "C1#Variance" & Elim,-1,Audit

End if

Next

End If

End Sub

'*************************************************
'* Allocation ROUTINE *
'*************************************************

Sub Allocate()

'-------------------------------------------------
' Admex allocation
'-------------------------------------------------
HS.Alloc "A#Admex","A#Admex.E#Group","[Base]","A#CogsTP" &
"/HS.Entity.Sum(A#CogsTP)",""

End Sub

'*************************************************
'* NO INPUT ROUTINE *
'*************************************************

Sub NoInput()

'-------------------------------------------------
' Movement flow for ST accounts
'-------------------------------------------------
HS.NoInput "V#<Entity Currency>.C1#Movement"

'--------------------------------------------------------------------
' Additional changes for EPU calculation for FXOpening and FXMovement
'--------------------------------------------------------------------
HS.NoInput "V#<Entity Currency>.A#EquityPickUp"
HS.NoInput "C1#FXOpening"
HS.NoInput "C1#FXMovement"

End Sub

'*************************************************
'* INPUT ROUTINE *
'*************************************************

Sub Input()

'-------------------------------------------------
' Fully diluted shares
'-------------------------------------------------
HS.Input "A#DilSha"

End Sub

'*************************************************
'* DYNAMIC ROUTINE *
'*************************************************

Sub Dynamic()

HS.Dynamic "A#GMPct=A#GroMar/A#SalesTP*100"

HS.Dynamic "A#ROA.W#Periodic=A#NetIncD*HS.Period.NumPerInGen/A#AssetsP*100"
HS.Dynamic
"A#ROA.W#QTD=A#NetIncD*HS.Period.NumPerInGen/Hs.View.PeriodNumber/A#AssetsQ*100"
HS.Dynamic
"A#ROA.W#HYTD=A#NetIncD*HS.Period.NumPerInGen/Hs.View.PeriodNumber/A#AssetsH*100"
HS.Dynamic
"A#ROA.W#YTD=A#NetIncD*HS.Period.NumPerInGen/Hs.View.PeriodNumber/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:
'Hs.Entity.Owned: will return the Owned entity of the pair currently processed
'Hs.Entity.Owner: will return the Owner of the pair
'Please note that this function is not absolutely necessary because it is
equivalent to Hs.Entity.Member
'
'Default parameters: Blank value for Hs.PEPU parameters will return from the EPU
table the percentage of ownership
'for the current pair in the current Scenario, Year, Period
'----------------------------------------------------------------------------------
---------------------------------------
Owner = Hs.Entity.Owner
Owned = Hs.Entity.Owned
lPown = Hs.GetCell("E#" & Owned & ".I#" & Owner & ".V#[None].A#[Shares
%Owned].C1#[None].C2#[None].C3#[None].C4#[None]")

OwnerDefCurr = HS.Entity.DefCurrency("")

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

Hs.Clear EquityPickUpDest
Hs.Exp EquityPickUpCalc

End Sub

'*************************************************
'* Support IC Transactions *
'*************************************************

Sub Transactions()

HS.SupportsTran "S#ActMon.A#RecltIC.C1#Closing"
HS.SupportsTran "S#ActMon.A#RecltIC.C1#Increases"
HS.SupportsTran "S#ActMon.A#RecltIC.C1#Decreases"
HS.SupportsTran "S#ActMon.A#RecltIC.C1#Other"

HS.SupportsTran "S#ActMon.A#PayltIC.C1#Closing"
HS.SupportsTran "S#ActMon.A#PayltIC.C1#Increases"
HS.SupportsTran "S#ActMon.A#PayltIC.C1#Decreases"
HS.SupportsTran "S#ActMon.A#PayltIC.C1#Other"

HS.SupportsTran "S#ActMon.A#RecstIC.C1#Closing"
HS.SupportsTran "S#ActMon.A#RecstIC.C1#Other"

HS.SupportsTran "S#ActMon.A#PaystIC.C1#Closing"
HS.SupportsTran "S#ActMon.A#PaystIC.C1#Other"

HS.SupportsTran "S#ActMon.A#SalesIC"
HS.SupportsTran "S#ActMon.A#CogsIC"

' Support for Scenario = ActMonZper

HS.SupportsTran "S#ActMonZPer.A#RecltIC.C1#Closing"
HS.SupportsTran "S#ActMonZPer.A#RecltIC.C1#Increases"
HS.SupportsTran "S#ActMonZper.A#RecltIC.C1#Decreases"
HS.SupportsTran "S#ActMonZPer.A#RecltIC.C1#Other"

HS.SupportsTran "S#ActMonZPer.A#PayltIC.C1#Closing"
HS.SupportsTran "S#ActMonZPer.A#PayltIC.C1#Increases"
HS.SupportsTran "S#ActMonZPer.A#PayltIC.C1#Decreases"
HS.SupportsTran "S#ActMonZPer.A#PayltIC.C1#Other"

HS.SupportsTran "S#ActMonZPer.A#RecstIC.C1#Closing"
HS.SupportsTran "S#ActMonZPer.A#RecstIC.C1#Other"

HS.SupportsTran "S#ActMonZper.A#PaystIC.C1#Closing"
HS.SupportsTran "S#ActMonZper.A#PaystIC.C1#Other"

HS.SupportsTran "S#ActMonZPer.A#SalesIC"
HS.SupportsTran "S#ActMonZPer.A#CogsIC"

' Support for Scenario = ActMonZYTD

HS.SupportsTran "S#ActMonZYTD.A#RecltIC.C1#Closing"
HS.SupportsTran "S#ActMonZYTD.A#RecltIC.C1#Increases"
HS.SupportsTran "S#ActMonZYTD.A#RecltIC.C1#Decreases"
HS.SupportsTran "S#ActMonZYTD.A#RecltIC.C1#Other"

HS.SupportsTran "S#ActMonZYTD.A#PayltIC.C1#Closing"
HS.SupportsTran "S#ActMonZYTD.A#PayltIC.C1#Increases"
HS.SupportsTran "S#ActMonZYTD.A#PayltIC.C1#Decreases"
HS.SupportsTran "S#ActMonZYTD.A#PayltIC.C1#Other"

HS.SupportsTran "S#ActMonZYTD.A#RecstIC.C1#Closing"
HS.SupportsTran "S#ActMonZYTD.A#RecstIC.C1#Other"

HS.SupportsTran "S#ActMonZYTD.A#PaystIC.C1#Closing"
HS.SupportsTran "S#ActMonZYTD.A#PaystIC.C1#Other"

HS.SupportsTran "S#ActMonZYTD.A#SalesIC"
HS.SupportsTran "S#ActMonZYTD.A#CogsIC"

' Support for Scenario = ActQtdZper

HS.SupportsTran "S#ActQtdZPer.A#RecltIC.C1#Closing"
HS.SupportsTran "S#ActQtdZPer.A#RecltIC.C1#Increases"
HS.SupportsTran "S#ActQtdZper.A#RecltIC.C1#Decreases"
HS.SupportsTran "S#ActQtdZPer.A#RecltIC.C1#Other"

HS.SupportsTran "S#ActQtdZPer.A#PayltIC.C1#Closing"
HS.SupportsTran "S#ActQtdZPer.A#PayltIC.C1#Increases"
HS.SupportsTran "S#ActQtdZPer.A#PayltIC.C1#Decreases"
HS.SupportsTran "S#ActQtdZPer.A#PayltIC.C1#Other"

HS.SupportsTran "S#ActQtdZPer.A#RecstIC.C1#Closing"
HS.SupportsTran "S#ActQtdZPer.A#RecstIC.C1#Other"

HS.SupportsTran "S#ActQtdZper.A#PaystIC.C1#Closing"
HS.SupportsTran "S#ActQtdZper.A#PaystIC.C1#Other"

HS.SupportsTran "S#ActQtdZPer.A#SalesIC"
HS.SupportsTran "S#ActQtdZPer.A#CogsIC"
' Support for Scenario = ActQtdZYTD

HS.SupportsTran "S#ActQtdZYTD.A#RecltIC.C1#Closing"
HS.SupportsTran "S#ActQtdZYTD.A#RecltIC.C1#Increases"
HS.SupportsTran "S#ActQtdZYTD.A#RecltIC.C1#Decreases"
HS.SupportsTran "S#ActQtdZYTD.A#RecltIC.C1#Other"

HS.SupportsTran "S#ActQtdZYTD.A#PayltIC.C1#Closing"
HS.SupportsTran "S#ActQtdZYTD.A#PayltIC.C1#Increases"
HS.SupportsTran "S#ActQtdZYTD.A#PayltIC.C1#Decreases"
HS.SupportsTran "S#ActQtdZYTD.A#PayltIC.C1#Other"

HS.SupportsTran "S#ActQtdZYTD.A#RecstIC.C1#Closing"
HS.SupportsTran "S#ActQtdZYTD.A#RecstIC.C1#Other"

HS.SupportsTran "S#ActQtdZYTD.A#PaystIC.C1#Closing"
HS.SupportsTran "S#ActQtdZYTD.A#PaystIC.C1#Other"

HS.SupportsTran "S#ActQtdZYTD.A#SalesIC"
HS.SupportsTran "S#ActQtdZYTD.A#CogsIC"

End Sub

'*************************************************
'* SUBROUTINES *
'*************************************************

'-------------------------------------------------
' Retrieves current ICP method
'-------------------------------------------------
Sub SetICP(ICP,ICPMethod)

ICPMethod=""

If ICP<>"[ICP None]" Then

ICPMethod=HS.Node.Method("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:" & HS.Entity.Member & " " &
Hs.Scenario.Member & " " & Hs.Period.Member)

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\rulerunlog.txt"
'put the name of the file to write a log for when the rules log gets deleted
Const FileDeleteSpec = "c:\temp\rulerunlogdeleted.txt"
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f, s, strTemp
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(FileSpec)
s = f.size
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 = fso.OpenTextFile(FileDeleteSpec, ForAppending, True)
f.WriteLine "Log file (" & FileSpec & ") reached size limit of " & FileSize &
" bytes and was deleted at " & Now()
f.Close
Set f = Nothing

'delete file because it surpassed the filesize limitation we desire


fso.DeleteFile(FileSpec)
Else
'continue with processing because filesize is under allotment
End If
Set f = fso.OpenTextFile(FileSpec, ForAppending, True)
f.WriteLine txtStringToWrite & " " & Now()
f.Close
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

You might also like