w_subject_export.srw 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. $PBExportHeader$w_subject_export.srw
  2. forward
  3. global type w_subject_export from Window
  4. end type
  5. type cb_3 from commandbutton within w_subject_export
  6. end type
  7. type sle_filename from singlelineedit within w_subject_export
  8. end type
  9. type cb_2 from commandbutton within w_subject_export
  10. end type
  11. type cb_export from commandbutton within w_subject_export
  12. end type
  13. type gb_1 from groupbox within w_subject_export
  14. end type
  15. end forward
  16. global type w_subject_export from Window
  17. int X=1056
  18. int Y=456
  19. int Width=2213
  20. int Height=624
  21. boolean TitleBar=true
  22. string Title="科目录出"
  23. long BackColor=81324524
  24. boolean ControlMenu=true
  25. boolean MinBox=true
  26. WindowType WindowType=popup!
  27. cb_3 cb_3
  28. sle_filename sle_filename
  29. cb_2 cb_2
  30. cb_export cb_export
  31. gb_1 gb_1
  32. end type
  33. global w_subject_export w_subject_export
  34. type variables
  35. BOOLEAN OL_BACKUP=TRUE
  36. end variables
  37. on w_subject_export.create
  38. this.cb_3=create cb_3
  39. this.sle_filename=create sle_filename
  40. this.cb_2=create cb_2
  41. this.cb_export=create cb_export
  42. this.gb_1=create gb_1
  43. this.Control[]={this.cb_3,&
  44. this.sle_filename,&
  45. this.cb_2,&
  46. this.cb_export,&
  47. this.gb_1}
  48. end on
  49. on w_subject_export.destroy
  50. destroy(this.cb_3)
  51. destroy(this.sle_filename)
  52. destroy(this.cb_2)
  53. destroy(this.cb_export)
  54. destroy(this.gb_1)
  55. end on
  56. event open;//wf_movetocenter
  57. environment exerun_env
  58. GetEnvironment(exerun_env )
  59. this.Move ( (PixelsToUnits(exerun_env.screenwidth, XPixelsToUnits!) - this.Width)/2,&
  60. (PixelsToUnits(exerun_env.screenheight, XPixelsToUnits!) - this.Height - 350 )/2) //
  61. //this.Move ( (exerun_env.screenwidth*4.62 - this.Width)/2, (exerun_env.screenheight*3.87 - this.Height)/2)
  62. return 0
  63. end event
  64. type cb_3 from commandbutton within w_subject_export
  65. int X=1970
  66. int Y=124
  67. int Width=137
  68. int Height=84
  69. int TabOrder=30
  70. string Text="..."
  71. int TextSize=-9
  72. int Weight=400
  73. string FaceName="宋体"
  74. FontCharSet FontCharSet=GB2312CharSet!
  75. FontPitch FontPitch=Variable!
  76. end type
  77. event clicked;//new
  78. Integer i
  79. String Pathname,Filename
  80. i = GetFileSaveName("选择导出文件",Pathname,Filename,"Dbf","数据文件Dbf,*.Dbf")
  81. IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
  82. cb_export.Enabled = OL_BACKUP
  83. sle_filename.Text = Pathname
  84. END IF
  85. end event
  86. type sle_filename from singlelineedit within w_subject_export
  87. event key pbm_keydown
  88. int X=91
  89. int Y=120
  90. int Width=1870
  91. int Height=92
  92. int TabOrder=20
  93. BorderStyle BorderStyle=StyleLowered!
  94. boolean AutoHScroll=false
  95. long TextColor=33554432
  96. int TextSize=-9
  97. int Weight=400
  98. string FaceName="宋体"
  99. FontCharSet FontCharSet=GB2312CharSet!
  100. FontPitch FontPitch=Variable!
  101. end type
  102. event key;IF Trim(THIS.Text) = "" THEN
  103. cb_export.Enabled = FALSE
  104. ELSE
  105. cb_export.Enabled = OL_BACKUP
  106. END IF
  107. end event
  108. event modified;IF Trim(THIS.Text) = "" THEN
  109. cb_export.Enabled = FALSE
  110. ELSE
  111. cb_export.Enabled = OL_BACKUP
  112. END IF
  113. end event
  114. type cb_2 from commandbutton within w_subject_export
  115. int X=1166
  116. int Y=344
  117. int Width=311
  118. int Height=96
  119. int TabOrder=40
  120. string Text="退出"
  121. int TextSize=-9
  122. int Weight=400
  123. string FaceName="宋体"
  124. FontCharSet FontCharSet=GB2312CharSet!
  125. FontPitch FontPitch=Variable!
  126. end type
  127. event clicked;close(parent)
  128. end event
  129. type cb_export from commandbutton within w_subject_export
  130. int X=567
  131. int Y=344
  132. int Width=311
  133. int Height=96
  134. int TabOrder=10
  135. boolean Enabled=false
  136. string Text="导出"
  137. int TextSize=-9
  138. int Weight=400
  139. string FaceName="宋体"
  140. FontCharSet FontCharSet=GB2312CharSet!
  141. FontPitch FontPitch=Variable!
  142. end type
  143. event clicked;IF NOT sys_power_issuper THEN
  144. MessageBox(publ_operator,'你没有使用权限!')
  145. RETURN
  146. END IF
  147. String arg_filename,arg_msg
  148. Blob arg_blob
  149. arg_filename = Trim(sle_filename.Text)
  150. IF arg_filename = '' THEN
  151. MessageBox('系统提示','请输入文件名称')
  152. RETURN
  153. END IF
  154. IF MessageBox("系统提示","是否确定要将帐套科目导出成文件",question!,yesno!,1) = 2 THEN
  155. RETURN
  156. END IF
  157. datastore ds_tmp
  158. ds_tmp = CREATE datastore
  159. ds_tmp.DataObject = 'dw_subject_export'
  160. ds_tmp.SetTransObject(sqlca)
  161. ds_tmp.Retrieve(sys_accsetid)
  162. IF FileExists(arg_filename) THEN
  163. IF MessageBox("系统提示","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 THEN
  164. RETURN
  165. END IF
  166. END IF
  167. IF ds_tmp.SaveAs(arg_filename,dbase2!,FALSE) = 1 THEN
  168. arg_msg = '数据导出成功!'
  169. ELSE
  170. arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!'
  171. END IF
  172. MessageBox('提示',arg_msg)
  173. end event
  174. type gb_1 from groupbox within w_subject_export
  175. int X=55
  176. int Y=44
  177. int Width=2089
  178. int Height=228
  179. int TabOrder=30
  180. string Text="导出文件路径"
  181. BorderStyle BorderStyle=StyleLowered!
  182. long TextColor=33554432
  183. long BackColor=67108864
  184. int TextSize=-9
  185. int Weight=400
  186. string FaceName="宋体"
  187. FontCharSet FontCharSet=GB2312CharSet!
  188. FontPitch FontPitch=Variable!
  189. end type