我必须通过添加按该价格销售该商品的月数来计算销售订单行上的净金额。为此,我创建了 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();
}
}**
构建和数据库同步一切顺利,没有错误,但行数的计算仍然不包括月数字段
_salesLine 中没有数据,初始化缓冲区:
FormRun formRun = sender.formRun() as FormRun;
FormDataSource salesLine_ds = formRun.dataSource(formDataSourceStr(SalesTable, SalesLine_LineAmount)) as FormDataSource;
SalesLine _salesLine = salesLine_ds.cursor();