|
|
using System;
|
|
|
using System.Data;
|
|
|
using DSWeb.Models;
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
|
namespace DSWeb.Authority
|
|
|
{
|
|
|
public class UserAuthorityManage
|
|
|
{
|
|
|
private UserAuthorityRangeEntity _userAuthorityRangeEntity;
|
|
|
private UserAuthorityDA _userAuthorityDA;
|
|
|
private AuthorityType _visibleType = AuthorityType.NULL;
|
|
|
private AuthorityType _operateType = AuthorityType.NULL;
|
|
|
|
|
|
public UserAuthorityManage()
|
|
|
{
|
|
|
}
|
|
|
#region 依据UserID和ModuleName初始化实体类UserAuthorityManage
|
|
|
/// <summary>
|
|
|
/// 依据UserID和ModuleName初始化实体类UserAuthorityManage
|
|
|
/// </summary>
|
|
|
/// <param name="tempUserID">UserID</param>
|
|
|
/// <param name="tempAuthorityModuleName">ModuleName</param>
|
|
|
public UserAuthorityManage(string tempUserID,string tempAuthorityModuleName)
|
|
|
{
|
|
|
if (_userAuthorityDA == null)
|
|
|
{
|
|
|
_userAuthorityDA = new UserAuthorityDA();
|
|
|
}
|
|
|
//获取用户的模块权限信息,返回UserAuthorityRangeEntity
|
|
|
_userAuthorityRangeEntity = _userAuthorityDA.GetUserAuthorityRange(tempUserID, tempAuthorityModuleName);
|
|
|
|
|
|
if (_userAuthorityRangeEntity != null)
|
|
|
{
|
|
|
if (_userAuthorityRangeEntity.GID != null)
|
|
|
{
|
|
|
_visibleType = GetAuthorityType(_userAuthorityRangeEntity.VisableRange);
|
|
|
_operateType = GetAuthorityType(_userAuthorityRangeEntity.OperateRange);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
#region GetVisibleRangeSql
|
|
|
/// <summary>
|
|
|
/// GetVisibleRangeSql
|
|
|
/// </summary>
|
|
|
/// <param name="tempType"></param>
|
|
|
/// <param name="tempModuleType"></param>
|
|
|
/// <param name="tempShowName"></param>
|
|
|
/// <param name="tempCompanyID"></param>
|
|
|
/// <param name="tempDeptName"></param>
|
|
|
/// <param name="tempUserID"></param>
|
|
|
/// <returns></returns>
|
|
|
public string GetVisibleRangeSql(AuthorityType tempType,ModuleType tempModuleType,string tempShowName,string tempCompanyID,string tempDeptName,string tempUserID)
|
|
|
{
|
|
|
string strResult = "";
|
|
|
switch (tempType)
|
|
|
{
|
|
|
case AuthorityType.NONE:
|
|
|
strResult = " AND 1 < 0 ";
|
|
|
break;
|
|
|
case AuthorityType.BYPERSONAL:
|
|
|
#region
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
strResult = string.Format(" AND A.APPLICANT = '{0}' ", tempUserID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND A.APPLICANT = '{0}'", tempUserID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND A.SETTLEUSER = '{0}' ", tempUserID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLEAPPSEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH || tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER = '{0}' OR A.APPLICANT = '{0}') ", tempUserID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND A.SETTLEUSER = '{0}' ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 1 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 1 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 2 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 2 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 1 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 1 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 2 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 2 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM wms_out WHERE CREATEUSER = '{0}' OR MODIFIEDUSER = '{0}') ", tempShowName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 1 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 1 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 2 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 2 ", tempUserID);
|
|
|
}
|
|
|
//********************************************内贸应收费用添加**********
|
|
|
if (tempModuleType == ModuleType.OPSEANLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
//*******************************************内贸应收费用审核***********
|
|
|
if (tempModuleType == ModuleType.SEANRECVFEE)
|
|
|
{
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 1",tempUserID);
|
|
|
}
|
|
|
//*******************************************内贸应付费用审核**********
|
|
|
if (tempModuleType == ModuleType.SEANPAYFEE)
|
|
|
{
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 2",tempUserID);
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
case AuthorityType.BYDEPARTMENT:
|
|
|
#region
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLEAPPSEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH || tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if(tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 1 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 2 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 1 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 2 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM wms_out WHERE CREATEUSER IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR MODIFIEDUSER = '{0}' ))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 1 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 2 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
//**********************************************添加应内贸应收费用***************************************
|
|
|
if (tempModuleType == ModuleType.OPSEANLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ",tempShowName,tempCompanyID,tempDeptName);
|
|
|
}
|
|
|
//********************************************审核内贸应收费用*********************************************
|
|
|
if (tempModuleType == ModuleType.SEANRECVFEE)
|
|
|
{
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 1 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
//********************************************审核内贸应付费用**********************************************
|
|
|
if (tempModuleType == ModuleType.SEANPAYFEE)
|
|
|
{
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 2 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
case AuthorityType.BYSUBCOMPANY:
|
|
|
#region
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLEAPPSEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH || tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
else if(tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
else if(tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 1 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 2 ", tempCompanyID);
|
|
|
}
|
|
|
|
|
|
if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 1 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 2 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM wms_out WHERE CREATEUSER IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
+ ") OR (INPUTBY = '{0}' OR MODIFIEDUSER = '{0}' ))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 1 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 2 ", tempCompanyID);
|
|
|
}
|
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
|
|
|
//*******************************************************2013-07-04添加应收费用************************
|
|
|
if (tempModuleType == ModuleType.OPSEANLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN(SELECT SHOWNAME FROM [USER] WHERE GID IN(SELECT USERID FROM [user_company] WHERE COMPANYID='{1}')OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE='{0}')))", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
//****************************************************2013-07-06审核应收费用*************************
|
|
|
if (tempModuleType == ModuleType.SEANRECVFEE)
|
|
|
{
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 1 ", tempCompanyID);
|
|
|
}
|
|
|
//****************************************************2013-07-06应付费用审核**********************
|
|
|
if (tempModuleType == ModuleType.SEANPAYFEE)
|
|
|
{
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 2 ", tempCompanyID);
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
case AuthorityType.ALL:
|
|
|
#region
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.OPSEAILIST || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPSEARCH)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
|
|
|
else if (tempModuleType == ModuleType.OPSEANLIST)//内贸添加应收应付
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.SEANRECVFEE)//内贸审核应收应付费用
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.SEANPAYFEE)//内贸审核应付费用
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
break;
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
return strResult;
|
|
|
}
|
|
|
#endregion
|
|
|
#region GetVisibleRangeSql
|
|
|
/// <summary>
|
|
|
/// GetVisibleRangeSql
|
|
|
/// </summary>
|
|
|
/// <param name="tempType"></param>
|
|
|
/// <param name="tempModuleType"></param>
|
|
|
/// <param name="tempShowName"></param>
|
|
|
/// <param name="tempCompanyID"></param>
|
|
|
/// <param name="tempDeptName"></param>
|
|
|
/// <param name="tempUserID"></param>
|
|
|
/// <returns></returns>
|
|
|
public string GetVisibleRangeSql(AuthorityType tempType, ModuleType tempModuleType, string tempShowName, string tempCompanyID, string tempDeptName, string tempUserID,string bstype)
|
|
|
{
|
|
|
string strResult = "";
|
|
|
switch (tempType)
|
|
|
{
|
|
|
case AuthorityType.NONE:
|
|
|
strResult = " AND 1 < 0 ";
|
|
|
break;
|
|
|
case AuthorityType.BYPERSONAL:
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
//if (bstype == "0")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'"
|
|
|
// + " union all "
|
|
|
// + " SELECT BSNO FROM op_seai WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}' "
|
|
|
// + ") "
|
|
|
// , tempShowName);
|
|
|
//}
|
|
|
//else if (bstype == "1")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
|
//}
|
|
|
//else if (bstype == "2")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
//}
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
string sOPLBCondition = "";
|
|
|
int itempoplb = int.Parse(bstype);
|
|
|
switch (itempoplb)
|
|
|
{
|
|
|
case 0://所有业务类型
|
|
|
sOPLBCondition = "";
|
|
|
break;
|
|
|
case 1://海运出口op_Seae
|
|
|
sOPLBCondition = " and OPLBNAME='海运出口' ";
|
|
|
break;
|
|
|
case 2://海运进口op_Seai
|
|
|
sOPLBCondition = " and OPLBNAME='海运进口' ";
|
|
|
break;
|
|
|
case 3:
|
|
|
sOPLBCondition = " and OPLBNAME='空运出口' ";
|
|
|
break;
|
|
|
case 4:
|
|
|
sOPLBCondition = " and OPLBNAME='空运进口' ";
|
|
|
break;
|
|
|
case 5://陆运托运
|
|
|
sOPLBCondition = " and OPLBNAME='陆运托运' ";
|
|
|
break;
|
|
|
case 6://仓储费
|
|
|
sOPLBCondition = " and OPLBNAME='仓储费' ";
|
|
|
break;
|
|
|
case 7://仓储入库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储入库' ";
|
|
|
break;
|
|
|
case 8://仓储出库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储出库' ";
|
|
|
break;
|
|
|
case 9://陆运派车
|
|
|
sOPLBCondition = " and OPLBNAME='陆运派车' ";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') {1}) ", tempShowName, sOPLBCondition);
|
|
|
//end
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
strResult = string.Format(" AND A.APPLICANT = '{0}' ", tempUserID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND A.APPLICANT = '{0}'", tempUserID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND A.SETTLEUSER = '{0}' ", tempUserID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLEAPPSEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH || tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
//if (bstype == "0")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}' union all SELECT BSNO FROM op_seai WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}' ) ", tempShowName);
|
|
|
//}
|
|
|
//else if (bstype == "1")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
//}
|
|
|
//else if (bstype == "2")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
//}
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
string sOPLBCondition = "";
|
|
|
int itempoplb = int.Parse(bstype);
|
|
|
switch (itempoplb)
|
|
|
{
|
|
|
case 0://所有业务类型
|
|
|
sOPLBCondition = "";
|
|
|
break;
|
|
|
case 1://海运出口op_Seae
|
|
|
sOPLBCondition = " and OPLBNAME='海运出口' ";
|
|
|
break;
|
|
|
case 2://海运进口op_Seai
|
|
|
sOPLBCondition = " and OPLBNAME='海运进口' ";
|
|
|
break;
|
|
|
case 3:
|
|
|
sOPLBCondition = " and OPLBNAME='空运出口' ";
|
|
|
break;
|
|
|
case 4:
|
|
|
sOPLBCondition = " and OPLBNAME='空运进口' ";
|
|
|
break;
|
|
|
case 5://陆运托运
|
|
|
sOPLBCondition = " and OPLBNAME='陆运托运' ";
|
|
|
break;
|
|
|
case 6://仓储费
|
|
|
sOPLBCondition = " and OPLBNAME='仓储费' ";
|
|
|
break;
|
|
|
case 7://仓储入库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储入库' ";
|
|
|
break;
|
|
|
case 8://仓储出库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储出库' ";
|
|
|
break;
|
|
|
case 9://陆运派车
|
|
|
sOPLBCondition = " and OPLBNAME='陆运派车' ";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') {1}) ", tempShowName,sOPLBCondition);
|
|
|
//end
|
|
|
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER = '{0}' OR A.APPLICANT = '{0}') ", tempUserID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND A.SETTLEUSER = '{0}' ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 1 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 1 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 2 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 2 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 1 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 1 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 2 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 2 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM wms_out WHERE CREATEUSER = '{0}' OR MODIFIEDUSER = '{0}') ", tempShowName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 1 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 1 ", tempUserID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 2 ", tempShowName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR = '{0}' AND FEETYPE = 2 ", tempUserID);
|
|
|
}
|
|
|
break;
|
|
|
case AuthorityType.BYDEPARTMENT:
|
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
//if (bstype == "0")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN "
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')) "
|
|
|
// + " union all "
|
|
|
// + " SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN "
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')) "
|
|
|
// + " ) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
//}
|
|
|
//else if (bstype == "1")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
//}
|
|
|
//else if (bstype == "2")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
//}
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
string sOPLBCondition = "";
|
|
|
int itempoplb = int.Parse(bstype);
|
|
|
switch (itempoplb)
|
|
|
{
|
|
|
case 0://所有业务类型
|
|
|
sOPLBCondition = "";
|
|
|
break;
|
|
|
case 1://海运出口op_Seae
|
|
|
sOPLBCondition = " and OPLBNAME='海运出口' ";
|
|
|
break;
|
|
|
case 2://海运进口op_Seai
|
|
|
sOPLBCondition = " and OPLBNAME='海运进口' ";
|
|
|
break;
|
|
|
case 3:
|
|
|
sOPLBCondition = " and OPLBNAME='空运出口' ";
|
|
|
break;
|
|
|
case 4:
|
|
|
sOPLBCondition = " and OPLBNAME='空运进口' ";
|
|
|
break;
|
|
|
case 5://陆运托运
|
|
|
sOPLBCondition = " and OPLBNAME='陆运托运' ";
|
|
|
break;
|
|
|
case 6://仓储费
|
|
|
sOPLBCondition = " and OPLBNAME='仓储费' ";
|
|
|
break;
|
|
|
case 7://仓储入库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储入库' ";
|
|
|
break;
|
|
|
case 8://仓储出库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储出库' ";
|
|
|
break;
|
|
|
case 9://陆运派车
|
|
|
sOPLBCondition = " and OPLBNAME='陆运派车' ";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE ( "
|
|
|
+ " INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')))"
|
|
|
+ " OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')"
|
|
|
+ " ) {3}) ", tempShowName, tempCompanyID, tempDeptName,sOPLBCondition);
|
|
|
//end
|
|
|
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLEAPPSEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH || tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
//if (bstype == "0")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')) "
|
|
|
// + " union all "
|
|
|
// + " SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN "
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')) "
|
|
|
// + " ) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
//}
|
|
|
//else if (bstype == "1")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
//}
|
|
|
//else if (bstype == "2")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
//}
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
string sOPLBCondition = "";
|
|
|
int itempoplb = int.Parse(bstype);
|
|
|
switch (itempoplb)
|
|
|
{
|
|
|
case 0://所有业务类型
|
|
|
sOPLBCondition = "";
|
|
|
break;
|
|
|
case 1://海运出口op_Seae
|
|
|
sOPLBCondition = " and OPLBNAME='海运出口' ";
|
|
|
break;
|
|
|
case 2://海运进口op_Seai
|
|
|
sOPLBCondition = " and OPLBNAME='海运进口' ";
|
|
|
break;
|
|
|
case 3:
|
|
|
sOPLBCondition = " and OPLBNAME='空运出口' ";
|
|
|
break;
|
|
|
case 4:
|
|
|
sOPLBCondition = " and OPLBNAME='空运进口' ";
|
|
|
break;
|
|
|
case 5://陆运托运
|
|
|
sOPLBCondition = " and OPLBNAME='陆运托运' ";
|
|
|
break;
|
|
|
case 6://仓储费
|
|
|
sOPLBCondition = " and OPLBNAME='仓储费' ";
|
|
|
break;
|
|
|
case 7://仓储入库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储入库' ";
|
|
|
break;
|
|
|
case 8://仓储出库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储出库' ";
|
|
|
break;
|
|
|
case 9://陆运派车
|
|
|
sOPLBCondition = " and OPLBNAME='陆运派车' ";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE ("
|
|
|
+ " INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')))"
|
|
|
+ " OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')"
|
|
|
+ ") {3} ) ", tempShowName, tempCompanyID, tempDeptName,sOPLBCondition);
|
|
|
//end
|
|
|
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 1 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 2 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 1 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 2 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM wms_out WHERE CREATEUSER IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR MODIFIEDUSER = '{0}' ))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 1 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
// + " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{1}')) AND FEETYPE = 2 ", tempCompanyID, tempDeptName);
|
|
|
}
|
|
|
break;
|
|
|
case AuthorityType.BYSUBCOMPANY:
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
//if (bstype == "0")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + " ) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')) "
|
|
|
// + " union all "
|
|
|
// + " SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + " ) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')) "
|
|
|
// + " ) ", tempShowName, tempCompanyID);
|
|
|
//}
|
|
|
//else if (bstype == "1")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
//}
|
|
|
//else if (bstype == "2")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
//}
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
string sOPLBCondition = "";
|
|
|
int itempoplb = int.Parse(bstype);
|
|
|
switch (itempoplb)
|
|
|
{
|
|
|
case 0://所有业务类型
|
|
|
sOPLBCondition = "";
|
|
|
break;
|
|
|
case 1://海运出口op_Seae
|
|
|
sOPLBCondition = " and OPLBNAME='海运出口' ";
|
|
|
break;
|
|
|
case 2://海运进口op_Seai
|
|
|
sOPLBCondition = " and OPLBNAME='海运进口' ";
|
|
|
break;
|
|
|
case 3:
|
|
|
sOPLBCondition = " and OPLBNAME='空运出口' ";
|
|
|
break;
|
|
|
case 4:
|
|
|
sOPLBCondition = " and OPLBNAME='空运进口' ";
|
|
|
break;
|
|
|
case 5://陆运托运
|
|
|
sOPLBCondition = " and OPLBNAME='陆运托运' ";
|
|
|
break;
|
|
|
case 6://仓储费
|
|
|
sOPLBCondition = " and OPLBNAME='仓储费' ";
|
|
|
break;
|
|
|
case 7://仓储入库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储入库' ";
|
|
|
break;
|
|
|
case 8://仓储出库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储出库' ";
|
|
|
break;
|
|
|
case 9://陆运派车
|
|
|
sOPLBCondition = " and OPLBNAME='陆运派车' ";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE ( "
|
|
|
+ " INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}')) "
|
|
|
+ " OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') "
|
|
|
+ " ) {2}) ", tempShowName, tempCompanyID, sOPLBCondition);
|
|
|
//end
|
|
|
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLEAPPSEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH || tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
//if (bstype == "0")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')) "
|
|
|
// + " union all "
|
|
|
// + " SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + " ) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')) "
|
|
|
// + " ) ", tempShowName, tempCompanyID);
|
|
|
//}
|
|
|
//else if (bstype == "1")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
//}
|
|
|
//else if (bstype == "2")
|
|
|
//{
|
|
|
// strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
//}
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
string sOPLBCondition = "";
|
|
|
int itempoplb = int.Parse(bstype);
|
|
|
switch (itempoplb)
|
|
|
{
|
|
|
case 0://所有业务类型
|
|
|
sOPLBCondition = "";
|
|
|
break;
|
|
|
case 1://海运出口op_Seae
|
|
|
sOPLBCondition = " and OPLBNAME='海运出口' ";
|
|
|
break;
|
|
|
case 2://海运进口op_Seai
|
|
|
sOPLBCondition = " and OPLBNAME='海运进口' ";
|
|
|
break;
|
|
|
case 3:
|
|
|
sOPLBCondition = " and OPLBNAME='空运出口' ";
|
|
|
break;
|
|
|
case 4:
|
|
|
sOPLBCondition = " and OPLBNAME='空运进口' ";
|
|
|
break;
|
|
|
case 5://陆运托运
|
|
|
sOPLBCondition = " and OPLBNAME='陆运托运' ";
|
|
|
break;
|
|
|
case 6://仓储费
|
|
|
sOPLBCondition = " and OPLBNAME='仓储费' ";
|
|
|
break;
|
|
|
case 7://仓储入库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储入库' ";
|
|
|
break;
|
|
|
case 8://仓储出库
|
|
|
sOPLBCondition = " and OPLBNAME='仓储出库' ";
|
|
|
break;
|
|
|
case 9://陆运派车
|
|
|
sOPLBCondition = " and OPLBNAME='陆运派车' ";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE ("
|
|
|
+ " INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}'))"
|
|
|
+ " OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}')"
|
|
|
+ " ) {2}) ", tempShowName, tempCompanyID, sOPLBCondition);
|
|
|
//end
|
|
|
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 1 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 2 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seai WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM VW_Settlement WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 1 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 2 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM wms_out WHERE CREATEUSER IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
+ ") OR (INPUTBY = '{0}' OR MODIFIEDUSER = '{0}' ))) ", tempShowName, tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 1 ", tempCompanyID);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
//strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
// + ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID);
|
|
|
strResult = string.Format(" AND ENTEROPERATOR IN (SELECT USERID FROM user_company WHERE COMPANYID='{0}') AND FEETYPE = 2 ", tempCompanyID);
|
|
|
}
|
|
|
break;
|
|
|
case AuthorityType.ALL:
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.OPSEAILIST || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPSEARCH)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
strResult = "";
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
return strResult;
|
|
|
}
|
|
|
#endregion
|
|
|
#region CheckOperateRange
|
|
|
/// <summary>
|
|
|
/// CheckOperateRange
|
|
|
/// </summary>
|
|
|
/// <param name="tempModuleType"></param>
|
|
|
/// <param name="tempAuthorityType"></param>
|
|
|
/// <param name="tempShowName"></param>
|
|
|
/// <param name="tempCompanyID"></param>
|
|
|
/// <param name="tempDeptName"></param>
|
|
|
/// <param name="tempBSNO"></param>
|
|
|
/// <param name="tempBillNO"></param>
|
|
|
/// <param name="tempUserID"></param>
|
|
|
/// <returns></returns>
|
|
|
public int CheckOperateRange(ModuleType tempModuleType,AuthorityType tempAuthorityType,string tempShowName,string tempCompanyID,string tempDeptName,string tempBSNO,string tempBillNO,string tempUserID)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
//***********************************2013-07-04添加费用---------------内贸
|
|
|
if (tempModuleType == ModuleType.OPSEANLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(string.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO='{0}'{1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
//**********************************2013-07-06审核费用----------------内贸
|
|
|
if (tempModuleType == ModuleType.SEANRECVFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(string.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1}",tempBillNO,GetVisibleRangeSql(tempAuthorityType,tempModuleType,tempShowName,tempCompanyID,tempDeptName,tempUserID)));
|
|
|
}
|
|
|
//************************************2013-07-06应付费用审核----------内贸
|
|
|
if (tempModuleType == ModuleType.SEANPAYFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(string.Format("SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ",tempBillNO,GetVisibleRangeSql(tempAuthorityType,tempModuleType,tempShowName,tempCompanyID,tempDeptName,tempUserID)));
|
|
|
}
|
|
|
#region
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.FEEAUDIT)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_invoice as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_invoiceapplication as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPSEARCH)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_settlement as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYSETTLESEARCH)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYSETTLEAPPSEARCH)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_payapplication as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, ""));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_settlement as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM crm_seaeorder WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
#endregion
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seai WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
string strls1 = GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "");
|
|
|
string strls2 = String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, strls1);
|
|
|
iResult = _userAuthorityDA.GetSqlCount(strls2);
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM wms_out WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
return iResult;
|
|
|
}
|
|
|
#endregion
|
|
|
#region CheckOperateRange
|
|
|
/// <summary>
|
|
|
/// CheckOperateRange
|
|
|
/// </summary>
|
|
|
/// <param name="tempModuleType"></param>
|
|
|
/// <param name="tempAuthorityType"></param>
|
|
|
/// <param name="tempShowName"></param>
|
|
|
/// <param name="tempCompanyID"></param>
|
|
|
/// <param name="tempDeptName"></param>
|
|
|
/// <param name="tempBSNO"></param>
|
|
|
/// <param name="tempBillNO"></param>
|
|
|
/// <param name="tempUserID"></param>
|
|
|
/// <returns></returns>
|
|
|
public int CheckOperateRange(ModuleType tempModuleType, AuthorityType tempAuthorityType, string tempShowName, string tempCompanyID, string tempDeptName, string tempBSNO, string tempBillNO, string tempUserID,string oplb)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.FEEAUDIT)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_invoice as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_invoiceapplication as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPSEARCH)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM {2} WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, ""),oplb));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM {2} WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, ""),oplb));
|
|
|
}
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_settlement as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYSETTLESEARCH)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM {2} WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, ""),oplb));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYSETTLEAPPSEARCH)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM {2} WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, ""),oplb ));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_payapplication as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVSETTLEAPPSEARCH)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM {2} WHERE BSNO = '{0}' {1}", tempBSNO, "",oplb ));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM {2} WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, ""),oplb));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_settlement as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM crm_seaeorder WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.OPSEAILIST)
|
|
|
{
|
|
|
//iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seai WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
|
//2013-02-05 修改
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM VW_Settlement WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIRECVFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.SEAIPAYFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTLIST)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM wms_out WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTRECVFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
if (tempModuleType == ModuleType.WMSOUTPAYFEE)
|
|
|
{
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 0 ELSE COUNT(*) END FROM ch_fee WHERE GID = '{0}' {1} ", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
}
|
|
|
return iResult;
|
|
|
}
|
|
|
#endregion
|
|
|
private AuthorityType GetAuthorityType(int iUserAuthorityType)
|
|
|
{
|
|
|
AuthorityType resultType = AuthorityType.NONE;
|
|
|
switch (iUserAuthorityType)
|
|
|
{
|
|
|
case 0:
|
|
|
resultType = AuthorityType.ALL;
|
|
|
break;
|
|
|
case 1:
|
|
|
resultType = AuthorityType.BYSUBCOMPANY;
|
|
|
break;
|
|
|
case 2:
|
|
|
resultType = AuthorityType.BYDEPARTMENT;
|
|
|
break;
|
|
|
case 3:
|
|
|
resultType = AuthorityType.BYPERSONAL;
|
|
|
break;
|
|
|
case 4:
|
|
|
resultType = AuthorityType.NONE;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
return resultType;
|
|
|
}
|
|
|
|
|
|
public AuthorityType VisibleType
|
|
|
{
|
|
|
get{ return _visibleType;}
|
|
|
}
|
|
|
|
|
|
public AuthorityType OperateType
|
|
|
{
|
|
|
get{ return _operateType;}
|
|
|
}
|
|
|
}
|
|
|
public enum AuthorityType
|
|
|
{
|
|
|
ALL = 0,
|
|
|
BYSUBCOMPANY = 1,
|
|
|
BYDEPARTMENT = 2,
|
|
|
BYPERSONAL = 3,
|
|
|
NONE = 4,
|
|
|
NULL = 5
|
|
|
}
|
|
|
|
|
|
public enum ModuleType
|
|
|
{
|
|
|
OPSEAEFEE = 0,
|
|
|
FEEAUDIT = 1,
|
|
|
INVOICEMAKEOUT = 2,
|
|
|
INVOICEAPPLIST = 3,
|
|
|
INVOICEAPPSEARCH = 4,
|
|
|
INVOICEIMPORT = 5,
|
|
|
PAYSETTLELIST = 6,
|
|
|
PAYSETTLESEARCH = 7,
|
|
|
PAYSETTLEAPPSEARCH = 8,
|
|
|
PAYSETTLEAPPLIST = 9,
|
|
|
RECVSETTLESEARCH = 10,
|
|
|
RECVSETTLELIST = 11,
|
|
|
SEAEORDERLIST = 12,
|
|
|
OPSEAELIST = 13,
|
|
|
RECVFEE = 14,
|
|
|
PAYFEE = 15,
|
|
|
OPSEAILIST = 16,
|
|
|
SEAIRECVFEE = 17,
|
|
|
SEAIPAYFEE = 18,
|
|
|
WMSOUTLIST=19,
|
|
|
WMSOUTRECVFEE=20,
|
|
|
WMSOUTPAYFEE=21,
|
|
|
|
|
|
OPSEANLIST=22,//应收费用添加
|
|
|
SEANRECVFEE = 23,//应收费用审核
|
|
|
SEANPAYFEE=24,//应付费用审核
|
|
|
|
|
|
RECVSETTLEAPPSEARCH = 25//收费申请查询,在数据库中无工作流数据,在此只是充当变量用
|
|
|
}
|
|
|
}
|