注释
社区兴趣团体现已从 Yammer 迁移到Microsoft Viva Engage。 若要加入 Viva Engage 社区并参与最新讨论,请填写 “请求访问财务和运营 Viva Engage 社区 ”表单,然后选择要加入的社区。
本文介绍业务运行时函数。
这些函数输入财务数据并计算公式。
cTerm
计算当前投资值产生目标值所需的周期数。
Syntax
real cTerm(real interest, real future_value, real current_value)
参数
| 参数 | Description |
|---|---|
| 利息 | 利率。 |
| future_value | 目标值。 |
| current_value | 当前投资价值。 |
返回值
达到 future_value所需的时间段数。
注解
current_value和future_value参数必须具有相同的前缀符号(加号或减号)。
Example
static void cTermExample(Args _arg)
{
real r;
;
r = cTerm(10.0, 500.00, 100.00);
print "The cTerm is " + num2Str(r, 2, 2, 1, 1);
pause;
}
ddb
计算资产的加速折旧。
Syntax
real ddb(real price, real scrap, real life, int period)
参数
| 参数 | Description |
|---|---|
| 价格 | 资产的购买价格。 |
| 废料 | 已注销的资产的剩余值。 |
| 生命 | 资产的预期生存期。 |
| period | 要计算折旧时间的周期。 |
返回值
资产的折旧。
注解
特定周期的账值等于购买价格减去前一期累计折旧:
- 周期 1 的书籍值 = 价格
- 第 2 周期的书籍值 = 第 1 周期的书籍值 – 第 1 周期的折旧
- 周期 n 的书籍值 = 周期的书籍值 (n–1) – 周期折旧(n–1)
折旧计算有三种变体:如果周期 > 生命周期:
- 折旧 = 0
如果 (时间段 n 的书籍值) - ((时间段 n 的书籍值) × 2 ÷ Life) < 残差值:
- 折旧 = (周期 n 的书籍值) - 残差值
在所有其他情况下:折旧 = (周期 n 的书值) × 2 ÷ Life Syd 和 sln 函数还计算资产的折旧值。 syd 和 ddb 函数在早期启用更高的折旧值,而 sln 计算线性折旧。
ddb(12000,2000,10,1); //Returns the value 2400.
ddb(12000,2000,10,3); //Returns the value 1536.
dg
计算贡献率,该比率基于销售价格和购买价格。 如果 销售 参数的值为 0.0,则无法完成计算。
Syntax
real dg(real sale, real purchase)
参数
| 参数 | Description |
|---|---|
| 销售 | 销售价格。 |
| 购买 | 购买价格。 |
返回值
贡献率。
注解
dg(1000,300); //Returns the value 0.7.
dg(100,30); //Returns the value 0.7.
dg(20000, 11000); //Returns the value 0.45.
抗体
计算投资的未来值。
Syntax
real fV(real amount, real interest, real life)
参数
| 参数 | Description |
|---|---|
| 量 | 在每个时间段内支付的金额。 |
| 利息 | 利率。 |
| 生命 | 投资周期数。 |
返回值
投资的未来价值。
注解
fV(100,0.14,10); //Returns the value 1933.73.
fV(400,0.10,5); //Returns the value 2442.04.
idg
根据购买价格和贡献率计算销售价格。
real idg(real purchase, real contribution_ratio)
参数
| 参数 | Description |
|---|---|
| 购买 | 购买价格。 |
| contribution_ratio | 贡献率。 |
返回值
销售价格。
注解
如果贡献比率等于 1.0,则无法完成计算。 idg 函数是 dg 函数的反函数。
idg(300,0.7); //Returns the value 1000.
idg(11000,0.45); //Returns the value 20000.
intvMax
检索指定时间段内按 func 参数指定的部分的间隔数。
int intvMax(date input_date, date ref_date, int func)
参数
| 参数 | Description |
|---|---|
| input_date | 句点的结束时间,必须晚于 ref_date 参数。 |
| ref_date | 时间段的开始时间。 |
| func | 指示除法单元的 IntvScale 系统枚举值。 |
注解
下面是 func 参数的可能值:
- None
- YearMonthDay
- YearMonth
- 年份
- MonthDay
- 月份
- 星期
- YearQuarter
- 季度
- YearWeek
- 周
- 工作日
Example
static void intvMaxExample()
{
date refDate = str2Date("4/9/2007", 213);
date inputDate = str2Date("10/5/2007", 213);
int numberOfIntervals;
;
numberOfIntervals = intvMax(inputDate, refDate, intvScale::YearMonth);
print numberOfIntervals;
pause;
}
intvName
返回指定日期之前指定间隔数的间隔的名称。
str intvName(date input_date, int col, enum func)
参数
| 参数 | Description |
|---|---|
| input_date | 第一个间隔中的日期。 |
| col | input_date参数指定的日期前的间隔数。 |
| func | intvScale 枚举值。 |
返回值
间隔的名称。
注解
例如,如果 func 参数是 IntvScale::WeekDay 枚举值,此方法将返回工作日的名称。 如果 func 参数是 IntvScale::Week 枚举值,则此方法返回一个包含周数的字符串。
Example
static void intvNameExample(Args _args)
{
date refDate = 2672010;
str name;
;
name = intvName(refDate, 3, intvScale::WeekDay);
Global::info(strfmt("%1 is the output, which indicates the day of the week 3 days after 26\7\2010.", name));
}
/**** Infolog display.
Message (09:56:55 am)
Thu is the output, which indicates the day of the week 3 days after 2672010.
****/
intvNo
计算将时间划分为指定间隔时两个日期之间的间隔数。
Syntax
int intvNo(date input_date, date ref_date, int func)
参数
| 参数 | Description |
|---|---|
| input_date | 指示时间段结束的日期 |
| ref_date | 一个指示周期开始的日期。 |
| func | intvScale 枚举值。 |
返回值
由ref_date和input_date参数指定的日期之间的间隔数。
Example
static void intvNoExample(Args _args)
{
date inputDate = str2Date("1/1/2007", 213);
date refDate = str2Date("3/1/2007", 213);
int noOfIntervals;
;
noOfIntervals = intvNo(refDate, inputDate, intvScale::Month);
print noOfIntervals;
pause;
//noOfIntervals now holds the difference in months between March and January (2).
}
intvNorm
返回时间段的规范化日期。
Syntax
date intvNorm(date input_date, date ref_date, int func)
参数
| 参数 | Description |
|---|---|
| input_date | 句点的结束时间,必须晚于 ref_date 参数指定的日期。 |
| ref_date | 时间段的开始时间。 |
| func | 指示间隔除法单位的 intvScale 枚举值。 |
返回值
时间段的规范化日期。
注解
返回的日期将等于 ref_date 参数所指定的日期所在的时间间隔中的第一天日期。
Example
static void example()
{
print intvNorm(today(), today()-1, IntVScale::WeekDay);
pause;
}
pmt
计算每期必须支付才能偿还贷款的金额。
Syntax
real pmt(real principal, real interest, real life)
参数
| 参数 | Description |
|---|---|
| 主体 | 最初借来的金额。 |
| 利息 | 每期应用于借款金额的利息。 |
| 生命 | 贷款偿还的期限数。 |
返回值
每个周期必须支付的金额。
注解
生命和兴趣参数必须以相同的时间单位表示。 life 参数的值必须大于 0.0。
Example
pmt(4000,0.14,4); //Returns the value 1372.82.
pmt(10000,0.10,20); //Returns the value 1174.60.
pt
检索数字的总和加上该数字的指定百分比。
Syntax
real pt(real amount, real percentage)
参数
| 参数 | Description |
|---|---|
| 量 | 原始数字。 |
| 百分比 | 百分比补充。 |
返回值
等于 ((amount *× *percentage) + amount 的数字。
注解
pt(2000.0,0.10); //Returns the value 2200.0.
pt(20.0,0.10); //Returns the value 22.0.
光伏
计算年金的现值,其中在多个周期内收到金额,并扣除每个周期的利率。
Syntax
real pv(real amount, real interest, real life)
参数
| 参数 | Description |
|---|---|
| 量 | 在每个时间段内支付的金额。 |
| 利息 | 利率。 |
| 生命 | 支付 金额 参数指定的值的次数。 |
返回值
年金的当前值。
注解
pv(300,0.14,4); //Returns the value 874.11.
率
计算当前投资值在指定时间段内获得未来价值所需的利息。
Syntax
real rate(real _future_value, real _current_value, real _terms)
参数
| 参数 | Description |
|---|---|
| _future_value | 投资的未来价值。 |
| _current_value | 投资的当前值。 |
| _条款 | 投资跨越的时间段数。 |
返回值
计算的利率。
注解
rate(10000,1000,20); //Returns the value 0.12.
sln
检索每个折旧周期的指定资产的常量折旧金额。
Syntax
real sln(real price, real scrap, real life)
参数
| 参数 | Description |
|---|---|
| 价格 | 资产的购买价格。 |
| 废料 | 资产的报废值。 |
| 生命 | 资产预期生命周期中的周期数。 |
返回值
折旧金额。
Example
static void slnExample(Args _arg)
{
real r;
;
r = sln(100.00, 50.00, 50.00);
print r;
pause;
}
西德妮
计算指定时间段内资产的折旧值。
Syntax
real syd(real _price, real _scrap, real _life, int _period)
参数
| 参数 | Description |
|---|---|
| _价格 | 资产的购买价格。 |
| _废料 | 资产的报废值。 |
| _生命 | 资产的预期生命周期(周期数)。 |
| _时期 | 要计算折旧的时间段。 |
返回值
指定时间段内折旧金额。
注解
与 sln 函数相比, syd 函数可以允许资产的加速折旧。 与 ddb 函数一样,这可以在资产生命周期的早期实现更高的折旧。
Example
在以下示例中,针对购买价格为 10,000、报废值为 2,000 且生命周期为 5 的资产计算定期折旧。 相比之下, sln(10000,2000,5) 将计算每个时间段的 1600.00。
// Returns the value 2666.67 (for the 1st period).
syd(10000,2000,5,1);
// Returns the value 2133.33 (for the 2nd period).
syd(10000,2000,5,2);
// Returns the value 1600.00 (for the 3rd period).
syd(10000,2000,5,3);
// Returns the value 1066.67 (for the 4th period).
syd(10000,2000,5,4);
// Returns the value 533.33 (for 5th - and final- period).
syd(10000,2000,5,5);
term
计算投资必须运行的时间段数。
Syntax
real term(real amount, real interest, real future_value)
参数
| 参数 | Description |
|---|---|
| 量 | 定期投资金额。 |
| 利息 | 每个周期的利率。 |
| future_value | 预计投资的未来价值 |
返回值
投资必须运行的时间段数。
Example
static void termExample(Args _args)
{
print term(400,0.08,5000); //returns the value '9.01'.
print term(100,0.14,3000); //returns the value '12.58'.
pause;
}