JackQu的程序员博客

欢迎来的我Blog.这里记录工作学习的点滴,愿与大家分享。欢迎大家共同交流 。

导航

获得用户部门权限

 

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;

 

 

 

posted on 2009-04-10 13:03  Qcj  阅读(328)  评论(0编辑  收藏  举报