uo_fj_printbill.sru 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. $PBExportHeader$uo_fj_printbill.sru
  2. forward
  3. global type uo_fj_printbill from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_fj_printbill from nonvisualobject
  7. end type
  8. global uo_fj_printbill uo_fj_printbill
  9. forward prototypes
  10. public function string f_getfilepath_pic (long arg_mtrlid, string arg_classname, string arg_dwname)
  11. public function string f_getfilepath (long arg_mtrlid, string arg_classname, string arg_dwname)
  12. public function string f_getfilepath_pic_bill (long arg_billtype, long arg_relid, long arg_relid_mx, string arg_classname, string arg_dwname)
  13. end prototypes
  14. public function string f_getfilepath_pic (long arg_mtrlid, string arg_classname, string arg_dwname);String rslt = ''
  15. Long ll_classid,ll_fileid,cnt
  16. String Pathname,ls_filename,ls_filetype
  17. String errmsg
  18. Blob ls_filedata
  19. SetNull(ls_filedata)
  20. IF arg_classname = '' THEN
  21. SELECT top 1 classid
  22. INTO :ll_classid
  23. FROM u_billpic_fileclass
  24. Where billtype = 201;
  25. IF sqlca.SQLCode <> 0 THEN ll_classid = 0
  26. ELSE
  27. SELECT classid
  28. INTO :ll_classid
  29. FROM U_FileClass
  30. WHERE ClassName = :arg_classname AND
  31. billtype = 201;
  32. SELECT count(*)
  33. INTO :cnt
  34. FROM u_billpic_fileclass
  35. Where classid = :ll_classid;
  36. IF sqlca.SQLCode <> 0 THEN cnt = 0
  37. IF cnt = 0 THEN ll_classid = 0
  38. END IF
  39. IF ll_classid > 0 THEN
  40. SELECT top 1 fileid,DisplayName,FileType INTO :ll_fileid,:ls_filename,:ls_filetype
  41. FROM u_file
  42. WHERE relid = :arg_mtrlid
  43. AND classid = :ll_classid
  44. AND (filetype = 'bmp' OR filetype = 'rle' OR filetype = 'wmf'
  45. OR filetype = 'tif' OR filetype = 'jpg' OR filetype = 'gif' OR filetype = 'jpeg')
  46. USING sys_fileDB_sqlca;
  47. IF sys_fileDB_sqlca.SQLCode <> 0 THEN
  48. ll_fileid = 0
  49. END IF
  50. IF ll_fileid > 0 THEN
  51. Pathname = sys_cur_path+ins_fjtemppath+'\' + String(sys_empid) + '_' + arg_dwname + '_' + string(ll_fileid) + '_' + ls_filename+'.'+ls_filetype
  52. IF Trim(Pathname) <> '' THEN
  53. IF NOT FileExists ( Pathname ) THEN
  54. SetNull(ls_filedata)
  55. SELECTBLOB filedata
  56. INTO:ls_filedata
  57. FROM u_file
  58. Where fileid = :ll_fileid USING sys_fileDB_sqlca;
  59. IF sys_fileDB_sqlca.SQLCode <> 0 THEN
  60. rslt = ''
  61. GOTO ext
  62. END IF
  63. IF f_saveblobtofile(ls_filedata,Pathname,errmsg) = 0 THEN
  64. rslt = ''
  65. GOTO ext
  66. ELSE
  67. rslt = Pathname
  68. END IF
  69. ELSE
  70. rslt = Pathname
  71. END IF
  72. ELSE
  73. rslt = ''
  74. GOTO ext
  75. END IF
  76. ELSE
  77. rslt = ''
  78. GOTO ext
  79. END IF
  80. END IF
  81. ext:
  82. RETURN rslt
  83. end function
  84. public function string f_getfilepath (long arg_mtrlid, string arg_classname, string arg_dwname);String rslt = ''
  85. Long ll_classid,ll_fileid,cnt
  86. String Pathname,ls_filename,ls_filetype
  87. String errmsg
  88. Blob ls_filedata
  89. SetNull(ls_filedata)
  90. IF arg_classname = '' THEN
  91. SELECT top 1 classid
  92. INTO :ll_classid
  93. FROM u_billpic_fileclass
  94. Where billtype = 201;
  95. IF sqlca.SQLCode <> 0 THEN ll_classid = 0
  96. ELSE
  97. SELECT classid
  98. INTO :ll_classid
  99. FROM U_FileClass
  100. WHERE ClassName = :arg_classname AND
  101. billtype = 201;
  102. SELECT count(*)
  103. INTO :cnt
  104. FROM u_billpic_fileclass
  105. Where classid = :ll_classid;
  106. IF sqlca.SQLCode <> 0 THEN cnt = 0
  107. IF cnt = 0 THEN ll_classid = 0
  108. END IF
  109. IF ll_classid > 0 THEN
  110. SELECT top 1 fileid,DisplayName,FileType INTO :ll_fileid,:ls_filename,:ls_filetype
  111. FROM u_file
  112. WHERE relid = :arg_mtrlid
  113. AND classid = :ll_classid
  114. AND (filetype = 'bmp' OR filetype = 'rle' OR filetype = 'wmf'
  115. OR filetype = 'tif' OR filetype = 'jpg' OR filetype = 'gif' OR filetype = 'jpeg')
  116. USING sys_fileDB_sqlca;
  117. IF sys_fileDB_sqlca.SQLCode <> 0 THEN
  118. ll_fileid = 0
  119. END IF
  120. IF ll_fileid > 0 THEN
  121. Pathname = sys_cur_path+ins_fjtemppath+'\' + String(sys_empid) + '_' + arg_dwname + '_' + ls_filename+'.'+ls_filetype
  122. ELSE
  123. rslt = ''
  124. GOTO ext
  125. END IF
  126. END IF
  127. ext:
  128. RETURN rslt
  129. end function
  130. 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 = ''
  131. Long ll_classid,ll_fileid,cnt
  132. String Pathname,ls_filename,ls_filetype
  133. String errmsg
  134. Blob ls_filedata
  135. SetNull(ls_filedata)
  136. IF arg_classname = '' THEN
  137. rslt = ''
  138. GOTO ext
  139. END IF
  140. SELECT classid
  141. INTO :ll_classid
  142. FROM U_FileClass
  143. WHERE ClassName = :arg_classname AND
  144. billtype = :arg_billtype;
  145. IF sqlca.SQLCode <> 0 THEN ll_classid = 0
  146. IF ll_classid = 0 THEN
  147. rslt = ''
  148. GOTO ext
  149. END IF
  150. IF ll_classid > 0 THEN
  151. SELECT top 1 fileid,DisplayName,FileType INTO :ll_fileid,:ls_filename,:ls_filetype
  152. FROM u_file
  153. WHERE relid = :arg_relid
  154. AND relid_mx = :arg_relid_mx
  155. AND classid = :ll_classid
  156. AND (filetype = 'bmp' OR filetype = 'rle' OR filetype = 'wmf'
  157. OR filetype = 'tif' OR filetype = 'jpg' OR filetype = 'gif' OR filetype = 'jpeg')
  158. Using sys_fileDB_sqlca;
  159. IF sys_fileDB_sqlca.SQLCode <> 0 THEN
  160. ll_fileid = 0
  161. END IF
  162. IF ll_fileid > 0 THEN
  163. Pathname = sys_cur_path+ins_fjtemppath+'\' + String(sys_empid) + '_' + arg_dwname + '_' + ls_filename+'.'+ls_filetype
  164. IF Trim(Pathname) <> '' THEN
  165. IF Not FileExists ( Pathname ) THEN
  166. SetNull(ls_filedata)
  167. SelectBlob filedata
  168. Into:ls_filedata
  169. From u_file
  170. Where fileid = :ll_fileid Using sys_fileDB_sqlca;
  171. IF sys_fileDB_sqlca.SQLCode <> 0 THEN
  172. rslt = ''
  173. GOTO ext
  174. END IF
  175. IF f_saveblobtofile(ls_filedata,Pathname,errmsg) = 0 THEN
  176. rslt = ''
  177. GOTO ext
  178. ELSE
  179. rslt = Pathname
  180. END IF
  181. ELSE
  182. rslt = Pathname
  183. END IF
  184. ELSE
  185. rslt = ''
  186. GOTO ext
  187. END IF
  188. ELSE
  189. rslt = ''
  190. GOTO ext
  191. END IF
  192. END IF
  193. ext:
  194. RETURN rslt
  195. end function
  196. on uo_fj_printbill.create
  197. call super::create
  198. TriggerEvent( this, "constructor" )
  199. end on
  200. on uo_fj_printbill.destroy
  201. TriggerEvent( this, "destructor" )
  202. call super::destroy
  203. end on