有三种常规类型的度量标准可用来为服务或合同的财务条件建模。 它们是:
请考虑以下示例:
新公司正在启动,要求设置电子邮件服务并进行邮箱维护。 随着新员工的不断加入,邮箱数会明显增加。 根据合同配备电子邮件服务会产生 $1000 的固定价格成本,另外,每月还需按邮箱支付额外成本。 每个邮箱的成本采用分级定价模型,如下所示:
|
邮箱数 |
每个邮箱成本 |
|
1-1,000 |
$1.00 |
|
1,001 - 5,000 |
$0.80 |
|
5,001+ |
$0.50 |
因此,添加的邮箱越多,每个邮箱的额外成本就越低。 (例如:1500 个邮箱会花费 (1000 x $1) + (500 x $0.80) = $1400。)使用此模型时,可以在合同中生成两个度量标准来反映该情况。
此外,管理团队对 2007 一整年的员工人数进行了估算,如下所示。 这种趋势是公司成立之初大量雇佣新员工以及后来在其他地区设立新办公室所带来的:
|
一月 |
二月 |
三月 |
四月 |
五月 |
六月 |
七月 |
八月 |
九月 |
十月 |
十一月 |
十二月 |
|
50 |
100 |
500 |
900 |
1600 |
1700 |
1800 |
2500 |
2600 |
3500 |
3600 |
5800 |
要为这些度量标准建模,请执行以下操作:
在合同中创建固定成本度量标准(使用“价格项”类型),具体信息如下所示:

为了指定此服务合同的固定成本,请将其作为参数实施到业务逻辑中(其中固定成本必须从 Result 函数返回),然后,此参数可以通过度量标准的目标声明来显示,如下所示:

返回此度量标准的参数值只是通过 Result 函数返回服务成本值的一个案例。

接下来,请创建变量定价度量标准(再次使用“价格项”类型),以便确定与所使用邮箱数相关的消耗成本。 将此度量标准命名为“邮箱消耗成本”并创建,让其包含如下所示的详细信息:

在该示例中,您需要将消耗参数输入度量标准详细信息中。 这些将进入 Price Per Unit 表。 要为上面描述邮箱数与成本间关系的表建模,请创建一个邮箱数上限列和一个单价列:

然后输入每级的值。 在这种情况下,邮箱的上限确定了与其关联的成本范围。 因为有 3 级,它们将按如下所示的方式添加到表中:

除此之外,还针对邮箱消耗实施预测函数。 可以通过使用预先设定的每月布局创建 Forecast 表来实施。

然后,使用方案说明中提供的表中的值填充该处。

现在,您可以为度量标准添加目标声明。 在本案例中,不需要参数值,因为它们都源自“Price Per Unit”和“Forecast”表。

最终,完成的业务逻辑如下所示:
Option Explicit
Dim PPUmap1, PPUmap2, PPUmap3, PPUkey, FCmap, periodFC, TierPPU
Dim currentMonth, TotalMailboxes, MailboxesThisPeriod, TotalPrice
Sub OnRegistration(dispatcher)
'sample registration only
dispatcher.RegisterByMetric "OnMailboxAddedEvent", "NewMailboxEventType", _
"MailboxResource", "MONTH", "MetricName", "MetricContract", _
"MetricContractParty"
End Sub
Sub OnLoad(TIME)
'Initialise the price tier maps and forecast maps
Set PPUmap1 = Context.Field ("Price Per Unit")(1)
Set PPUmap2 = Context.Field ("Price Per Unit")(2)
Set PPUmap3 = Context.Field ("Price Per Unit")(3)
Set FCmap = Context.Field ("Forecast")(1)
End Sub
Sub OnPeriodStart(TIME)
'TODO: ADD code here TO handle period START event
currentMonth = GetMonth (time)
If Context.IsInForecast Then
periodFC = getForecastValue (currentMonth)
End If
MailboxesThisPeriod = 0
TotalPrice = 0
End Sub
Sub OnPeriodEnd(TIME, isComplete)
' Calculate the current price of all the mailboxes using the tiered
' pricing model
' This uses a cumulative approach as it goes through each tier to
' determine total cost.
TotalPrice = getMailboxCost (TotalMailboxes)
End Sub
Sub OnTimeslotEnter(TIME)
End Sub
Sub OnTimeslotExit(TIME)
End Sub
Sub OnMailboxAddedEvent(eventDetails)
MailboxesThisPeriod = MailboxesThisPeriod + 1
TotalMailboxes = TotalMailBoxes + 1
End Sub
Function Forecast
Forecast = getMailboxCost (periodFC)
End Function
Function Target
Target = Null
End Function
Function Result
result = TotalPrice
End Function
Function getforecastvalue(q)
getforecastvalue = FCmap (q)
End Function
Function getmonth(time)
'this function retrieves the month
Dim lTime
lTime = Tools.GetLocaleTime(time)
getmonth = monthname (datepart ("m", lTime), True) & _
"-0" & datepart ("d", lTime) & "-" & datepart ("yyyy", lTime)
End Function
Function getMailboxCost(num_boxes)
'Function calculates the cost of the mailboxes using the tiered pricing model
Dim returnValue
If num_boxes <= PPUmap1 ("Mailboxes") Then
'First tier
returnValue = num_boxes * PPUmap1 ("UnitCost")
'Out.Log "Tier1: " & num_boxes
Else If num_boxes > PPUmap1 ("Mailboxes") And num_boxes <= PPUmap2 ("Mailboxes") Then
'second tier only
returnValue = (PPUmap1 ("Mailboxes") * PPUmap1 ("UnitCost")) + _
((num_boxes - PPUmap1 ("Mailboxes")) * PPUmap2 ("UnitCost"))
'Out.Log "Tier2: " & num_boxes
Else If num_boxes > PPUmap2 ("Mailboxes") Then
'third tier
returnValue = (PPUmap1 ("Mailboxes") * PPUmap1 ("UnitCost")) + _
((PPUmap2 ("Mailboxes") - PPUmap1 ("Mailboxes")) * PPUmap2 ("UnitCost")) + _
((num_boxes - PPUmap2 ("Mailboxes")) * PPUmap3 ("UnitCost"))
'Out.Log "Tier3: " & num_boxes
End If
getMailboxCost = returnValue
'Out.Log "Cost is: " & returnValue
End Function
注意:该业务逻辑脚本处理预测计算(使用“Forecast”表)以及财务消耗成本这两方面的结果。 两种计算都会使用同一公式 getMailboxCost(),以便根据为该度量标准定义的“Price per Unit”表来计算分级定价。
| 版权所有 © 2012 CA。 保留所有权利。 | 就该主题发送电子邮件至 CA Technologies |