w_rep_group_add.srw 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. $PBExportHeader$w_rep_group_add.srw
  2. forward
  3. global type w_rep_group_add from w_publ_base
  4. end type
  5. type cb_save_add from uo_imflatbutton within w_rep_group_add
  6. end type
  7. type cb_save_exit from uo_imflatbutton within w_rep_group_add
  8. end type
  9. type cb_save_delet from uo_imflatbutton within w_rep_group_add
  10. end type
  11. type st_1 from statictext within w_rep_group_add
  12. end type
  13. type st_2 from statictext within w_rep_group_add
  14. end type
  15. type sle_1 from singlelineedit within w_rep_group_add
  16. end type
  17. type sle_2 from singlelineedit within w_rep_group_add
  18. end type
  19. type rb_1 from radiobutton within w_rep_group_add
  20. end type
  21. type rb_2 from radiobutton within w_rep_group_add
  22. end type
  23. type r_bar from rectangle within w_rep_group_add
  24. end type
  25. type s_u_rp from structure within w_rep_group_add
  26. end type
  27. end forward
  28. type s_u_rp from structure
  29. string rpcode
  30. string rpname
  31. integer rptype
  32. string col1name0
  33. string col1name1
  34. string col1name2
  35. string col2name0
  36. string col2name1
  37. string col2name2
  38. end type
  39. global type w_rep_group_add from w_publ_base
  40. integer width = 1847
  41. integer height = 420
  42. string title = "组增加"
  43. boolean minbox = false
  44. windowtype windowtype = response!
  45. long backcolor = 134217742
  46. cb_save_add cb_save_add
  47. cb_save_exit cb_save_exit
  48. cb_save_delet cb_save_delet
  49. st_1 st_1
  50. st_2 st_2
  51. sle_1 sle_1
  52. sle_2 sle_2
  53. rb_1 rb_1
  54. rb_2 rb_2
  55. r_bar r_bar
  56. end type
  57. global w_rep_group_add w_rep_group_add
  58. type variables
  59. public:
  60. long groupid,if_Parent
  61. string groupname
  62. private:
  63. s_u_rp ss_u_rp
  64. Boolean IT_NEWBEGIN = FALSE //新建标志
  65. Boolean IT_UPDATEBEGIN = FALSE//修改标志
  66. end variables
  67. forward prototypes
  68. public subroutine p_clearmx ()
  69. public function integer save (ref string arg_msg)
  70. public function integer acceptmx (string arg_rpcode, string arg_rpname, integer arg_rptype, string arg_col1name0, string arg_col1name1, string arg_col1name2, string arg_col2name0, string arg_col2name1, string arg_col2name2)
  71. end prototypes
  72. public subroutine p_clearmx ();groupname=''
  73. end subroutine
  74. public function integer save (ref string arg_msg);Int rslt = 1,i
  75. Long ll_count
  76. IF if_Parent = 1 THEN
  77. ll_count = 0
  78. SELECT count(*) Into :ll_count From u_rep_groupmx Where reltype = 3 And groupid = :groupid ;
  79. IF ll_count > 0 THEN
  80. rslt = 0
  81. arg_msg = "组明细包含组,不能改为父项,请先删除组明细再修改"+"~n"+sqlca.SQLErrText
  82. GOTO ext
  83. END IF
  84. END IF
  85. IF IT_NEWBEGIN = True And IT_UPDATEBEGIN = False THEN
  86. groupid = f_sys_scidentity(0,"u_rep_group","groupid",arg_msg,True,sqlca) //数据commit事务)
  87. IF groupid <= 0 THEN
  88. rslt = 0
  89. GOTO ext
  90. END IF
  91. INSERT INTO u_rep_group
  92. (groupid,
  93. groupname,
  94. if_Parent
  95. )
  96. VALUES (
  97. :groupid,
  98. :groupname,
  99. :if_Parent
  100. ) Using sqlca;
  101. IF sqlca.SQLCode <> 0 THEN
  102. rslt = 0
  103. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
  104. ROLLBACK Using sqlca;
  105. GOTO ext
  106. END IF
  107. END IF
  108. IF IT_UPDATEBEGIN = True And IT_NEWBEGIN = False THEN
  109. UPDATE u_rep_group
  110. SET
  111. groupname = :groupname,
  112. if_Parent = :if_Parent
  113. Where groupid = :groupid;
  114. IF sqlca.SQLCode <> 0 THEN
  115. rslt = 0
  116. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
  117. ROLLBACK Using sqlca;
  118. GOTO ext
  119. END IF
  120. END IF
  121. ext:
  122. IF rslt = 0 THEN
  123. p_clearmx()
  124. ROLLBACK Using sqlca;
  125. ELSEIF rslt = 1 THEN
  126. COMMIT Using sqlca;
  127. END IF
  128. RETURN rslt
  129. end function
  130. public function integer acceptmx (string arg_rpcode, string arg_rpname, integer arg_rptype, string arg_col1name0, string arg_col1name1, string arg_col1name2, string arg_col2name0, string arg_col2name1, string arg_col2name2);Int rslt = 1
  131. IF Trim(arg_rpcode) = "" THEN arg_rpcode = ""
  132. IF Trim(arg_rpname) = "" THEN arg_rpname = ""
  133. IF Trim(arg_col1name0) = "" THEN arg_col1name0 = ""
  134. IF Trim(arg_col1name1) = "" THEN arg_col1name1 = ""
  135. IF Trim(arg_col1name2) = "" THEN arg_col1name2 = ""
  136. IF Trim(arg_col2name0) = "" THEN arg_col2name0 = ""
  137. IF Trim(arg_col2name1) = "" THEN arg_col2name1 = ""
  138. IF Trim(arg_col2name2) = "" THEN arg_col2name2 = ""
  139. IF arg_rpcode = "" THEN
  140. MessageBox("Error","报表编码不能为空")
  141. rslt = 0
  142. GOTO ext
  143. END IF
  144. IF arg_rpname = "" THEN
  145. MessageBox("Error","报表名称不能为空")
  146. rslt = 0
  147. GOTO ext
  148. END IF
  149. ss_u_rp.rpcode = arg_rpcode
  150. ss_u_rp.rpname = arg_rpname
  151. ss_u_rp.rptype = arg_rptype
  152. ss_u_rp.col1name0 = arg_col1name0
  153. ss_u_rp.col1name1 = arg_col1name1
  154. ss_u_rp.col1name2 = arg_col1name2
  155. ss_u_rp.col2name0 = arg_col2name0
  156. ss_u_rp.col2name1 = arg_col2name1
  157. ss_u_rp.col2name2 = arg_col2name2
  158. ext:
  159. IF rslt = 0 THEN p_clearmx()
  160. RETURN rslt
  161. end function
  162. on w_rep_group_add.create
  163. int iCurrent
  164. call super::create
  165. this.cb_save_add=create cb_save_add
  166. this.cb_save_exit=create cb_save_exit
  167. this.cb_save_delet=create cb_save_delet
  168. this.st_1=create st_1
  169. this.st_2=create st_2
  170. this.sle_1=create sle_1
  171. this.sle_2=create sle_2
  172. this.rb_1=create rb_1
  173. this.rb_2=create rb_2
  174. this.r_bar=create r_bar
  175. iCurrent=UpperBound(this.Control)
  176. this.Control[iCurrent+1]=this.cb_save_add
  177. this.Control[iCurrent+2]=this.cb_save_exit
  178. this.Control[iCurrent+3]=this.cb_save_delet
  179. this.Control[iCurrent+4]=this.st_1
  180. this.Control[iCurrent+5]=this.st_2
  181. this.Control[iCurrent+6]=this.sle_1
  182. this.Control[iCurrent+7]=this.sle_2
  183. this.Control[iCurrent+8]=this.rb_1
  184. this.Control[iCurrent+9]=this.rb_2
  185. this.Control[iCurrent+10]=this.r_bar
  186. end on
  187. on w_rep_group_add.destroy
  188. call super::destroy
  189. destroy(this.cb_save_add)
  190. destroy(this.cb_save_exit)
  191. destroy(this.cb_save_delet)
  192. destroy(this.st_1)
  193. destroy(this.st_2)
  194. destroy(this.sle_1)
  195. destroy(this.sle_2)
  196. destroy(this.rb_1)
  197. destroy(this.rb_2)
  198. destroy(this.r_bar)
  199. end on
  200. event open;call super::open;String ls_groupname
  201. Integer ll_Parent
  202. IF String( Message.StringParm) = "new" THEN
  203. IT_NEWBEGIN = True
  204. IT_UPDATEBEGIN = False
  205. ELSE
  206. groupid = Long(Message.StringParm)
  207. IT_NEWBEGIN = False
  208. IT_UPDATEBEGIN = True
  209. SELECT groupname,if_Parent Into :ls_groupname,:ll_Parent From u_rep_group Where u_rep_group.groupid = :groupid;
  210. sle_2.Text = ls_groupname
  211. IF ll_Parent = 0 THEN
  212. rb_1.Checked = True
  213. ELSE
  214. rb_2.Checked = True
  215. END IF
  216. END IF
  217. end event
  218. type cb_func from w_publ_base`cb_func within w_rep_group_add
  219. boolean visible = false
  220. integer x = 2592
  221. integer y = 280
  222. end type
  223. type cb_exit from w_publ_base`cb_exit within w_rep_group_add
  224. boolean visible = false
  225. integer x = 2363
  226. integer y = 104
  227. end type
  228. type cb_save_add from uo_imflatbutton within w_rep_group_add
  229. integer x = 270
  230. integer y = 216
  231. integer width = 393
  232. integer height = 112
  233. integer taborder = 160
  234. boolean bringtotop = true
  235. string text = "保存并新增"
  236. string normalpicname = "new.bmp"
  237. integer picsize = 16
  238. end type
  239. event clicked;call super::clicked;Integer rp_type
  240. String arg_msg
  241. groupname = Trim(sle_2.Text)
  242. if rb_1.checked=true then
  243. if_Parent=0
  244. else
  245. if_Parent=1
  246. end if
  247. IF groupname = "" THEN
  248. MessageBox('Error!',"组名不能为空")
  249. RETURN
  250. END IF
  251. arg_msg = ""
  252. IF Save(arg_msg ) = 0 THEN //i 为printid
  253. MessageBox('Error!',arg_msg)
  254. RETURN
  255. END IF
  256. MessageBox(publ_operator,'保存操作成功!')
  257. IT_NEWBEGIN = True
  258. IT_UPDATEBEGIN = False
  259. sle_2.text=''
  260. sle_2.SetFocus()
  261. RETURN
  262. end event
  263. type cb_save_exit from uo_imflatbutton within w_rep_group_add
  264. integer x = 846
  265. integer y = 216
  266. integer width = 407
  267. integer height = 112
  268. integer taborder = 170
  269. boolean bringtotop = true
  270. string text = "保存并退出"
  271. boolean default = true
  272. string normalpicname = "open.bmp"
  273. integer picsize = 16
  274. end type
  275. event clicked;call super::clicked;Integer rp_type
  276. String arg_msg
  277. groupname = Trim(sle_2.Text)
  278. if rb_1.checked=true then
  279. if_Parent=0
  280. else
  281. if_Parent=1
  282. end if
  283. IF groupname = "" THEN
  284. MessageBox('Error!',"组名不能为空")
  285. RETURN
  286. END IF
  287. arg_msg = ""
  288. IF Save(arg_msg ) = 0 THEN //i 为printid
  289. MessageBox('Error!',arg_msg)
  290. RETURN
  291. END IF
  292. MessageBox(publ_operator,'保存操作成功!')
  293. Close(Parent)
  294. end event
  295. type cb_save_delet from uo_imflatbutton within w_rep_group_add
  296. integer x = 1394
  297. integer y = 216
  298. integer width = 393
  299. integer height = 112
  300. integer taborder = 180
  301. boolean bringtotop = true
  302. string text = "退出"
  303. boolean default = true
  304. string normalpicname = "delete.bmp"
  305. integer picsize = 16
  306. end type
  307. event clicked;call super::clicked;close(parent)
  308. end event
  309. type st_1 from statictext within w_rep_group_add
  310. boolean visible = false
  311. integer x = 32
  312. integer y = 36
  313. integer width = 507
  314. integer height = 80
  315. boolean bringtotop = true
  316. integer textsize = -9
  317. integer weight = 400
  318. fontcharset fontcharset = gb2312charset!
  319. fontpitch fontpitch = variable!
  320. string facename = "宋体"
  321. long textcolor = 33554432
  322. long backcolor = 67108864
  323. string text = "报表id:"
  324. alignment alignment = right!
  325. boolean focusrectangle = false
  326. end type
  327. type st_2 from statictext within w_rep_group_add
  328. integer x = 32
  329. integer y = 28
  330. integer width = 507
  331. integer height = 80
  332. boolean bringtotop = true
  333. integer textsize = -9
  334. integer weight = 400
  335. fontcharset fontcharset = gb2312charset!
  336. fontpitch fontpitch = variable!
  337. string facename = "宋体"
  338. long textcolor = 134217751
  339. long backcolor = 134217748
  340. string text = "组名称:"
  341. boolean focusrectangle = false
  342. end type
  343. type sle_1 from singlelineedit within w_rep_group_add
  344. boolean visible = false
  345. integer x = 535
  346. integer y = 20
  347. integer width = 494
  348. integer height = 84
  349. integer taborder = 10
  350. boolean bringtotop = true
  351. integer textsize = -9
  352. integer weight = 400
  353. fontcharset fontcharset = gb2312charset!
  354. fontpitch fontpitch = variable!
  355. string facename = "宋体"
  356. long textcolor = 33554432
  357. boolean enabled = false
  358. boolean border = false
  359. end type
  360. type sle_2 from singlelineedit within w_rep_group_add
  361. integer x = 288
  362. integer y = 24
  363. integer width = 1495
  364. integer height = 84
  365. integer taborder = 20
  366. boolean bringtotop = true
  367. integer textsize = -9
  368. integer weight = 400
  369. fontcharset fontcharset = gb2312charset!
  370. fontpitch fontpitch = variable!
  371. string facename = "宋体"
  372. long textcolor = 33554432
  373. long backcolor = 134217750
  374. boolean border = false
  375. end type
  376. type rb_1 from radiobutton within w_rep_group_add
  377. integer x = 293
  378. integer y = 132
  379. integer width = 233
  380. integer height = 60
  381. boolean bringtotop = true
  382. integer textsize = -9
  383. integer weight = 400
  384. fontcharset fontcharset = gb2312charset!
  385. fontpitch fontpitch = variable!
  386. string facename = "宋体"
  387. long textcolor = 33554432
  388. long backcolor = 67108864
  389. string text = "父项"
  390. boolean checked = true
  391. end type
  392. type rb_2 from radiobutton within w_rep_group_add
  393. integer x = 713
  394. integer y = 132
  395. integer width = 233
  396. integer height = 60
  397. boolean bringtotop = true
  398. integer textsize = -9
  399. integer weight = 400
  400. fontcharset fontcharset = gb2312charset!
  401. fontpitch fontpitch = variable!
  402. string facename = "宋体"
  403. long textcolor = 33554432
  404. long backcolor = 67108864
  405. string text = "子项"
  406. end type
  407. type r_bar from rectangle within w_rep_group_add
  408. boolean visible = false
  409. long linecolor = 16777215
  410. integer linethickness = 4
  411. long fillcolor = 1073741824
  412. integer x = 4530
  413. integer y = 544
  414. integer width = 146
  415. integer height = 68
  416. end type
  417. event constructor;this.fillcolor = 14215660
  418. this.linecolor = 14215660
  419. this.x = -1
  420. this.y = -1
  421. //this.height = ln_bar.beginy - 5
  422. //
  423. end event