w_dwprint_dynamic_imexport.srw 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. $PBExportHeader$w_dwprint_dynamic_imexport.srw
  2. forward
  3. global type w_dwprint_dynamic_imexport from w_publ_base
  4. end type
  5. type sle_filename from singlelineedit within w_dwprint_dynamic_imexport
  6. end type
  7. type cb_1 from uo_imflatbutton within w_dwprint_dynamic_imexport
  8. end type
  9. type cb_import from uo_imflatbutton within w_dwprint_dynamic_imexport
  10. end type
  11. type cb_export from uo_imflatbutton within w_dwprint_dynamic_imexport
  12. end type
  13. type sle_filename1 from singlelineedit within w_dwprint_dynamic_imexport
  14. end type
  15. type cb_2 from uo_imflatbutton within w_dwprint_dynamic_imexport
  16. end type
  17. type gb_1 from groupbox within w_dwprint_dynamic_imexport
  18. end type
  19. type gb_2 from groupbox within w_dwprint_dynamic_imexport
  20. end type
  21. end forward
  22. global type w_dwprint_dynamic_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_dwprint_dynamic_imexport w_dwprint_dynamic_imexport
  39. type variables
  40. end variables
  41. on w_dwprint_dynamic_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_dwprint_dynamic_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_dwprint_dynamic_imexport
  74. boolean visible = false
  75. end type
  76. type cb_exit from w_publ_base`cb_exit within w_dwprint_dynamic_imexport
  77. integer x = 1815
  78. integer y = 556
  79. integer width = 325
  80. end type
  81. type sle_filename from singlelineedit within w_dwprint_dynamic_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_dwprint_dynamic_imexport
  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_dwprint_dynamic_imexport
  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_dynamic
  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_dynamic = CREATE datastore
  137. ds_dynamic.DataObject = 'dw_dwprint_dynamic'
  138. ds_dynamic.SetTransObject(sqlca)
  139. ds_dynamic.ImportFile(arg_filename)
  140. ds_dynamic.AcceptText()
  141. IF ds_dynamic.RowCount() <= 0 THEN
  142. MessageBox('提示','你导入的数据库表文件没有数据',information!,ok!)
  143. RETURN
  144. END IF
  145. String chnname
  146. String dft_new_dwname
  147. String pblname
  148. Long prownum
  149. String dwtype
  150. Long powerid
  151. Long auditprint
  152. Long ptype
  153. Long dwprintid
  154. String dft_old_dwname
  155. Long ifuse
  156. String ls_find
  157. Long ifdefault
  158. datastore ds_dynamic_cur
  159. ds_dynamic_cur = CREATE datastore
  160. ds_dynamic_cur.DataObject = 'dw_dwprint_dynamic'
  161. ds_dynamic_cur.SetTransObject(sqlca)
  162. ds_dynamic_cur.Retrieve('全部')
  163. FOR ll_i = 1 TO ds_dynamic.RowCount()
  164. chnname = ds_dynamic.Object.chnname[ll_i]
  165. dft_new_dwname = ds_dynamic.Object.dft_new_dwname[ll_i]
  166. pblname = ds_dynamic.Object.pblname[ll_i]
  167. prownum = ds_dynamic.Object.prownum[ll_i]
  168. dwtype = ds_dynamic.Object.dwtype[ll_i]
  169. powerid = ds_dynamic.Object.powerid[ll_i]
  170. auditprint = ds_dynamic.Object.auditprint[ll_i]
  171. ptype = ds_dynamic.Object.ptype[ll_i]
  172. dwprintid = ds_dynamic.Object.dwprintid[ll_i]
  173. dft_old_dwname = ds_dynamic.Object.dft_old_dwname[ll_i]
  174. ifuse = ds_dynamic.Object.ifuse[ll_i]
  175. ifdefault = ds_dynamic.Object.ifdefault[ll_i]
  176. ls_find = ' dwprintid = '+String(dwprintid)
  177. IF ds_dynamic_cur.Find(ls_find,1,ds_dynamic_cur.RowCount()) > 0 THEN
  178. UPDATE sys_dft_dwprint_dynamic
  179. SET sys_dft_dwprint_dynamic.chnname = :chnname,
  180. sys_dft_dwprint_dynamic.dft_new_dwname = :dft_new_dwname,
  181. sys_dft_dwprint_dynamic.pblname = :pblname,
  182. sys_dft_dwprint_dynamic.prownum = :prownum,
  183. sys_dft_dwprint_dynamic.dwtype = :dwtype,
  184. sys_dft_dwprint_dynamic.powerid = :powerid,
  185. sys_dft_dwprint_dynamic.auditprint = :auditprint,
  186. sys_dft_dwprint_dynamic.ptype = :ptype,
  187. sys_dft_dwprint_dynamic.dft_old_dwname = :dft_old_dwname,
  188. sys_dft_dwprint_dynamic.ifuse = :ifuse,
  189. sys_dft_dwprint_dynamic.ifdefault = :ifdefault
  190. Where sys_dft_dwprint_dynamic.dwprintid = :dwprintid;
  191. IF sqlca.SQLCode <> 0 THEN
  192. MessageBox(publ_operator,'更新数据库表的数据失败,'+sqlca.SQLErrText)
  193. rollback;
  194. RETURN
  195. END IF
  196. ELSEIF ds_dynamic_cur.Find(ls_find,1,ds_dynamic_cur.RowCount()) = 0 THEN
  197. INSERT INTO sys_dft_dwprint_dynamic(
  198. sys_dft_dwprint_dynamic.chnname,
  199. sys_dft_dwprint_dynamic.dft_new_dwname,
  200. sys_dft_dwprint_dynamic.pblname,
  201. sys_dft_dwprint_dynamic.prownum,
  202. sys_dft_dwprint_dynamic.dwtype ,
  203. sys_dft_dwprint_dynamic.powerid ,
  204. sys_dft_dwprint_dynamic.auditprint,
  205. sys_dft_dwprint_dynamic.ptype,
  206. sys_dft_dwprint_dynamic.dwprintid,
  207. sys_dft_dwprint_dynamic.dft_old_dwname,
  208. sys_dft_dwprint_dynamic.ifuse,
  209. sys_dft_dwprint_dynamic.ifdefault)
  210. VALUES(
  211. :chnname,
  212. :dft_new_dwname,
  213. :pblname,
  214. :prownum,
  215. :dwtype ,
  216. :powerid ,
  217. :auditprint,
  218. :ptype,
  219. :dwprintid,
  220. :dft_old_dwname,
  221. :ifuse,
  222. :ifdefault);
  223. IF sqlca.SQLCode <> 0 THEN
  224. MessageBox('提示','插入数据库表的数据失败,'+sqlca.SQLErrText,information!,ok!)
  225. rollback;
  226. RETURN
  227. END IF
  228. END IF
  229. NEXT
  230. COMMIT;
  231. MessageBox('提示','导入数据库表的数据成功',information!,ok!)
  232. end event
  233. type cb_export from uo_imflatbutton within w_dwprint_dynamic_imexport
  234. integer x = 1810
  235. integer y = 376
  236. integer width = 325
  237. integer height = 96
  238. integer taborder = 40
  239. boolean bringtotop = true
  240. string text = "导出"
  241. end type
  242. event clicked;call super::clicked;
  243. string arg_filename,arg_msg
  244. blob arg_blob
  245. arg_filename = trim(sle_filename1.text)
  246. if arg_filename = '' then
  247. messagebox('提示','请输入文件名称',information!,ok!)
  248. return
  249. end if
  250. if messagebox("询问","是否确定要将打印格式设置导出成文件",question!,yesno!,1) = 2 then
  251. return
  252. end if
  253. datastore ds_dynamic
  254. ds_dynamic = create datastore
  255. ds_dynamic.dataobject = 'dw_dwprint_dynamic'
  256. ds_dynamic.settransobject(sqlca)
  257. ds_dynamic.retrieve('全部')
  258. if fileexists(arg_filename) then
  259. if messagebox("询问","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 then
  260. return
  261. end if
  262. end if
  263. if ds_dynamic.saveas(arg_filename,dbase2!,false) = 1 then
  264. arg_msg = '数据导出成功!'
  265. else
  266. arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!'
  267. end if
  268. messagebox('提示',arg_msg,information!,ok!)
  269. end event
  270. type sle_filename1 from singlelineedit within w_dwprint_dynamic_imexport
  271. integer x = 96
  272. integer y = 376
  273. integer width = 1586
  274. integer height = 92
  275. integer taborder = 40
  276. boolean bringtotop = true
  277. integer textsize = -9
  278. integer weight = 400
  279. fontcharset fontcharset = gb2312charset!
  280. fontpitch fontpitch = variable!
  281. string facename = "宋体"
  282. long textcolor = 33554432
  283. borderstyle borderstyle = stylelowered!
  284. end type
  285. type cb_2 from uo_imflatbutton within w_dwprint_dynamic_imexport
  286. integer x = 1696
  287. integer y = 376
  288. integer width = 114
  289. integer height = 96
  290. integer taborder = 50
  291. boolean bringtotop = true
  292. string text = "..."
  293. end type
  294. event clicked;call super::clicked;
  295. Integer i
  296. String Pathname
  297. String Filename
  298. i = GetFileSaveName("选择文件",Pathname,Filename,"Dbf","数据文件Dbf,*.Dbf")
  299. IF i = 1 AND Trim(Pathname) <> "" AND Trim(Filename) <> "" THEN
  300. PARENT.sle_filename1.Text = Pathname
  301. END IF
  302. RETURN
  303. end event
  304. type gb_1 from groupbox within w_dwprint_dynamic_imexport
  305. integer x = 55
  306. integer y = 48
  307. integer width = 2107
  308. integer height = 216
  309. integer taborder = 10
  310. integer textsize = -9
  311. integer weight = 400
  312. fontcharset fontcharset = gb2312charset!
  313. fontpitch fontpitch = variable!
  314. string facename = "宋体"
  315. long textcolor = 33554432
  316. long backcolor = 79741120
  317. string text = "导入文件路径"
  318. end type
  319. type gb_2 from groupbox within w_dwprint_dynamic_imexport
  320. integer x = 59
  321. integer y = 308
  322. integer width = 2107
  323. integer height = 216
  324. integer taborder = 20
  325. integer textsize = -9
  326. integer weight = 400
  327. fontcharset fontcharset = gb2312charset!
  328. fontpitch fontpitch = variable!
  329. string facename = "宋体"
  330. long textcolor = 33554432
  331. long backcolor = 79741120
  332. string text = "导出文件路径"
  333. end type