w_fj_bill_mng_imexport.srw 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. $PBExportHeader$w_fj_bill_mng_imexport.srw
  2. forward
  3. global type w_fj_bill_mng_imexport from w_publ_base
  4. end type
  5. type sle_filename from singlelineedit within w_fj_bill_mng_imexport
  6. end type
  7. type cb_1 from uo_imflatbutton within w_fj_bill_mng_imexport
  8. end type
  9. type cb_import from uo_imflatbutton within w_fj_bill_mng_imexport
  10. end type
  11. type cb_export from uo_imflatbutton within w_fj_bill_mng_imexport
  12. end type
  13. type sle_filename1 from singlelineedit within w_fj_bill_mng_imexport
  14. end type
  15. type cb_2 from uo_imflatbutton within w_fj_bill_mng_imexport
  16. end type
  17. type gb_1 from groupbox within w_fj_bill_mng_imexport
  18. end type
  19. type gb_2 from groupbox within w_fj_bill_mng_imexport
  20. end type
  21. end forward
  22. global type w_fj_bill_mng_imexport from w_publ_base
  23. integer width = 2235
  24. integer height = 760
  25. string title = "导入导出单据附件分类"
  26. boolean minbox = false
  27. windowtype windowtype = response!
  28. long backcolor = 67108864
  29. sle_filename sle_filename
  30. cb_1 cb_1
  31. cb_import cb_import
  32. cb_export cb_export
  33. sle_filename1 sle_filename1
  34. cb_2 cb_2
  35. gb_1 gb_1
  36. gb_2 gb_2
  37. end type
  38. global w_fj_bill_mng_imexport w_fj_bill_mng_imexport
  39. type variables
  40. end variables
  41. on w_fj_bill_mng_imexport.create
  42. int iCurrent
  43. call super::create
  44. this.sle_filename=create sle_filename
  45. this.cb_1=create cb_1
  46. this.cb_import=create cb_import
  47. this.cb_export=create cb_export
  48. this.sle_filename1=create sle_filename1
  49. this.cb_2=create cb_2
  50. this.gb_1=create gb_1
  51. this.gb_2=create gb_2
  52. iCurrent=UpperBound(this.Control)
  53. this.Control[iCurrent+1]=this.sle_filename
  54. this.Control[iCurrent+2]=this.cb_1
  55. this.Control[iCurrent+3]=this.cb_import
  56. this.Control[iCurrent+4]=this.cb_export
  57. this.Control[iCurrent+5]=this.sle_filename1
  58. this.Control[iCurrent+6]=this.cb_2
  59. this.Control[iCurrent+7]=this.gb_1
  60. this.Control[iCurrent+8]=this.gb_2
  61. end on
  62. on w_fj_bill_mng_imexport.destroy
  63. call super::destroy
  64. destroy(this.sle_filename)
  65. destroy(this.cb_1)
  66. destroy(this.cb_import)
  67. destroy(this.cb_export)
  68. destroy(this.sle_filename1)
  69. destroy(this.cb_2)
  70. destroy(this.gb_1)
  71. destroy(this.gb_2)
  72. end on
  73. type cb_func from w_publ_base`cb_func within w_fj_bill_mng_imexport
  74. boolean visible = false
  75. end type
  76. type cb_exit from w_publ_base`cb_exit within w_fj_bill_mng_imexport
  77. integer x = 1824
  78. integer y = 552
  79. integer width = 325
  80. end type
  81. type sle_filename from singlelineedit within w_fj_bill_mng_imexport
  82. integer x = 91
  83. integer y = 116
  84. integer width = 1586
  85. integer height = 92
  86. integer taborder = 30
  87. boolean bringtotop = true
  88. integer textsize = -9
  89. integer weight = 400
  90. fontcharset fontcharset = gb2312charset!
  91. fontpitch fontpitch = variable!
  92. string facename = "宋体"
  93. long textcolor = 33554432
  94. borderstyle borderstyle = stylelowered!
  95. end type
  96. type cb_1 from uo_imflatbutton within w_fj_bill_mng_imexport
  97. integer x = 1701
  98. integer y = 116
  99. integer width = 114
  100. integer height = 96
  101. integer taborder = 40
  102. boolean bringtotop = true
  103. string text = "..."
  104. end type
  105. event clicked;call super::clicked;
  106. integer i
  107. string pathname
  108. string filename
  109. i = getfilesavename("选择文件",pathname,filename,"Dbf","数据文件Dbf,*.Dbf")
  110. if i = 1 and trim(pathname) <> "" and trim(filename) <> "" then
  111. parent.sle_filename.text = pathname
  112. end if
  113. return
  114. end event
  115. type cb_import from uo_imflatbutton within w_fj_bill_mng_imexport
  116. integer x = 1815
  117. integer y = 116
  118. integer width = 325
  119. integer height = 96
  120. integer taborder = 40
  121. boolean bringtotop = true
  122. string text = "导入"
  123. end type
  124. event clicked;call super::clicked;Long ll_i
  125. IF NOT sys_power_issuper THEN
  126. MessageBox('提示','你没有使用权限!',information!,OK!)
  127. RETURN
  128. END IF
  129. datastore ds_field
  130. String arg_filename
  131. arg_filename = Trim(sle_filename.Text)
  132. IF arg_filename = '' THEN
  133. MessageBox('提示','请输入文件名称',information!,OK!)
  134. RETURN
  135. END IF
  136. ds_field = CREATE datastore
  137. ds_field.DataObject = 'dw_fileclass'
  138. ds_field.SetTransObject(sqlca)
  139. ds_field.ImportFile(arg_filename)
  140. ds_field.AcceptText()
  141. IF ds_field.RowCount() <= 0 THEN
  142. MessageBox('提示','你导入的单据附件分类文件没有数据',information!,OK!)
  143. RETURN
  144. END IF
  145. DELETE FROM pbcatcol;
  146. IF sqlca.SQLCode <> 0 THEN
  147. MessageBox('错误','删除原单据附件分类数据失败,'+sqlca.SQLErrText,stopsign!,OK!)
  148. RETURN
  149. END IF
  150. long ClassID
  151. string ClassName
  152. string Dscrp
  153. long billtype
  154. FOR ll_i = 1 TO ds_field.RowCount()
  155. ClassID = ds_field.Object.ClassID[ll_i]
  156. ClassName = ds_field.Object.ClassName[ll_i]
  157. Dscrp = ds_field.Object.Dscrp[ll_i]
  158. billtype = ds_field.Object.billtype[ll_i]
  159. INSERT INTO u_fileclass(
  160. ClassID ,
  161. ClassName ,
  162. Dscrp,
  163. billtype
  164. )
  165. VALUES(
  166. :ClassID ,
  167. :ClassName ,
  168. :Dscrp,
  169. :billtype );
  170. IF sqlca.SQLCode <> 0 THEN
  171. MessageBox('错误','导入单据附件分类数据失败,'+sqlca.SQLErrText,stopsign!,OK!)
  172. RETURN
  173. END IF
  174. NEXT
  175. COMMIT;
  176. MessageBox('提示','导入单据附件分类数据成功',information!,OK!)
  177. end event
  178. type cb_export from uo_imflatbutton within w_fj_bill_mng_imexport
  179. integer x = 1815
  180. integer y = 368
  181. integer width = 325
  182. integer height = 96
  183. integer taborder = 40
  184. boolean bringtotop = true
  185. string text = "导出"
  186. end type
  187. event clicked;call super::clicked;
  188. string arg_filename,arg_msg
  189. blob arg_blob
  190. arg_filename = trim(sle_filename1.text)
  191. if arg_filename = '' then
  192. messagebox('提示','请输入文件名称',information!,OK!)
  193. return
  194. end if
  195. if messagebox("询问","是否确定要将单据附件分类导出成文件",question!,yesno!,1) = 2 then
  196. return
  197. end if
  198. datastore ds_field
  199. ds_field = create datastore
  200. ds_field.dataobject = 'dw_fileclass'
  201. ds_field.settransobject(sqlca)
  202. ds_field.retrieve(-1)
  203. if fileexists(arg_filename) then
  204. if messagebox("询问","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 then
  205. return
  206. end if
  207. end if
  208. if ds_field.saveas(arg_filename,dBASE3!,false) = 1 then
  209. arg_msg = '数据导出成功!'
  210. else
  211. arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!'
  212. end if
  213. messagebox('提示',arg_msg,information!,OK!)
  214. end event
  215. type sle_filename1 from singlelineedit within w_fj_bill_mng_imexport
  216. integer x = 91
  217. integer y = 368
  218. integer width = 1586
  219. integer height = 92
  220. integer taborder = 40
  221. boolean bringtotop = true
  222. integer textsize = -9
  223. integer weight = 400
  224. fontcharset fontcharset = gb2312charset!
  225. fontpitch fontpitch = variable!
  226. string facename = "宋体"
  227. long textcolor = 33554432
  228. borderstyle borderstyle = stylelowered!
  229. end type
  230. type cb_2 from uo_imflatbutton within w_fj_bill_mng_imexport
  231. integer x = 1701
  232. integer y = 368
  233. integer width = 114
  234. integer height = 96
  235. integer taborder = 50
  236. boolean bringtotop = true
  237. string text = "..."
  238. end type
  239. event clicked;call super::clicked;
  240. integer i
  241. string pathname
  242. string filename
  243. i = getfilesavename("选择文件",pathname,filename,"Dbf","数据文件Dbf,*.Dbf")
  244. if i = 1 and trim(pathname) <> "" and trim(filename) <> "" then
  245. parent.sle_filename1.text = pathname
  246. end if
  247. return
  248. end event
  249. type gb_1 from groupbox within w_fj_bill_mng_imexport
  250. integer x = 59
  251. integer y = 48
  252. integer width = 2107
  253. integer height = 216
  254. integer taborder = 10
  255. integer textsize = -9
  256. integer weight = 400
  257. fontcharset fontcharset = gb2312charset!
  258. fontpitch fontpitch = variable!
  259. string facename = "宋体"
  260. long textcolor = 33554432
  261. long backcolor = 79741120
  262. string text = "导入文件路径"
  263. end type
  264. type gb_2 from groupbox within w_fj_bill_mng_imexport
  265. integer x = 59
  266. integer y = 300
  267. integer width = 2107
  268. integer height = 216
  269. integer taborder = 20
  270. integer textsize = -9
  271. integer weight = 400
  272. fontcharset fontcharset = gb2312charset!
  273. fontpitch fontpitch = variable!
  274. string facename = "宋体"
  275. long textcolor = 33554432
  276. long backcolor = 79741120
  277. string text = "导出文件路径"
  278. end type