w_aifmb_addcuscomm.srw 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. $PBExportHeader$w_aifmb_addcuscomm.srw
  2. forward
  3. global type w_aifmb_addcuscomm from window
  4. end type
  5. type sle_sptcode from singlelineedit within w_aifmb_addcuscomm
  6. end type
  7. type sle_sptname from singlelineedit within w_aifmb_addcuscomm
  8. end type
  9. type st_sptcode from statictext within w_aifmb_addcuscomm
  10. end type
  11. type st_sptname from statictext within w_aifmb_addcuscomm
  12. end type
  13. type st_lcusname from statictext within w_aifmb_addcuscomm
  14. end type
  15. type st_lcuscode from statictext within w_aifmb_addcuscomm
  16. end type
  17. type sle_lcusname from singlelineedit within w_aifmb_addcuscomm
  18. end type
  19. type sle_lcuscode from singlelineedit within w_aifmb_addcuscomm
  20. end type
  21. type cb_exit from commandbutton within w_aifmb_addcuscomm
  22. end type
  23. type cb_ok from commandbutton within w_aifmb_addcuscomm
  24. end type
  25. type sle_cusname from singlelineedit within w_aifmb_addcuscomm
  26. end type
  27. type sle_cuscode from singlelineedit within w_aifmb_addcuscomm
  28. end type
  29. type st_3 from statictext within w_aifmb_addcuscomm
  30. end type
  31. type st_2 from statictext within w_aifmb_addcuscomm
  32. end type
  33. type st_1 from statictext within w_aifmb_addcuscomm
  34. end type
  35. type ddlb_custype from dropdownlistbox within w_aifmb_addcuscomm
  36. end type
  37. end forward
  38. global type w_aifmb_addcuscomm from window
  39. integer width = 1143
  40. integer height = 1064
  41. boolean titlebar = true
  42. string title = "添加合作关系"
  43. boolean controlmenu = true
  44. windowtype windowtype = response!
  45. long backcolor = 67108864
  46. string icon = "AppIcon!"
  47. boolean center = true
  48. sle_sptcode sle_sptcode
  49. sle_sptname sle_sptname
  50. st_sptcode st_sptcode
  51. st_sptname st_sptname
  52. st_lcusname st_lcusname
  53. st_lcuscode st_lcuscode
  54. sle_lcusname sle_lcusname
  55. sle_lcuscode sle_lcuscode
  56. cb_exit cb_exit
  57. cb_ok cb_ok
  58. sle_cusname sle_cusname
  59. sle_cuscode sle_cuscode
  60. st_3 st_3
  61. st_2 st_2
  62. st_1 st_1
  63. ddlb_custype ddlb_custype
  64. end type
  65. global w_aifmb_addcuscomm w_aifmb_addcuscomm
  66. type variables
  67. string ins_cusid
  68. s_aifmb_addcuscomm s_parm
  69. end variables
  70. on w_aifmb_addcuscomm.create
  71. this.sle_sptcode=create sle_sptcode
  72. this.sle_sptname=create sle_sptname
  73. this.st_sptcode=create st_sptcode
  74. this.st_sptname=create st_sptname
  75. this.st_lcusname=create st_lcusname
  76. this.st_lcuscode=create st_lcuscode
  77. this.sle_lcusname=create sle_lcusname
  78. this.sle_lcuscode=create sle_lcuscode
  79. this.cb_exit=create cb_exit
  80. this.cb_ok=create cb_ok
  81. this.sle_cusname=create sle_cusname
  82. this.sle_cuscode=create sle_cuscode
  83. this.st_3=create st_3
  84. this.st_2=create st_2
  85. this.st_1=create st_1
  86. this.ddlb_custype=create ddlb_custype
  87. this.Control[]={this.sle_sptcode,&
  88. this.sle_sptname,&
  89. this.st_sptcode,&
  90. this.st_sptname,&
  91. this.st_lcusname,&
  92. this.st_lcuscode,&
  93. this.sle_lcusname,&
  94. this.sle_lcuscode,&
  95. this.cb_exit,&
  96. this.cb_ok,&
  97. this.sle_cusname,&
  98. this.sle_cuscode,&
  99. this.st_3,&
  100. this.st_2,&
  101. this.st_1,&
  102. this.ddlb_custype}
  103. end on
  104. on w_aifmb_addcuscomm.destroy
  105. destroy(this.sle_sptcode)
  106. destroy(this.sle_sptname)
  107. destroy(this.st_sptcode)
  108. destroy(this.st_sptname)
  109. destroy(this.st_lcusname)
  110. destroy(this.st_lcuscode)
  111. destroy(this.sle_lcusname)
  112. destroy(this.sle_lcuscode)
  113. destroy(this.cb_exit)
  114. destroy(this.cb_ok)
  115. destroy(this.sle_cusname)
  116. destroy(this.sle_cuscode)
  117. destroy(this.st_3)
  118. destroy(this.st_2)
  119. destroy(this.st_1)
  120. destroy(this.ddlb_custype)
  121. end on
  122. event open;
  123. s_parm = Message.PowerObjectParm
  124. ins_cusid = s_parm.cusid
  125. sle_cuscode.Text = s_parm.cuscode
  126. sle_cusname.Text = s_parm.cusname
  127. IF s_parm.lb_readonly THEN
  128. sle_cuscode.Enabled = False
  129. sle_cusname.Enabled = False
  130. END IF
  131. IF s_parm.ll_cusid > 0 THEN
  132. sle_lcuscode.Text = s_parm.ls_cuscode
  133. sle_lcusname.Text = s_parm.ls_cusname
  134. END IF
  135. IF s_parm.ll_sptid > 0 THEN
  136. sle_sptcode.Text = s_parm.ls_sptcode
  137. sle_sptname.Text = s_parm.ls_sptname
  138. END IF
  139. IF s_parm.ll_cusid <= 0 And s_parm.ll_sptid <= 0 THEN
  140. This.Height = sle_lcusname.Y + This.Height - This.WorkSpaceHeight()
  141. cb_ok.Y = sle_lcuscode.Y
  142. cb_exit.Y = sle_lcuscode.Y
  143. st_lcuscode.Visible = False
  144. st_lcusname.Visible = False
  145. sle_lcuscode.Visible = False
  146. sle_lcusname.Visible = False
  147. st_sptcode.Visible = False
  148. st_sptname.Visible = False
  149. sle_sptcode.Visible = False
  150. sle_sptname.Visible = False
  151. ELSEIF s_parm.ll_cusid > 0 And s_parm.ll_sptid <= 0 THEN
  152. This.Height = sle_sptname.Y + This.Height - This.WorkSpaceHeight()
  153. cb_ok.Y = sle_sptcode.Y
  154. cb_exit.Y = sle_sptcode.Y
  155. st_sptcode.Visible = False
  156. st_sptname.Visible = False
  157. sle_sptcode.Visible = False
  158. sle_sptname.Visible = False
  159. ddlb_custype.Enabled = false
  160. ddlb_custype.Text = '[2]经销商/客户'
  161. ELSEIF s_parm.ll_sptid > 0 And s_parm.ll_cusid <= 0 THEN
  162. This.Height = sle_sptname.Y + This.Height - This.WorkSpaceHeight()
  163. cb_ok.Y = sle_sptcode.Y
  164. cb_exit.Y = sle_sptcode.Y
  165. st_lcuscode.Visible = False
  166. st_lcusname.Visible = False
  167. sle_lcuscode.Visible = False
  168. sle_lcusname.Visible = False
  169. st_sptcode.Y = st_lcuscode.Y
  170. st_sptname.Y = st_lcusname.Y
  171. sle_sptcode.Y = sle_lcuscode.Y
  172. sle_sptname.Y = sle_lcusname.Y
  173. ddlb_custype.Enabled = false
  174. ddlb_custype.Text = '[1]供应商'
  175. ELSE
  176. ddlb_custype.Enabled = false
  177. ddlb_custype.Text = '[3]客户/供应商'
  178. END IF
  179. end event
  180. type sle_sptcode from singlelineedit within w_aifmb_addcuscomm
  181. integer x = 471
  182. integer y = 632
  183. integer width = 549
  184. integer height = 88
  185. integer taborder = 40
  186. integer textsize = -9
  187. integer weight = 400
  188. fontcharset fontcharset = gb2312charset!
  189. fontpitch fontpitch = variable!
  190. string facename = "宋体"
  191. long textcolor = 33554432
  192. boolean enabled = false
  193. boolean displayonly = true
  194. borderstyle borderstyle = stylelowered!
  195. end type
  196. type sle_sptname from singlelineedit within w_aifmb_addcuscomm
  197. integer x = 471
  198. integer y = 752
  199. integer width = 549
  200. integer height = 84
  201. integer taborder = 50
  202. integer textsize = -9
  203. integer weight = 400
  204. fontcharset fontcharset = gb2312charset!
  205. fontpitch fontpitch = variable!
  206. string facename = "宋体"
  207. long textcolor = 33554432
  208. boolean enabled = false
  209. boolean displayonly = true
  210. borderstyle borderstyle = stylelowered!
  211. end type
  212. type st_sptcode from statictext within w_aifmb_addcuscomm
  213. integer x = 41
  214. integer y = 652
  215. integer width = 402
  216. integer height = 48
  217. integer textsize = -9
  218. integer weight = 400
  219. fontcharset fontcharset = gb2312charset!
  220. fontpitch fontpitch = variable!
  221. string facename = "宋体"
  222. long textcolor = 33554432
  223. long backcolor = 67108864
  224. string text = "供应商编码"
  225. alignment alignment = right!
  226. boolean focusrectangle = false
  227. end type
  228. type st_sptname from statictext within w_aifmb_addcuscomm
  229. integer x = 41
  230. integer y = 768
  231. integer width = 402
  232. integer height = 48
  233. integer textsize = -9
  234. integer weight = 400
  235. fontcharset fontcharset = gb2312charset!
  236. fontpitch fontpitch = variable!
  237. string facename = "宋体"
  238. long textcolor = 33554432
  239. long backcolor = 67108864
  240. string text = "供应商名称"
  241. alignment alignment = right!
  242. boolean focusrectangle = false
  243. end type
  244. type st_lcusname from statictext within w_aifmb_addcuscomm
  245. integer x = 41
  246. integer y = 532
  247. integer width = 402
  248. integer height = 48
  249. integer textsize = -9
  250. integer weight = 400
  251. fontcharset fontcharset = gb2312charset!
  252. fontpitch fontpitch = variable!
  253. string facename = "宋体"
  254. long textcolor = 33554432
  255. long backcolor = 67108864
  256. string text = "客户名称"
  257. alignment alignment = right!
  258. boolean focusrectangle = false
  259. end type
  260. type st_lcuscode from statictext within w_aifmb_addcuscomm
  261. integer x = 41
  262. integer y = 416
  263. integer width = 402
  264. integer height = 48
  265. integer textsize = -9
  266. integer weight = 400
  267. fontcharset fontcharset = gb2312charset!
  268. fontpitch fontpitch = variable!
  269. string facename = "宋体"
  270. long textcolor = 33554432
  271. long backcolor = 67108864
  272. string text = "客户编码"
  273. alignment alignment = right!
  274. boolean focusrectangle = false
  275. end type
  276. type sle_lcusname from singlelineedit within w_aifmb_addcuscomm
  277. integer x = 471
  278. integer y = 516
  279. integer width = 549
  280. integer height = 84
  281. integer taborder = 50
  282. integer textsize = -9
  283. integer weight = 400
  284. fontcharset fontcharset = gb2312charset!
  285. fontpitch fontpitch = variable!
  286. string facename = "宋体"
  287. long textcolor = 33554432
  288. boolean enabled = false
  289. boolean displayonly = true
  290. borderstyle borderstyle = stylelowered!
  291. end type
  292. type sle_lcuscode from singlelineedit within w_aifmb_addcuscomm
  293. integer x = 471
  294. integer y = 396
  295. integer width = 549
  296. integer height = 88
  297. integer taborder = 40
  298. integer textsize = -9
  299. integer weight = 400
  300. fontcharset fontcharset = gb2312charset!
  301. fontpitch fontpitch = variable!
  302. string facename = "宋体"
  303. long textcolor = 33554432
  304. boolean enabled = false
  305. boolean displayonly = true
  306. borderstyle borderstyle = stylelowered!
  307. end type
  308. type cb_exit from commandbutton within w_aifmb_addcuscomm
  309. integer x = 782
  310. integer y = 868
  311. integer width = 242
  312. integer height = 84
  313. integer taborder = 50
  314. integer textsize = -9
  315. integer weight = 400
  316. fontcharset fontcharset = gb2312charset!
  317. fontpitch fontpitch = variable!
  318. string facename = "宋体"
  319. string text = "取消"
  320. boolean cancel = true
  321. end type
  322. event clicked;close(parent)
  323. end event
  324. type cb_ok from commandbutton within w_aifmb_addcuscomm
  325. integer x = 517
  326. integer y = 868
  327. integer width = 242
  328. integer height = 84
  329. integer taborder = 40
  330. integer textsize = -9
  331. integer weight = 400
  332. fontcharset fontcharset = gb2312charset!
  333. fontpitch fontpitch = variable!
  334. string facename = "宋体"
  335. string text = "确认"
  336. boolean default = true
  337. end type
  338. event clicked;Int rslt = 1
  339. String arg_msg
  340. Long ll_custype, ll_cuscommid
  341. String ls_cuscode
  342. String ls_cusname
  343. ls_cuscode = sle_cuscode.Text
  344. ls_cusname = sle_cusname.Text
  345. uo_aifmb = Create uo_aifmb
  346. IF ls_cuscode = '' THEN
  347. rslt = 0
  348. arg_msg = '请填写企业代码'
  349. GOTO ext
  350. END IF
  351. IF ls_cusname = '' THEN
  352. rslt = 0
  353. arg_msg = '请填写企业名称'
  354. GOTO ext
  355. END IF
  356. IF ddlb_custype.Text = '[1]供应商' THEN
  357. ll_custype = 1
  358. ELSEIF ddlb_custype.Text = '[2]经销商/客户' THEN
  359. ll_custype = 2
  360. ELSE
  361. ll_custype = 3
  362. END IF
  363. Long ll_cnt
  364. SELECT COUNT(0)
  365. INTO :ll_cnt
  366. FROM LJFIEB_CusComm
  367. WHERE CusID = :ins_cusid
  368. Using sys_email_sqlca;
  369. IF sys_email_sqlca.SQLCode <> 0 THEN
  370. rslt = 0
  371. arg_msg = '查询关系是否已经添加失败,' + sys_email_sqlca.SQLErrText
  372. GOTO ext
  373. END IF
  374. IF ll_cnt = 0 THEN
  375. SELECT COUNT(0)
  376. INTO :ll_cnt
  377. FROM LJFIEB_CusComm
  378. WHERE cuscode = :ls_cuscode
  379. Using sys_email_sqlca;
  380. IF sys_email_sqlca.SQLCode <> 0 THEN
  381. rslt = 0
  382. arg_msg = '查询企业代号是否重复失败,' + sys_email_sqlca.SQLErrText
  383. GOTO ext
  384. END IF
  385. IF ll_cnt > 0 THEN
  386. rslt = 0
  387. arg_msg = '企业代号'+ls_cuscode+'重复请修改后再试'
  388. GOTO ext
  389. END IF
  390. SELECT isnull(max(CusCommID),10)
  391. INTO :ll_cuscommid
  392. FROM LJFIEB_CusComm
  393. Using sys_email_sqlca;
  394. IF sys_email_sqlca.SQLCode <> 0 THEN
  395. rslt = 0
  396. arg_msg = '查询企业最大企业编码失败,' + sys_email_sqlca.SQLErrText
  397. GOTO ext
  398. END IF
  399. ll_cuscommid++
  400. INSERT INTO LJFIEB_CusComm(CusCommID,CusType,CusCode,CusName,CusID,Accept,IfDynamic)
  401. VALUES(:ll_cuscommid,:ll_custype,:ls_cuscode,:ls_cusname,:ins_cusid,1,2)
  402. Using sys_email_sqlca;
  403. IF sys_email_sqlca.SQLCode <> 0 THEN
  404. rslt = 0
  405. arg_msg = '添加合作关系失败,' + sys_email_sqlca.SQLErrText
  406. GOTO ext
  407. END IF
  408. END IF
  409. IF s_parm.ll_CusID > 0 THEN
  410. UPDATE u_cust SET commcode = :ls_cuscode, ifecomm = 1, commsccode = ''
  411. Where CusID = :s_parm.ll_CusID;
  412. IF sqlca.SQLCode <> 0 THEN
  413. rslt = 0
  414. arg_msg = '绑定客户失败,' + sqlca.SQLErrText
  415. GOTO ext
  416. END IF
  417. END IF
  418. IF s_parm.ll_sptid > 0 THEN
  419. UPDATE u_spt SET commcode = :ls_cuscode, ifecomm = 1, commsccode = ''
  420. Where sptid = :s_parm.ll_sptid;
  421. IF sqlca.SQLCode <> 0 THEN
  422. rslt = 0
  423. arg_msg = '绑定供应商失败,' + sqlca.SQLErrText
  424. GOTO ext
  425. END IF
  426. END IF
  427. IF uo_aifmb.uf_addcuscomm(ins_cusid, ll_custype, arg_msg) <> 1 THEN
  428. rslt = 0
  429. GOTO ext
  430. END IF
  431. ext:
  432. Destroy uo_aifmb
  433. IF rslt = 1 THEN
  434. COMMIT;
  435. COMMIT Using sys_email_sqlca;
  436. Close(Parent)
  437. ELSE
  438. ROLLBACK;
  439. ROLLBACK Using sys_email_sqlca;
  440. MessageBox('ERROR', arg_msg)
  441. END IF
  442. end event
  443. type sle_cusname from singlelineedit within w_aifmb_addcuscomm
  444. integer x = 471
  445. integer y = 280
  446. integer width = 549
  447. integer height = 84
  448. integer taborder = 30
  449. integer textsize = -9
  450. integer weight = 400
  451. fontcharset fontcharset = gb2312charset!
  452. fontpitch fontpitch = variable!
  453. string facename = "宋体"
  454. long textcolor = 33554432
  455. borderstyle borderstyle = stylelowered!
  456. end type
  457. type sle_cuscode from singlelineedit within w_aifmb_addcuscomm
  458. integer x = 471
  459. integer y = 164
  460. integer width = 549
  461. integer height = 84
  462. integer taborder = 20
  463. integer textsize = -9
  464. integer weight = 400
  465. fontcharset fontcharset = gb2312charset!
  466. fontpitch fontpitch = variable!
  467. string facename = "宋体"
  468. long textcolor = 33554432
  469. borderstyle borderstyle = stylelowered!
  470. end type
  471. type st_3 from statictext within w_aifmb_addcuscomm
  472. integer x = 101
  473. integer y = 296
  474. integer width = 343
  475. integer height = 48
  476. integer textsize = -9
  477. integer weight = 400
  478. fontcharset fontcharset = gb2312charset!
  479. fontpitch fontpitch = variable!
  480. string facename = "宋体"
  481. long textcolor = 33554432
  482. long backcolor = 67108864
  483. string text = "企业本地名称"
  484. alignment alignment = right!
  485. boolean focusrectangle = false
  486. end type
  487. type st_2 from statictext within w_aifmb_addcuscomm
  488. integer x = 101
  489. integer y = 180
  490. integer width = 343
  491. integer height = 48
  492. integer textsize = -9
  493. integer weight = 400
  494. fontcharset fontcharset = gb2312charset!
  495. fontpitch fontpitch = variable!
  496. string facename = "宋体"
  497. long textcolor = 33554432
  498. long backcolor = 67108864
  499. string text = "企业本地代码"
  500. alignment alignment = right!
  501. boolean focusrectangle = false
  502. end type
  503. type st_1 from statictext within w_aifmb_addcuscomm
  504. integer x = 197
  505. integer y = 64
  506. integer width = 247
  507. integer height = 48
  508. integer textsize = -9
  509. integer weight = 400
  510. fontcharset fontcharset = gb2312charset!
  511. fontpitch fontpitch = variable!
  512. string facename = "宋体"
  513. long textcolor = 33554432
  514. long backcolor = 67108864
  515. string text = "关系"
  516. alignment alignment = right!
  517. boolean focusrectangle = false
  518. end type
  519. type ddlb_custype from dropdownlistbox within w_aifmb_addcuscomm
  520. integer x = 471
  521. integer y = 48
  522. integer width = 549
  523. integer height = 452
  524. integer taborder = 10
  525. integer textsize = -9
  526. integer weight = 400
  527. fontcharset fontcharset = gb2312charset!
  528. fontpitch fontpitch = variable!
  529. string facename = "宋体"
  530. long textcolor = 33554432
  531. string text = "[1]供应商"
  532. string item[] = {"[1]供应商","[2]经销商/客户","[3]客户/供应商"}
  533. borderstyle borderstyle = stylelowered!
  534. end type