订单主表上一键审核其所有订单明细可以吗?刚好和下面的相反,因为如果订单明细太多的话要一个个审核也是一件很麻烦的事,
假定订单和订单明细表都有一个名为“审核”的列,逻辑型。
当某个订单的所有订单明细全部通过审核后,此订单也自动审核通过,当某订单的任何一个订单明细取消审核后,此订单也自动取消审核。
为此可以将订单明细表的DataColChanged事件代码设置为:
If e.DataCol.name =
"审核"
Then
Dim pr As
DataRow =
e.DataRow.GetParentRow("订单")
If
pr IsNot
Nothing
Then
Dim
crs As
List(of DataRow) = pr.GetChildRows("订单明细")
Dim cnt As
Integer
For
Each cr As
DataRow
In crs
If cr("审核") = True
cnt = cnt + 1
End
If
Next
pr("审核") = (crs.Count = cnt)
End
If
End
If