f_last_ctdate.srf 832 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $PBExportHeader$f_last_ctdate.srf
  2. global type f_last_ctdate from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_last_ctdate (ref datetime arg_ctdate, ref string arg_msg)
  6. end prototypes
  7. global function integer f_last_ctdate (ref datetime arg_ctdate, ref string arg_msg);//取最后截数时间
  8. Int rslt = 1
  9. Long cnt
  10. //IF sys_power_issuper THEN
  11. // rslt = 1
  12. // GOTO ext
  13. //END IF
  14. SELECT count(*) INTO :cnt
  15. From sys_ct_data;
  16. IF sqlca.SQLCode <> 0 THEN
  17. arg_msg = '查询系统是否曾经截数失败,'+sqlca.SQLErrText
  18. rslt = 0
  19. GOTO ext
  20. END IF
  21. IF cnt = 0 THEN
  22. rslt = 2
  23. GOTO ext
  24. END IF
  25. SELECT max(ct_datetime)
  26. INTO :arg_ctdate
  27. From sys_ct_data;
  28. IF sqlca.SQLCode <> 0 THEN
  29. rslt = 0
  30. arg_msg = '查询最后截数日期出错,'+sqlca.SQLErrText
  31. GOTO ext
  32. END IF
  33. ext:
  34. RETURN rslt
  35. end function