w_create_book.srw 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  1. $PBExportHeader$w_create_book.srw
  2. $PBExportComments$数据库连接窗口
  3. forward
  4. global type w_create_book from w_publ_base
  5. end type
  6. type cb_ok from uo_imflatbutton within w_create_book
  7. end type
  8. type cb_ch2 from commandbutton within w_create_book
  9. end type
  10. type sle_filename from singlelineedit within w_create_book
  11. end type
  12. type st_8 from statictext within w_create_book
  13. end type
  14. type gb_1 from groupbox within w_create_book
  15. end type
  16. type st_2334 from statictext within w_create_book
  17. end type
  18. type st_345 from statictext within w_create_book
  19. end type
  20. type sle_sqldb_mdf_sor from singlelineedit within w_create_book
  21. end type
  22. type sle_sqldb_ldf_sor from singlelineedit within w_create_book
  23. end type
  24. type cbx_db_h from checkbox within w_create_book
  25. end type
  26. type gb_3 from groupbox within w_create_book
  27. end type
  28. type st_jd from statictext within w_create_book
  29. end type
  30. type st_2 from statictext within w_create_book
  31. end type
  32. type sle_database from singlelineedit within w_create_book
  33. end type
  34. type sle_bookname from singlelineedit within w_create_book
  35. end type
  36. type st_1 from statictext within w_create_book
  37. end type
  38. type sle_code from singlelineedit within w_create_book
  39. end type
  40. type st_3 from statictext within w_create_book
  41. end type
  42. type cbx_ifuse from checkbox within w_create_book
  43. end type
  44. type st_13 from statictext within w_create_book
  45. end type
  46. type sle_folder from singlelineedit within w_create_book
  47. end type
  48. type cb_2 from commandbutton within w_create_book
  49. end type
  50. type sle_fj from singlelineedit within w_create_book
  51. end type
  52. type cb_fj from commandbutton within w_create_book
  53. end type
  54. type cbx_fj from checkbox within w_create_book
  55. end type
  56. type cbx_1 from checkbox within w_create_book
  57. end type
  58. type st_14 from statictext within w_create_book
  59. end type
  60. type sle_pbl from singlelineedit within w_create_book
  61. end type
  62. end forward
  63. global type w_create_book from w_publ_base
  64. integer x = 283
  65. integer y = 12
  66. integer width = 2331
  67. integer height = 1244
  68. string title = "新建帐套"
  69. boolean minbox = false
  70. windowtype windowtype = response!
  71. cb_ok cb_ok
  72. cb_ch2 cb_ch2
  73. sle_filename sle_filename
  74. st_8 st_8
  75. gb_1 gb_1
  76. st_2334 st_2334
  77. st_345 st_345
  78. sle_sqldb_mdf_sor sle_sqldb_mdf_sor
  79. sle_sqldb_ldf_sor sle_sqldb_ldf_sor
  80. cbx_db_h cbx_db_h
  81. gb_3 gb_3
  82. st_jd st_jd
  83. st_2 st_2
  84. sle_database sle_database
  85. sle_bookname sle_bookname
  86. st_1 st_1
  87. sle_code sle_code
  88. st_3 st_3
  89. cbx_ifuse cbx_ifuse
  90. st_13 st_13
  91. sle_folder sle_folder
  92. cb_2 cb_2
  93. sle_fj sle_fj
  94. cb_fj cb_fj
  95. cbx_fj cbx_fj
  96. cbx_1 cbx_1
  97. st_14 st_14
  98. sle_pbl sle_pbl
  99. end type
  100. global w_create_book w_create_book
  101. type prototypes
  102. Subroutine Sleep(ulong dwMilliseconds) LIBRARY "kernel32.dll"
  103. Function long ShellExecuteA (long hwnd, string lpOperation ,String lpFile, String lpParameters, String lpDirectory, Long nShowCmd) Library "shell32.dll" alias for "ShellExecuteA;Ansi"
  104. end prototypes
  105. type variables
  106. String ls_bat_filename = '_ls_cmd_run.bat'
  107. String ls_txt_filename = '_ls_cmd_rslt.txt'
  108. String masterpath
  109. s_outerconnection s_db
  110. end variables
  111. forward prototypes
  112. public function integer wf_findisql ()
  113. public function integer wf_buildsqldb (ref string arg_msg)
  114. public function integer wf_autopbl ()
  115. end prototypes
  116. public function integer wf_findisql ();
  117. IF FileExists('c:\mssql7\data\master.mdf') THEN
  118. masterpath = 'c:\mssql7\data\'
  119. GOTO ext
  120. END IF
  121. IF FileExists('c:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN
  122. masterpath = 'c:\Program Files\Microsoft SQL Server\data\'
  123. GOTO ext
  124. END IF
  125. IF FileExists('c:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN
  126. masterpath = "c:\Program Files\Microsoft SQL Server\MSSQL\data\"
  127. GOTO ext
  128. END IF
  129. IF FileExists('d:\mssql7\data\master.mdf') THEN
  130. masterpath = 'd:\mssql7\data\'
  131. GOTO ext
  132. END IF
  133. IF FileExists('d:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN
  134. masterpath = 'd:\Program Files\Microsoft SQL Server\data\'
  135. GOTO ext
  136. END IF
  137. IF FileExists('d:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN
  138. masterpath = 'd:\Program Files\Microsoft SQL Server\MSSQL\data\'
  139. GOTO ext
  140. END IF
  141. IF FileExists('e:\mssql7\data\master.mdf') THEN
  142. masterpath = 'e:\mssql7\data\'
  143. GOTO ext
  144. END IF
  145. IF FileExists('e:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN
  146. masterpath = 'e:\Program Files\Microsoft SQL Server\data\'
  147. GOTO ext
  148. END IF
  149. IF FileExists('e:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN
  150. masterpath = 'e:\Program Files\Microsoft SQL Server\MSSQL\data\'
  151. GOTO ext
  152. END IF
  153. IF FileExists('f:\mssql7\data\master.mdf') THEN
  154. masterpath = 'f:\mssql7\data\'
  155. GOTO ext
  156. END IF
  157. IF FileExists('f:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN
  158. masterpath = 'f:\Program Files\Microsoft SQL Server\data\'
  159. GOTO ext
  160. END IF
  161. IF FileExists('f:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN
  162. masterpath = 'f:\Program Files\Microsoft SQL Server\MSSQL\data\'
  163. GOTO ext
  164. END IF
  165. IF FileExists('g:\mssql7\data\master.mdf') THEN
  166. masterpath = 'g:\mssql7\data\'
  167. GOTO ext
  168. END IF
  169. IF FileExists('g:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN
  170. masterpath = 'g:\Program Files\Microsoft SQL Server\data\'
  171. GOTO ext
  172. END IF
  173. IF FileExists('g:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN
  174. masterpath = 'g:\Program Files\Microsoft SQL Server\MSSQL\data\'
  175. GOTO ext
  176. END IF
  177. IF FileExists('h:\mssql7\data\master.mdf') THEN
  178. masterpath = 'h:\mssql7\data\'
  179. GOTO ext
  180. END IF
  181. IF FileExists('h:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN
  182. masterpath = 'h:\Program Files\Microsoft SQL Server\data\'
  183. GOTO ext
  184. END IF
  185. IF FileExists('h:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN
  186. masterpath = 'h:\Program Files\Microsoft SQL Server\MSSQL\data\'
  187. GOTO ext
  188. END IF
  189. IF FileExists('d:\Program Files\MSDE\MSSQL\data\master.mdf') THEN
  190. masterpath = 'd:\Program Files\MSDE\MSSQL\data\'
  191. GOTO ext
  192. END IF
  193. ext:
  194. IF masterpath = '' THEN masterpath = "c:\Program Files\Microsoft SQL Server\MSSQL\data\"
  195. sle_folder.text = sys_cur_path + 'database'
  196. RETURN 0
  197. end function
  198. public function integer wf_buildsqldb (ref string arg_msg);Integer li_FileNum,rslt = 1
  199. String comm,msg
  200. Long i,j,lu_return
  201. Transaction db_Transaction
  202. db_Transaction = CREATE Transaction
  203. Int ll_result
  204. ll_result = createdirectory(sle_folder.Text)
  205. comm = ' create DATABASE '+sle_database.Text+&
  206. " on(name='"+sle_sqldb_mdf_sor.Text+"',FILENAME= '"+sle_folder.Text + '\' + sle_database.Text+'_data.ldf'+"') log on (name='"+sle_sqldb_ldf_sor.Text+"',FILENAME= '"+sle_folder.Text + '\' + sle_database.Text+'_log.ldf'+"')"
  207. db_Transaction.DBMS = sqlca.DBMS
  208. db_Transaction.Database = 'master'
  209. db_Transaction.LogID = sqlca.LogID
  210. db_Transaction.LogPass = sqlca.LogPass
  211. db_Transaction.ServerName = sqlca.ServerName
  212. IF db_Transaction.Database = '' OR db_Transaction.ServerName = '' THEN
  213. arg_msg = "连接数据库失败!"
  214. rslt = 0
  215. GOTO ext
  216. END IF
  217. CONNECT USING db_Transaction;
  218. IF db_Transaction.SQLCode <> 0 THEN
  219. arg_msg = '连接master数据库失败,'+db_Transaction.SQLErrText
  220. rslt = 0
  221. GOTO ext
  222. END IF
  223. db_Transaction.AutoCommit = TRUE
  224. st_jd.Text = '正在新建数据库...'
  225. EXECUTE IMMEDIATE :comm USING db_Transaction;
  226. IF db_Transaction.SQLCode <> 0 THEN
  227. arg_msg = '建立失败,请手动建立及恢复数据库>'+db_Transaction.SQLErrText
  228. ROLLBACK USING db_Transaction;
  229. rslt = 0
  230. GOTO ext
  231. ELSE
  232. rslt = 1
  233. COMMIT USING db_Transaction;
  234. END IF
  235. st_jd.Text = '正在恢复数据库...'
  236. comm = 'RESTORE DATABASE '+sle_database.Text+" from DISK= '"+sle_filename.Text+"'"+&
  237. " WITH MOVE '"+sle_sqldb_mdf_sor.Text+"' TO '"+sle_folder.Text + '\' + sle_database.Text+'_data.ldf'+"',"+&
  238. " MOVE '"+sle_sqldb_ldf_sor.Text+"' TO '"+sle_folder.Text + '\' + sle_database.Text+'_log.ldf'+"',"+'REPLACE'
  239. EXECUTE IMMEDIATE :comm USING db_Transaction;
  240. IF db_Transaction.SQLCode <> 0 THEN
  241. arg_msg = '恢复失败,请手动恢复数据库>'+db_Transaction.SQLErrText
  242. ROLLBACK USING db_Transaction;
  243. rslt = 0
  244. GOTO ext
  245. ELSE
  246. rslt = 1
  247. COMMIT USING db_Transaction;
  248. END IF
  249. IF cbx_db_h.Checked AND cbx_fj.Checked THEN
  250. IF sle_fj.Text = '' THEN
  251. arg_msg = '请先选择附件数据库文件!'
  252. END IF
  253. String ls_fjname,ls_test
  254. ls_fjname = RightTrim(LeftTrim(sle_database.Text)) + '_fj'
  255. ls_test = "if exists(select 1 from master..sysdatabases where name='" + ls_fjname + "') raiserror('Database existed',18,1) else raiserror('Database not existed',18,1) "
  256. EXECUTE IMMEDIATE :ls_test USING db_Transaction;
  257. IF db_Transaction.SQLErrText = 'Database existed' THEN
  258. IF MessageBox ("询问","附件数据库已存在,是否确定要覆盖?",Question!,YesNo! ) = 2 THEN
  259. RETURN 1
  260. ELSE
  261. comm = " IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'" + ls_fjname + "') DROP DATABASE [" + ls_fjname + "]"
  262. EXECUTE IMMEDIATE :comm USING db_Transaction;
  263. IF db_Transaction.SQLCode <> 0 THEN
  264. arg_msg = '删除失败,请手动删除附件数据库>'+db_Transaction.SQLErrText
  265. ROLLBACK;
  266. rslt = 0
  267. GOTO ext
  268. ELSE
  269. rslt = 1
  270. COMMIT;
  271. END IF
  272. END IF
  273. END IF
  274. st_jd.Text = '正在新建附件数据库...'
  275. comm = " create DATABASE " + ls_fjname +&
  276. " on(name='" + ls_fjname + "_data',FILENAME= '"+sle_folder.Text + '\' + ls_fjname + ".MDF" +"') log on (name=' " + ls_fjname + "_log',FILENAME= '"+sle_folder.Text + '\' + ls_fjname + ".ldf"+"')"
  277. EXECUTE IMMEDIATE :comm USING db_Transaction;
  278. IF db_Transaction.SQLCode <> 0 THEN
  279. arg_msg = '建立失败,请手动建立及恢复附件数据库>'+db_Transaction.SQLErrText
  280. ROLLBACK;
  281. rslt = 0
  282. GOTO ext
  283. ELSE
  284. rslt = 1
  285. COMMIT;
  286. END IF
  287. st_jd.Text = '正在恢复附件数据库...'
  288. comm = "RESTORE DATABASE " + ls_fjname + " from DISK= '"+sle_fj.Text+"'"+&
  289. " WITH MOVE 'filemanage_Data' TO '"+sle_folder.Text + '\' + ls_fjname + ".MDF"+"',"+&
  290. " MOVE 'filemanage_Log' TO '"+sle_folder.Text + '\' + ls_fjname + ".ldf"+"',"+'REPLACE'
  291. EXECUTE IMMEDIATE :comm USING db_Transaction;
  292. IF db_Transaction.SQLCode <> 0 THEN
  293. arg_msg = '恢复失败,请手动附件恢复附数据库>'+db_Transaction.SQLErrText
  294. ROLLBACK;
  295. rslt = 0
  296. GOTO ext
  297. ELSE
  298. rslt = 1
  299. COMMIT;
  300. END IF
  301. END IF
  302. //自动添加打印格式库
  303. IF LeftTrim(RightTrim(sle_pbl.Text)) <> '' THEN
  304. String ls_pbl
  305. ls_pbl = sys_cur_path + LeftTrim(RightTrim(sle_pbl.Text))
  306. IF FileExists(ls_pbl) THEN
  307. IF MessageBox ("询问","格式库文件已存在,是否确定要覆盖?",Question!,YesNo! ) = 2 THEN
  308. GOTO buildpbl
  309. ELSE
  310. FileDelete(ls_pbl)
  311. IF LibraryCreate(ls_pbl) = -1 THEN
  312. rslt = -1
  313. arg_msg = '创建格式库文件失败,请手动创建'
  314. END IF
  315. END IF
  316. ELSE
  317. IF LibraryCreate(ls_pbl) = -1 THEN
  318. rslt = -1
  319. arg_msg = '创建格式库文件失败,请手动创建'
  320. END IF
  321. END IF
  322. buildpbl:
  323. comm = "INSERT INTO " + RightTrim(LeftTrim(sle_database.Text)) + ".dbo.u_setliblist ("+&
  324. "libname )"+&
  325. "VALUES"+&
  326. "("+&
  327. "'" + LeftTrim(RightTrim(sle_pbl.Text)) + "'"+&
  328. ");"
  329. EXECUTE IMMEDIATE :comm USING sqlca;
  330. IF sqlca.SQLCode = -1 THEN
  331. rslt = -1
  332. arg_msg = '请在系统选项设置手动添加该格式库文件'
  333. GOTO ext
  334. END IF
  335. END IF
  336. ext:
  337. RETURN rslt
  338. end function
  339. public function integer wf_autopbl ();sle_pbl.Text = + 'printbill_' + sle_database.Text+'.pbl'
  340. RETURN 1
  341. end function
  342. event open;call super::open;
  343. wf_findisql()
  344. end event
  345. on w_create_book.create
  346. int iCurrent
  347. call super::create
  348. this.cb_ok=create cb_ok
  349. this.cb_ch2=create cb_ch2
  350. this.sle_filename=create sle_filename
  351. this.st_8=create st_8
  352. this.gb_1=create gb_1
  353. this.st_2334=create st_2334
  354. this.st_345=create st_345
  355. this.sle_sqldb_mdf_sor=create sle_sqldb_mdf_sor
  356. this.sle_sqldb_ldf_sor=create sle_sqldb_ldf_sor
  357. this.cbx_db_h=create cbx_db_h
  358. this.gb_3=create gb_3
  359. this.st_jd=create st_jd
  360. this.st_2=create st_2
  361. this.sle_database=create sle_database
  362. this.sle_bookname=create sle_bookname
  363. this.st_1=create st_1
  364. this.sle_code=create sle_code
  365. this.st_3=create st_3
  366. this.cbx_ifuse=create cbx_ifuse
  367. this.st_13=create st_13
  368. this.sle_folder=create sle_folder
  369. this.cb_2=create cb_2
  370. this.sle_fj=create sle_fj
  371. this.cb_fj=create cb_fj
  372. this.cbx_fj=create cbx_fj
  373. this.cbx_1=create cbx_1
  374. this.st_14=create st_14
  375. this.sle_pbl=create sle_pbl
  376. iCurrent=UpperBound(this.Control)
  377. this.Control[iCurrent+1]=this.cb_ok
  378. this.Control[iCurrent+2]=this.cb_ch2
  379. this.Control[iCurrent+3]=this.sle_filename
  380. this.Control[iCurrent+4]=this.st_8
  381. this.Control[iCurrent+5]=this.gb_1
  382. this.Control[iCurrent+6]=this.st_2334
  383. this.Control[iCurrent+7]=this.st_345
  384. this.Control[iCurrent+8]=this.sle_sqldb_mdf_sor
  385. this.Control[iCurrent+9]=this.sle_sqldb_ldf_sor
  386. this.Control[iCurrent+10]=this.cbx_db_h
  387. this.Control[iCurrent+11]=this.gb_3
  388. this.Control[iCurrent+12]=this.st_jd
  389. this.Control[iCurrent+13]=this.st_2
  390. this.Control[iCurrent+14]=this.sle_database
  391. this.Control[iCurrent+15]=this.sle_bookname
  392. this.Control[iCurrent+16]=this.st_1
  393. this.Control[iCurrent+17]=this.sle_code
  394. this.Control[iCurrent+18]=this.st_3
  395. this.Control[iCurrent+19]=this.cbx_ifuse
  396. this.Control[iCurrent+20]=this.st_13
  397. this.Control[iCurrent+21]=this.sle_folder
  398. this.Control[iCurrent+22]=this.cb_2
  399. this.Control[iCurrent+23]=this.sle_fj
  400. this.Control[iCurrent+24]=this.cb_fj
  401. this.Control[iCurrent+25]=this.cbx_fj
  402. this.Control[iCurrent+26]=this.cbx_1
  403. this.Control[iCurrent+27]=this.st_14
  404. this.Control[iCurrent+28]=this.sle_pbl
  405. end on
  406. on w_create_book.destroy
  407. call super::destroy
  408. destroy(this.cb_ok)
  409. destroy(this.cb_ch2)
  410. destroy(this.sle_filename)
  411. destroy(this.st_8)
  412. destroy(this.gb_1)
  413. destroy(this.st_2334)
  414. destroy(this.st_345)
  415. destroy(this.sle_sqldb_mdf_sor)
  416. destroy(this.sle_sqldb_ldf_sor)
  417. destroy(this.cbx_db_h)
  418. destroy(this.gb_3)
  419. destroy(this.st_jd)
  420. destroy(this.st_2)
  421. destroy(this.sle_database)
  422. destroy(this.sle_bookname)
  423. destroy(this.st_1)
  424. destroy(this.sle_code)
  425. destroy(this.st_3)
  426. destroy(this.cbx_ifuse)
  427. destroy(this.st_13)
  428. destroy(this.sle_folder)
  429. destroy(this.cb_2)
  430. destroy(this.sle_fj)
  431. destroy(this.cb_fj)
  432. destroy(this.cbx_fj)
  433. destroy(this.cbx_1)
  434. destroy(this.st_14)
  435. destroy(this.sle_pbl)
  436. end on
  437. type cb_func from w_publ_base`cb_func within w_create_book
  438. boolean visible = false
  439. integer x = 1568
  440. integer y = 1124
  441. integer taborder = 40
  442. boolean enabled = false
  443. end type
  444. type cb_exit from w_publ_base`cb_exit within w_create_book
  445. integer x = 1403
  446. integer y = 1040
  447. integer width = 315
  448. integer taborder = 150
  449. string text = "取消"
  450. end type
  451. type cb_ok from uo_imflatbutton within w_create_book
  452. integer x = 635
  453. integer y = 1040
  454. integer width = 315
  455. integer height = 96
  456. integer taborder = 140
  457. string normalpicname = "ok.bmp"
  458. end type
  459. event clicked;call super::clicked;
  460. IF Trim(sle_database.Text) = '' THEN
  461. MessageBox('提示','请输入数据库名称!',information!,OK!)
  462. RETURN
  463. END IF
  464. IF Trim(sle_database.Text) = '' THEN
  465. MessageBox('提示','请输入编号!',information!,OK!)
  466. RETURN
  467. END IF
  468. String arg_msg
  469. IF NOT cbx_1.Checked THEN
  470. IF NOT FileExists(sle_filename.Text) THEN
  471. MessageBox("提示","指定恢复数据文件不存在",information!,OK!)
  472. RETURN
  473. END IF
  474. IF Trim(sle_folder.Text) = '' THEN
  475. MessageBox('提示','请输入目标文件路径!',information!,OK!)
  476. RETURN
  477. END IF
  478. IF wf_buildsqldb(arg_msg) = 0 THEN
  479. MessageBox("错误",arg_msg,stopsign!,OK!)
  480. RETURN
  481. END IF
  482. END IF
  483. String ls_ini_book
  484. Long i
  485. String ifuse
  486. FOR i = 1 TO 20
  487. // ls_ini_book = f_psw_bczh(ProfileString (sys_inifilename_other,'sys_dl_book', String(i), ''),1,sys_power_key)
  488. ls_ini_book = ProfileString (sys_inifilename_other,'sys_dl_book', String(i), '')
  489. IF Trim(ls_ini_book) = '' THEN
  490. IF cbx_ifuse.Checked THEN
  491. ifuse = '1'
  492. ELSE
  493. ifuse = '0'
  494. END IF
  495. String ls_temp
  496. ls_temp = RightTrim(LeftTrim(sle_bookname.Text)) + ':'+&
  497. RightTrim(LeftTrim(sle_database.Text))+ ':'+&
  498. RightTrim(LeftTrim(sle_code.Text))+ ':'+&
  499. ifuse
  500. // SetProfileString (sys_inifilename_other,'sys_dl_book', String(i), f_psw_bczh(ls_temp,0,sys_power_key))
  501. SetProfileString (sys_inifilename_other,'sys_dl_book', String(i), ls_temp)
  502. GOTO ext
  503. END IF
  504. NEXT
  505. MessageBox('提示','新建帐套成功!',information!,OK!)
  506. ext:
  507. Close(PARENT)
  508. end event
  509. type cb_ch2 from commandbutton within w_create_book
  510. integer x = 2117
  511. integer y = 340
  512. integer width = 114
  513. integer height = 84
  514. integer taborder = 60
  515. integer textsize = -9
  516. integer weight = 400
  517. fontcharset fontcharset = gb2312charset!
  518. fontpitch fontpitch = variable!
  519. string facename = "宋体"
  520. string text = "..."
  521. end type
  522. event clicked;
  523. Integer i
  524. String Pathname,Filename
  525. i = GetFileSaveName("选择主数据库文件",Pathname,Filename,"Dat","数据文件Dat,*.Dat")
  526. IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
  527. sle_filename.Text = Pathname
  528. END IF
  529. end event
  530. type sle_filename from singlelineedit within w_create_book
  531. integer x = 457
  532. integer y = 340
  533. integer width = 1655
  534. integer height = 80
  535. integer taborder = 50
  536. integer textsize = -9
  537. integer weight = 400
  538. fontcharset fontcharset = gb2312charset!
  539. fontpitch fontpitch = variable!
  540. string facename = "宋体"
  541. long textcolor = 33554432
  542. borderstyle borderstyle = stylelowered!
  543. end type
  544. type st_8 from statictext within w_create_book
  545. integer x = 87
  546. integer y = 356
  547. integer width = 370
  548. integer height = 76
  549. boolean bringtotop = true
  550. integer textsize = -9
  551. integer weight = 400
  552. fontcharset fontcharset = gb2312charset!
  553. fontpitch fontpitch = variable!
  554. string facename = "宋体"
  555. long textcolor = 33554432
  556. long backcolor = 134217739
  557. boolean enabled = false
  558. string text = "空数据库来自:"
  559. alignment alignment = right!
  560. boolean focusrectangle = false
  561. end type
  562. type gb_1 from groupbox within w_create_book
  563. integer x = 64
  564. integer width = 2194
  565. integer height = 656
  566. integer taborder = 170
  567. integer textsize = -9
  568. integer weight = 400
  569. fontcharset fontcharset = gb2312charset!
  570. fontpitch fontpitch = variable!
  571. string facename = "宋体"
  572. long textcolor = 33554432
  573. long backcolor = 134217739
  574. end type
  575. type st_2334 from statictext within w_create_book
  576. integer x = 128
  577. integer y = 740
  578. integer width = 329
  579. integer height = 76
  580. boolean bringtotop = true
  581. integer textsize = -9
  582. integer weight = 400
  583. fontcharset fontcharset = gb2312charset!
  584. fontpitch fontpitch = variable!
  585. string facename = "宋体"
  586. long textcolor = 33554432
  587. long backcolor = 134217739
  588. boolean enabled = false
  589. string text = "源数据名称:"
  590. alignment alignment = right!
  591. boolean focusrectangle = false
  592. end type
  593. type st_345 from statictext within w_create_book
  594. integer x = 128
  595. integer y = 840
  596. integer width = 329
  597. integer height = 76
  598. boolean bringtotop = true
  599. integer textsize = -9
  600. integer weight = 400
  601. fontcharset fontcharset = gb2312charset!
  602. fontpitch fontpitch = variable!
  603. string facename = "宋体"
  604. long textcolor = 33554432
  605. long backcolor = 134217739
  606. boolean enabled = false
  607. string text = "源日志名称:"
  608. alignment alignment = right!
  609. boolean focusrectangle = false
  610. end type
  611. type sle_sqldb_mdf_sor from singlelineedit within w_create_book
  612. integer x = 457
  613. integer y = 724
  614. integer width = 1655
  615. integer height = 80
  616. integer taborder = 100
  617. integer textsize = -9
  618. integer weight = 400
  619. fontcharset fontcharset = gb2312charset!
  620. fontpitch fontpitch = variable!
  621. string facename = "宋体"
  622. long textcolor = 33554432
  623. boolean enabled = false
  624. string text = "ljerp1_data"
  625. borderstyle borderstyle = stylelowered!
  626. end type
  627. type sle_sqldb_ldf_sor from singlelineedit within w_create_book
  628. integer x = 457
  629. integer y = 824
  630. integer width = 1655
  631. integer height = 80
  632. integer taborder = 110
  633. integer textsize = -9
  634. integer weight = 400
  635. fontcharset fontcharset = gb2312charset!
  636. fontpitch fontpitch = variable!
  637. string facename = "宋体"
  638. long textcolor = 33554432
  639. boolean enabled = false
  640. string text = "ljerp1_log"
  641. borderstyle borderstyle = stylelowered!
  642. end type
  643. type cbx_db_h from checkbox within w_create_book
  644. integer x = 101
  645. integer y = 668
  646. integer width = 201
  647. integer height = 60
  648. boolean bringtotop = true
  649. integer textsize = -9
  650. integer weight = 400
  651. fontcharset fontcharset = gb2312charset!
  652. fontpitch fontpitch = variable!
  653. string facename = "宋体"
  654. long textcolor = 33554432
  655. long backcolor = 134217739
  656. string text = "高级"
  657. end type
  658. event clicked;sle_sqldb_mdf_sor.Enabled = THIS.Checked
  659. sle_sqldb_ldf_sor.Enabled = THIS.Checked
  660. cbx_fj.Enabled = THIS.Checked
  661. IF cbx_fj.Checked THEN
  662. sle_fj.Enabled = THIS.Checked
  663. cb_fj.Enabled = THIS.Checked
  664. ELSE
  665. sle_fj.Enabled = false
  666. cb_fj.Enabled = false
  667. END IF
  668. end event
  669. type gb_3 from groupbox within w_create_book
  670. integer x = 64
  671. integer y = 668
  672. integer width = 2194
  673. integer height = 360
  674. integer taborder = 160
  675. integer textsize = -9
  676. integer weight = 400
  677. fontcharset fontcharset = gb2312charset!
  678. fontpitch fontpitch = variable!
  679. string facename = "宋体"
  680. long textcolor = 33554432
  681. long backcolor = 134217739
  682. end type
  683. type st_jd from statictext within w_create_book
  684. integer x = 1664
  685. integer y = 44
  686. integer width = 576
  687. integer height = 64
  688. boolean bringtotop = true
  689. integer textsize = -9
  690. integer weight = 400
  691. fontcharset fontcharset = gb2312charset!
  692. fontpitch fontpitch = variable!
  693. string facename = "宋体"
  694. long textcolor = 16711680
  695. long backcolor = 134217739
  696. boolean enabled = false
  697. alignment alignment = right!
  698. boolean focusrectangle = false
  699. end type
  700. type st_2 from statictext within w_create_book
  701. integer x = 160
  702. integer y = 252
  703. integer width = 297
  704. integer height = 60
  705. boolean bringtotop = true
  706. integer textsize = -8
  707. integer weight = 400
  708. fontpitch fontpitch = variable!
  709. fontfamily fontfamily = swiss!
  710. string facename = "MS Sans Serif"
  711. long textcolor = 41943040
  712. long backcolor = 134217739
  713. boolean enabled = false
  714. string text = "数据库名称:"
  715. alignment alignment = right!
  716. boolean focusrectangle = false
  717. end type
  718. type sle_database from singlelineedit within w_create_book
  719. integer x = 457
  720. integer y = 240
  721. integer width = 1655
  722. integer height = 80
  723. integer taborder = 30
  724. boolean bringtotop = true
  725. integer textsize = -8
  726. integer weight = 400
  727. fontpitch fontpitch = variable!
  728. fontfamily fontfamily = swiss!
  729. string facename = "MS Sans Serif"
  730. long textcolor = 41943040
  731. boolean autohscroll = false
  732. borderstyle borderstyle = stylelowered!
  733. end type
  734. event modified;wf_autopbl()
  735. end event
  736. type sle_bookname from singlelineedit within w_create_book
  737. integer x = 457
  738. integer y = 136
  739. integer width = 1655
  740. integer height = 80
  741. integer taborder = 20
  742. boolean bringtotop = true
  743. integer textsize = -8
  744. integer weight = 400
  745. fontpitch fontpitch = variable!
  746. fontfamily fontfamily = swiss!
  747. string facename = "MS Sans Serif"
  748. long textcolor = 41943040
  749. boolean autohscroll = false
  750. borderstyle borderstyle = stylelowered!
  751. end type
  752. type st_1 from statictext within w_create_book
  753. integer x = 201
  754. integer y = 148
  755. integer width = 256
  756. integer height = 60
  757. boolean bringtotop = true
  758. integer textsize = -8
  759. integer weight = 400
  760. fontpitch fontpitch = variable!
  761. fontfamily fontfamily = swiss!
  762. string facename = "MS Sans Serif"
  763. long textcolor = 41943040
  764. long backcolor = 134217739
  765. boolean enabled = false
  766. string text = "帐套名称:"
  767. alignment alignment = right!
  768. boolean focusrectangle = false
  769. end type
  770. type sle_code from singlelineedit within w_create_book
  771. integer x = 457
  772. integer y = 44
  773. integer width = 503
  774. integer height = 80
  775. integer taborder = 10
  776. boolean bringtotop = true
  777. integer textsize = -8
  778. integer weight = 400
  779. fontpitch fontpitch = variable!
  780. fontfamily fontfamily = swiss!
  781. string facename = "MS Sans Serif"
  782. long textcolor = 41943040
  783. boolean autohscroll = false
  784. borderstyle borderstyle = stylelowered!
  785. end type
  786. type st_3 from statictext within w_create_book
  787. integer x = 315
  788. integer y = 56
  789. integer width = 142
  790. integer height = 60
  791. boolean bringtotop = true
  792. integer textsize = -8
  793. integer weight = 400
  794. fontpitch fontpitch = variable!
  795. fontfamily fontfamily = swiss!
  796. string facename = "MS Sans Serif"
  797. long textcolor = 41943040
  798. long backcolor = 134217739
  799. boolean enabled = false
  800. string text = "编号:"
  801. alignment alignment = right!
  802. boolean focusrectangle = false
  803. end type
  804. type cbx_ifuse from checkbox within w_create_book
  805. integer x = 969
  806. integer y = 48
  807. integer width = 215
  808. integer height = 64
  809. boolean bringtotop = true
  810. integer textsize = -8
  811. integer weight = 400
  812. fontcharset fontcharset = ansi!
  813. fontpitch fontpitch = variable!
  814. fontfamily fontfamily = swiss!
  815. string facename = "MS Sans Serif"
  816. long textcolor = 41943040
  817. long backcolor = 134217739
  818. string text = "使用"
  819. boolean checked = true
  820. end type
  821. type st_13 from statictext within w_create_book
  822. integer x = 87
  823. integer y = 456
  824. integer width = 370
  825. integer height = 76
  826. boolean bringtotop = true
  827. integer textsize = -9
  828. integer weight = 400
  829. fontcharset fontcharset = gb2312charset!
  830. fontpitch fontpitch = variable!
  831. string facename = "宋体"
  832. long textcolor = 33554432
  833. long backcolor = 134217739
  834. boolean enabled = false
  835. string text = "目标文件路径:"
  836. alignment alignment = right!
  837. boolean focusrectangle = false
  838. end type
  839. type sle_folder from singlelineedit within w_create_book
  840. integer x = 457
  841. integer y = 440
  842. integer width = 1655
  843. integer height = 80
  844. integer taborder = 70
  845. boolean bringtotop = true
  846. integer textsize = -9
  847. integer weight = 400
  848. fontcharset fontcharset = gb2312charset!
  849. fontpitch fontpitch = variable!
  850. string facename = "宋体"
  851. long textcolor = 33554432
  852. borderstyle borderstyle = stylelowered!
  853. end type
  854. type cb_2 from commandbutton within w_create_book
  855. integer x = 2117
  856. integer y = 436
  857. integer width = 114
  858. integer height = 84
  859. integer taborder = 80
  860. boolean bringtotop = true
  861. integer textsize = -9
  862. integer weight = 400
  863. fontcharset fontcharset = gb2312charset!
  864. fontpitch fontpitch = variable!
  865. string facename = "宋体"
  866. string text = "..."
  867. end type
  868. event clicked;
  869. //
  870. //GetFolder()
  871. //功 能:显示文件夹选择对话框。
  872. //语 法:GetFolder (title , director )
  873. //参 数:title:String类型,指定文件夹选择框的标题;
  874. // directory:String类型,文件夹的路径,即指定显示哪个文件夹下的子文件夹,又用于保存用户最终选择的文件夹的路径。
  875. //返回值:Integer。函数执行成功时返回1,发生错误时返回-1。当用户选择了”取消”按钮或直接关闭对话框,函数返回0。
  876. //示 例:This example displays the folder contents of the Sybase directory in a folder selection dialog box. The string passed in the title argument displays above the tree view:
  877. string ls_path
  878. integer li_result
  879. ls_path = mid(sys_cur_path,1,len(sys_cur_path )- 1)
  880. li_result = GetFolder( "目标文件路径", ls_path )
  881. sle_folder.text=ls_path
  882. end event
  883. type sle_fj from singlelineedit within w_create_book
  884. integer x = 457
  885. integer y = 924
  886. integer width = 1655
  887. integer height = 80
  888. integer taborder = 120
  889. boolean bringtotop = true
  890. integer textsize = -9
  891. integer weight = 400
  892. fontcharset fontcharset = gb2312charset!
  893. fontpitch fontpitch = variable!
  894. string facename = "宋体"
  895. long textcolor = 33554432
  896. boolean enabled = false
  897. borderstyle borderstyle = stylelowered!
  898. end type
  899. type cb_fj from commandbutton within w_create_book
  900. integer x = 2117
  901. integer y = 916
  902. integer width = 114
  903. integer height = 84
  904. integer taborder = 130
  905. boolean bringtotop = true
  906. integer textsize = -9
  907. integer weight = 400
  908. fontcharset fontcharset = gb2312charset!
  909. fontpitch fontpitch = variable!
  910. string facename = "宋体"
  911. boolean enabled = false
  912. string text = "..."
  913. end type
  914. event clicked;Integer i
  915. String Pathname,Filename
  916. i = GetFileSaveName("选择附件数据库文件",Pathname,Filename,"Dat","数据文件Dat,*.Dat")
  917. IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
  918. sle_fj.Text = Pathname
  919. END IF
  920. end event
  921. type cbx_fj from checkbox within w_create_book
  922. integer x = 73
  923. integer y = 932
  924. integer width = 384
  925. integer height = 60
  926. boolean bringtotop = true
  927. integer textsize = -9
  928. integer weight = 400
  929. fontcharset fontcharset = gb2312charset!
  930. fontpitch fontpitch = variable!
  931. string facename = "宋体"
  932. long textcolor = 33554432
  933. long backcolor = 134217739
  934. string text = "附件数据库:"
  935. end type
  936. event clicked;IF THIS.Checked THEN
  937. sle_fj.Enabled = TRUE
  938. cb_fj.Enabled = TRUE
  939. ELSE
  940. sle_fj.Enabled = FALSE
  941. cb_fj.Enabled = FALSE
  942. END IF
  943. end event
  944. type cbx_1 from checkbox within w_create_book
  945. integer x = 1175
  946. integer y = 48
  947. integer width = 466
  948. integer height = 64
  949. boolean bringtotop = true
  950. integer textsize = -9
  951. integer weight = 400
  952. fontcharset fontcharset = gb2312charset!
  953. fontpitch fontpitch = variable!
  954. string facename = "宋体"
  955. long textcolor = 33554432
  956. long backcolor = 134217739
  957. string text = "连接现有数据库"
  958. end type
  959. event clicked;IF THIS.Checked THEN
  960. sle_filename.Enabled = FALSE
  961. cb_ch2.Enabled = FALSE
  962. sle_folder.Enabled = FALSE
  963. cb_2.Enabled = FALSE
  964. cbx_db_h.Enabled = FALSE
  965. sle_sqldb_mdf_sor.Enabled = FALSE
  966. sle_sqldb_ldf_sor.Enabled = FALSE
  967. cbx_fj.Enabled = FALSE
  968. sle_fj.Enabled = FALSE
  969. cb_fj.Enabled = FALSE
  970. sle_pbl.Enabled = FALSE
  971. ELSE
  972. sle_filename.Enabled = TRUE
  973. cb_ch2.Enabled = TRUE
  974. sle_folder.Enabled = TRUE
  975. cb_2.Enabled = TRUE
  976. cbx_db_h.Enabled = TRUE
  977. sle_pbl.Enabled = TRUE
  978. sle_sqldb_mdf_sor.Enabled = cbx_db_h.Checked
  979. sle_sqldb_ldf_sor.Enabled = cbx_db_h.Checked
  980. cbx_fj.Enabled = cbx_db_h.Checked
  981. IF cbx_db_h.Checked THEN
  982. IF cbx_fj.Checked THEN
  983. sle_fj.Enabled = cbx_fj.Checked
  984. cb_fj.Enabled = cbx_fj.Checked
  985. ELSE
  986. sle_fj.Enabled = FALSE
  987. cb_fj.Enabled = FALSE
  988. END IF
  989. END IF
  990. END IF
  991. end event
  992. type st_14 from statictext within w_create_book
  993. integer x = 151
  994. integer y = 532
  995. integer width = 306
  996. integer height = 96
  997. boolean bringtotop = true
  998. integer textsize = -9
  999. integer weight = 400
  1000. fontcharset fontcharset = gb2312charset!
  1001. fontpitch fontpitch = variable!
  1002. string facename = "宋体"
  1003. long textcolor = 33554432
  1004. long backcolor = 134217739
  1005. boolean enabled = false
  1006. string text = "打印格式库文件名称:"
  1007. alignment alignment = right!
  1008. boolean focusrectangle = false
  1009. end type
  1010. type sle_pbl from singlelineedit within w_create_book
  1011. integer x = 457
  1012. integer y = 540
  1013. integer width = 1655
  1014. integer height = 80
  1015. integer taborder = 90
  1016. boolean bringtotop = true
  1017. integer textsize = -9
  1018. integer weight = 400
  1019. fontcharset fontcharset = gb2312charset!
  1020. fontpitch fontpitch = variable!
  1021. string facename = "宋体"
  1022. long textcolor = 33554432
  1023. borderstyle borderstyle = stylelowered!
  1024. end type