w_rpt_update.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. $PBExportHeader$w_rpt_update.srw
  2. $PBExportComments$Update设置-- 窗口
  3. forward
  4. global type w_rpt_update from Window
  5. end type
  6. type dw3 from datawindow within w_rpt_update
  7. end type
  8. type st_4 from statictext within w_rpt_update
  9. end type
  10. type st_3 from statictext within w_rpt_update
  11. end type
  12. type st_2 from statictext within w_rpt_update
  13. end type
  14. type ddlb_1 from dropdownlistbox within w_rpt_update
  15. end type
  16. type st_1 from statictext within w_rpt_update
  17. end type
  18. type rb_4 from radiobutton within w_rpt_update
  19. end type
  20. type rb_5 from radiobutton within w_rpt_update
  21. end type
  22. type rb_3 from radiobutton within w_rpt_update
  23. end type
  24. type rb_2 from radiobutton within w_rpt_update
  25. end type
  26. type rb_1 from radiobutton within w_rpt_update
  27. end type
  28. type cbx_1 from checkbox within w_rpt_update
  29. end type
  30. type dw2 from datawindow within w_rpt_update
  31. end type
  32. type cb_2 from commandbutton within w_rpt_update
  33. end type
  34. type cb_1 from commandbutton within w_rpt_update
  35. end type
  36. type dw1 from datawindow within w_rpt_update
  37. end type
  38. type gb_2 from groupbox within w_rpt_update
  39. end type
  40. type gb_1 from groupbox within w_rpt_update
  41. end type
  42. end forward
  43. global type w_rpt_update from Window
  44. int X=5
  45. int Y=320
  46. int Width=2926
  47. int Height=1712
  48. boolean TitleBar=true
  49. string Title="更新属性"
  50. long BackColor=80269524
  51. boolean ControlMenu=true
  52. WindowType WindowType=response!
  53. dw3 dw3
  54. st_4 st_4
  55. st_3 st_3
  56. st_2 st_2
  57. ddlb_1 ddlb_1
  58. st_1 st_1
  59. rb_4 rb_4
  60. rb_5 rb_5
  61. rb_3 rb_3
  62. rb_2 rb_2
  63. rb_1 rb_1
  64. cbx_1 cbx_1
  65. dw2 dw2
  66. cb_2 cb_2
  67. cb_1 cb_1
  68. dw1 dw1
  69. gb_2 gb_2
  70. gb_1 gb_1
  71. end type
  72. global w_rpt_update w_rpt_update
  73. type variables
  74. int i,ii_rows
  75. string is_temp
  76. datawindow idw
  77. DataWindowChild idw_child
  78. string is_updatetable,is_updatewhere,is_updatekeyinplace
  79. end variables
  80. forward prototypes
  81. public subroutine wf_ok ()
  82. end prototypes
  83. public subroutine wf_ok ();if cbx_1.checked=false then
  84. cb_1.enabled=true
  85. else
  86. if ddlb_1.text>'' and dw1.find("cupdate='yes'",1,999)>0 and dw2.find("ckey='yes'",1,999)>0 then
  87. cb_1.enabled=true
  88. else
  89. cb_1.enabled=false
  90. end if
  91. end if
  92. end subroutine
  93. on w_rpt_update.create
  94. this.dw3=create dw3
  95. this.st_4=create st_4
  96. this.st_3=create st_3
  97. this.st_2=create st_2
  98. this.ddlb_1=create ddlb_1
  99. this.st_1=create st_1
  100. this.rb_4=create rb_4
  101. this.rb_5=create rb_5
  102. this.rb_3=create rb_3
  103. this.rb_2=create rb_2
  104. this.rb_1=create rb_1
  105. this.cbx_1=create cbx_1
  106. this.dw2=create dw2
  107. this.cb_2=create cb_2
  108. this.cb_1=create cb_1
  109. this.dw1=create dw1
  110. this.gb_2=create gb_2
  111. this.gb_1=create gb_1
  112. this.Control[]={this.dw3,&
  113. this.st_4,&
  114. this.st_3,&
  115. this.st_2,&
  116. this.ddlb_1,&
  117. this.st_1,&
  118. this.rb_4,&
  119. this.rb_5,&
  120. this.rb_3,&
  121. this.rb_2,&
  122. this.rb_1,&
  123. this.cbx_1,&
  124. this.dw2,&
  125. this.cb_2,&
  126. this.cb_1,&
  127. this.dw1,&
  128. this.gb_2,&
  129. this.gb_1}
  130. end on
  131. on w_rpt_update.destroy
  132. destroy(this.dw3)
  133. destroy(this.st_4)
  134. destroy(this.st_3)
  135. destroy(this.st_2)
  136. destroy(this.ddlb_1)
  137. destroy(this.st_1)
  138. destroy(this.rb_4)
  139. destroy(this.rb_5)
  140. destroy(this.rb_3)
  141. destroy(this.rb_2)
  142. destroy(this.rb_1)
  143. destroy(this.cbx_1)
  144. destroy(this.dw2)
  145. destroy(this.cb_2)
  146. destroy(this.cb_1)
  147. destroy(this.dw1)
  148. destroy(this.gb_2)
  149. destroy(this.gb_1)
  150. end on
  151. event open;f_wcenter(this)
  152. idw=w_rpt_main.dw3
  153. idw.rowscopy(1,idw.rowcount(),Primary!,dw1,1,Primary!)
  154. dw1.sharedata(dw2)
  155. string ls[],ls_sql,ls_from
  156. ls_sql=w_rpt_main.istr_rpt.rsqlselect
  157. if ls_sql='' then return
  158. f_rpt_cksql(ls_sql,is_temp,ls_from,is_temp,is_temp,is_temp)
  159. ls_from=f_replace(ls_from+',',',','~t')
  160. f_atab(ls[],ls_from)
  161. for i=1 to upperbound(ls[])
  162. ddlb_1.additem(ls[i])
  163. next
  164. dw3.GetChild('cname',idw_child)
  165. dw3.insertrow(0)
  166. dw1.rowscopy(1,dw1.rowcount(),Primary!,idw_child,1,Primary!)
  167. idw_child.insertrow(1)
  168. is_updatetable=w_rpt_main.is_updatetable
  169. ddlb_1.text=is_updatetable
  170. is_updatewhere=w_rpt_main.is_updatewhere
  171. rb_1.checked=is_updatewhere="0"
  172. rb_2.checked=is_updatewhere="1"
  173. rb_3.checked=is_updatewhere="2"
  174. is_updatekeyinplace=lower(w_rpt_main.is_updatekeyinplace)
  175. rb_4.checked=is_updatekeyinplace="no"
  176. rb_5.checked=is_updatekeyinplace="yes"
  177. ii_rows=dw1.rowcount()
  178. for i=1 to ii_rows
  179. if dw1.getitemstring(i,'cupdate')='yes' then
  180. dw1.SelectRow(i,true)
  181. end if
  182. if dw1.getitemstring(i,'cidentity')='yes' then
  183. dw3.setitem(1,1,dw1.getitemstring(i,'cname'))
  184. end if
  185. next
  186. ii_rows=dw2.rowcount()
  187. for i=1 to ii_rows
  188. if dw2.getitemstring(i,'ckey')='yes' then
  189. dw2.SelectRow(i,true)
  190. end if
  191. next
  192. if is_updatetable>'' then
  193. cbx_1.postevent(clicked!)
  194. cbx_1.checked=true
  195. else
  196. cbx_1.postevent(clicked!)
  197. cbx_1.postevent(clicked!)
  198. end if
  199. end event
  200. type dw3 from datawindow within w_rpt_update
  201. int X=507
  202. int Y=1528
  203. int Width=919
  204. int Height=92
  205. int TabOrder=80
  206. string DataObject="dw_rpt_identity"
  207. boolean Border=false
  208. boolean LiveScroll=true
  209. end type
  210. type st_4 from statictext within w_rpt_update
  211. int X=55
  212. int Y=1536
  213. int Width=453
  214. int Height=76
  215. boolean Enabled=false
  216. string Text="Identity Column:"
  217. Alignment Alignment=Right!
  218. boolean FocusRectangle=false
  219. long TextColor=33554432
  220. long BackColor=67108864
  221. int TextSize=-9
  222. int Weight=400
  223. string FaceName="宋体"
  224. FontCharSet FontCharSet=GB2312CharSet!
  225. FontPitch FontPitch=Variable!
  226. end type
  227. type st_3 from statictext within w_rpt_update
  228. int X=1472
  229. int Y=620
  230. int Width=590
  231. int Height=76
  232. boolean Enabled=false
  233. string Text="Unigue Key Column(s):"
  234. Alignment Alignment=Center!
  235. boolean FocusRectangle=false
  236. long TextColor=33554432
  237. long BackColor=67108864
  238. int TextSize=-9
  239. int Weight=400
  240. string FaceName="宋体"
  241. FontCharSet FontCharSet=GB2312CharSet!
  242. FontPitch FontPitch=Variable!
  243. end type
  244. type st_2 from statictext within w_rpt_update
  245. int X=9
  246. int Y=620
  247. int Width=535
  248. int Height=76
  249. boolean Enabled=false
  250. string Text="Updateable Columns:"
  251. Alignment Alignment=Center!
  252. boolean FocusRectangle=false
  253. long TextColor=33554432
  254. long BackColor=67108864
  255. int TextSize=-9
  256. int Weight=400
  257. string FaceName="宋体"
  258. FontCharSet FontCharSet=GB2312CharSet!
  259. FontPitch FontPitch=Variable!
  260. end type
  261. type ddlb_1 from dropdownlistbox within w_rpt_update
  262. int X=1211
  263. int Y=20
  264. int Width=910
  265. int Height=228
  266. int TabOrder=10
  267. BorderStyle BorderStyle=StyleLowered!
  268. boolean VScrollBar=true
  269. long TextColor=33554432
  270. int TextSize=-9
  271. int Weight=400
  272. string FaceName="宋体"
  273. FontCharSet FontCharSet=GB2312CharSet!
  274. FontPitch FontPitch=Variable!
  275. end type
  276. event selectionchanged;wf_ok()
  277. end event
  278. type st_1 from statictext within w_rpt_update
  279. int X=754
  280. int Y=32
  281. int Width=453
  282. int Height=76
  283. boolean Enabled=false
  284. string Text="Table To Update:"
  285. Alignment Alignment=Center!
  286. boolean FocusRectangle=false
  287. long TextColor=33554432
  288. long BackColor=67108864
  289. int TextSize=-9
  290. int Weight=400
  291. string FaceName="宋体"
  292. FontCharSet FontCharSet=GB2312CharSet!
  293. FontPitch FontPitch=Variable!
  294. end type
  295. type rb_4 from radiobutton within w_rpt_update
  296. int X=1248
  297. int Y=240
  298. int Width=686
  299. int Height=76
  300. string Text="Use Delete then Insert"
  301. BorderStyle BorderStyle=StyleLowered!
  302. boolean Checked=true
  303. long TextColor=33554432
  304. long BackColor=67108864
  305. int TextSize=-9
  306. int Weight=400
  307. string FaceName="宋体"
  308. FontCharSet FontCharSet=GB2312CharSet!
  309. FontPitch FontPitch=Variable!
  310. end type
  311. event clicked;is_updatekeyinplace="no"
  312. end event
  313. type rb_5 from radiobutton within w_rpt_update
  314. int X=1248
  315. int Y=336
  316. int Width=795
  317. int Height=76
  318. string Text="Use Update"
  319. BorderStyle BorderStyle=StyleLowered!
  320. long TextColor=33554432
  321. long BackColor=67108864
  322. int TextSize=-9
  323. int Weight=400
  324. string FaceName="宋体"
  325. FontCharSet FontCharSet=GB2312CharSet!
  326. FontPitch FontPitch=Variable!
  327. end type
  328. event clicked;is_updatekeyinplace="yes"
  329. end event
  330. type rb_3 from radiobutton within w_rpt_update
  331. int X=105
  332. int Y=432
  333. int Width=795
  334. int Height=76
  335. string Text="Key and Modified Columns"
  336. BorderStyle BorderStyle=StyleLowered!
  337. long TextColor=33554432
  338. long BackColor=67108864
  339. int TextSize=-9
  340. int Weight=400
  341. string FaceName="宋体"
  342. FontCharSet FontCharSet=GB2312CharSet!
  343. FontPitch FontPitch=Variable!
  344. end type
  345. event clicked;is_updatewhere="2"
  346. end event
  347. type rb_2 from radiobutton within w_rpt_update
  348. int X=105
  349. int Y=336
  350. int Width=795
  351. int Height=76
  352. string Text="Key and Updateable Columns"
  353. BorderStyle BorderStyle=StyleLowered!
  354. boolean Checked=true
  355. long TextColor=33554432
  356. long BackColor=67108864
  357. int TextSize=-9
  358. int Weight=400
  359. string FaceName="宋体"
  360. FontCharSet FontCharSet=GB2312CharSet!
  361. FontPitch FontPitch=Variable!
  362. end type
  363. event clicked;is_updatewhere="1"
  364. end event
  365. type rb_1 from radiobutton within w_rpt_update
  366. int X=105
  367. int Y=240
  368. int Width=384
  369. int Height=76
  370. string Text="Key Columns"
  371. BorderStyle BorderStyle=StyleLowered!
  372. long TextColor=33554432
  373. long BackColor=67108864
  374. int TextSize=-9
  375. int Weight=400
  376. string FaceName="宋体"
  377. FontCharSet FontCharSet=GB2312CharSet!
  378. FontPitch FontPitch=Variable!
  379. end type
  380. event clicked;is_updatewhere="0"
  381. end event
  382. type cbx_1 from checkbox within w_rpt_update
  383. int X=50
  384. int Y=20
  385. int Width=439
  386. int Height=76
  387. string Text="Allow Updates"
  388. BorderStyle BorderStyle=StyleLowered!
  389. long TextColor=33554432
  390. long BackColor=67108864
  391. int TextSize=-9
  392. int Weight=400
  393. string FaceName="宋体"
  394. FontCharSet FontCharSet=GB2312CharSet!
  395. FontPitch FontPitch=Variable!
  396. end type
  397. event clicked;ddlb_1.enabled=checked
  398. rb_1.enabled=checked
  399. rb_2.enabled=checked
  400. rb_3.enabled=checked
  401. rb_4.enabled=checked
  402. rb_5.enabled=checked
  403. dw1.enabled=checked
  404. dw2.enabled=checked
  405. dw3.enabled=checked
  406. wf_ok()
  407. end event
  408. type dw2 from datawindow within w_rpt_update
  409. int X=1463
  410. int Y=696
  411. int Width=1435
  412. int Height=808
  413. int TabOrder=70
  414. string DataObject="dw_rpt_column"
  415. BorderStyle BorderStyle=StyleLowered!
  416. boolean HScrollBar=true
  417. boolean VScrollBar=true
  418. boolean HSplitScroll=true
  419. boolean LiveScroll=true
  420. end type
  421. event clicked;if row>0 then
  422. if getSelectedRow(Row - 1)=row then
  423. SelectRow(Row,false)
  424. setitem(row,'ckey','no')
  425. else
  426. SelectRow(Row,true)
  427. setitem(row,'ckey','yes')
  428. end if
  429. wf_ok()
  430. end if
  431. return 1
  432. end event
  433. type cb_2 from commandbutton within w_rpt_update
  434. int X=2533
  435. int Y=212
  436. int Width=247
  437. int Height=108
  438. int TabOrder=30
  439. string Text="取消"
  440. int TextSize=-9
  441. int Weight=400
  442. string FaceName="宋体"
  443. FontPitch FontPitch=Variable!
  444. end type
  445. event clicked;close(parent)
  446. end event
  447. type cb_1 from commandbutton within w_rpt_update
  448. int X=2533
  449. int Y=64
  450. int Width=247
  451. int Height=108
  452. int TabOrder=20
  453. boolean Enabled=false
  454. string Text="确认"
  455. int TextSize=-9
  456. int Weight=400
  457. string FaceName="宋体"
  458. FontPitch FontPitch=Variable!
  459. end type
  460. event clicked;is_temp=dw3.getitemstring(1,1)
  461. ii_rows=dw1.rowcount()
  462. for i=1 to ii_rows
  463. if dw1.getitemstring(i,'cname')=is_temp then
  464. dw1.setitem(i,'cidentity','yes')
  465. else
  466. dw1.setitem(i,'cidentity','no')
  467. end if
  468. next
  469. idw.reset()
  470. dw1.rowscopy(1,ii_rows,Primary!,idw,1,Primary!)
  471. if cbx_1.checked then
  472. w_rpt_main.is_updatetable=ddlb_1.text
  473. w_rpt_main.is_updatewhere=is_updatewhere
  474. w_rpt_main.is_updatekeyinplace=is_updatekeyinplace
  475. else
  476. w_rpt_main.is_updatetable=''
  477. w_rpt_main.is_updatewhere='2'
  478. w_rpt_main.is_updatekeyinplace='no'
  479. end if
  480. w_rpt_main.ii_save=1
  481. close(parent)
  482. end event
  483. type dw1 from datawindow within w_rpt_update
  484. int X=9
  485. int Y=696
  486. int Width=1435
  487. int Height=808
  488. int TabOrder=60
  489. string DataObject="dw_rpt_column"
  490. BorderStyle BorderStyle=StyleLowered!
  491. boolean HScrollBar=true
  492. boolean VScrollBar=true
  493. boolean HSplitScroll=true
  494. boolean LiveScroll=true
  495. end type
  496. event clicked;if row>0 then
  497. if getSelectedRow(Row -1)=row then
  498. SelectRow(Row,false)
  499. setitem(row,'cupdate','no')
  500. else
  501. SelectRow(Row,true)
  502. setitem(row,'cupdate','yes')
  503. end if
  504. wf_ok()
  505. end if
  506. return 1
  507. end event
  508. type gb_2 from groupbox within w_rpt_update
  509. int X=1175
  510. int Y=152
  511. int Width=946
  512. int Height=408
  513. int TabOrder=40
  514. string Text="Key Modification"
  515. BorderStyle BorderStyle=StyleLowered!
  516. long TextColor=33554432
  517. long BackColor=67108864
  518. int TextSize=-9
  519. int Weight=400
  520. string FaceName="宋体"
  521. FontCharSet FontCharSet=GB2312CharSet!
  522. FontPitch FontPitch=Variable!
  523. end type
  524. type gb_1 from groupbox within w_rpt_update
  525. int X=41
  526. int Y=152
  527. int Width=946
  528. int Height=408
  529. int TabOrder=50
  530. string Text="Where Clause For Update/Delete"
  531. BorderStyle BorderStyle=StyleLowered!
  532. long TextColor=33554432
  533. long BackColor=67108864
  534. int TextSize=-9
  535. int Weight=400
  536. string FaceName="宋体"
  537. FontCharSet FontCharSet=GB2312CharSet!
  538. FontPitch FontPitch=Variable!
  539. end type