w_cworkitem_edit.srw 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. $PBExportHeader$w_cworkitem_edit.srw
  2. forward
  3. global type w_cworkitem_edit from w_publ_edit_choice
  4. end type
  5. end forward
  6. global type w_cworkitem_edit from w_publ_edit_choice
  7. integer width = 1586
  8. integer height = 1544
  9. string title = "考勤项目"
  10. boolean minbox = true
  11. windowtype windowtype = popup!
  12. end type
  13. global w_cworkitem_edit w_cworkitem_edit
  14. on w_cworkitem_edit.create
  15. call super::create
  16. end on
  17. on w_cworkitem_edit.destroy
  18. call super::destroy
  19. end on
  20. type cb_func from w_publ_edit_choice`cb_func within w_cworkitem_edit
  21. boolean visible = false
  22. end type
  23. type cb_exit from w_publ_edit_choice`cb_exit within w_cworkitem_edit
  24. integer x = 841
  25. end type
  26. type cb_add from w_publ_edit_choice`cb_add within w_cworkitem_edit
  27. integer x = 5
  28. end type
  29. event cb_add::clicked;call super::clicked;IF NOT f_power_ind(208) THEN
  30. MessageBox('提示','你没有使用权限!', Information!, OK! )
  31. RETURN
  32. END IF
  33. Long ll_newid,i
  34. String errmsg
  35. IF dw_edit_mode THEN
  36. dw_uc.AcceptText()
  37. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  38. MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
  39. RETURN
  40. END IF
  41. dw_uc.Object.cworkname[dw_uc.GetRow()] = Trim(dw_uc.Object.cworkname[dw_uc.GetRow()])
  42. IF dw_uc.Object.cworkname[dw_uc.GetRow()] = '' THEN
  43. MessageBox('提示','请输入项目名称!', Information!, OK! )
  44. RETURN
  45. END IF
  46. IF dw_uc.Object.cworkid[dw_uc.GetRow()] = 0 THEN
  47. ll_newid = f_sys_scidentity(0,"u_gz_cworkitem","cworkid",errmsg,FALSE,sqlca)
  48. IF ll_newid <= 0 THEN
  49. MessageBox('提示',errmsg, Information!, OK! )
  50. RETURN
  51. ELSE
  52. dw_uc.Object.cworkid[dw_uc.GetRow()] = ll_newid
  53. END IF
  54. END IF
  55. END IF
  56. IF dw_edit_mode THEN
  57. String ls_errmsg
  58. IF dw_uc.Update() = -1 THEN
  59. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  60. ls_errmsg = "关键内容重复"
  61. ELSE
  62. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  63. END IF
  64. ROLLBACK;
  65. MessageBox ('提示',ls_errmsg+",保存操作失败!", Information!, OK! )
  66. LS_UPDATE_FLAG = FALSE
  67. RETURN
  68. ELSE
  69. COMMIT;
  70. FOR i = 1 TO 3
  71. dw_uc.SetTabOrder ( i, 0 )
  72. NEXT
  73. LS_UPDATE_FLAG = TRUE
  74. END IF
  75. ins_sqlerrtext = ""
  76. ELSE
  77. Long li_row, li_cur_row
  78. li_cur_row = dw_uc.GetRow()
  79. li_row = dw_uc.InsertRow (0)
  80. FOR i = 1 TO 3
  81. dw_uc.SetTabOrder ( i, i*10 )
  82. NEXT
  83. dw_uc.SelectRow(0,FALSE)
  84. dw_uc.ScrollToRow (li_row)
  85. dw_uc.SelectRow(li_row,TRUE)
  86. dw_uc.SetFocus()
  87. modifyrow_no = li_row
  88. END IF
  89. dw_edit_mode = NOT dw_edit_mode
  90. WF_FACE_CHANGE()
  91. end event
  92. type cb_edit from w_publ_edit_choice`cb_edit within w_cworkitem_edit
  93. integer x = 197
  94. end type
  95. event cb_edit::clicked;call super::clicked;if not f_power_ind(208) then
  96. messagebox(publ_operator,'你没有使用权限!')
  97. return
  98. end if
  99. Long i
  100. IF dw_edit_mode THEN
  101. IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! OR dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN
  102. dw_uc.DeleteRow(dw_uc.GetRow())
  103. ELSE
  104. dw_uc.ReselectRow(dw_uc.GetRow())
  105. END IF
  106. FOR i = 1 TO 3
  107. dw_uc.SetTabOrder ( i, 0 )
  108. NEXT
  109. modifyrow_no = 0
  110. ELSE
  111. modifyrow_no = dw_uc.GetRow()
  112. FOR i = 1 TO 3
  113. dw_uc.SetTabOrder ( i, i*10 )
  114. NEXT
  115. dw_uc.SetFocus()
  116. dw_uc.SelectRow(0,FALSE)
  117. dw_uc.ScrollToRow (modifyrow_no)
  118. dw_uc.SelectRow(modifyrow_no,TRUE)
  119. END IF
  120. dw_edit_mode = NOT dw_edit_mode
  121. WF_FACE_CHANGE()
  122. end event
  123. type cb_delet from w_publ_edit_choice`cb_delet within w_cworkitem_edit
  124. integer x = 389
  125. end type
  126. event cb_delet::clicked;call super::clicked;if not f_power_ind(208) then
  127. messagebox('提示','你没有使用权限!')
  128. return
  129. end if
  130. IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  131. RETURN
  132. END IF
  133. long LS_id
  134. LONG LS_LONG=0
  135. string ls_code,arg_msg
  136. IF DW_UC.GETROW()<=0 THEN
  137. MESSAGEBOX('','没有操作目标记录!')
  138. RETURN
  139. END IF
  140. LS_id=DW_UC.OBJECT.cworkid[DW_UC.GETROW()]
  141. select COUNT(*) into :LS_LONG from u_gz_cwork
  142. where u_gz_cwork.cworkid=:LS_id ;
  143. if SQLCA.SQLCode<>0 then
  144. MessageBox ('提示',"数据查询操作失败!(请重试!)",Information!,OK!)
  145. return
  146. end if
  147. IF LS_LONG>0 THEN
  148. MessageBox ('提示',"该资料已经使用于考勤单,不可以删除!",Information!,OK!)
  149. RETURN
  150. END IF
  151. dw_uc.SetRedraw (false)
  152. dw_UC.DeleteRow (0)
  153. dw_UC.TriggerEvent (rowfocuschanged!)
  154. if dw_UC.Update() = -1 then
  155. rollback;
  156. MessageBox ('提示',"删除记录操作失败!", Information!, OK! )
  157. else
  158. commit;
  159. end if
  160. dw_uc.SetRedraw (true)
  161. end event
  162. type cb_choice from w_publ_edit_choice`cb_choice within w_cworkitem_edit
  163. boolean visible = false
  164. integer x = 1266
  165. boolean enabled = false
  166. end type
  167. type dw_uc from w_publ_edit_choice`dw_uc within w_cworkitem_edit
  168. integer width = 1554
  169. integer height = 1264
  170. string dataobject = "dw_cworkitem_edit"
  171. end type
  172. type cb_rtr from w_publ_edit_choice`cb_rtr within w_cworkitem_edit
  173. integer x = 539
  174. end type
  175. type cb_help from w_publ_edit_choice`cb_help within w_cworkitem_edit
  176. integer x = 690
  177. end type
  178. type ln_bar from w_publ_edit_choice`ln_bar within w_cworkitem_edit
  179. integer endx = 1280
  180. end type
  181. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_cworkitem_edit
  182. integer endx = 1280
  183. end type
  184. type r_bar from w_publ_edit_choice`r_bar within w_cworkitem_edit
  185. integer x = 1189
  186. end type