此函数将源视点 (POV) 分配到目标 POV。使用因子 POV 作为分配基准,并可选择将分配总金额冲销到抵销 POV。此函数用于自定义维分配。
返回值
没有返回值。
语法
Custom_Alloc(Destination,Source,Factor,FactorN,FactorD,
Elimination)
表 12-18 Custom_Alloc 函数的语法
参数 | 有效值 |
---|---|
Destination |
有效的目标 POV,是帐户、ICP 和 Custom 1-4 成员的有效组合。 |
Source |
有效的源 POV,是维成员的有效组合。Source 是要分摊的金额。 |
Factor |
有效的源 POV。Factor 是用于存储分摊因子的帐户。 |
FactorN |
有效的源 POV。FactorN 是用作分摊基准的分子因子。 |
FactorD |
有效的源 POV。FactorD 是用作分摊基准的分母因子。 |
Elimination |
有效的源 POV。Elimination 可以是空字符串 ("");在这种情况下,该参数将被忽略。如果设置了 Elimination 参数,过帐到目标 POV 的金额乘以 -1 后过帐到抵销 POV。 |
详细说明
此函数将源 POV 分配到目标 POV。使用因子 POV 作为分配基准,并可选择将分配总金额冲销到抵销 POV。此函数用于自定义维分配。
Factor 参数存储 FactorN 除以 FactorD 的结果。要因子允许引用非当前实体时,需要此参数。
如果源 POV 中的实体为某个父代,则必须合并该父代后才能在子代级别执行计算。如果父代货币不同于子代货币,则还必须先换算所有相关货币,才能在子代级别执行计算。
建议在调用例程中设置变量并将其传递给 Custom_Alloc 函数;这些变量定义目标、源、因子、FactorN、FactorD 和抵销 POV。另外还建议将调用例程中的变量名称设置与 Custom_Alloc 函数中的相同。
Elimination 参数可以是空字符串 ("");在这种情况下,该参数将被忽略。如果设置了 Elimination 参数,由过帐到“目标 POV”的金额将乘以 -1 后过帐到抵销 POV。
示例
根据 Products Sales 占 Total Sales 的比例,将 Telephone 帐户分配到产品中。将分配金额的反转值过帐到 Allocations 帐户。
表 12-19 Custom_Alloc 函数的示例
帐户 | Jan2014 | Feb2014 | Mar2014 |
---|---|---|---|
A#Telephone.C1#[None] |
100 |
300 |
400 |
A#Sales.C1#Product1 |
1000 |
1000 |
1000 |
A#Sales.C1#Product2 |
1000 |
2000 |
3000 |
A#Sales.C1#TotalProducts |
2000 |
3000 |
4000 |
Custom_Alloc |
不适用 |
不适用 |
不适用 |
A#Factor.C1#Product1 |
0.50 |
0.33 |
0.25 |
A#Factor.C1#Product2 |
0.50 |
0.66 |
0.75 |
A#Telephone.C1#Product1 |
50 |
100 |
100 |
A#Telephone.C1#Product2 |
50 |
200 |
300 |
A#ProductAllocations.C1#[None] |
-100 |
-300 |
-400 |
从 CUSTOM_ALLOC 函数返回的值如下:
HS.EXP "A#Factor = A#Sales / A#Sales.C1#TotalProducts"
HS.EXP "A#Telephone = A#Telephone.C1#[None] * A#Factor"
HS.EXP "A#Allocations.C1#[None] = (A#Telephone.C1#[None] * -1)"
示例脚本
本脚本包含以下信息:
在调用例程中编写的示例语句。
在调用例程中设置变量并将其传递给 Custom_Alloc 函数。
调用例程中的变量名称设置为与 Custom_Alloc 函数中的相同。
Sub Calculate()
Dim Destination Dim Source Dim Elimination Dim Factor Dim FactorN Dim FactorD Dim C1list Dim C1item
C1list = HS.Custom1.List("Alloc")
For Each C1item in C1list
Source = "A#Telephone.C1#[None]" Destination = "A#Telephone.C1#" & C1item Factor = "A#Factor.C1#" & C1item FactorN = "A#Sales.C1#" & C1item FactorD = "A#Sales.C1#TotalProducts" Elimination = "A#ProductAllocations.C1#" & C1item
Call Custom_Alloc(Destination,Source,Factor,FactorN, FactorD,Elimination)
Next
End Sub
' Beginning of the Custom_Alloc function
Sub Custom_Alloc(Destination,Source,FactorN,FactorD, Elimination)
HS.Clear Factor
HS.Exp Factor & " = " & FactorN & "/" & FactorD
HS.EXP Destination & " = " & Source & " * " & Factor
If Elimination <> "" Then
HS.EXP Elimination & " = " & Source & " * -1 * " & Factor
End If
End Sub