f_open_win.srf 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. $PBExportHeader$f_open_win.srf
  2. global type f_open_win from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_open_win (long arg_scid, string arg_code)
  6. end prototypes
  7. global function integer f_open_win (long arg_scid, string arg_code);//arg_w_name 可为空
  8. s_edit_index_tran s_tran
  9. s_tran.work_mode = 0
  10. s_tran.arg_pkid = 0
  11. s_tran.arg_string_code = arg_code
  12. s_tran.c_long = arg_scid
  13. s_tran.d_long = 2
  14. s_tran.if_retrieve_all = local_retrieve_all
  15. String ls_scname,ls_sccode
  16. String ls_space
  17. Int li_spacenum
  18. String ls_d_string
  19. Boolean if_f
  20. IF arg_scid = -1 THEN
  21. Long i, ll_scid
  22. String ls_code, ls_char
  23. ls_code = Reverse (arg_code)
  24. FOR i = 1 To Len(ls_code)
  25. IF Not IsNumber(Mid(ls_code, i, 1)) THEN
  26. EXIT
  27. END IF
  28. NEXT
  29. ls_sccode = Reverse (Mid(ls_code, i, 2))
  30. SELECT scid
  31. INTO :ll_scid
  32. FROM u_scdef
  33. Where sccode = :ls_sccode;
  34. IF sqlca.SQLCode <> 0 THEN
  35. ll_scid = 0
  36. END IF
  37. arg_scid = ll_scid
  38. END IF
  39. SELECT scname,sccode
  40. INTO :ls_scname,:ls_sccode
  41. FROM u_scdef
  42. Where scid = :arg_scid;
  43. IF sqlca.SQLCode <> 0 Or IsNull(ls_scname) THEN ls_scname = ''
  44. li_spacenum = 50 - Len(Trim(ls_scname)) - 2 - Len(String(arg_scid))
  45. ls_space = Fill(' ',li_spacenum)
  46. ls_d_string = ls_scname+ls_space+'['+String(arg_scid)+']'
  47. s_tran.d_string = ls_d_string
  48. String ls_billcode,ls_win1,ls_win2
  49. ls_billcode = Mid(Trim(arg_code),Len(ls_sccode) + 1,2)
  50. SELECT win1,win2
  51. INTO :ls_win1,:ls_win2
  52. FROM u_billcode
  53. Where firststr = :ls_billcode;
  54. IF sqlca.SQLCode <> 0 THEN
  55. if_f = False
  56. ELSE
  57. if_f = True
  58. END IF
  59. IF Not if_f THEN
  60. SELECT win1,win2
  61. INTO :ls_win1,:ls_win2
  62. FROM u_billcode
  63. Where oldfirststr = :ls_billcode;
  64. IF sqlca.SQLCode <> 0 THEN
  65. if_f = False
  66. ELSE
  67. if_f = True
  68. END IF
  69. END IF
  70. IF if_f THEN
  71. window openwin
  72. OpenWithParm(openwin,s_tran,ls_win1)
  73. END IF
  74. RETURN 1
  75. end function