f_cusorspt_name.srf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. $PBExportHeader$f_cusorspt_name.srf
  2. global type f_cusorspt_name from function_object
  3. end type
  4. forward prototypes
  5. global function string f_cusorspt_name (long arg_relid, long arg_repid)
  6. global function string f_cusorspt_name (integer arg_reltype, long arg_relid, long arg_repid)
  7. end prototypes
  8. global function string f_cusorspt_name (long arg_relid, long arg_repid);string ls_name
  9. return ls_name
  10. end function
  11. global function string f_cusorspt_name (integer arg_reltype, long arg_relid, long arg_repid);String ls_name,ls_name1,ls_name2
  12. IF arg_reltype = 0 THEN
  13. IF arg_repid = 0 THEN
  14. SELECT Top 1 u_cust.Name Into :ls_name1 From u_cust Where u_cust.cusid = :arg_relid;
  15. SELECT Top 1 u_cust.rep Into :ls_name2 From u_cust Where u_cust.cusid = :arg_relid;
  16. ls_name = ls_name1+'_' +ls_name2
  17. ELSE
  18. SELECT Top 1 u_cust.Name Into :ls_name1 From u_cust Where u_cust.cusid = :arg_relid;
  19. 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;
  20. ls_name = ls_name1+'_' +ls_name2
  21. END IF
  22. ELSEIF arg_reltype = 1 THEN
  23. IF arg_repid = 0 THEN
  24. SELECT Top 1 u_spt.Name Into :ls_name1 From u_spt Where u_spt.sptid = :arg_relid;
  25. SELECT Top 1 u_spt.rep Into :ls_name2 From u_spt Where u_spt.sptid = :arg_relid;
  26. ls_name = ls_name1+'_' +ls_name2
  27. ELSE
  28. SELECT Top 1 u_spt.Name Into :ls_name1 From u_spt Where u_spt.sptid = :arg_relid;
  29. 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 ;
  30. ls_name = ls_name1+'_' +ls_name2
  31. END IF
  32. ELSEIF arg_reltype = 2 THEN
  33. select u_rep_group.groupname into :ls_name2 from u_rep_group where u_rep_group.groupid= :arg_relid;
  34. ls_name = '自定义组_' +ls_name2
  35. END IF
  36. RETURN ls_name
  37. end function