w_unit_def.srw 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. $PBExportHeader$w_unit_def.srw
  2. forward
  3. global type w_unit_def from w_publ_edit_choice
  4. end type
  5. type cb_view from uo_imflatbutton within w_unit_def
  6. end type
  7. end forward
  8. global type w_unit_def from w_publ_edit_choice
  9. integer width = 1819
  10. integer height = 1544
  11. string title = "单位"
  12. boolean minbox = true
  13. windowtype windowtype = popup!
  14. cb_view cb_view
  15. end type
  16. global w_unit_def w_unit_def
  17. on w_unit_def.create
  18. int iCurrent
  19. call super::create
  20. this.cb_view=create cb_view
  21. iCurrent=UpperBound(this.Control)
  22. this.Control[iCurrent+1]=this.cb_view
  23. end on
  24. on w_unit_def.destroy
  25. call super::destroy
  26. destroy(this.cb_view)
  27. end on
  28. type cb_func from w_publ_edit_choice`cb_func within w_unit_def
  29. end type
  30. type cb_exit from w_publ_edit_choice`cb_exit within w_unit_def
  31. end type
  32. type cb_add from w_publ_edit_choice`cb_add within w_unit_def
  33. end type
  34. event cb_add::clicked;call super::clicked;if not f_power_ind(667) then
  35. messagebox('提示','你没有使用权限!', Information!, OK! )
  36. return
  37. end if
  38. long ll_newid,i
  39. string errmsg
  40. IF dw_edit_mode THEN
  41. dw_uc.accepttext()
  42. if dw_uc.GetNextModified(0, Primary!)=0 then
  43. MESSAGEBOX('提示','没有任何修改,不可以保存!', Information!, OK! )
  44. RETURN
  45. end if
  46. DW_UC.OBJECT.unit[DW_UC.GETROW()]=TRIM(DW_UC.OBJECT.unit[DW_UC.GETROW()])
  47. IF DW_UC.OBJECT.unit[DW_UC.GETROW()]='' THEN
  48. MESSAGEBOX('提示','请输入单位!', Information!, OK! )
  49. RETURN
  50. END IF
  51. if dw_uc.object.unitid[dw_uc.getrow()]=0 then
  52. ll_newid=f_sys_scidentity(0,"u_unit_def","unitid",errmsg,false,sqlca)
  53. if ll_newid<=0 then
  54. messagebox('提示',errmsg, Information!, OK! )
  55. return
  56. else
  57. dw_uc.object.unitid[DW_UC.GETROW()]=ll_newid
  58. end if
  59. end if
  60. end if
  61. IF dw_edit_mode THEN
  62. string ls_errmsg
  63. if dw_UC.Update() = -1 then
  64. if pos(ins_sqlerrtext,"Cannot insert duplicate key row")>0 then
  65. ls_errmsg="关键内容重复"
  66. else
  67. ls_errmsg="因为网络或其他原因>"+ins_sqlerrtext
  68. end if
  69. rollback;
  70. MessageBox ('提示',ls_errmsg+",保存操作失败!", Information!, OK! )
  71. LS_UPDATE_FLAG=FALSE
  72. RETURN
  73. else
  74. commit;
  75. for i=1 to 3
  76. dw_UC.SetTabOrder ( i, 0 )
  77. next
  78. LS_UPDATE_FLAG=TRUE
  79. end if
  80. ins_sqlerrtext=""
  81. ELSE
  82. long li_row, li_cur_row
  83. li_cur_row = dw_UC.GetRow()
  84. li_row = dw_UC.InsertRow (0)
  85. for i=1 to 3
  86. dw_UC.SetTabOrder ( i, i*10 )
  87. next
  88. dw_uc.selectrow(0,false)
  89. dw_UC.ScrollToRow (li_row)
  90. dw_uc.selectrow(li_row,true)
  91. dw_UC.SetFocus()
  92. modifyrow_no= li_row
  93. END IF
  94. dw_edit_mode= NOT dw_edit_mode
  95. WF_FACE_CHANGE()
  96. end event
  97. type cb_edit from w_publ_edit_choice`cb_edit within w_unit_def
  98. end type
  99. event cb_edit::clicked;call super::clicked;if not f_power_ind(667) then
  100. messagebox('提示','你没有使用权限!', Information!, OK! )
  101. return
  102. end if
  103. Long i
  104. IF dw_edit_mode THEN
  105. IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! OR dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN
  106. dw_uc.DeleteRow(dw_uc.GetRow())
  107. ELSE
  108. dw_uc.ReselectRow(dw_uc.GetRow())
  109. END IF
  110. FOR i = 1 TO 2
  111. dw_uc.SetTabOrder ( i, 0 )
  112. NEXT
  113. modifyrow_no = 0
  114. ELSE
  115. modifyrow_no = dw_uc.GetRow()
  116. FOR i = 1 TO 2
  117. dw_uc.SetTabOrder ( i, i*10 )
  118. NEXT
  119. dw_uc.SetFocus()
  120. dw_uc.SelectRow(0,FALSE)
  121. dw_uc.ScrollToRow (modifyrow_no)
  122. dw_uc.SelectRow(modifyrow_no,TRUE)
  123. END IF
  124. dw_edit_mode = NOT dw_edit_mode
  125. WF_FACE_CHANGE()
  126. end event
  127. type cb_delet from w_publ_edit_choice`cb_delet within w_unit_def
  128. end type
  129. event cb_delet::clicked;call super::clicked;if not f_power_ind(667) then
  130. messagebox('提示','你没有使用权限!', Information!, OK! )
  131. return
  132. end if
  133. IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  134. RETURN
  135. END IF
  136. string arg_msg
  137. IF DW_UC.GETROW()<=0 THEN
  138. MESSAGEBOX('提示','没有操作目标记录!', Information!, OK! )
  139. RETURN
  140. END IF
  141. dw_uc.SetRedraw (false)
  142. dw_UC.DeleteRow (0)
  143. dw_UC.TriggerEvent (rowfocuschanged!)
  144. if dw_UC.Update() = -1 then
  145. rollback;
  146. MessageBox ('提示',"删除记录操作失败!", Information!, OK! )
  147. else
  148. commit;
  149. end if
  150. dw_uc.SetRedraw (true)
  151. end event
  152. type cb_choice from w_publ_edit_choice`cb_choice within w_unit_def
  153. boolean visible = false
  154. integer x = 1609
  155. boolean enabled = false
  156. end type
  157. type dw_uc from w_publ_edit_choice`dw_uc within w_unit_def
  158. integer width = 1792
  159. string dataobject = "dw_unit_def"
  160. end type
  161. event dw_uc::dwnkey;call super::dwnkey;IF Key = keyenter! THEN
  162. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  163. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  164. RETURN 1
  165. END IF
  166. end event
  167. type cb_rtr from w_publ_edit_choice`cb_rtr within w_unit_def
  168. end type
  169. type cb_help from w_publ_edit_choice`cb_help within w_unit_def
  170. end type
  171. type ln_bar from w_publ_edit_choice`ln_bar within w_unit_def
  172. integer endx = 1792
  173. end type
  174. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_unit_def
  175. integer endx = 1792
  176. end type
  177. type r_bar from w_publ_edit_choice`r_bar within w_unit_def
  178. end type
  179. type cb_view from uo_imflatbutton within w_unit_def
  180. integer x = 837
  181. integer width = 151
  182. integer height = 164
  183. integer taborder = 30
  184. boolean bringtotop = true
  185. string text = "预览"
  186. string normalpicname = "preview.bmp"
  187. integer picsize = 16
  188. toolbaralignment pic_align = alignattop!
  189. boolean border = false
  190. end type
  191. event clicked;call super::clicked;S_print_MSG LS_PRMSG
  192. LS_PRMSG.obj_dwNAME = 'dw_rp_unit_def'
  193. LS_PRMSG.SHARE_DW = DW_UC
  194. LS_PRMSG.TAG_TEXT = parent.title
  195. LS_PRMSG.SETUP_FLAG = 0
  196. LS_PRMSG.PAGECH_FLAG = 1
  197. OpenWithParm(w_publ_preview,LS_PRMSG)
  198. end event