$PBExportHeader$f_get_filenum.srf
global type f_get_filenum from function_object
end type

forward prototypes
global function long f_get_filenum (long arg_billtype, integer arg_scid, long arg_relid, string arg_relid_mx)
global function long f_get_filenum (long arg_billtype, integer arg_scid, long arg_relid, long arg_relid_mx, string arg_relcode)
end prototypes

global function long f_get_filenum (long arg_billtype, integer arg_scid, long arg_relid, string arg_relid_mx);Long num












RETURN NUM
end function

global function long f_get_filenum (long arg_billtype, integer arg_scid, long arg_relid, long arg_relid_mx, string arg_relcode);Long num

SELECT count(*)
INTO :NUM
FROM u_file
WHERE billtype = :arg_billtype
	AND scid = :arg_scid
	AND relid = :arg_relid
	AND relid_mx = :arg_relid_mx
	AND relcode = :arg_relcode USING sys_fileDB_sqlca;
IF sys_fileDB_sqlca.SQLCODE <> 0 THEN
	NUM = 0
END IF


RETURN NUM
end function

