使用自定义公式计算销售订单行上的净额

问题描述 投票:0回答:1

我必须通过添加按该价格销售该商品的月数来计算销售订单行上的净金额。为此,我创建了 SalesTable 表单的扩展,并为数据字段“行金额”使用了事件处理程序 OnValidating。 以下是我编写的代码:

**[Extensionof(formStr(SalesTable))] 最终类 PRMSC_SalesLine_Extension {

 //<summary>

 //</summary>
 //<param name="sender"></param>
 //<param name="e"></param>
[FormControlEventHandler(formControlStr(SalesTable, SalesLine_LineAmount), FormControlEventType::Validating)]
public static void SalesLine_LineAmount_OnValidating(FormControl sender, FormControlEventArgs e)
{
    SalesLine  _salesLine;
    _salesLine.LineAmount = (_salesLine.SalesPrice)*(_salesLine.SalesQty)*(_salesLine.PRMSC_NoOfMonths);
    FormControlCancelableSuperEventArgs cancelableSuperEventArgs = e as FormControlCancelableSuperEventArgs;
    cancelableSuperEventArgs.CancelSuperCall();
}

}**

构建和数据库同步一切顺利,没有错误,但行数的计算仍然不包括月数字段

class datasource microsoft-dynamics x++ dynamics-365
1个回答
0
投票

_salesLine 中没有数据,初始化缓冲区:

 FormRun        formRun         = sender.formRun() as FormRun;
 FormDataSource salesLine_ds    = formRun.dataSource(formDataSourceStr(SalesTable, SalesLine_LineAmount)) as FormDataSource;
 SalesLine      _salesLine      = salesLine_ds.cursor();
© www.soinside.com 2019 - 2024. All rights reserved.