Select e.DataCol.Name Case "确定订单" If e.NewValue = True Then e.DataRow.Locked = True End If Case "下单时间","影楼名称" If e.DataRow.IsNull("下单时间") OrElse e.DataRow.IsNull("影楼名称") Then e.DataRow("订单编号") = Nothing Else Dim d As Date = e.DataRow("下单时间") Dim max As String Dim idx As Integer Dim flt As String Dim bh As String = e.DataRow("影楼代码") & Format(d,"yyyyMMdd") & "-" '生成编号的前缀 flt = "影楼代码 = '"& e.DataRow("影楼代码") & "'and 下单时间 = #" & e.DataRow("下单时间") & "# And [_Identify] <> " & e.DataRow("_Identify") max = e.DataTable.Compute("Max(订单编号)",flt) '取得该天的同影楼的最大单据编号 If max > "" Then '如果存在最大单据编号 idx = max.Substring ( max.IndexOf ("-")+1,2) +1 '获得最大单据编号的后三位顺序号,并加1 Else idx = 1 '否则顺序号等于1 End If e.DataRow("订单编号") = bh & Format(idx,"00") End If End Select
|