$PBExportHeader$f_cusorspt_name.srf global type f_cusorspt_name from function_object end type forward prototypes global function string f_cusorspt_name (long arg_relid, long arg_repid) global function string f_cusorspt_name (integer arg_reltype, long arg_relid, long arg_repid) end prototypes global function string f_cusorspt_name (long arg_relid, long arg_repid);string ls_name return ls_name end function global function string f_cusorspt_name (integer arg_reltype, long arg_relid, long arg_repid);String ls_name,ls_name1,ls_name2 IF arg_reltype = 0 THEN IF arg_repid = 0 THEN SELECT Top 1 u_cust.Name Into :ls_name1 From u_cust Where u_cust.cusid = :arg_relid; SELECT Top 1 u_cust.rep Into :ls_name2 From u_cust Where u_cust.cusid = :arg_relid; ls_name = ls_name1+'_' +ls_name2 ELSE SELECT Top 1 u_cust.Name Into :ls_name1 From u_cust Where u_cust.cusid = :arg_relid; SELECT Top 1 u_cust_rep.repname Into :ls_name2 From u_cust_rep Where u_cust_rep.cusid = :arg_relid and u_cust_rep.repid = :arg_repid; ls_name = ls_name1+'_' +ls_name2 END IF ELSEIF arg_reltype = 1 THEN IF arg_repid = 0 THEN SELECT Top 1 u_spt.Name Into :ls_name1 From u_spt Where u_spt.sptid = :arg_relid; SELECT Top 1 u_spt.rep Into :ls_name2 From u_spt Where u_spt.sptid = :arg_relid; ls_name = ls_name1+'_' +ls_name2 ELSE SELECT Top 1 u_spt.Name Into :ls_name1 From u_spt Where u_spt.sptid = :arg_relid; SELECT Top 1 u_spt_rep.repname Into :ls_name2 From u_spt_rep Where u_spt_rep.sptid = :arg_relid and u_spt_rep.repid = :arg_repid ; ls_name = ls_name1+'_' +ls_name2 END IF ELSEIF arg_reltype = 2 THEN select u_rep_group.groupname into :ls_name2 from u_rep_group where u_rep_group.groupid= :arg_relid; ls_name = '自定义组_' +ls_name2 END IF RETURN ls_name end function