1 、 afterOpenProject代码:
If Syscmd.Project.Update(False,False) = False Then
Forms("领薪员工刷新").Open()
Forms("表标题").Open()
DataTables("员工").DataCols("出生日期").RaiseDataColChanged()
DataTables("员工").DataCols("月薪附属_有无红月奖").RaiseDataColChanged()
RibbonTabs.AllowMinimize = True
RibbonTabs.Minimized = True
For Each dt As Table In Tables
Tables(dt.Name).OpenView(Tables(dt.Name).DataTable.Name)
Tables(dt.Name).DefaultRowHeight = 25
Tables(dt.Name).AllowDelete = False
Tables(dt.Name).Select(-1,0)
Next
For Each dt As DataTable In DataTables '这段设置的是每个DATATABLE的交替行的颜色
DataTables(dt.Name).SysStyles("Alternate").BackColor = Color.DarkKhaki
Next
Tables("DK订单.出货规划.DKNP出货备注").Visible = False
Tables("DK用NP.DKNP出货备注").Visible = False
Tables("出货规划.DKNP出货备注").Visible = True
Tables("DK订单.出货规划").Visible = True
Tables("DG.DWL").Visible = True
Tables("DNP.单NP成本").Visible = True
Tables("DNP.加工基准时量").Visible = True
Tables("销售与衍生对账.销售应收与衍生应付").Visible = True
Tables("采购与衍生对账.采购应付与衍生应收").Visible = True
If User.Type <> UserTypeEnum.Developer
TableCaptionVisible = False
End If
End If
2、LoadUserSetting代码:
If User.Name = "周振华" Or User.Name = "张超" Or User.Name = "付登芬" Or User.Name = "郭栩彤" Or User.Name = "周敏" Or User.Name = "邱淑琴" Or User.Name = "陈喜华" Then '这段代码主要是为了让不同的人看到不同的行
DataTables("DK订单").LoadFilter = ""
Else
If User.Name = "可俊" Or User.Name = "龙邦辉" Then
DataTables("DK订单").LoadFilter = "业务员 = '" & User.Name & "'"
End If
End If
If User.Name = "周振华" Or User.Name = "张超" Or User.Name = "付登芬" Or User.Name = "郭栩彤" Or User.Name = "邱淑琴" Or User.Name = "陈喜华" Then DataTables("出货规划").LoadFilter = ""
Else
If User.Name = "可俊" Or User.Name = "龙邦辉" Then
DataTables("出货规划").LoadFilter = "发货员 = '" & User.Name & "'"
End If
End If
If User.Name = "周振华" Or User.Name = "张超" Or User.Name = "付登芬" Or User.Name = "郭栩彤" Or User.Name = "周敏" Then
DataTables("销售与衍生对账").LoadFilter = ""
Else
If User.Name = "可俊" Or User.Name = "龙邦辉" Then
DataTables("销售与衍生对账").LoadFilter = "业务姓名 = '" & User.Name & "'"
Else
If User.Name = "陈喜华" Or User.Name = "邱淑琴" Then
DataTables("销售与衍生对账").LoadFilter = "跟单姓名 = '" & User.Name & "'"
End If
End If
End If
If User.Name = "周振华" Or User.Name = "张超" Or User.Name = "付登芬" Or User.Name = "郭栩彤" Or User.Name = "周敏" Then
DataTables("销售应收与衍生应付").LoadFilter = ""
Else
If User.Name = "可俊" Or User.Name = "龙邦辉" Then
DataTables("销售应收与衍生应付").LoadFilter = "业务_姓名 = '" & User.Name & "'"
Else
If User.Name = "陈喜华" Or User.Name = "邱淑琴" Then
DataTables("销售应收与衍生应付").LoadFilter = "跟单_姓名 = '" & User.Name & "'"
End If
End If
End If
If User.Group = "决策部" Then
DataTables("采购规划").LoadFilter = ""
Else
If User.Group = "采购部" Then
DataTables("采购规划").LoadFilter = "采购员= '" & User.Name & "'"
End If
End If
If User.Group = "决策部" Then
DataTables("采购与衍生对账").LoadFilter = ""
Else
If User.Group = "采购部" Then
DataTables("采购与衍生对账").LoadFilter = "采购员= '" & User.Name & "'"
End If
End If
If User.Group = "决策部" Then
DataTables("报销").LoadFilter = ""
Else
If User.Group= "市场部" Or User.Group = "采购部" Or User.Group = "开发部" Or User.Group = "制造部" Then
DataTables("报销").LoadFilter = "报销人= '" & User.Name & "'"
End If
End If
If User.Group = "决策部" Then
DataTables("工作计划").LoadFilter = ""
Else
If User.Group = "财务部" Or User.Group = "市场部" Or User.Group = "采购部" Or User.Group = "开发部" Or User.Group = "制造部" Then
DataTables("工作计划").LoadFilter = "姓名= '" & User.Name & "'"
End If
End If
If User.Group ="市场部" Then
RibbonTabs("Common").Groups("Data").Items("LoadTree").Enabled= False
RibbonTabs("Common").Groups("SortAndFilter").Items("FilterTree").Enabled= False
Else
RibbonTabs("Common").Groups("Data").Items("LoadTree").Enabled= True
RibbonTabs("Common").Groups("SortAndFilter").Items("FilterTree").Enabled= True
End If
If User.Name = "周振华" Then
RibbonTabs("Common").Groups("Data").Items("Reset").Enabled= True
Else
RibbonTabs("Common").Groups("Data").Items("Reset").Enabled= False
End If
For Each t As Table In Tables
t.Visible = True
t.AllowEdit = True
For Each c As Col In t.Cols
c.Visible = True
c.AllowEdit = True
Next
Next
Tables("授权表").Visible = (User.Type <> UserTypeEnum.User )
If User.Type <> UserTypeEnum.User Then
Return
End If
For Each dr As DataRow In DataTables("授权表").Select("用户名 = '" & User.Name & "'" )
If dr.IsNull("列名") Then
For Each t As Table In Tables
If t.DataTable.Name = dr("表名") Then
t.Visible = Not dr("不可见")
t.AllowEdit = Not dr("不可编辑")
End If
Next
Else
For Each t As Table In Tables
If t.DataTable.Name = dr("表名") Then
For Each c As Col In t.Cols
If c.Name = dr("列名") Then
c.Visible = Not dr("不可见")
c.AllowEdit = Not dr("不可编辑")
End If
Next
End If
Next
End If
Next
3、BeforeCloseProject代码:
没有代码