Fun_GetLookCustomer.md 1.41 KB

Fun_GetLookCustomer (function)

获取客户查看权限

  • Type: FUNCTION
  • Returns: longtext
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sLogin_id varchar(255)
2 IN sBr_id varchar(255)
3 IN sSu_id varchar(255)

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFunGetLookCustomer'._

Narrative

Business context: Customer data-scope filter — when system setting CkxLookCustomer = 1 and the caller is not sysadmin, returns the comma-separated EleCustomer.sId list this login is allowed to see (joined through sftlogininfocustomergroup.sSalesManId); otherwise returns '' meaning "no restriction".

What it does: Reads SysSystemSettings.CkxLookCustomer, checks SftLoginInfo.sType, then GROUP_CONCATs the customer IDs assigned to the login's permission group.

Invocation: Embedded as an IN (Fun_GetLookCustomer(...)) filter clause in sales / receivables / manufacturing reports — called by Sp_financial_CustomerGrossProfit, Sp_financial_OrderGrossProfit* (multiple variants), Sp_financial_SaleManGrossProfit, Sp_financial_EasyCost, Sp_Manufacture_MftPlanPhase*, Sp_Manufacture_ProcessReport, Sp_Manufacture_ProductionArrange, Sp_Inventory_ProductInOutStore_new, Sp_GetOrder_Process, etc.