str=" APPLICANT in (select USERID from user_company where COMPANYID='"+companyid+"') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='"+deptname+"')";
//var deptname = rangeDa.GetDEPTNAME(userid);
//str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
vardeptgid=rangeDa.GetDEPTGID(userid);
str=" APPLICANT in (select USERID from vw_user where deptgid='"+deptgid+"') ";
str=" APPLICANT in (select USERID from user_company where COMPANYID='"+companyid+"') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='"+deptname+"')";
//var deptname = rangeDa.GetDEPTNAME(userid);
//str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
vardeptgid=rangeDa.GetDEPTGID(userid);
str=" APPLICANT in (select USERID from vw_user where deptgid='"+deptgid+"') ";
}
elseif(visiblerange=="1")
{
str=" APPLICANT in (select USERID from user_company where COMPANYID='" +companyid+"')";
str=" SALECORPID='"+companyid+"' or APPLICANT in (select USERID from user_company where COMPANYID='" +companyid+"')";
str=" APPLICANT in (select USERID from user_company where COMPANYID='"+companyid+"') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='"+deptname+"')";
//var deptname = rangeDa.GetDEPTNAME(userid);
//str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
vardeptgid=rangeDa.GetDEPTGID(userid);
str=" APPLICANT in (select USERID from vw_user where deptgid='"+deptgid+"') ";