完整代码
Select Case e.Col.Name
Case "申请支出", "实际支出","支出说明","支出去向"
If e.Row.IsNull("实收") = False Then 'AndAlso 'e.Row.Isnull("第二列") = False Then
e.Cancel = True
End If
End Select
Select Case e.Col.Name
Case "实收", "入账","收入凭号","收入说明"
If e.Row.IsNull("申请支出") = False Then 'AndAlso 'e.Row.Isnull("第二列") = False Then
e.Cancel = True
End If
End Select
Dim pr As DataRow = e.Row.DataRow.GetParentrow("利润单") '如果当前表的父表"利润单"中的"订单状态"列中的内容等于以下内容,那么锁定子表中的关联行
If pr IsNot Nothing Then
If pr("订单状态") = "3-业务审核" OrElse pr("订单状态") = "4-订单完成" Then
e.cancel = True
End If
End If
If e.Col.Name = "订单编号" OrElse e.Col.Name = "实收" OrElse e.Col.Name = "收入凭号" OrElse e.Col.Name = "收入说明" OrElse e.Col.Name = "申请支出" OrElse e.Col.Name = "支出说明" OrElse e.Col.Name = "支出去向"Then
If pr IsNot Nothing AndAlso pr("订单状态") = "2-财务审核" Then
e.cancel = True
End If
End If
If e.Col.Name = "账单编号" OrElse e.Col.Name = "入账" OrElse e.Col.Name = "实际支出" Then
If pr IsNot Nothing AndAlso pr("订单状态") = "1-新增订单" Then
If User.Group <> "办公室" Then '且用户不是办公室
e.cancel = True
End If
End If
End If
If User.Group <> "办公室" Then '且用户不是办公室
If pr IsNot Nothing AndAlso pr("订单状态") = "2-财务审核" Then
e.cancel = True
End If
End If
If e.Col.Name = "实收" OrElse e.Col.Name = "收入凭号" OrElse e.Col.Name = "收入说明" OrElse e.Col.Name = "支出说明" OrElse e.Col.Name = "支出去向" OrElse e.Col.Name = "申请支出" Then
If User.Name <> pr("业务负责") Then '如果当前登陆不是业务负责时
If pr IsNot Nothing AndAlso pr("订单状态") = "1-新增订单" Then '如果内容是"1-新增订单"
e.Cancel = True '禁止编辑
End If
End If
End If
If e.Table.Current IsNot Nothing Then
If Forms("营业报账").Opened Then
If e.Table.Current.isnull("账单编号") = True Then
Forms("营业报账").Controls("删除利润明细按键").Enabled = True
Else
Forms("营业报账").Controls("删除利润明细按键").Enabled = False
End If
End If
End If