$PBExportHeader$uo_fj_printbill.sru forward global type uo_fj_printbill from nonvisualobject end type end forward global type uo_fj_printbill from nonvisualobject end type global uo_fj_printbill uo_fj_printbill forward prototypes public function string f_getfilepath_pic (long arg_mtrlid, string arg_classname, string arg_dwname) public function string f_getfilepath (long arg_mtrlid, string arg_classname, string arg_dwname) public function string f_getfilepath_pic_bill (long arg_billtype, long arg_relid, long arg_relid_mx, string arg_classname, string arg_dwname) end prototypes public function string f_getfilepath_pic (long arg_mtrlid, string arg_classname, string arg_dwname);String rslt = '' Long ll_classid,ll_fileid,cnt String Pathname,ls_filename,ls_filetype String errmsg Blob ls_filedata SetNull(ls_filedata) IF arg_classname = '' THEN SELECT top 1 classid INTO :ll_classid FROM u_billpic_fileclass Where billtype = 201; IF sqlca.SQLCode <> 0 THEN ll_classid = 0 ELSE SELECT classid INTO :ll_classid FROM U_FileClass WHERE ClassName = :arg_classname AND billtype = 201; SELECT count(*) INTO :cnt FROM u_billpic_fileclass Where classid = :ll_classid; IF sqlca.SQLCode <> 0 THEN cnt = 0 IF cnt = 0 THEN ll_classid = 0 END IF IF ll_classid > 0 THEN SELECT top 1 fileid,DisplayName,FileType INTO :ll_fileid,:ls_filename,:ls_filetype FROM u_file WHERE relid = :arg_mtrlid AND classid = :ll_classid AND (filetype = 'bmp' OR filetype = 'rle' OR filetype = 'wmf' OR filetype = 'tif' OR filetype = 'jpg' OR filetype = 'gif' OR filetype = 'jpeg') USING sys_fileDB_sqlca; IF sys_fileDB_sqlca.SQLCode <> 0 THEN ll_fileid = 0 END IF IF ll_fileid > 0 THEN Pathname = sys_cur_path+ins_fjtemppath+'\' + String(sys_empid) + '_' + arg_dwname + '_' + string(ll_fileid) + '_' + ls_filename+'.'+ls_filetype IF Trim(Pathname) <> '' THEN IF NOT FileExists ( Pathname ) THEN SetNull(ls_filedata) SELECTBLOB filedata INTO:ls_filedata FROM u_file Where fileid = :ll_fileid USING sys_fileDB_sqlca; IF sys_fileDB_sqlca.SQLCode <> 0 THEN rslt = '' GOTO ext END IF IF f_saveblobtofile(ls_filedata,Pathname,errmsg) = 0 THEN rslt = '' GOTO ext ELSE rslt = Pathname END IF ELSE rslt = Pathname END IF ELSE rslt = '' GOTO ext END IF ELSE rslt = '' GOTO ext END IF END IF ext: RETURN rslt end function public function string f_getfilepath (long arg_mtrlid, string arg_classname, string arg_dwname);String rslt = '' Long ll_classid,ll_fileid,cnt String Pathname,ls_filename,ls_filetype String errmsg Blob ls_filedata SetNull(ls_filedata) IF arg_classname = '' THEN SELECT top 1 classid INTO :ll_classid FROM u_billpic_fileclass Where billtype = 201; IF sqlca.SQLCode <> 0 THEN ll_classid = 0 ELSE SELECT classid INTO :ll_classid FROM U_FileClass WHERE ClassName = :arg_classname AND billtype = 201; SELECT count(*) INTO :cnt FROM u_billpic_fileclass Where classid = :ll_classid; IF sqlca.SQLCode <> 0 THEN cnt = 0 IF cnt = 0 THEN ll_classid = 0 END IF IF ll_classid > 0 THEN SELECT top 1 fileid,DisplayName,FileType INTO :ll_fileid,:ls_filename,:ls_filetype FROM u_file WHERE relid = :arg_mtrlid AND classid = :ll_classid AND (filetype = 'bmp' OR filetype = 'rle' OR filetype = 'wmf' OR filetype = 'tif' OR filetype = 'jpg' OR filetype = 'gif' OR filetype = 'jpeg') USING sys_fileDB_sqlca; IF sys_fileDB_sqlca.SQLCode <> 0 THEN ll_fileid = 0 END IF IF ll_fileid > 0 THEN Pathname = sys_cur_path+ins_fjtemppath+'\' + String(sys_empid) + '_' + arg_dwname + '_' + ls_filename+'.'+ls_filetype ELSE rslt = '' GOTO ext END IF END IF ext: RETURN rslt end function public function string f_getfilepath_pic_bill (long arg_billtype, long arg_relid, long arg_relid_mx, string arg_classname, string arg_dwname);String rslt = '' Long ll_classid,ll_fileid,cnt String Pathname,ls_filename,ls_filetype String errmsg Blob ls_filedata SetNull(ls_filedata) IF arg_classname = '' THEN rslt = '' GOTO ext END IF SELECT classid INTO :ll_classid FROM U_FileClass WHERE ClassName = :arg_classname AND billtype = :arg_billtype; IF sqlca.SQLCode <> 0 THEN ll_classid = 0 IF ll_classid = 0 THEN rslt = '' GOTO ext END IF IF ll_classid > 0 THEN SELECT top 1 fileid,DisplayName,FileType INTO :ll_fileid,:ls_filename,:ls_filetype FROM u_file WHERE relid = :arg_relid AND relid_mx = :arg_relid_mx AND classid = :ll_classid AND (filetype = 'bmp' OR filetype = 'rle' OR filetype = 'wmf' OR filetype = 'tif' OR filetype = 'jpg' OR filetype = 'gif' OR filetype = 'jpeg') Using sys_fileDB_sqlca; IF sys_fileDB_sqlca.SQLCode <> 0 THEN ll_fileid = 0 END IF IF ll_fileid > 0 THEN Pathname = sys_cur_path+ins_fjtemppath+'\' + String(sys_empid) + '_' + arg_dwname + '_' + ls_filename+'.'+ls_filetype IF Trim(Pathname) <> '' THEN IF Not FileExists ( Pathname ) THEN SetNull(ls_filedata) SelectBlob filedata Into:ls_filedata From u_file Where fileid = :ll_fileid Using sys_fileDB_sqlca; IF sys_fileDB_sqlca.SQLCode <> 0 THEN rslt = '' GOTO ext END IF IF f_saveblobtofile(ls_filedata,Pathname,errmsg) = 0 THEN rslt = '' GOTO ext ELSE rslt = Pathname END IF ELSE rslt = Pathname END IF ELSE rslt = '' GOTO ext END IF ELSE rslt = '' GOTO ext END IF END IF ext: RETURN rslt end function on uo_fj_printbill.create call super::create TriggerEvent( this, "constructor" ) end on on uo_fj_printbill.destroy TriggerEvent( this, "destructor" ) call super::destroy end on