w_outrepdef_edit.srw 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. $PBExportHeader$w_outrepdef_edit.srw
  2. forward
  3. global type w_outrepdef_edit from w_publ_edit_choice
  4. end type
  5. type cb_view from uo_imflatbutton within w_outrepdef_edit
  6. end type
  7. type cbx_inuse from checkbox within w_outrepdef_edit
  8. end type
  9. type st_msg from statictext within w_outrepdef_edit
  10. end type
  11. end forward
  12. global type w_outrepdef_edit from w_publ_edit_choice
  13. integer width = 2533
  14. integer height = 1640
  15. string title = "业务员"
  16. boolean minbox = true
  17. windowtype windowtype = popup!
  18. boolean if_ue_retr = true
  19. boolean if_ue_filter = true
  20. boolean if_ue_sort = true
  21. boolean if_ue_sentdataout = true
  22. cb_view cb_view
  23. cbx_inuse cbx_inuse
  24. st_msg st_msg
  25. end type
  26. global w_outrepdef_edit w_outrepdef_edit
  27. type variables
  28. s_outrepdef INS_RT_STRU
  29. long il_inuse = 1
  30. long il_Edit_column = 5
  31. end variables
  32. on w_outrepdef_edit.create
  33. int iCurrent
  34. call super::create
  35. this.cb_view=create cb_view
  36. this.cbx_inuse=create cbx_inuse
  37. this.st_msg=create st_msg
  38. iCurrent=UpperBound(this.Control)
  39. this.Control[iCurrent+1]=this.cb_view
  40. this.Control[iCurrent+2]=this.cbx_inuse
  41. this.Control[iCurrent+3]=this.st_msg
  42. end on
  43. on w_outrepdef_edit.destroy
  44. call super::destroy
  45. destroy(this.cb_view)
  46. destroy(this.cbx_inuse)
  47. destroy(this.st_msg)
  48. end on
  49. event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU)
  50. end event
  51. event retrieve_uc;dw_UC.retrieve(il_inuse)
  52. end event
  53. event open;call super::open;IF sys_option_outrep = 1 THEN
  54. st_msg.Visible = True
  55. st_msg.Text = "使用业务员限制,修改不能改名称"
  56. ELSE
  57. st_msg.Visible = False
  58. END IF
  59. end event
  60. type cb_func from w_publ_edit_choice`cb_func within w_outrepdef_edit
  61. end type
  62. type cb_exit from w_publ_edit_choice`cb_exit within w_outrepdef_edit
  63. integer x = 987
  64. end type
  65. type cb_add from w_publ_edit_choice`cb_add within w_outrepdef_edit
  66. end type
  67. event cb_add::clicked;call super::clicked;IF Not f_power_ind(18) THEN
  68. MessageBox('提示','你没有使用权限!', Information!, OK! )
  69. RETURN
  70. END IF
  71. Long i
  72. IF dw_edit_mode THEN
  73. dw_uc.AcceptText()
  74. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  75. MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
  76. RETURN
  77. END IF
  78. dw_uc.Object.outrepcode[dw_uc.GetRow()] = Upper(Trim(dw_uc.Object.outrepcode[dw_uc.GetRow()]))
  79. dw_uc.Object.outrepname[dw_uc.GetRow()] = Trim(dw_uc.Object.outrepname[dw_uc.GetRow()])
  80. dw_uc.Object.outrepdscrp[dw_uc.GetRow()] = Trim(dw_uc.Object.outrepdscrp[dw_uc.GetRow()])
  81. dw_uc.Object.opdate[dw_uc.GetRow()] = Today()
  82. dw_uc.Object.opemp[dw_uc.GetRow()] = publ_operator
  83. IF dw_uc.Object.outrepcode[dw_uc.GetRow()] = '' THEN
  84. MessageBox('提示','请输入编号!', Information!, OK! )
  85. RETURN
  86. END IF
  87. IF dw_uc.Object.outrepname[dw_uc.GetRow()] = '' THEN
  88. MessageBox('提示','请输入名称!', Information!, OK! )
  89. RETURN
  90. END IF
  91. String ls_errmsg
  92. IF dw_uc.Update() = -1 THEN
  93. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  94. ls_errmsg = "关键内容重复"
  95. ELSE
  96. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  97. END IF
  98. ROLLBACK;
  99. MessageBox ("提示",ls_errmsg+",保存操作失败!", Information!, OK! )
  100. LS_UPDATE_FLAG = False
  101. RETURN
  102. ELSE
  103. COMMIT;
  104. LS_UPDATE_FLAG = True
  105. FOR i = 1 To il_Edit_column
  106. dw_uc.SetTabOrder ( i, 0 )
  107. NEXT
  108. END IF
  109. ins_sqlerrtext = ""
  110. ELSE
  111. Long li_row, li_cur_row
  112. li_cur_row = dw_uc.GetRow()
  113. li_row = dw_uc.InsertRow (0)
  114. FOR i = 1 To il_Edit_column
  115. dw_uc.SetTabOrder ( i, i*10 )
  116. NEXT
  117. dw_uc.SelectRow(0,False)
  118. dw_uc.ScrollToRow (li_row)
  119. dw_uc.SelectRow(li_row,True)
  120. dw_uc.SetFocus()
  121. dw_uc.SetColumn("outrepcode")
  122. modifyrow_no = li_row
  123. END IF
  124. dw_edit_mode = Not dw_edit_mode
  125. WF_FACE_CHANGE()
  126. end event
  127. type cb_edit from w_publ_edit_choice`cb_edit within w_outrepdef_edit
  128. end type
  129. event cb_edit::clicked;call super::clicked;IF Not f_power_ind(18) THEN
  130. MessageBox('提示','你没有使用权限!', Information!, OK! )
  131. RETURN
  132. END IF
  133. Long i
  134. IF dw_edit_mode THEN
  135. IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! Or dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN
  136. dw_uc.DeleteRow(dw_uc.GetRow())
  137. ELSE
  138. dw_uc.ReselectRow(dw_uc.GetRow())
  139. END IF
  140. FOR i = 1 To il_Edit_column
  141. dw_uc.SetTabOrder ( i, 0 )
  142. NEXT
  143. modifyrow_no = 0
  144. ELSE
  145. modifyrow_no = dw_uc.GetRow()
  146. FOR i = 1 To il_Edit_column
  147. dw_uc.SetTabOrder ( i, i*10 )
  148. NEXT
  149. //使用业务员限制,名称不能修改
  150. IF sys_option_outrep = 1 THEN
  151. dw_uc.SetTabOrder('outrepname',0)
  152. END IF
  153. dw_uc.SetFocus()
  154. dw_uc.SelectRow(0,False)
  155. dw_uc.ScrollToRow (modifyrow_no)
  156. dw_uc.SelectRow(modifyrow_no,True)
  157. END IF
  158. dw_edit_mode = Not dw_edit_mode
  159. WF_FACE_CHANGE()
  160. end event
  161. type cb_delet from w_publ_edit_choice`cb_delet within w_outrepdef_edit
  162. end type
  163. event cb_delet::clicked;call super::clicked;IF Not f_power_ind(18) THEN
  164. MessageBox('提示','你没有使用权限!', Information!, OK! )
  165. RETURN
  166. END IF
  167. IF MessageBox ("询问","是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  168. RETURN
  169. END IF
  170. //检查客户资料, 销售发货单,销售订单,如果已经应用,不允许删除
  171. String ls_outrepname
  172. Long ll_cnt, ll_row
  173. ll_row = dw_uc.GetRow()
  174. ls_outrepname = dw_uc.Object.outrepname[ll_row]
  175. SELECT count(*)
  176. INTO :ll_cnt
  177. FROM u_cust
  178. Where custype = :ls_outrepname;
  179. IF sqlca.SQLCode <> 0 THEN
  180. ll_cnt = 0
  181. END IF
  182. IF ll_cnt > 0 THEN
  183. MessageBox('系统提示','当前业务员已经应用到客户资料中,不能删除')
  184. RETURN
  185. END IF
  186. SELECT count(*)
  187. INTO :ll_cnt
  188. FROM u_saletask
  189. Where assign_emp = :ls_outrepname;
  190. IF sqlca.SQLCode <> 0 THEN
  191. ll_cnt = 0
  192. END IF
  193. IF ll_cnt > 0 THEN
  194. MessageBox('系统提示','当前业务员已经应用到销售订单中,不能删除')
  195. RETURN
  196. END IF
  197. SELECT count(*)
  198. INTO :ll_cnt
  199. FROM u_outware
  200. Where outrep = :ls_outrepname
  201. and billtype = 1;
  202. IF sqlca.SQLCode <> 0 THEN
  203. ll_cnt = 0
  204. END IF
  205. IF ll_cnt > 0 THEN
  206. MessageBox('系统提示','当前业务员已经应用到销售发货单中,不能删除')
  207. RETURN
  208. END IF
  209. dw_uc.SetRedraw (False)
  210. dw_uc.DeleteRow (0)
  211. dw_uc.TriggerEvent (RowFocusChanged!)
  212. IF dw_uc.Update() = -1 THEN
  213. ROLLBACK;
  214. MessageBox ("错误","删除记录操作失败!",StopSign!,OK!)
  215. ELSE
  216. COMMIT;
  217. END IF
  218. dw_uc.SetRedraw (True)
  219. end event
  220. type cb_choice from w_publ_edit_choice`cb_choice within w_outrepdef_edit
  221. boolean visible = false
  222. integer y = 500
  223. integer width = 279
  224. end type
  225. event cb_choice::clicked;call super::clicked;LONG rOW
  226. ROW=dw_uc.getrow()
  227. if ROW<=0 then
  228. messagebox('提示','请先选择目标行!', Information!, OK! )
  229. return
  230. end if
  231. INS_RT_STRU.outrepcode=dw_uc.OBJECT.outrepcode[ROW]
  232. INS_RT_STRU.outrepname=dw_uc.OBJECT.outrepname[ROW]
  233. INS_RT_STRU.outrepdscrp=dw_uc.OBJECT.outrepdscrp[ROW]
  234. CLOSE(PARENT)
  235. end event
  236. type dw_uc from w_publ_edit_choice`dw_uc within w_outrepdef_edit
  237. event dwnkey pbm_dwnkey
  238. integer y = 280
  239. integer width = 2510
  240. integer height = 1256
  241. string dataobject = "dw_outrep_index"
  242. end type
  243. event dw_uc::dwnkey;call super::dwnkey;IF Key = KeyEnter! THEN //
  244. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  245. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  246. RETURN 1
  247. END IF
  248. end event
  249. type cb_rtr from w_publ_edit_choice`cb_rtr within w_outrepdef_edit
  250. end type
  251. type cb_help from w_publ_edit_choice`cb_help within w_outrepdef_edit
  252. integer x = 837
  253. end type
  254. type ln_bar from w_publ_edit_choice`ln_bar within w_outrepdef_edit
  255. end type
  256. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_outrepdef_edit
  257. end type
  258. type r_bar from w_publ_edit_choice`r_bar within w_outrepdef_edit
  259. end type
  260. type cb_view from uo_imflatbutton within w_outrepdef_edit
  261. boolean visible = false
  262. integer x = 837
  263. integer width = 151
  264. integer height = 164
  265. integer taborder = 30
  266. boolean bringtotop = true
  267. string text = "预览"
  268. string normalpicname = "preview.bmp"
  269. integer picsize = 16
  270. toolbaralignment pic_align = alignattop!
  271. boolean border = false
  272. end type
  273. event clicked;call super::clicked;S_print_MSG LS_PRMSG
  274. LS_PRMSG.obj_dwNAME = 'dw_rp_outrep_index'
  275. LS_PRMSG.SHARE_DW = DW_UC
  276. LS_PRMSG.TAG_TEXT = parent.title
  277. LS_PRMSG.SETUP_FLAG = 0
  278. LS_PRMSG.PAGECH_FLAG = 1
  279. OpenWithParm(w_publ_preview,LS_PRMSG)
  280. end event
  281. type cbx_inuse from checkbox within w_outrepdef_edit
  282. integer x = 14
  283. integer y = 196
  284. integer width = 402
  285. integer height = 60
  286. boolean bringtotop = true
  287. integer textsize = -9
  288. integer weight = 400
  289. fontcharset fontcharset = gb2312charset!
  290. fontpitch fontpitch = variable!
  291. string facename = "宋体"
  292. long textcolor = 33554432
  293. long backcolor = 134217739
  294. string text = "只显示有效"
  295. boolean checked = true
  296. end type
  297. event clicked;IF dw_edit_mode THEN RETURN
  298. IF THIS.Checked THEN
  299. il_inuse = 1
  300. ELSE
  301. il_inuse = -1
  302. END IF
  303. cb_rtr.TriggerEvent(Clicked!)
  304. end event
  305. type st_msg from statictext within w_outrepdef_edit
  306. integer x = 773
  307. integer y = 196
  308. integer width = 1001
  309. integer height = 60
  310. boolean bringtotop = true
  311. integer textsize = -9
  312. integer weight = 400
  313. fontcharset fontcharset = gb2312charset!
  314. fontpitch fontpitch = variable!
  315. string facename = "宋体"
  316. long textcolor = 255
  317. long backcolor = 134217739
  318. string text = "使用业务员限制,修改不能改名称"
  319. boolean focusrectangle = false
  320. end type