f_get_filenum.srf 939 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. $PBExportHeader$f_get_filenum.srf
  2. global type f_get_filenum from function_object
  3. end type
  4. forward prototypes
  5. global function long f_get_filenum (long arg_billtype, integer arg_scid, long arg_relid, string arg_relid_mx)
  6. global function long f_get_filenum (long arg_billtype, integer arg_scid, long arg_relid, long arg_relid_mx, string arg_relcode)
  7. end prototypes
  8. global function long f_get_filenum (long arg_billtype, integer arg_scid, long arg_relid, string arg_relid_mx);Long num
  9. RETURN NUM
  10. end function
  11. global function long f_get_filenum (long arg_billtype, integer arg_scid, long arg_relid, long arg_relid_mx, string arg_relcode);Long num
  12. SELECT count(*)
  13. INTO :NUM
  14. FROM u_file
  15. WHERE billtype = :arg_billtype
  16. AND scid = :arg_scid
  17. AND relid = :arg_relid
  18. AND relid_mx = :arg_relid_mx
  19. AND relcode = :arg_relcode USING sys_fileDB_sqlca;
  20. IF sys_fileDB_sqlca.SQLCODE <> 0 THEN
  21. NUM = 0
  22. END IF
  23. RETURN NUM
  24. end function