123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- $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
|