w_subject_import.srw 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. $PBExportHeader$w_subject_import.srw
  2. forward
  3. global type w_subject_import from window
  4. end type
  5. type cb_exit from commandbutton within w_subject_import
  6. end type
  7. type cb_backup from commandbutton within w_subject_import
  8. end type
  9. type cb_ch from commandbutton within w_subject_import
  10. end type
  11. type sle_filename from singlelineedit within w_subject_import
  12. end type
  13. type gb_1 from groupbox within w_subject_import
  14. end type
  15. end forward
  16. global type w_subject_import from window
  17. integer x = 814
  18. integer y = 864
  19. integer width = 2231
  20. integer height = 528
  21. boolean titlebar = true
  22. string title = "导入会计科目"
  23. boolean controlmenu = true
  24. boolean minbox = true
  25. windowtype windowtype = popup!
  26. long backcolor = 134217739
  27. boolean center = true
  28. cb_exit cb_exit
  29. cb_backup cb_backup
  30. cb_ch cb_ch
  31. sle_filename sle_filename
  32. gb_1 gb_1
  33. end type
  34. global w_subject_import w_subject_import
  35. type variables
  36. BOOLEAN OL_BACKUP=TRUE
  37. end variables
  38. on w_subject_import.create
  39. this.cb_exit=create cb_exit
  40. this.cb_backup=create cb_backup
  41. this.cb_ch=create cb_ch
  42. this.sle_filename=create sle_filename
  43. this.gb_1=create gb_1
  44. this.Control[]={this.cb_exit,&
  45. this.cb_backup,&
  46. this.cb_ch,&
  47. this.sle_filename,&
  48. this.gb_1}
  49. end on
  50. on w_subject_import.destroy
  51. destroy(this.cb_exit)
  52. destroy(this.cb_backup)
  53. destroy(this.cb_ch)
  54. destroy(this.sle_filename)
  55. destroy(this.gb_1)
  56. end on
  57. event open;IF Message.DoubleParm = 1 THEN
  58. OL_BACKUP=FALSE
  59. END IF
  60. end event
  61. type cb_exit from commandbutton within w_subject_import
  62. integer x = 1266
  63. integer y = 308
  64. integer width = 311
  65. integer height = 96
  66. integer taborder = 80
  67. integer textsize = -9
  68. integer weight = 400
  69. fontcharset fontcharset = gb2312charset!
  70. fontpitch fontpitch = variable!
  71. string facename = "宋体"
  72. string text = "退出"
  73. end type
  74. event clicked;close(parent)
  75. end event
  76. type cb_backup from commandbutton within w_subject_import
  77. integer x = 576
  78. integer y = 308
  79. integer width = 311
  80. integer height = 96
  81. integer taborder = 50
  82. integer textsize = -9
  83. integer weight = 400
  84. fontcharset fontcharset = gb2312charset!
  85. fontpitch fontpitch = variable!
  86. string facename = "宋体"
  87. boolean enabled = false
  88. string text = "导入"
  89. end type
  90. event clicked;IF NOT sys_power_issuper THEN
  91. MessageBox('提示','你没有使用权限!',information!,OK!)
  92. RETURN
  93. END IF
  94. String ls_msg
  95. datastore ds_tmp
  96. ds_tmp = CREATE datastore
  97. ds_tmp.DataObject = 'dw_subject_import'
  98. ds_tmp.SetTransObject(sqlca)
  99. ds_tmp.ImportFile(sle_filename.Text)
  100. ds_tmp.AcceptText()
  101. IF ds_tmp.RowCount() <= 0 THEN
  102. MessageBox('提示','你导入的帐套会计科目文件没有数据',information!,OK!)
  103. RETURN
  104. END IF
  105. DELETE FROM cw_subject;
  106. IF sqlca.SQLCode <> 0 THEN
  107. ls_msg = sqlca.SQLErrText
  108. ROLLBACK;
  109. MessageBox('错误','删除原帐套会计科目数据失败,'+ls_msg,stopsign!,OK!)
  110. RETURN
  111. END IF
  112. IF ds_tmp.UPDATE() = -1 THEN
  113. ROLLBACK;
  114. MessageBox ("错误","保存操作失败!",stopsign!,ok!)
  115. RETURN
  116. ELSE
  117. COMMIT;
  118. MessageBox('提示','导入帐套会计科目成功',information!,OK!)
  119. RETURN
  120. END IF
  121. end event
  122. type cb_ch from commandbutton within w_subject_import
  123. integer x = 1975
  124. integer y = 112
  125. integer width = 137
  126. integer height = 84
  127. integer taborder = 20
  128. integer textsize = -9
  129. integer weight = 400
  130. fontcharset fontcharset = gb2312charset!
  131. fontpitch fontpitch = variable!
  132. string facename = "宋体"
  133. string text = "..."
  134. end type
  135. event clicked;//new
  136. Integer i
  137. String Pathname,Filename
  138. i = GetFileSaveName("选择备份文件",Pathname,Filename,"Dbf","数据文件Dbf,*.Dbf")
  139. IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
  140. cb_backup.Enabled = OL_BACKUP
  141. sle_filename.Text = Pathname
  142. END IF
  143. end event
  144. type sle_filename from singlelineedit within w_subject_import
  145. event key pbm_keydown
  146. integer x = 101
  147. integer y = 112
  148. integer width = 1870
  149. integer height = 92
  150. integer taborder = 10
  151. integer textsize = -9
  152. integer weight = 400
  153. fontcharset fontcharset = gb2312charset!
  154. fontpitch fontpitch = variable!
  155. string facename = "宋体"
  156. long textcolor = 33554432
  157. borderstyle borderstyle = stylelowered!
  158. end type
  159. event key;if trim(this.text)="" then
  160. cb_backup.enabled=false
  161. else
  162. cb_backup.enabled=OL_BACKUP
  163. end if
  164. end event
  165. event modified;if trim(this.text)="" then
  166. cb_backup.enabled=false
  167. else
  168. cb_backup.enabled=OL_BACKUP
  169. end if
  170. end event
  171. type gb_1 from groupbox within w_subject_import
  172. integer x = 64
  173. integer y = 36
  174. integer width = 2089
  175. integer height = 228
  176. integer textsize = -9
  177. integer weight = 400
  178. fontcharset fontcharset = gb2312charset!
  179. fontpitch fontpitch = variable!
  180. string facename = "宋体"
  181. long textcolor = 33554432
  182. long backcolor = 134217739
  183. string text = "导入文件路径"
  184. end type