w_rpt_imexport_table.srw 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. $PBExportHeader$w_rpt_imexport_table.srw
  2. forward
  3. global type w_rpt_imexport_table from w_publ_base
  4. end type
  5. type sle_filename from singlelineedit within w_rpt_imexport_table
  6. end type
  7. type cb_1 from uo_imflatbutton within w_rpt_imexport_table
  8. end type
  9. type cb_import from uo_imflatbutton within w_rpt_imexport_table
  10. end type
  11. type cb_export from uo_imflatbutton within w_rpt_imexport_table
  12. end type
  13. type sle_filename1 from singlelineedit within w_rpt_imexport_table
  14. end type
  15. type cb_2 from uo_imflatbutton within w_rpt_imexport_table
  16. end type
  17. type gb_1 from groupbox within w_rpt_imexport_table
  18. end type
  19. type gb_2 from groupbox within w_rpt_imexport_table
  20. end type
  21. end forward
  22. global type w_rpt_imexport_table 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_rpt_imexport_table w_rpt_imexport_table
  39. type variables
  40. end variables
  41. on w_rpt_imexport_table.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_rpt_imexport_table.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_rpt_imexport_table
  74. boolean visible = false
  75. end type
  76. type cb_exit from w_publ_base`cb_exit within w_rpt_imexport_table
  77. integer x = 1815
  78. integer y = 556
  79. integer width = 325
  80. end type
  81. type sle_filename from singlelineedit within w_rpt_imexport_table
  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_rpt_imexport_table
  97. integer x = 1691
  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_rpt_imexport_table
  116. integer x = 1806
  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_table
  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_table = CREATE datastore
  137. ds_table.DataObject = 'dw_rpt_table_def'
  138. ds_table.SetTransObject(sqlca)
  139. ds_table.ImportFile(arg_filename)
  140. ds_table.AcceptText()
  141. IF ds_table.RowCount() <= 0 THEN
  142. MessageBox('提示','你导入的数据库表文件没有数据',information!,OK!)
  143. RETURN
  144. END IF
  145. DELETE FROM u_report_table;
  146. IF sqlca.SQLCode <> 0 THEN
  147. MessageBox('错误','删除数据库表失败,'+sqlca.SQLErrText,stopsign!,OK!)
  148. RETURN
  149. END IF
  150. Long ll_tableid
  151. String ls_engish,ls_chinese
  152. FOR ll_i = 1 TO ds_table.RowCount()
  153. ll_tableid = ds_table.Object.tableID[ll_i]
  154. ls_engish = ds_table.Object.table_english[ll_i]
  155. ls_chinese = ds_table.Object.table_chinese[ll_i]
  156. INSERT INTO u_report_table(
  157. u_report_table.tableID ,
  158. u_report_table.table_english,
  159. u_report_table.table_chinese)
  160. VALUES(
  161. :ll_tableid ,
  162. :ls_engish,
  163. :ls_chinese);
  164. IF sqlca.SQLCode <> 0 THEN
  165. MessageBox('错误','删除原数据库表的数据失败,'+sqlca.SQLErrText,stopsign!,OK!)
  166. RETURN
  167. END IF
  168. NEXT
  169. COMMIT;
  170. MessageBox('提示','导入数据库表的数据成功',information!,OK!)
  171. end event
  172. type cb_export from uo_imflatbutton within w_rpt_imexport_table
  173. integer x = 1810
  174. integer y = 376
  175. integer width = 325
  176. integer height = 96
  177. integer taborder = 40
  178. boolean bringtotop = true
  179. string text = "导出"
  180. end type
  181. event clicked;call super::clicked;
  182. string arg_filename,arg_msg
  183. blob arg_blob
  184. arg_filename = trim(sle_filename1.text)
  185. if arg_filename = '' then
  186. messagebox('提示','请输入文件名称',information!,OK!)
  187. return
  188. end if
  189. if messagebox("询问","是否确定要将表信息导出成文件",question!,yesno!,1) = 2 then
  190. return
  191. end if
  192. datastore ds_table
  193. ds_table = create datastore
  194. ds_table.dataobject = 'dw_rpt_table_def'
  195. ds_table.settransobject(sqlca)
  196. ds_table.retrieve( )
  197. if fileexists(arg_filename) then
  198. if messagebox("询问","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 then
  199. return
  200. end if
  201. end if
  202. if ds_table.saveas(arg_filename,dbase2!,false) = 1 then
  203. arg_msg = '数据导出成功!'
  204. else
  205. arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!'
  206. end if
  207. messagebox('提示',arg_msg,information!,OK!)
  208. end event
  209. type sle_filename1 from singlelineedit within w_rpt_imexport_table
  210. integer x = 96
  211. integer y = 376
  212. integer width = 1586
  213. integer height = 92
  214. integer taborder = 40
  215. boolean bringtotop = true
  216. integer textsize = -9
  217. integer weight = 400
  218. fontcharset fontcharset = gb2312charset!
  219. fontpitch fontpitch = variable!
  220. string facename = "宋体"
  221. long textcolor = 33554432
  222. borderstyle borderstyle = stylelowered!
  223. end type
  224. type cb_2 from uo_imflatbutton within w_rpt_imexport_table
  225. integer x = 1696
  226. integer y = 376
  227. integer width = 114
  228. integer height = 96
  229. integer taborder = 50
  230. boolean bringtotop = true
  231. string text = "..."
  232. end type
  233. event clicked;call super::clicked;
  234. Integer i
  235. String Pathname
  236. String Filename
  237. i = GetFileSaveName("选择文件",Pathname,Filename,"Dbf","数据文件Dbf,*.Dbf")
  238. IF i = 1 AND Trim(Pathname) <> "" AND Trim(Filename) <> "" THEN
  239. PARENT.sle_filename1.Text = Pathname
  240. END IF
  241. RETURN
  242. end event
  243. type gb_1 from groupbox within w_rpt_imexport_table
  244. integer x = 55
  245. integer y = 48
  246. integer width = 2107
  247. integer height = 216
  248. integer taborder = 10
  249. integer textsize = -9
  250. integer weight = 400
  251. fontcharset fontcharset = gb2312charset!
  252. fontpitch fontpitch = variable!
  253. string facename = "宋体"
  254. long textcolor = 33554432
  255. long backcolor = 79741120
  256. string text = "导入文件路径"
  257. end type
  258. type gb_2 from groupbox within w_rpt_imexport_table
  259. integer x = 59
  260. integer y = 308
  261. integer width = 2107
  262. integer height = 216
  263. integer taborder = 20
  264. integer textsize = -9
  265. integer weight = 400
  266. fontcharset fontcharset = gb2312charset!
  267. fontpitch fontpitch = variable!
  268. string facename = "宋体"
  269. long textcolor = 33554432
  270. long backcolor = 79741120
  271. string text = "导出文件路径"
  272. end type