$PBExportHeader$w_rep_group_add.srw forward global type w_rep_group_add from w_publ_base end type type cb_save_add from uo_imflatbutton within w_rep_group_add end type type cb_save_exit from uo_imflatbutton within w_rep_group_add end type type cb_save_delet from uo_imflatbutton within w_rep_group_add end type type st_1 from statictext within w_rep_group_add end type type st_2 from statictext within w_rep_group_add end type type sle_1 from singlelineedit within w_rep_group_add end type type sle_2 from singlelineedit within w_rep_group_add end type type rb_1 from radiobutton within w_rep_group_add end type type rb_2 from radiobutton within w_rep_group_add end type type r_bar from rectangle within w_rep_group_add end type type s_u_rp from structure within w_rep_group_add end type end forward type s_u_rp from structure string rpcode string rpname integer rptype string col1name0 string col1name1 string col1name2 string col2name0 string col2name1 string col2name2 end type global type w_rep_group_add from w_publ_base integer width = 1847 integer height = 420 string title = "组增加" boolean minbox = false windowtype windowtype = response! long backcolor = 134217742 cb_save_add cb_save_add cb_save_exit cb_save_exit cb_save_delet cb_save_delet st_1 st_1 st_2 st_2 sle_1 sle_1 sle_2 sle_2 rb_1 rb_1 rb_2 rb_2 r_bar r_bar end type global w_rep_group_add w_rep_group_add type variables public: long groupid,if_Parent string groupname private: s_u_rp ss_u_rp Boolean IT_NEWBEGIN = FALSE //新建标志 Boolean IT_UPDATEBEGIN = FALSE//修改标志 end variables forward prototypes public subroutine p_clearmx () public function integer save (ref string arg_msg) 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) end prototypes public subroutine p_clearmx ();groupname='' end subroutine public function integer save (ref string arg_msg);Int rslt = 1,i Long ll_count IF if_Parent = 1 THEN ll_count = 0 SELECT count(*) Into :ll_count From u_rep_groupmx Where reltype = 3 And groupid = :groupid ; IF ll_count > 0 THEN rslt = 0 arg_msg = "组明细包含组,不能改为父项,请先删除组明细再修改"+"~n"+sqlca.SQLErrText GOTO ext END IF END IF IF IT_NEWBEGIN = True And IT_UPDATEBEGIN = False THEN groupid = f_sys_scidentity(0,"u_rep_group","groupid",arg_msg,True,sqlca) //数据commit事务) IF groupid <= 0 THEN rslt = 0 GOTO ext END IF INSERT INTO u_rep_group (groupid, groupname, if_Parent ) VALUES ( :groupid, :groupname, :if_Parent ) Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText ROLLBACK Using sqlca; GOTO ext END IF END IF IF IT_UPDATEBEGIN = True And IT_NEWBEGIN = False THEN UPDATE u_rep_group SET groupname = :groupname, if_Parent = :if_Parent Where groupid = :groupid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText ROLLBACK Using sqlca; GOTO ext END IF END IF ext: IF rslt = 0 THEN p_clearmx() ROLLBACK Using sqlca; ELSEIF rslt = 1 THEN COMMIT Using sqlca; END IF RETURN rslt end function 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 IF Trim(arg_rpcode) = "" THEN arg_rpcode = "" IF Trim(arg_rpname) = "" THEN arg_rpname = "" IF Trim(arg_col1name0) = "" THEN arg_col1name0 = "" IF Trim(arg_col1name1) = "" THEN arg_col1name1 = "" IF Trim(arg_col1name2) = "" THEN arg_col1name2 = "" IF Trim(arg_col2name0) = "" THEN arg_col2name0 = "" IF Trim(arg_col2name1) = "" THEN arg_col2name1 = "" IF Trim(arg_col2name2) = "" THEN arg_col2name2 = "" IF arg_rpcode = "" THEN MessageBox("Error","报表编码不能为空") rslt = 0 GOTO ext END IF IF arg_rpname = "" THEN MessageBox("Error","报表名称不能为空") rslt = 0 GOTO ext END IF ss_u_rp.rpcode = arg_rpcode ss_u_rp.rpname = arg_rpname ss_u_rp.rptype = arg_rptype ss_u_rp.col1name0 = arg_col1name0 ss_u_rp.col1name1 = arg_col1name1 ss_u_rp.col1name2 = arg_col1name2 ss_u_rp.col2name0 = arg_col2name0 ss_u_rp.col2name1 = arg_col2name1 ss_u_rp.col2name2 = arg_col2name2 ext: IF rslt = 0 THEN p_clearmx() RETURN rslt end function on w_rep_group_add.create int iCurrent call super::create this.cb_save_add=create cb_save_add this.cb_save_exit=create cb_save_exit this.cb_save_delet=create cb_save_delet this.st_1=create st_1 this.st_2=create st_2 this.sle_1=create sle_1 this.sle_2=create sle_2 this.rb_1=create rb_1 this.rb_2=create rb_2 this.r_bar=create r_bar iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_save_add this.Control[iCurrent+2]=this.cb_save_exit this.Control[iCurrent+3]=this.cb_save_delet this.Control[iCurrent+4]=this.st_1 this.Control[iCurrent+5]=this.st_2 this.Control[iCurrent+6]=this.sle_1 this.Control[iCurrent+7]=this.sle_2 this.Control[iCurrent+8]=this.rb_1 this.Control[iCurrent+9]=this.rb_2 this.Control[iCurrent+10]=this.r_bar end on on w_rep_group_add.destroy call super::destroy destroy(this.cb_save_add) destroy(this.cb_save_exit) destroy(this.cb_save_delet) destroy(this.st_1) destroy(this.st_2) destroy(this.sle_1) destroy(this.sle_2) destroy(this.rb_1) destroy(this.rb_2) destroy(this.r_bar) end on event open;call super::open;String ls_groupname Integer ll_Parent IF String( Message.StringParm) = "new" THEN IT_NEWBEGIN = True IT_UPDATEBEGIN = False ELSE groupid = Long(Message.StringParm) IT_NEWBEGIN = False IT_UPDATEBEGIN = True SELECT groupname,if_Parent Into :ls_groupname,:ll_Parent From u_rep_group Where u_rep_group.groupid = :groupid; sle_2.Text = ls_groupname IF ll_Parent = 0 THEN rb_1.Checked = True ELSE rb_2.Checked = True END IF END IF end event type cb_func from w_publ_base`cb_func within w_rep_group_add boolean visible = false integer x = 2592 integer y = 280 end type type cb_exit from w_publ_base`cb_exit within w_rep_group_add boolean visible = false integer x = 2363 integer y = 104 end type type cb_save_add from uo_imflatbutton within w_rep_group_add integer x = 270 integer y = 216 integer width = 393 integer height = 112 integer taborder = 160 boolean bringtotop = true string text = "保存并新增" string normalpicname = "new.bmp" integer picsize = 16 end type event clicked;call super::clicked;Integer rp_type String arg_msg groupname = Trim(sle_2.Text) if rb_1.checked=true then if_Parent=0 else if_Parent=1 end if IF groupname = "" THEN MessageBox('Error!',"组名不能为空") RETURN END IF arg_msg = "" IF Save(arg_msg ) = 0 THEN //i 为printid MessageBox('Error!',arg_msg) RETURN END IF MessageBox(publ_operator,'保存操作成功!') IT_NEWBEGIN = True IT_UPDATEBEGIN = False sle_2.text='' sle_2.SetFocus() RETURN end event type cb_save_exit from uo_imflatbutton within w_rep_group_add integer x = 846 integer y = 216 integer width = 407 integer height = 112 integer taborder = 170 boolean bringtotop = true string text = "保存并退出" boolean default = true string normalpicname = "open.bmp" integer picsize = 16 end type event clicked;call super::clicked;Integer rp_type String arg_msg groupname = Trim(sle_2.Text) if rb_1.checked=true then if_Parent=0 else if_Parent=1 end if IF groupname = "" THEN MessageBox('Error!',"组名不能为空") RETURN END IF arg_msg = "" IF Save(arg_msg ) = 0 THEN //i 为printid MessageBox('Error!',arg_msg) RETURN END IF MessageBox(publ_operator,'保存操作成功!') Close(Parent) end event type cb_save_delet from uo_imflatbutton within w_rep_group_add integer x = 1394 integer y = 216 integer width = 393 integer height = 112 integer taborder = 180 boolean bringtotop = true string text = "退出" boolean default = true string normalpicname = "delete.bmp" integer picsize = 16 end type event clicked;call super::clicked;close(parent) end event type st_1 from statictext within w_rep_group_add boolean visible = false integer x = 32 integer y = 36 integer width = 507 integer height = 80 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "报表id:" alignment alignment = right! boolean focusrectangle = false end type type st_2 from statictext within w_rep_group_add integer x = 32 integer y = 28 integer width = 507 integer height = 80 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 134217751 long backcolor = 134217748 string text = "组名称:" boolean focusrectangle = false end type type sle_1 from singlelineedit within w_rep_group_add boolean visible = false integer x = 535 integer y = 20 integer width = 494 integer height = 84 integer taborder = 10 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean enabled = false boolean border = false end type type sle_2 from singlelineedit within w_rep_group_add integer x = 288 integer y = 24 integer width = 1495 integer height = 84 integer taborder = 20 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217750 boolean border = false end type type rb_1 from radiobutton within w_rep_group_add integer x = 293 integer y = 132 integer width = 233 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "父项" boolean checked = true end type type rb_2 from radiobutton within w_rep_group_add integer x = 713 integer y = 132 integer width = 233 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "子项" end type type r_bar from rectangle within w_rep_group_add boolean visible = false long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 4530 integer y = 544 integer width = 146 integer height = 68 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 //this.height = ln_bar.beginy - 5 // end event