w_trans_custoutrep.srw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. $PBExportHeader$w_trans_custoutrep.srw
  2. forward
  3. global type w_trans_custoutrep from w_publ_easyq
  4. end type
  5. type ddlb_1 from dropdownlistbox within w_trans_custoutrep
  6. end type
  7. type st_1 from statictext within w_trans_custoutrep
  8. end type
  9. type cb_ok from uo_imflatbutton within w_trans_custoutrep
  10. end type
  11. type tv_1 from uo_tv_cusarea within w_trans_custoutrep
  12. end type
  13. type cbx_1 from checkbox within w_trans_custoutrep
  14. end type
  15. type cbx_inuse from checkbox within w_trans_custoutrep
  16. end type
  17. type cb_3 from uo_imflatbutton within w_trans_custoutrep
  18. end type
  19. end forward
  20. global type w_trans_custoutrep from w_publ_easyq
  21. string title = "客户变更业务员"
  22. ddlb_1 ddlb_1
  23. st_1 st_1
  24. cb_ok cb_ok
  25. tv_1 tv_1
  26. cbx_1 cbx_1
  27. cbx_inuse cbx_inuse
  28. cb_3 cb_3
  29. end type
  30. global w_trans_custoutrep w_trans_custoutrep
  31. type variables
  32. string ls_areaname
  33. string ls_area
  34. Int inuse = 1
  35. end variables
  36. on w_trans_custoutrep.create
  37. int iCurrent
  38. call super::create
  39. this.ddlb_1=create ddlb_1
  40. this.st_1=create st_1
  41. this.cb_ok=create cb_ok
  42. this.tv_1=create tv_1
  43. this.cbx_1=create cbx_1
  44. this.cbx_inuse=create cbx_inuse
  45. this.cb_3=create cb_3
  46. iCurrent=UpperBound(this.Control)
  47. this.Control[iCurrent+1]=this.ddlb_1
  48. this.Control[iCurrent+2]=this.st_1
  49. this.Control[iCurrent+3]=this.cb_ok
  50. this.Control[iCurrent+4]=this.tv_1
  51. this.Control[iCurrent+5]=this.cbx_1
  52. this.Control[iCurrent+6]=this.cbx_inuse
  53. this.Control[iCurrent+7]=this.cb_3
  54. end on
  55. on w_trans_custoutrep.destroy
  56. call super::destroy
  57. destroy(this.ddlb_1)
  58. destroy(this.st_1)
  59. destroy(this.cb_ok)
  60. destroy(this.tv_1)
  61. destroy(this.cbx_1)
  62. destroy(this.cbx_inuse)
  63. destroy(this.cb_3)
  64. end on
  65. event resize;call super::resize;tv_1.height=this.height - tv_1.y - 115
  66. end event
  67. event open;call super::open;cb_1.triggerevent(clicked!)
  68. end event
  69. type cb_func from w_publ_easyq`cb_func within w_trans_custoutrep
  70. end type
  71. type cb_exit from w_publ_easyq`cb_exit within w_trans_custoutrep
  72. integer x = 1303
  73. end type
  74. type cb_2 from w_publ_easyq`cb_2 within w_trans_custoutrep
  75. integer x = 1719
  76. integer y = 404
  77. end type
  78. type cb_psetup from w_publ_easyq`cb_psetup within w_trans_custoutrep
  79. integer x = 887
  80. integer y = 412
  81. end type
  82. type cb_1 from w_publ_easyq`cb_1 within w_trans_custoutrep
  83. end type
  84. event cb_1::clicked;call super::clicked;//ls_areaname
  85. dw_1.Retrieve(ls_areaname, inuse )
  86. end event
  87. type st_3 from w_publ_easyq`st_3 within w_trans_custoutrep
  88. integer x = 1650
  89. integer y = 204
  90. integer width = 283
  91. string text = "开始日期:"
  92. end type
  93. type st_4 from w_publ_easyq`st_4 within w_trans_custoutrep
  94. boolean visible = false
  95. integer x = 2016
  96. integer y = 412
  97. end type
  98. type em_1 from w_publ_easyq`em_1 within w_trans_custoutrep
  99. integer x = 1947
  100. integer y = 188
  101. boolean enabled = false
  102. end type
  103. type em_2 from w_publ_easyq`em_2 within w_trans_custoutrep
  104. boolean visible = false
  105. integer x = 2121
  106. integer y = 464
  107. end type
  108. type ddlb_yl from w_publ_easyq`ddlb_yl within w_trans_custoutrep
  109. integer x = 1399
  110. integer y = 416
  111. end type
  112. type cbx_yl from w_publ_easyq`cbx_yl within w_trans_custoutrep
  113. integer x = 1179
  114. integer y = 416
  115. end type
  116. type dw_1 from w_publ_easyq`dw_1 within w_trans_custoutrep
  117. integer x = 736
  118. integer y = 316
  119. integer width = 2798
  120. integer height = 1200
  121. string dataobject = "dw_trans_custoutrep"
  122. end type
  123. event dw_1::rowfocuschanged;call super::rowfocuschanged;IF currentrow <=0 THEN RETURN
  124. this.selectrow(0,false)
  125. this.selectrow(currentrow,true)
  126. end event
  127. type sle_mtrl from w_publ_easyq`sle_mtrl within w_trans_custoutrep
  128. end type
  129. type sle_cust from w_publ_easyq`sle_cust within w_trans_custoutrep
  130. end type
  131. type st_mtrl from w_publ_easyq`st_mtrl within w_trans_custoutrep
  132. end type
  133. type st_cust from w_publ_easyq`st_cust within w_trans_custoutrep
  134. end type
  135. type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_trans_custoutrep
  136. end type
  137. type pb_em1 from w_publ_easyq`pb_em1 within w_trans_custoutrep
  138. boolean visible = false
  139. end type
  140. type pb_em2 from w_publ_easyq`pb_em2 within w_trans_custoutrep
  141. boolean visible = false
  142. end type
  143. type pb_2 from w_publ_easyq`pb_2 within w_trans_custoutrep
  144. boolean visible = false
  145. end type
  146. type cb_help from w_publ_easyq`cb_help within w_trans_custoutrep
  147. integer x = 1152
  148. end type
  149. type cb_copyself from w_publ_easyq`cb_copyself within w_trans_custoutrep
  150. end type
  151. type gb_1 from w_publ_easyq`gb_1 within w_trans_custoutrep
  152. end type
  153. type ln_bar from w_publ_easyq`ln_bar within w_trans_custoutrep
  154. end type
  155. type ln_bar2 from w_publ_easyq`ln_bar2 within w_trans_custoutrep
  156. end type
  157. type r_bar from w_publ_easyq`r_bar within w_trans_custoutrep
  158. end type
  159. type ln_1 from w_publ_easyq`ln_1 within w_trans_custoutrep
  160. end type
  161. type ln_2 from w_publ_easyq`ln_2 within w_trans_custoutrep
  162. end type
  163. type ln_3 from w_publ_easyq`ln_3 within w_trans_custoutrep
  164. end type
  165. type ln_4 from w_publ_easyq`ln_4 within w_trans_custoutrep
  166. end type
  167. type ddlb_1 from dropdownlistbox within w_trans_custoutrep
  168. integer x = 521
  169. integer y = 200
  170. integer width = 530
  171. integer height = 896
  172. integer taborder = 30
  173. boolean bringtotop = true
  174. integer textsize = -9
  175. integer weight = 400
  176. fontcharset fontcharset = gb2312charset!
  177. fontpitch fontpitch = variable!
  178. string facename = "宋体"
  179. long textcolor = 33554432
  180. boolean vscrollbar = true
  181. borderstyle borderstyle = stylelowered!
  182. end type
  183. event constructor;string ls_pf
  184. DECLARE pf_cur CURSOR FOR
  185. SELECT distinct u_outrepdef.outrepname
  186. FROM u_outrepdef where inuse = 1;
  187. open pf_cur;
  188. fetch pf_cur into :ls_pf;
  189. do while sqlca.sqlcode=0
  190. ddlb_1.ADDItem(ls_pf)
  191. fetch pf_cur into :ls_pf;
  192. loop
  193. close pf_cur;
  194. end event
  195. type st_1 from statictext within w_trans_custoutrep
  196. integer x = 27
  197. integer y = 212
  198. integer width = 485
  199. integer height = 48
  200. boolean bringtotop = true
  201. integer textsize = -9
  202. integer weight = 400
  203. fontcharset fontcharset = gb2312charset!
  204. fontpitch fontpitch = variable!
  205. string facename = "宋体"
  206. long textcolor = 33554432
  207. long backcolor = 134217739
  208. string text = "新业务员/上级经理"
  209. boolean focusrectangle = false
  210. end type
  211. type cb_ok from uo_imflatbutton within w_trans_custoutrep
  212. integer x = 306
  213. integer width = 393
  214. integer height = 164
  215. integer taborder = 110
  216. boolean bringtotop = true
  217. string text = "转换新业务员"
  218. string normalpicname = "update.bmp"
  219. integer picsize = 16
  220. toolbaralignment pic_align = alignattop!
  221. boolean border = false
  222. end type
  223. event clicked;call super::clicked;IF Not f_power_ind(714) THEN
  224. MessageBox('提示','你没有使用权限!', Information!, OK! )
  225. RETURN
  226. END IF
  227. Int rslt = 1
  228. String arg_msg
  229. Long i,ll_cusid
  230. String ls_custype
  231. DateTime ldt_enddate
  232. String ls_msg
  233. dw_1.AcceptText()
  234. ldt_enddate = DateTime(Date(Trim(em_1.Text)),Time(0))
  235. ls_custype = Trim(ddlb_1.Text)
  236. IF ls_custype = "" THEN
  237. MessageBox('提示','新业务员不能为空!', Information!, OK! )
  238. RETURN
  239. END IF
  240. IF cbx_1.Checked THEN
  241. ls_msg = "是否确定要将以下客户资料转换新业务员?~r~n 当前操作同时将"+String(ldt_enddate, 'yyyy-mm-dd')+"后的销售单,应收帐转换新业务员?转换后将不能撤改"
  242. ELSE
  243. ls_msg = "是否确定要将以下客户资料转换新业务员?转换后将不能撤改"
  244. END IF
  245. IF MessageBox ("询问",ls_msg,Question!,YesNo! ) = 2 THEN
  246. RETURN
  247. END IF
  248. open(w_sys_wait_jdt)
  249. w_sys_wait_jdt.wf_accepttol(dw_1.RowCount())
  250. FOR i = 1 To dw_1.RowCount()
  251. w_sys_wait_jdt.wf_inc(i)
  252. w_sys_wait_jdt.wf_set_msg('正在处理行:'+string(i)+"......")
  253. ll_cusid = dw_1.Object.cusid[i]
  254. UPDATE u_cust
  255. SET custype = :ls_custype
  256. Where cusid = :ll_cusid;
  257. IF sqlca.SQLCode <> 0 THEN
  258. arg_msg = '转换客户表中新业务员失败!'+sqlca.SQLErrText
  259. rslt = 0
  260. GOTO ext
  261. END IF
  262. IF cbx_1.Checked THEN
  263. UPDATE u_saletask
  264. SET Assign_Emp = :ls_custype
  265. WHERE cusid = :ll_cusid AND
  266. taskdate >= :ldt_enddate;
  267. IF sqlca.SQLCode <> 0 THEN
  268. arg_msg = '转换销售订单中新业务员失败!'+sqlca.SQLErrText
  269. rslt = 0
  270. GOTO ext
  271. END IF
  272. UPDATE u_outware
  273. SET outrep = :ls_custype
  274. WHERE cusid = :ll_cusid AND
  275. outdate >= :ldt_enddate;
  276. IF sqlca.SQLCode <> 0 THEN
  277. arg_msg = '转换销售发货单中新业务员失败!'+sqlca.SQLErrText
  278. rslt = 0
  279. GOTO ext
  280. END IF
  281. UPDATE u_bmsttake SET
  282. inrep = :ls_custype
  283. WHERE buildtype = 1
  284. AND cusid = :ll_cusid AND
  285. takedate >= :ldt_enddate;
  286. IF sqlca.SQLCode <> 0 THEN
  287. arg_msg = '转换应收帐单中新业务员失败!'+sqlca.SQLErrText
  288. rslt = 0
  289. GOTO ext
  290. END IF
  291. UPDATE u_bmsttakemx SET
  292. inrep = :ls_custype
  293. WHERE buildtype = 1
  294. AND cusid = :ll_cusid AND
  295. takedate >= :ldt_enddate;
  296. IF sqlca.SQLCode <> 0 THEN
  297. arg_msg = '转换应收帐明细单中新业务员失败!'+sqlca.SQLErrText
  298. rslt = 0
  299. GOTO ext
  300. END IF
  301. END IF
  302. NEXT
  303. ext:
  304. close(w_sys_wait_jdt)
  305. IF rslt = 0 THEN
  306. ROLLBACK;
  307. MessageBox('提示',arg_msg, Information!, OK! )
  308. ELSE
  309. IF cbx_1.Checked THEN
  310. ls_msg = '转换新业务员且更新'+String(ldt_enddate, 'yyyy-mm-dd')+'后的单据'
  311. ELSE
  312. ls_msg = '转换新业务员'
  313. END IF
  314. COMMIT;
  315. MessageBox('提示',ls_msg+'成功!', Information!, OK! )
  316. //日志
  317. // Long ls_id
  318. // String ls_code
  319. // ls_id = dw_pageretr.Object.inwareid[pagerert_row]
  320. // ls_code = dw_pageretr.Object.inwarecode[pagerert_row]
  321. f_setsysoplog('客户变更业务员',ls_msg,arg_msg,True)
  322. //--
  323. cb_1.TriggerEvent(Clicked!)
  324. END IF
  325. end event
  326. type tv_1 from uo_tv_cusarea within w_trans_custoutrep
  327. integer y = 316
  328. integer width = 736
  329. integer height = 1200
  330. integer taborder = 80
  331. boolean bringtotop = true
  332. integer textsize = -9
  333. fontcharset fontcharset = gb2312charset!
  334. fontfamily fontfamily = anyfont!
  335. string facename = "宋体"
  336. end type
  337. event selectionchanged;
  338. Long ll_hand
  339. Long ll_mtrltypeid
  340. TreeViewItem l_tvi
  341. ll_hand = THIS.FindItem(CurrentTreeItem!,0)
  342. IF THIS.GetItem(ll_hand,l_tvi) = 1 THEN
  343. IF ll_hand = 1 THEN
  344. ll_mtrltypeid = 0
  345. ELSE
  346. ll_mtrltypeid = l_tvi.Data
  347. END IF
  348. f_getinfo(ll_mtrltypeid)
  349. THIS.ExpandItem(ll_hand)
  350. END IF
  351. ls_area=l_tvi.label
  352. ls_areaname = THIS.uo_cur_info.areaname
  353. ls_areaname = ls_areaname + '%'
  354. cb_1.TriggerEvent(Clicked!)
  355. end event
  356. type cbx_1 from checkbox within w_trans_custoutrep
  357. integer x = 1065
  358. integer y = 204
  359. integer width = 590
  360. integer height = 60
  361. boolean bringtotop = true
  362. integer textsize = -9
  363. integer weight = 400
  364. fontcharset fontcharset = gb2312charset!
  365. fontpitch fontpitch = variable!
  366. string facename = "宋体"
  367. long textcolor = 33554432
  368. long backcolor = 134217739
  369. string text = "更新销售单据业务员"
  370. end type
  371. event clicked;IF This.Checked THEN
  372. em_1.Enabled = True
  373. ELSE
  374. em_1.Enabled = False
  375. END IF
  376. end event
  377. type cbx_inuse from checkbox within w_trans_custoutrep
  378. integer x = 2382
  379. integer y = 204
  380. integer width = 402
  381. integer height = 60
  382. boolean bringtotop = true
  383. integer textsize = -9
  384. integer weight = 400
  385. fontcharset fontcharset = gb2312charset!
  386. fontpitch fontpitch = variable!
  387. string facename = "宋体"
  388. long textcolor = 33554432
  389. long backcolor = 134217739
  390. string text = "只显示有效"
  391. boolean checked = true
  392. end type
  393. event clicked;IF dw_edit_mode THEN RETURN
  394. IF THIS.Checked THEN
  395. inuse = 1
  396. ELSE
  397. inuse = -1
  398. END IF
  399. cb_1.TriggerEvent(Clicked!)
  400. end event
  401. type cb_3 from uo_imflatbutton within w_trans_custoutrep
  402. integer x = 704
  403. integer width = 443
  404. integer height = 164
  405. integer taborder = 30
  406. boolean bringtotop = true
  407. string text = "转换新上级经理"
  408. string normalpicname = "update.bmp"
  409. integer picsize = 16
  410. toolbaralignment pic_align = alignattop!
  411. boolean border = false
  412. end type
  413. event clicked;call super::clicked;IF Not f_power_ind(714) THEN
  414. MessageBox('提示','你没有使用权限!', Information!, OK! )
  415. RETURN
  416. END IF
  417. Int rslt = 1
  418. String arg_msg
  419. Long i,ll_cusid
  420. String ls_upname
  421. DateTime ldt_enddate
  422. String ls_msg
  423. dw_1.AcceptText()
  424. ldt_enddate = DateTime(Date(Trim(em_1.Text)),Time(0))
  425. ls_upname = Trim(ddlb_1.Text)
  426. IF ls_upname = "" THEN
  427. MessageBox('提示','新上级经理不能为空!', Information!, OK! )
  428. RETURN
  429. END IF
  430. ls_msg = "是否确定要将以下客户资料转换上级经理?转换后将不能撤改"
  431. IF MessageBox ("询问",ls_msg,Question!,YesNo! ) = 2 THEN
  432. RETURN
  433. END IF
  434. open(w_sys_wait_jdt)
  435. w_sys_wait_jdt.wf_accepttol(dw_1.RowCount())
  436. FOR i = 1 To dw_1.RowCount()
  437. w_sys_wait_jdt.wf_inc(i)
  438. w_sys_wait_jdt.wf_set_msg('正在处理行:'+string(i)+"......")
  439. ll_cusid = dw_1.Object.cusid[i]
  440. UPDATE u_cust
  441. SET upname = :ls_upname
  442. Where cusid = :ll_cusid;
  443. IF sqlca.SQLCode <> 0 THEN
  444. arg_msg = '转换客户表中上级经理失败!'+sqlca.SQLErrText
  445. rslt = 0
  446. GOTO ext
  447. END IF
  448. NEXT
  449. ext:
  450. close(w_sys_wait_jdt)
  451. IF rslt = 0 THEN
  452. ROLLBACK;
  453. MessageBox('提示',arg_msg, Information!, OK! )
  454. ELSE
  455. ls_msg = '转换新上级经理'
  456. COMMIT;
  457. MessageBox('提示',ls_msg+'成功!', Information!, OK! )
  458. //日志
  459. // Long ls_id
  460. // String ls_code
  461. // ls_id = dw_pageretr.Object.inwareid[pagerert_row]
  462. // ls_code = dw_pageretr.Object.inwarecode[pagerert_row]
  463. f_setsysoplog('客户上级经理',ls_msg,arg_msg,True)
  464. //--
  465. cb_1.TriggerEvent(Clicked!)
  466. END IF
  467. end event