Dim f As String = Tables("利润单").Cols("订单状态").ComboList
If e.IsFocusCell
If e.Col.Name = "订单状态" AndAlso User.Group= "办公室"
Tables("利润单").Cols("订单状态").ComboList = "3-业务审核"
Else
Tables("利润单").Cols("订单状态").ComboList = f
End If
End If
If e.Col.Name = "订单状态" Then \'如果修改的是订单状态列
If e.Row("订单状态") = "2-财务审核" Then \'如果内容是"2-财务审核"
If User.Group <> "办公室" Then \'且用户不是办公室
e.Cancel = True \'那么禁止编辑
End If
End If
End If
If e.Col.Name = "订单状态" Then \'如果修改的是订单状态列
If e.Row("订单状态") = "3-业务审核" Then \'如果内容是"3-财务审核"
If User.Group <> "经理组" Then \'且用户不是经理组
e.Cancel = True \'那么禁止编辑
End If
End If
End If
If e.Row("订单状态") = "1-新增订单" Then \'如果内容是"1-新增订单"
If e.Row("业务负责") <> User.Name Then \'且用户不是业务负责人
e.Cancel = True \'那么禁止编辑
End If
End If
If e.Table.Current IsNot Nothing Then
If Forms("利润订单窗口").Opened Then
Dim a As WinForm.Button = Forms("利润订单窗口").Controls("新增利润明细按键")
Dim b As WinForm.Button = Forms("利润订单窗口").Controls("删除利润单按键")
Dim d As WinForm.Button = Forms("利润订单窗口").Controls("删除利润明细按键")
Select Case e.Table.Current("订单状态")
Case "2-财务审核","3-业务审核","4-订单完成"
a.Enabled = False
b.Enabled = False
d.Enabled = False
Case Else
a.Enabled = True
b.Enabled = True
d.Enabled = True
End Select
End If
End If
If e.Table.Current IsNot Nothing Then \'如果当前表中没有对应的内容,那么执行下边
If Forms("利润订单窗口").Opened \'如果窗口打开
If user.Name = e.Table.Current("业务负责") Then
Forms("利润订单窗口").Controls("新增利润明细按键").Enabled = True
Else
Forms("利润订单窗口").Controls("新增利润明细按键").Enabled = False
End If
End If
End If
If e.Table.Current IsNot Nothing Then \'如果当前表中没有对应的内容,那么执行下边
If Forms("利润订单窗口").Opened \'如果窗口打开
Dim flag As Boolean = False
For Each r As Row In Tables("利润单.利润明细单").Rows
If r.IsNull("账单编号") = False Then
flag = True
Exit For
End If
Next
If flag = False AndAlso user.Name = e.Table.Current("业务负责") Then
Forms("利润订单窗口").Controls("删除利润单按键").Enabled = True
Else
Forms("利润订单窗口").Controls("删除利润单按键").Enabled = False
End If
End If
End If
改为:
Dim s As String = Tables("利润单").Cols("订单状态").ComboList
If e.IsFocusCell
If e.Col.Name = "订单状态" AndAlso _UserGroup = "导游组"
Tables("利润单").Cols("订单状态").ComboList = "2-财务审核"
Else
Tables("利润单").Cols("订单状态").ComboList = s
End If
End If
Dim f As String = Tables("利润单").Cols("订单状态").ComboList
If e.IsFocusCell
If e.Col.Name = "订单状态" AndAlso _UserGroup = "办公室"
Tables("利润单").Cols("订单状态").ComboList = "3-业务审核"
Else
Tables("利润单").Cols("订单状态").ComboList = f
End If
End If
If e.Col.Name = "订单状态" Then \'如果修改的是订单状态列
If e.Row("订单状态") = "2-财务审核" Then \'如果内容是"2-财务审核"
If _UserGroup <> "办公室" Then \'且用户不是办公室
e.Cancel = True \'那么禁止编辑
End If
End If
End If
If e.Col.Name = "订单状态" Then \'如果修改的是订单状态列
If e.Row("订单状态") = "3-业务审核" Then \'如果内容是"3-财务审核"
If _UserGroup <> "经理组" Then \'且用户不是经理组
e.Cancel = True \'那么禁止编辑
End If
End If
End If
If e.Row("订单状态") = "1-新增订单" Then \'如果内容是"1-新增订单"
If e.Row("业务负责") <> _UserName Then \'且用户不是业务负责人
e.Cancel = True \'那么禁止编辑
End If
End If
If e.Table.Current IsNot Nothing Then
If Forms("利润订单窗口").Opened Then
Dim a As WinForm.Button = Forms("利润订单窗口").Controls("新增利润明细按键")
Dim b As WinForm.Button = Forms("利润订单窗口").Controls("删除利润单按键")
Dim d As WinForm.Button = Forms("利润订单窗口").Controls("删除利润明细按键")
Select Case e.Table.Current("订单状态")
Case "2-财务审核","3-业务审核","4-订单完成"
a.Enabled = False
b.Enabled = False
d.Enabled = False
Case Else
a.Enabled = True
b.Enabled = True
d.Enabled = True
End Select
End If
End If
If e.Table.Current IsNot Nothing Then \'如果当前表中没有对应的内容,那么执行下边
If Forms("利润订单窗口").Opened \'如果窗口打开
If _userName = e.Table.Current("业务负责") Then
Forms("利润订单窗口").Controls("新增利润明细按键").Enabled = True
Else
Forms("利润订单窗口").Controls("新增利润明细按键").Enabled = False
End If
End If
End If
If e.Table.Current IsNot Nothing Then \'如果当前表中没有对应的内容,那么执行下边
If Forms("利润订单窗口").Opened \'如果窗口打开
Dim flag As Boolean = False
For Each r As Row In Tables("利润单.利润明细单").Rows
If r.IsNull("账单编号") = False Then
flag = True
Exit For
End If
Next
If flag = False AndAlso _userName = e.Table.Current("业务负责") Then
Forms("利润订单窗口").Controls("删除利润单按键").Enabled = True
Else
Forms("利润订单窗口").Controls("删除利润单按键").Enabled = False
End If
End If
End If
给帮忙给看下,这个改法对不对,能不能起作用?谢谢!
还有个问题,这个权限是不是还受默认用户影响,默认用户应该怎么设置?