w_cus_ecomm_edit_add.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. $PBExportHeader$w_cus_ecomm_edit_add.srw
  2. forward
  3. global type w_cus_ecomm_edit_add from w_publ_base
  4. end type
  5. type st_1 from statictext within w_cus_ecomm_edit_add
  6. end type
  7. type sle_summary from singlelineedit within w_cus_ecomm_edit_add
  8. end type
  9. type cb_save from uo_imflatbutton within w_cus_ecomm_edit_add
  10. end type
  11. type cb_paste from uo_imflatbutton within w_cus_ecomm_edit_add
  12. end type
  13. type dw_cus_rep from u_dw_rbtnfilter within w_cus_ecomm_edit_add
  14. end type
  15. type tv_pwr from uo_ljfieb_tv_pwr within w_cus_ecomm_edit_add
  16. end type
  17. type ln_bar from line within w_cus_ecomm_edit_add
  18. end type
  19. type ln_bar2 from line within w_cus_ecomm_edit_add
  20. end type
  21. type r_bar from rectangle within w_cus_ecomm_edit_add
  22. end type
  23. end forward
  24. global type w_cus_ecomm_edit_add from w_publ_base
  25. integer width = 3611
  26. integer height = 2380
  27. string title = "电子商务用户新建/修改"
  28. boolean minbox = false
  29. windowtype windowtype = response!
  30. st_1 st_1
  31. sle_summary sle_summary
  32. cb_save cb_save
  33. cb_paste cb_paste
  34. dw_cus_rep dw_cus_rep
  35. tv_pwr tv_pwr
  36. ln_bar ln_bar
  37. ln_bar2 ln_bar2
  38. r_bar r_bar
  39. end type
  40. global w_cus_ecomm_edit_add w_cus_ecomm_edit_add
  41. type prototypes
  42. Function long GetCursor () Library "user32.dll" Alias for "GetCursor"
  43. Function long LoadCursor (long hInstance, long lpCursorName) Library "user32.dll" Alias for "LoadCursorW"
  44. end prototypes
  45. type variables
  46. long cur_cusid
  47. long cur_repid
  48. long copy_repid
  49. end variables
  50. forward prototypes
  51. public function integer wf_save ()
  52. public function integer wf_insertrow ()
  53. public subroutine wf_set_tvchild (long arg_handl, integer arg_index)
  54. public subroutine wf_set_tvparent (long arg_handl, integer arg_index)
  55. end prototypes
  56. public function integer wf_save ();Int rslt = 1
  57. Long li_row
  58. String arg_msg
  59. uo_ljfieb_cus uo_ljc
  60. uo_ljc = Create uo_ljfieb_cus
  61. uo_ljfieb uo_fieb
  62. uo_fieb = Create uo_ljfieb
  63. uo_fieb.commit_transaction = sys_email_sqlca
  64. dw_cus_rep.AcceptText()
  65. li_row = dw_cus_rep.GetRow()
  66. IF li_row <= 0 THEN
  67. arg_msg = "没有可保存的信息"
  68. rslt = 0
  69. GOTO ext
  70. END IF
  71. s_cus_rep_ljfieb s_rep
  72. String ls_Permissions
  73. Long ll_handl
  74. Long ll_repid_arr[]
  75. Long ll_cnt
  76. Boolean lb_SetPwd
  77. ls_Permissions = Fill('0', 5000)
  78. ll_handl = tv_pwr.FindItem(RootTreeItem!,0)
  79. IF ll_handl > 0 THEN tv_pwr.pf_get_value(ll_handl, ls_Permissions)
  80. s_rep.repid = dw_cus_rep.Object.repid[li_row]
  81. IF s_rep.repid = 0 THEN //新用户传密码
  82. lb_SetPwd = True
  83. ELSE //修改的不传密码
  84. lb_SetPwd = False
  85. END IF
  86. s_rep.cusid = dw_cus_rep.Object.cusid[li_row]
  87. s_rep.loginname = Trim(dw_cus_rep.Object.loginname[li_row])
  88. s_rep.repname = Trim(dw_cus_rep.Object.repname[li_row])
  89. s_rep.deptname = Trim(dw_cus_rep.Object.deptname[li_row])
  90. s_rep.duty = Trim(dw_cus_rep.Object.duty[li_row])
  91. s_rep.sex = Trim(dw_cus_rep.Object.sex[li_row])
  92. s_rep.officetel = Trim(dw_cus_rep.Object.officetel[li_row])
  93. s_rep.handtel = Trim(dw_cus_rep.Object.handtel[li_row])
  94. s_rep.faxno = Trim(dw_cus_rep.Object.faxno[li_row])
  95. s_rep.email = Trim(dw_cus_rep.Object.email[li_row])
  96. s_rep.interest = Trim(dw_cus_rep.Object.interest[li_row])
  97. s_rep.mainproduct = Trim(dw_cus_rep.Object.mainproduct[li_row])
  98. s_rep.qqcode = Trim(dw_cus_rep.Object.qqcode[li_row])
  99. s_rep.msncode = Trim(dw_cus_rep.Object.msncode[li_row])
  100. s_rep.dscrp = Trim(dw_cus_rep.Object.dscrp[li_row])
  101. s_rep.Address = Trim(dw_cus_rep.Object.Address[li_row])
  102. s_rep.Permissions = ls_Permissions
  103. s_rep.reptype = 2 //1-供应商; 2-客户;
  104. s_rep.ljemail = Trim(dw_cus_rep.Object.ljemail[li_row])
  105. //保存本地数据库
  106. IF uo_ljc.uof_add_cust_rep(s_rep,arg_msg,False) = 0 THEN
  107. rslt = 0
  108. GOTO ext
  109. END IF
  110. //发送电商数据库
  111. ll_repid_arr[1] = uo_ljc.uo_repid
  112. IF uo_fieb.send_cust_rep(0, ll_repid_arr, '', '', '', lb_SetPwd, arg_msg, False) = 0 THEN
  113. rslt = 0
  114. GOTO ext
  115. END IF
  116. long ll_cusid_arr[]
  117. ll_cusid_arr[1] = dw_cus_rep.Object.cusid[li_row]
  118. IF uo_fieb.send_cust(0, ll_cusid_arr, '', '', '', arg_msg, False) = 0 THEN
  119. rslt = 0
  120. GOTO ext
  121. END IF
  122. ext:
  123. Destroy uo_ljc
  124. Destroy uo_fieb
  125. IF rslt = 0 THEN
  126. ROLLBACK Using sqlca;
  127. ROLLBACK Using sys_email_sqlca;
  128. MessageBox('系统提示',arg_msg)
  129. ELSE
  130. COMMIT Using sqlca;
  131. COMMIT Using sys_email_sqlca;
  132. MessageBox('系统提示',"保存成功")
  133. END IF
  134. RETURN rslt
  135. end function
  136. public function integer wf_insertrow ();Long ll_row
  137. ll_row = dw_cus_rep.InsertRow(0)
  138. dw_cus_rep.Object.cusid[ll_row] = cur_cusid
  139. IF cur_repid > 0 THEN
  140. dw_cus_rep.Retrieve(cur_repid)
  141. String ls_Permissions
  142. SELECT Permissions
  143. INTO :ls_Permissions
  144. FROM ros_cust_rep
  145. Where repid = :cur_repid;
  146. IF sqlca.SQLCode <> 0 THEN
  147. ls_Permissions = ''
  148. END IF
  149. Long ll_handl
  150. ll_handl = tv_pwr.FindItem(RootTreeItem!,0)
  151. IF ll_handl > 0 THEN tv_pwr.pf_refresh_value(ll_handl,ls_Permissions)
  152. END IF
  153. dw_cus_rep.SetFocus()
  154. dw_cus_rep.SetColumn('loginname')
  155. RETURN 1
  156. end function
  157. public subroutine wf_set_tvchild (long arg_handl, integer arg_index);
  158. Long ll_handl
  159. treeviewitem tvi
  160. ll_handl = arg_handl
  161. tv_pwr.GetItem(ll_handl,tvi)
  162. tvi.StatePictureIndex = arg_index
  163. tv_pwr.SetItem(ll_handl,tvi)
  164. ll_handl = tv_pwr.FindItem(ChildTreeItem!,ll_handl)
  165. DO WHILE ll_handl > 0
  166. wf_set_tvchild(ll_handl, arg_index)
  167. ll_handl = tv_pwr.FindItem(NextTreeItem!,ll_handl)
  168. LOOP
  169. end subroutine
  170. public subroutine wf_set_tvparent (long arg_handl, integer arg_index);
  171. Long ll_handl
  172. treeviewitem tvi
  173. ll_handl = arg_handl
  174. tv_pwr.GetItem(ll_handl,tvi)
  175. tvi.StatePictureIndex = arg_index
  176. tv_pwr.SetItem(ll_handl,tvi)
  177. ll_handl = tv_pwr.FindItem(ParentTreeItem!,ll_handl)
  178. DO WHILE ll_handl > 0
  179. tv_pwr.GetItem(ll_handl,tvi)
  180. tvi.StatePictureIndex = arg_index
  181. tv_pwr.SetItem(ll_handl,tvi)
  182. ll_handl = tv_pwr.FindItem(ParentTreeItem!,ll_handl)
  183. LOOP
  184. end subroutine
  185. on w_cus_ecomm_edit_add.create
  186. int iCurrent
  187. call super::create
  188. this.st_1=create st_1
  189. this.sle_summary=create sle_summary
  190. this.cb_save=create cb_save
  191. this.cb_paste=create cb_paste
  192. this.dw_cus_rep=create dw_cus_rep
  193. this.tv_pwr=create tv_pwr
  194. this.ln_bar=create ln_bar
  195. this.ln_bar2=create ln_bar2
  196. this.r_bar=create r_bar
  197. iCurrent=UpperBound(this.Control)
  198. this.Control[iCurrent+1]=this.st_1
  199. this.Control[iCurrent+2]=this.sle_summary
  200. this.Control[iCurrent+3]=this.cb_save
  201. this.Control[iCurrent+4]=this.cb_paste
  202. this.Control[iCurrent+5]=this.dw_cus_rep
  203. this.Control[iCurrent+6]=this.tv_pwr
  204. this.Control[iCurrent+7]=this.ln_bar
  205. this.Control[iCurrent+8]=this.ln_bar2
  206. this.Control[iCurrent+9]=this.r_bar
  207. end on
  208. on w_cus_ecomm_edit_add.destroy
  209. call super::destroy
  210. destroy(this.st_1)
  211. destroy(this.sle_summary)
  212. destroy(this.cb_save)
  213. destroy(this.cb_paste)
  214. destroy(this.dw_cus_rep)
  215. destroy(this.tv_pwr)
  216. destroy(this.ln_bar)
  217. destroy(this.ln_bar2)
  218. destroy(this.r_bar)
  219. end on
  220. event open;call super::open;dw_cus_rep.SetTransObject(sqlca)
  221. s_edit_index_tran s_tran //传递参数使用
  222. s_tran = Message.PowerObjectParm
  223. cur_cusid = s_tran.b_long
  224. cur_repid = s_tran.c_long
  225. copy_repid = s_tran.d_long
  226. cb_paste.Enabled = copy_repid > 0
  227. wf_insertrow()
  228. end event
  229. event close;call super::close;//closewithreturn(this,s_return)
  230. end event
  231. event resize;call super::resize;ln_bar.endx = this.width
  232. ln_bar2.endx = this.width
  233. r_bar.width = this.width
  234. dw_cus_rep.height = this.height - dw_cus_rep.y - 140
  235. tv_pwr.x = dw_cus_rep.x +dw_cus_rep.width +10
  236. tv_pwr.y = dw_cus_rep.y
  237. tv_pwr.width = this.width - tv_pwr.x - 40
  238. tv_pwr.height = dw_cus_rep.height
  239. end event
  240. type cb_func from w_publ_base`cb_func within w_cus_ecomm_edit_add
  241. boolean visible = false
  242. integer taborder = 30
  243. end type
  244. type cb_exit from w_publ_base`cb_exit within w_cus_ecomm_edit_add
  245. integer x = 311
  246. integer width = 151
  247. integer height = 164
  248. integer picsize = 16
  249. toolbaralignment pic_align = alignattop!
  250. boolean border = false
  251. end type
  252. event cb_exit::clicked;//s_return.returnflag = 0
  253. close(parent)
  254. end event
  255. type st_1 from statictext within w_cus_ecomm_edit_add
  256. boolean visible = false
  257. integer y = 32
  258. integer width = 160
  259. integer height = 48
  260. boolean bringtotop = true
  261. integer textsize = -9
  262. integer weight = 400
  263. fontcharset fontcharset = gb2312charset!
  264. fontpitch fontpitch = variable!
  265. string facename = "宋体"
  266. long textcolor = 33554432
  267. long backcolor = 134217739
  268. string text = "摘要"
  269. alignment alignment = right!
  270. boolean focusrectangle = false
  271. end type
  272. type sle_summary from singlelineedit within w_cus_ecomm_edit_add
  273. boolean visible = false
  274. integer x = 169
  275. integer y = 28
  276. integer width = 2144
  277. integer height = 84
  278. integer taborder = 60
  279. boolean bringtotop = true
  280. integer textsize = -9
  281. integer weight = 400
  282. fontcharset fontcharset = gb2312charset!
  283. fontpitch fontpitch = variable!
  284. string facename = "宋体"
  285. long textcolor = 33554432
  286. borderstyle borderstyle = stylelowered!
  287. end type
  288. type cb_save from uo_imflatbutton within w_cus_ecomm_edit_add
  289. integer width = 151
  290. integer height = 164
  291. integer taborder = 50
  292. boolean bringtotop = true
  293. string text = "保存"
  294. string normalpicname = "save.bmp"
  295. integer picsize = 16
  296. toolbaralignment pic_align = alignattop!
  297. boolean border = false
  298. end type
  299. event clicked;call super::clicked;IF wf_save() = 1 THEN
  300. Close(Parent)
  301. END IF
  302. end event
  303. type cb_paste from uo_imflatbutton within w_cus_ecomm_edit_add
  304. integer x = 155
  305. integer width = 151
  306. integer height = 164
  307. integer taborder = 20
  308. boolean bringtotop = true
  309. string text = "粘贴"
  310. string normalpicname = "paste.bmp"
  311. integer picsize = 16
  312. toolbaralignment pic_align = alignattop!
  313. boolean border = false
  314. end type
  315. event clicked;call super::clicked;if copy_repid <= 0 then return
  316. String ls_Permissions
  317. SELECT Permissions
  318. INTO :ls_Permissions
  319. FROM ros_cust_rep
  320. Where repid = :copy_repid;
  321. IF sqlca.SQLCode <> 0 THEN
  322. ls_Permissions = ''
  323. END IF
  324. Long ll_handl
  325. ll_handl = tv_pwr.FindItem(RootTreeItem!,0)
  326. IF ll_handl > 0 THEN tv_pwr.pf_refresh_value(ll_handl,ls_Permissions)
  327. end event
  328. type dw_cus_rep from u_dw_rbtnfilter within w_cus_ecomm_edit_add
  329. integer y = 180
  330. integer width = 1495
  331. integer height = 1908
  332. integer taborder = 70
  333. boolean bringtotop = true
  334. string title = "客户资料"
  335. string dataobject = "dw_cus_rep_ecomm_edit_add"
  336. boolean maxbox = true
  337. boolean livescroll = false
  338. boolean titleclick_sort_use = true
  339. end type
  340. event doubleclicked;call super::doubleclicked;//IF Not dw_edit_mode THEN RETURN
  341. //
  342. //Long ll_row
  343. //
  344. //ll_row = dw_cus.GetRow()
  345. //
  346. //IF ll_row <= 0 THEN RETURN
  347. //
  348. //OpenWithParm(w_cuscomm_list_ch,2)
  349. //
  350. //s_cuscomm_ljfieb INS_RT_STRU
  351. //
  352. //INS_RT_STRU = Message.PowerObjectParm
  353. //
  354. //dw_cus.Object.ifecomm[ll_row] = 1
  355. //dw_cus.Object.commcode[ll_row] = INS_RT_STRU.CusCode
  356. //
  357. //
  358. //dw_cus.accepttext()
  359. //
  360. //
  361. end event
  362. event dwnkey;call super::dwnkey;Parent.TriggerEvent('user_key')
  363. IF Key = KeyDownArrow! THEN RETURN 1
  364. IF Key = KeyEnter! THEN //
  365. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  366. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  367. RETURN 1
  368. END IF
  369. end event
  370. event rowfocuschanging;call super::rowfocuschanging;return 1
  371. end event
  372. event constructor;//
  373. end event
  374. type tv_pwr from uo_ljfieb_tv_pwr within w_cus_ecomm_edit_add
  375. integer x = 1509
  376. integer y = 192
  377. integer taborder = 20
  378. boolean bringtotop = true
  379. end type
  380. event clicked;call super::clicked;Int li_state
  381. Long ll_handl
  382. treeviewitem tvi
  383. Boolean lb_changed = False
  384. IF GetCursor() = LoadCursor(0, 32649) THEN
  385. lb_changed = True
  386. END IF
  387. IF This.GetItem(Handle,tvi) = 1 THEN
  388. li_state = tvi.StatePictureIndex //当前的状态
  389. IF lb_changed THEN
  390. //3 - li_state
  391. IF li_state = 1 THEN //没有权限 --> 有权限
  392. li_state = 2
  393. //父级同时变更
  394. ELSE //2 有权限 --> 没有权限
  395. li_state = 1
  396. //子级同时变更
  397. END IF
  398. tvi.StatePictureIndex = li_state
  399. This.SetItem(Handle,tvi)
  400. IF li_state = 2 THEN
  401. wf_set_tvparent(Handle, li_state)
  402. ELSE
  403. wf_set_tvchild(Handle, li_state)
  404. END IF
  405. END IF
  406. END IF
  407. end event
  408. type ln_bar from line within w_cus_ecomm_edit_add
  409. long linecolor = 268435456
  410. integer linethickness = 4
  411. integer beginy = 172
  412. integer endx = 2007
  413. integer endy = 172
  414. end type
  415. type ln_bar2 from line within w_cus_ecomm_edit_add
  416. long linecolor = 16777215
  417. integer linethickness = 4
  418. integer beginy = 176
  419. integer endx = 2039
  420. integer endy = 176
  421. end type
  422. type r_bar from rectangle within w_cus_ecomm_edit_add
  423. long linecolor = 16777215
  424. integer linethickness = 4
  425. long fillcolor = 1073741824
  426. integer x = 1531
  427. integer width = 146
  428. integer height = 68
  429. end type
  430. event constructor;this.fillcolor = 14215660
  431. this.linecolor = 14215660
  432. this.x = -1
  433. this.y = -1
  434. this.height = ln_bar.beginy - 5
  435. end event