f_open_win.srf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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);s_edit_index_tran s_tran
  8. s_tran.work_mode = 0
  9. s_tran.arg_pkid = 0
  10. s_tran.arg_string_code = arg_code
  11. s_tran.c_long = arg_scid
  12. s_tran.d_long = 2
  13. s_tran.if_retrieve_all = local_retrieve_all
  14. String ls_scname,ls_sccode
  15. String ls_space
  16. Int li_spacenum
  17. String ls_d_string
  18. Boolean if_f
  19. SELECT scname,sccode
  20. INTO :ls_scname,:ls_sccode
  21. FROM u_scdef
  22. Where scid = :arg_scid;
  23. IF sqlca.SQLCode <> 0 OR IsNull(ls_scname) THEN ls_scname = ''
  24. li_spacenum = 50 - Len(Trim(ls_scname)) - 2 - Len(String(arg_scid))
  25. ls_space = Fill(' ',li_spacenum)
  26. ls_d_string = ls_scname+ls_space+'['+String(arg_scid)+']'
  27. s_tran.d_string = ls_d_string
  28. String ls_billcode,ls_win1,ls_win2
  29. ls_billcode = Mid(Trim(arg_code),Len(ls_sccode) + 1,2)
  30. SELECT win1,win2
  31. INTO :ls_win1,:ls_win2
  32. FROM u_billcode
  33. Where firststr = :ls_billcode;
  34. IF sqlca.SQLCode <> 0 THEN
  35. if_f = FALSE
  36. ELSE
  37. if_f = TRUE
  38. END IF
  39. IF NOT if_f THEN
  40. SELECT win1,win2
  41. INTO :ls_win1,:ls_win2
  42. FROM u_billcode
  43. Where oldfirststr = :ls_billcode;
  44. IF sqlca.SQLCode <> 0 THEN
  45. if_f = FALSE
  46. ELSE
  47. if_f = TRUE
  48. END IF
  49. END IF
  50. IF if_f THEN
  51. window openwin
  52. OpenWithParm(openwin,s_tran,ls_win1)
  53. END IF
  54. RETURN 1
  55. end function