获得用户部门权限
var LoginUserDepts : WideString; procedure SetDBComboBoxDeptItems; var DeptList :TStringlist; i :Integer; begin DeptList:=TStringlist.Create; try DeptList.CommaText:=ListUserDepts(aLoginUser.Userid); for i:=0 to DeptList.Count-1 do begin LoginUserDepts:=LoginUserDepts+','+DeptList.Names[i]; end; LoginUserDepts:=Copy(LoginUserDepts,2,Length(LoginUserDepts)-1) finally DeptList.Free; end; end; ==使用============================================= if pos('2,',LoginUserDepts)>0 then begin //2 表示财务部 if pos('27',LoginUserDepts)>0 then SQL.Add('and ((i.SrcbsBillDeptid in ('+LoginUserDepts+')) or (i.srcactid in (3,38,43,125) and i.corpid=162))') else SQL.Add('and i.SrcbsBillDeptid in ('+LoginUserDepts+')'); end;