w_itemdef_ch_with_itemflag.srw 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. $PBExportHeader$w_itemdef_ch_with_itemflag.srw
  2. forward
  3. global type w_itemdef_ch_with_itemflag from w_publ_choice
  4. end type
  5. type cbx_mlselect from checkbox within w_itemdef_ch_with_itemflag
  6. end type
  7. type cbx_all from checkbox within w_itemdef_ch_with_itemflag
  8. end type
  9. end forward
  10. global type w_itemdef_ch_with_itemflag from w_publ_choice
  11. integer width = 3611
  12. integer height = 2380
  13. string title = "收支项目选择"
  14. cbx_mlselect cbx_mlselect
  15. cbx_all cbx_all
  16. end type
  17. global w_itemdef_ch_with_itemflag w_itemdef_ch_with_itemflag
  18. type variables
  19. Boolean if_changeselect = TRUE
  20. Int if_mlselect = 0
  21. s_itemdef_arr INS_RT_STRU
  22. int ins_itemflag = 0
  23. end variables
  24. on w_itemdef_ch_with_itemflag.create
  25. int iCurrent
  26. call super::create
  27. this.cbx_mlselect=create cbx_mlselect
  28. this.cbx_all=create cbx_all
  29. iCurrent=UpperBound(this.Control)
  30. this.Control[iCurrent+1]=this.cbx_mlselect
  31. this.Control[iCurrent+2]=this.cbx_all
  32. end on
  33. on w_itemdef_ch_with_itemflag.destroy
  34. call super::destroy
  35. destroy(this.cbx_mlselect)
  36. destroy(this.cbx_all)
  37. end on
  38. event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU)
  39. end event
  40. event dw_filter;call super::dw_filter;String obj_expr = ''
  41. IF Trim(sle_ch.Text) <> '' THEN
  42. IF Pos(Trim(sle_ch.Text),'%') = 0 THEN
  43. obj_expr = obj_expr+'( itemcode LIKE "%'+Trim(sle_ch.Text)+'%" )'
  44. ELSE
  45. obj_expr = obj_expr+'( itemcode LIKE "'+Trim(sle_ch.Text)+'" )'
  46. END IF
  47. END IF
  48. dw_ch.SetFilter(obj_expr)
  49. dw_ch.SetRedraw(False)
  50. dw_ch.Filter()
  51. IF dw_ch.RowCount() >= 1 THEN
  52. dw_ch.SelectRow(0,False)
  53. dw_ch.SelectRow(1,True)
  54. END IF
  55. dw_ch.SetRedraw(True)
  56. end event
  57. event open;this.triggerevent('ue_before_open')
  58. wf_movetocenter()
  59. ins_itemflag = message.doubleparm
  60. if_ue_sort=true
  61. dw_CH.SetTransObject (sqlca)
  62. cb_retrieve.TRIGGEREVENT(CLICKED!)
  63. end event
  64. event key;call super::key;If KeyDown(KeyEnter!) And KeyDown(KeyControl!) Then
  65. cb_choice.TriggerEvent(Clicked!)
  66. End If
  67. end event
  68. type cb_func from w_publ_choice`cb_func within w_itemdef_ch_with_itemflag
  69. end type
  70. type cb_exit from w_publ_choice`cb_exit within w_itemdef_ch_with_itemflag
  71. end type
  72. type sle_ch from w_publ_choice`sle_ch within w_itemdef_ch_with_itemflag
  73. end type
  74. type dw_ch from w_publ_choice`dw_ch within w_itemdef_ch_with_itemflag
  75. integer width = 3579
  76. integer height = 1984
  77. string dataobject = "dw_itemdef_index_with_itemflag"
  78. end type
  79. event dw_ch::rowfocuschanged;IF if_mlselect = 1 THEN
  80. IF currentrow <= 0 THEN RETURN
  81. IF KeyDown(keycontrol!) THEN
  82. IF THIS.IsSelected(currentrow) THEN
  83. THIS.SelectRow(currentrow,FALSE)
  84. if_changeselect = FALSE
  85. ELSE
  86. if_changeselect = TRUE
  87. END IF
  88. ELSE
  89. IF NOT THIS.IsSelected(currentrow) THEN
  90. THIS.SelectRow(currentrow,TRUE)
  91. if_changeselect = FALSE
  92. ELSE
  93. if_changeselect = TRUE
  94. END IF
  95. END IF
  96. ELSE
  97. IF dw_edit_mode THEN RETURN
  98. IF currentrow <= 0 THEN RETURN
  99. THIS.SelectRow(0,FALSE)
  100. THIS.SelectRow(currentrow,TRUE)
  101. END IF
  102. end event
  103. event dw_ch::clicked;if row>0 then
  104. this.setrow(row)
  105. if if_mlselect=1 then
  106. if if_changeselect then
  107. this.selectrow(row,not this.IsSelected(row))
  108. else
  109. if_changeselect=true
  110. end if
  111. else
  112. this.selectrow(0,false)
  113. this.selectrow(row,true)
  114. end if
  115. end if
  116. end event
  117. type st_1 from w_publ_choice`st_1 within w_itemdef_ch_with_itemflag
  118. end type
  119. type cb_retrieve from w_publ_choice`cb_retrieve within w_itemdef_ch_with_itemflag
  120. end type
  121. event cb_retrieve::clicked;dw_ch.retrieve(ins_itemflag)
  122. end event
  123. type cb_choice from w_publ_choice`cb_choice within w_itemdef_ch_with_itemflag
  124. end type
  125. event cb_choice::clicked;call super::clicked;Long row,ll_i,chc
  126. FOR ll_i = 1 To dw_ch.RowCount()
  127. IF dw_ch.IsSelected(ll_i) THEN
  128. chc++
  129. INS_RT_STRU.itemid[chc] = dw_ch.Object.itemid[ll_i]
  130. INS_RT_STRU.itemcode[chc] = dw_ch.Object.itemcode[ll_i]
  131. INS_RT_STRU.itemname[chc] = dw_ch.Object.itemname[ll_i]
  132. INS_RT_STRU.itemtype[chc] = dw_ch.Object.itemtype[ll_i]
  133. INS_RT_STRU.itemdscrp[chc] = dw_ch.Object.dscrp[ll_i]
  134. INS_RT_STRU.itemflag[chc] = dw_ch.Object.itemflag[ll_i]
  135. INS_RT_STRU.itemsectype[chc] = dw_ch.Object.itemsectype[ll_i]
  136. END IF
  137. NEXT
  138. IF chc = 0 THEN
  139. MessageBox('系统提示','请至少选择一个目标行!',StopSign!)
  140. RETURN
  141. END IF
  142. Close(Parent)
  143. end event
  144. type ln_bar from w_publ_choice`ln_bar within w_itemdef_ch_with_itemflag
  145. end type
  146. type ln_bar2 from w_publ_choice`ln_bar2 within w_itemdef_ch_with_itemflag
  147. end type
  148. type r_bar from w_publ_choice`r_bar within w_itemdef_ch_with_itemflag
  149. end type
  150. type ln_1 from w_publ_choice`ln_1 within w_itemdef_ch_with_itemflag
  151. end type
  152. type ln_2 from w_publ_choice`ln_2 within w_itemdef_ch_with_itemflag
  153. end type
  154. type cbx_mlselect from checkbox within w_itemdef_ch_with_itemflag
  155. integer x = 901
  156. integer y = 196
  157. integer width = 256
  158. integer height = 60
  159. boolean bringtotop = true
  160. integer textsize = -9
  161. integer weight = 400
  162. fontcharset fontcharset = gb2312charset!
  163. fontpitch fontpitch = variable!
  164. string facename = "宋体"
  165. long backcolor = 134217739
  166. string text = "多选"
  167. end type
  168. event clicked;IF THIS.Checked THEN
  169. if_mlselect = 1
  170. cbx_all.Enabled = TRUE
  171. ELSE
  172. if_mlselect = 0
  173. cbx_all.Enabled = FALSE
  174. cbx_all.Checked = FALSE
  175. Long li
  176. FOR li = 1 TO dw_ch.RowCount()
  177. dw_ch.SelectRow(li,FALSE)
  178. NEXT
  179. END IF
  180. f_SetProfileString (sys_empid,dw_ch.DataObject, "if_mlselect", String(if_mlselect))
  181. end event
  182. event constructor;if_mlselect = Integer(f_ProfileString (sys_empid,dw_ch.DataObject, "if_mlselect", '0'))
  183. IF if_mlselect = 0 THEN
  184. THIS.Checked = FALSE
  185. cbx_all.Enabled = FALSE
  186. ELSE
  187. THIS.Checked = TRUE
  188. cbx_all.Enabled = TRUE
  189. END IF
  190. end event
  191. type cbx_all from checkbox within w_itemdef_ch_with_itemflag
  192. integer x = 1111
  193. integer y = 196
  194. integer width = 242
  195. integer height = 60
  196. boolean bringtotop = true
  197. integer textsize = -9
  198. integer weight = 400
  199. fontcharset fontcharset = gb2312charset!
  200. fontpitch fontpitch = variable!
  201. string facename = "宋体"
  202. long backcolor = 134217739
  203. boolean enabled = false
  204. string text = "全选"
  205. end type
  206. event clicked;IF dw_ch.RowCount() <= 0 THEN RETURN
  207. Long li
  208. IF THIS.Checked THEN
  209. FOR li = 1 TO dw_ch.RowCount()
  210. dw_ch.SelectRow(li,TRUE)
  211. NEXT
  212. ELSE
  213. FOR li = 1 TO dw_ch.RowCount()
  214. dw_ch.SelectRow(li,FALSE)
  215. NEXT
  216. END IF
  217. end event