w_expensesdef.srw 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. $PBExportHeader$w_expensesdef.srw
  2. forward
  3. global type w_expensesdef from w_publ_edit_choice
  4. end type
  5. type cbx_mlselect from checkbox within w_expensesdef
  6. end type
  7. type cbx_allselect from checkbox within w_expensesdef
  8. end type
  9. end forward
  10. global type w_expensesdef from w_publ_edit_choice
  11. integer width = 2048
  12. integer height = 1544
  13. string title = "客户费用项目"
  14. cbx_mlselect cbx_mlselect
  15. cbx_allselect cbx_allselect
  16. end type
  17. global w_expensesdef w_expensesdef
  18. type variables
  19. s_mtrldef_array INS_RT_STRU
  20. int if_mlselect=0
  21. boolean if_select_all=false
  22. boolean if_changeselect=true
  23. end variables
  24. forward prototypes
  25. public function integer wf_face_change ()
  26. end prototypes
  27. public function integer wf_face_change (); cbx_mlselect.enabled = not dw_edit_mode
  28. cbx_allselect.enabled = not dw_edit_mode
  29. IF dw_edit_mode THEN
  30. cb_func.Enabled = FALSE
  31. cb_choice.Enabled = FALSE
  32. cb_delet.Enabled = FALSE
  33. cb_rtr.Enabled = FALSE
  34. cb_edit.Text = "放弃&E"
  35. cb_add.Text = "保存&S"
  36. cb_edit.normalpicname = 'Undo.bmp'
  37. cb_add.normalpicname = 'Save.bmp'
  38. ELSE
  39. cb_func.Enabled = TRUE
  40. cb_delet.Enabled = TRUE
  41. cb_choice.Enabled = TRUE
  42. cb_rtr.Enabled = TRUE
  43. cb_edit.Text = "修改&E"
  44. cb_add.Text = "新建&S"
  45. cb_edit.normalpicname = 'OPEN.bmp'
  46. cb_add.normalpicname = 'new.bmp'
  47. END IF
  48. cb_edit.of_init_draw()
  49. cb_add.of_init_draw()
  50. cb_edit.of_paint()
  51. cb_add.of_paint()
  52. cb_add.TriggerEvent('ue_textchange')
  53. cb_edit.TriggerEvent('ue_textchange')
  54. RETURN 1
  55. end function
  56. on w_expensesdef.create
  57. int iCurrent
  58. call super::create
  59. this.cbx_mlselect=create cbx_mlselect
  60. this.cbx_allselect=create cbx_allselect
  61. iCurrent=UpperBound(this.Control)
  62. this.Control[iCurrent+1]=this.cbx_mlselect
  63. this.Control[iCurrent+2]=this.cbx_allselect
  64. end on
  65. on w_expensesdef.destroy
  66. call super::destroy
  67. destroy(this.cbx_mlselect)
  68. destroy(this.cbx_allselect)
  69. end on
  70. event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU)
  71. end event
  72. type cb_func from w_publ_edit_choice`cb_func within w_expensesdef
  73. end type
  74. type cb_exit from w_publ_edit_choice`cb_exit within w_expensesdef
  75. end type
  76. type cb_add from w_publ_edit_choice`cb_add within w_expensesdef
  77. end type
  78. event cb_add::clicked;call super::clicked;IF NOT f_power_ind(1018) THEN
  79. MessageBox('提示','你没有使用权限!', Information!, OK! )
  80. RETURN
  81. END IF
  82. Long ll_newid,i
  83. String errmsg
  84. IF dw_edit_mode THEN
  85. dw_uc.AcceptText()
  86. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  87. MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
  88. RETURN
  89. END IF
  90. dw_uc.Object.expensesname[dw_uc.GetRow()] = Trim(dw_uc.Object.expensesname[dw_uc.GetRow()])
  91. dw_uc.Object.expensescode[dw_uc.GetRow()] = Trim(dw_uc.Object.expensescode[dw_uc.GetRow()])
  92. IF dw_uc.Object.expensesname[dw_uc.GetRow()] = '' THEN
  93. MessageBox('提示','请输入项目名称!', Information!, OK! )
  94. RETURN
  95. END IF
  96. IF dw_uc.Object.expensescode[dw_uc.GetRow()] = '' THEN
  97. MessageBox('提示','请输入项目名称!', Information!, OK! )
  98. RETURN
  99. END IF
  100. IF dw_uc.Object.expensesid[dw_uc.GetRow()] = 0 THEN
  101. ll_newid = f_sys_scidentity(0,"U_Expenses","ExpensesID",errmsg,FALSE,sqlca)
  102. IF ll_newid <= 0 THEN
  103. MessageBox('提示',errmsg, Information!, OK! )
  104. RETURN
  105. ELSE
  106. dw_uc.Object.expensesid[dw_uc.GetRow()] = ll_newid
  107. END IF
  108. END IF
  109. END IF
  110. IF dw_edit_mode THEN
  111. String ls_errmsg
  112. IF dw_uc.Update() = -1 THEN
  113. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  114. ls_errmsg = "关键内容重复"
  115. ELSE
  116. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  117. END IF
  118. ROLLBACK;
  119. MessageBox ('提示',ls_errmsg+",保存操作失败!",Exclamation!,OK!)
  120. LS_UPDATE_FLAG = FALSE
  121. RETURN
  122. ELSE
  123. COMMIT;
  124. FOR i = 1 TO 3
  125. dw_uc.SetTabOrder ( i, 0 )
  126. NEXT
  127. LS_UPDATE_FLAG = TRUE
  128. END IF
  129. ins_sqlerrtext = ""
  130. ELSE
  131. Long li_row, li_cur_row
  132. li_cur_row = dw_uc.GetRow()
  133. li_row = dw_uc.InsertRow (0)
  134. FOR i = 1 TO 3
  135. dw_uc.SetTabOrder ( i, i*10 )
  136. NEXT
  137. dw_uc.SelectRow(0,FALSE)
  138. dw_uc.ScrollToRow (li_row)
  139. dw_uc.SelectRow(li_row,TRUE)
  140. dw_uc.SetFocus()
  141. modifyrow_no = li_row
  142. END IF
  143. dw_edit_mode = NOT dw_edit_mode
  144. WF_FACE_CHANGE()
  145. end event
  146. type cb_edit from w_publ_edit_choice`cb_edit within w_expensesdef
  147. end type
  148. event cb_edit::clicked;call super::clicked;IF NOT f_power_ind(1018) THEN
  149. MessageBox('提示','你没有使用权限!', Information!, OK! )
  150. RETURN
  151. END IF
  152. long i
  153. IF dw_edit_mode THEN
  154. if dw_uc.GetItemStatus(dw_UC.getrow(), 0, Primary!)=NewModified! or dw_uc.GetItemStatus(dw_UC.getrow(), 0, Primary!)=New! then
  155. dw_UC.deleterow(dw_UC.getrow())
  156. else
  157. dw_UC.ReselectRow(dw_UC.getrow())
  158. end if
  159. for i=1 to 3
  160. dw_UC.SetTabOrder ( i, 0 )
  161. next
  162. modifyrow_no = 0
  163. ELSE
  164. modifyrow_no = dw_UC.getrow()
  165. for i=1 to 3
  166. dw_UC.SetTabOrder ( i, i*10 )
  167. next
  168. dw_UC.SetFocus()
  169. dw_UC.selectrow(0,false)
  170. dw_UC.ScrollToRow (modifyrow_no)
  171. dw_uc.selectrow(modifyrow_no,true)
  172. END IF
  173. dw_edit_mode= NOT dw_edit_mode
  174. WF_FACE_CHANGE()
  175. end event
  176. type cb_delet from w_publ_edit_choice`cb_delet within w_expensesdef
  177. end type
  178. event cb_delet::clicked;call super::clicked;IF NOT f_power_ind(1018) THEN
  179. MessageBox('提示','你没有使用权限!', Information!, OK! )
  180. RETURN
  181. END IF
  182. IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  183. RETURN
  184. END IF
  185. Long LS_id
  186. Long LS_LONG = 0
  187. String ls_code,arg_msg
  188. IF DW_UC.GetRow() <= 0 THEN
  189. MessageBox('','没有操作目标记录!', Information!, OK! )
  190. RETURN
  191. END IF
  192. LS_id = DW_UC.Object.Expensesid[DW_UC.GetRow()]
  193. SELECT count(u_reissuemx.mtrlid) INTO :LS_LONG
  194. FROM u_reissuemx INNER JOIN
  195. u_reissue ON u_reissuemx.reissueid = u_reissue.reissueid AND
  196. u_reissuemx.scid = u_reissue.scid
  197. Where (u_reissue.TYPE = 1) AND u_reissuemx.mtrlid = :LS_id;
  198. IF SQLCA.SQLCode <> 0 THEN
  199. MessageBox ('提示',"数据查询操作失败!(请重试!)",Exclamation!,OK!)
  200. RETURN
  201. END IF
  202. IF LS_LONG > 0 THEN
  203. MessageBox ('提示',"该资料已经使用于补件单,不可以删除!",Exclamation!,OK!)
  204. RETURN
  205. END IF
  206. DW_UC.SetRedraw (FALSE)
  207. DW_UC.DeleteRow (0)
  208. DW_UC.TriggerEvent (RowFocusChanged!)
  209. IF DW_UC.Update() = -1 THEN
  210. ROLLBACK;
  211. MessageBox ('提示',"删除记录操作失败!",Exclamation!,OK!)
  212. ELSE
  213. COMMIT;
  214. END IF
  215. DW_UC.SetRedraw (TRUE)
  216. end event
  217. type cb_choice from w_publ_edit_choice`cb_choice within w_expensesdef
  218. end type
  219. event cb_choice::clicked;call super::clicked;Long ROW,ls_i,chC = 0
  220. ROW = dw_uc.GetRow()
  221. IF ROW <= 0 THEN
  222. MessageBox('提示','请先选择目标行!', Information!, OK! )
  223. RETURN
  224. END IF
  225. FOR ls_i = 1 TO dw_uc.RowCount()
  226. IF dw_uc.IsSelected(ls_i) THEN
  227. chC++
  228. INS_RT_STRU.mtrlid[chC] = dw_uc.Object.Expensesid[ls_i]
  229. INS_RT_STRU.mtrlname[chC] = dw_uc.Object.Expensesname[ls_i]
  230. INS_RT_STRU.mtrlcode[chC] = dw_uc.Object.Expensescode[ls_i]
  231. END IF
  232. NEXT
  233. IF chC = 0 THEN
  234. MessageBox('提示','请至少选择一个目标行!', Information!, OK! )
  235. RETURN
  236. END IF
  237. Close(PARENT)
  238. end event
  239. type dw_uc from w_publ_edit_choice`dw_uc within w_expensesdef
  240. integer width = 2016
  241. string dataobject = "dw_expensesdef"
  242. end type
  243. event dw_uc::clicked;if row > 0 and dw_edit_mode then
  244. this.setrow(row)
  245. if if_mlselect = 1 then
  246. if if_changeselect then
  247. this.selectrow(row,not this.isselected(row))
  248. else
  249. if_changeselect = true
  250. end if
  251. else
  252. this.selectrow(0,false)
  253. this.selectrow(row,true)
  254. end if
  255. end if
  256. end event
  257. event dw_uc::rowfocuschanged;IF modifyrow_no > 0 AND dw_edit_mode THEN
  258. THIS.SetRow(modifyrow_no)
  259. THIS.ScrollToRow(modifyrow_no)
  260. ELSE
  261. IF if_mlselect = 1 THEN
  262. IF currentrow <= 0 THEN RETURN
  263. IF KeyDown(keycontrol!) THEN
  264. IF THIS.IsSelected(currentrow) THEN
  265. THIS.SelectRow(currentrow,FALSE)
  266. if_changeselect = FALSE
  267. ELSE
  268. if_changeselect = TRUE
  269. END IF
  270. ELSE
  271. IF NOT THIS.IsSelected(currentrow) THEN
  272. THIS.SelectRow(currentrow,TRUE)
  273. if_changeselect = FALSE
  274. ELSE
  275. if_changeselect = TRUE
  276. END IF
  277. END IF
  278. ELSE
  279. IF dw_edit_mode THEN RETURN
  280. IF currentrow <= 0 THEN RETURN
  281. THIS.SelectRow(0,FALSE)
  282. THIS.SelectRow(currentrow,TRUE)
  283. dw_uc.SetRow(currentrow)
  284. dw_uc.ScrollToRow (currentrow)
  285. END IF
  286. END IF
  287. end event
  288. event dw_uc::rbuttondown; if dw_edit_mode then return
  289. call super::rbuttondown
  290. end event
  291. event dw_uc::doubleclicked;call super::doubleclicked;cb_choice.triggerevent( clicked!)
  292. end event
  293. type cb_rtr from w_publ_edit_choice`cb_rtr within w_expensesdef
  294. end type
  295. type cb_help from w_publ_edit_choice`cb_help within w_expensesdef
  296. end type
  297. type ln_bar from w_publ_edit_choice`ln_bar within w_expensesdef
  298. end type
  299. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_expensesdef
  300. end type
  301. type r_bar from w_publ_edit_choice`r_bar within w_expensesdef
  302. integer x = 1390
  303. end type
  304. type cbx_mlselect from checkbox within w_expensesdef
  305. integer x = 1362
  306. integer y = 52
  307. integer width = 215
  308. integer height = 60
  309. boolean bringtotop = true
  310. integer textsize = -9
  311. integer weight = 400
  312. fontcharset fontcharset = gb2312charset!
  313. fontpitch fontpitch = variable!
  314. string facename = "宋体"
  315. long textcolor = 16711680
  316. long backcolor = 134217739
  317. string text = "多选"
  318. end type
  319. event clicked;if this.checked then
  320. if_mlselect=1
  321. cbx_allselect.enabled=true
  322. else
  323. if_mlselect=0
  324. cbx_allselect.enabled=false
  325. cbx_allselect.checked=false
  326. cbx_allselect.triggerevent(clicked!)
  327. end if
  328. f_SetProfileString (sys_empid,dw_uc.DATAOBJECT, "if_mlselect", string(if_mlselect))
  329. end event
  330. event constructor;this.backcolor = 14215660
  331. if_mlselect=long(f_ProfileString (sys_empid,dw_uc.DATAOBJECT, "if_mlselect",'0'))
  332. if if_mlselect = 0 then
  333. cbx_mlselect.checked = false
  334. else
  335. cbx_mlselect.checked = true
  336. end if
  337. end event
  338. type cbx_allselect from checkbox within w_expensesdef
  339. integer x = 1678
  340. integer y = 52
  341. integer width = 229
  342. integer height = 60
  343. boolean bringtotop = true
  344. integer textsize = -9
  345. integer weight = 400
  346. fontcharset fontcharset = gb2312charset!
  347. fontpitch fontpitch = variable!
  348. string facename = "宋体"
  349. long textcolor = 16711680
  350. long backcolor = 134217739
  351. boolean enabled = false
  352. string text = "全选"
  353. end type
  354. event clicked;if dw_uc.rowcount()<=0 then return
  355. long li
  356. if this.checked then
  357. for li =1 to dw_uc.rowcount()
  358. dw_uc.selectrow(li,true)
  359. next
  360. else
  361. for li =1 to dw_uc.rowcount()
  362. dw_uc.selectrow(li,false)
  363. next
  364. end if
  365. end event
  366. event constructor;this.backcolor = 14215660
  367. end event