$PBExportHeader$w_user_report_style_list.srw
forward
global type w_user_report_style_list from w_publ_choice
end type
type cb_edit from uo_imflatbutton within w_user_report_style_list
end type
type cb_del from uo_imflatbutton within w_user_report_style_list
end type
type ln_3 from line within w_user_report_style_list
end type
type ln_4 from line within w_user_report_style_list
end type
end forward

global type w_user_report_style_list from w_publ_choice
integer width = 1906
integer height = 1680
string title = "报表查询方案"
boolean controlmenu = true
cb_edit cb_edit
cb_del cb_del
ln_3 ln_3
ln_4 ln_4
end type
global w_user_report_style_list w_user_report_style_list

type variables
long ins_empid
string ins_dwname

s_user_report_style INS_RT_STRU
end variables

on w_user_report_style_list.create
int iCurrent
call super::create
this.cb_edit=create cb_edit
this.cb_del=create cb_del
this.ln_3=create ln_3
this.ln_4=create ln_4
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.cb_edit
this.Control[iCurrent+2]=this.cb_del
this.Control[iCurrent+3]=this.ln_3
this.Control[iCurrent+4]=this.ln_4
end on

on w_user_report_style_list.destroy
call super::destroy
destroy(this.cb_edit)
destroy(this.cb_del)
destroy(this.ln_3)
destroy(this.ln_4)
end on

event open;this.triggerevent('ue_before_open')
wf_movetocenter()

s_user_report_style s_style

s_style = Message.PowerObjectParm

ins_empid = s_style.empid
ins_dwname = s_style.dwname

if_ue_sort=true
dw_CH.SetTransObject (sqlca)
cb_retrieve.TRIGGEREVENT(CLICKED!)


end event

event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU)
end event

type cb_func from w_publ_choice`cb_func within w_user_report_style_list
end type

type cb_exit from w_publ_choice`cb_exit within w_user_report_style_list
integer x = 869
end type

type sle_ch from w_publ_choice`sle_ch within w_user_report_style_list
boolean visible = false
end type

type dw_ch from w_publ_choice`dw_ch within w_user_report_style_list
integer y = 176
integer width = 1883
string dataobject = "dw_user_report_style_list"
end type

type st_1 from w_publ_choice`st_1 within w_user_report_style_list
boolean visible = false
end type

type cb_retrieve from w_publ_choice`cb_retrieve within w_user_report_style_list
end type

event cb_retrieve::clicked;dw_ch.retrieve(ins_dwname,ins_empid)
end event

type cb_choice from w_publ_choice`cb_choice within w_user_report_style_list
integer x = 306
end type

event cb_choice::clicked;call super::clicked;Long LS_ROW
LS_ROW = dw_CH.GetRow()
IF LS_ROW <= 0 THEN
	MessageBox('系统提示','请先选择目标行!',StopSign!)
	RETURN
END IF

INS_RT_STRU.sort = dw_CH.Object.dwnSyntax_sort[LS_ROW]
INS_RT_STRU.filter = dw_CH.Object.dwnSyntax_filter[LS_ROW]
INS_RT_STRU.visible = dw_CH.Object.dwnSyntax_layout_column_visible[LS_ROW]
INS_RT_STRU.width = dw_CH.Object.dwnSyntax_layout_column_width[LS_ROW]
INS_RT_STRU.column_x = dw_CH.Object.dwnSyntax_layout_column_x[LS_ROW]
INS_RT_STRU.stylename = dw_CH.Object.stylename[LS_ROW]

Close(PARENT)

end event

type ln_bar from w_publ_choice`ln_bar within w_user_report_style_list
end type

type ln_bar2 from w_publ_choice`ln_bar2 within w_user_report_style_list
end type

type r_bar from w_publ_choice`r_bar within w_user_report_style_list
end type

type ln_1 from w_publ_choice`ln_1 within w_user_report_style_list
boolean visible = false
end type

type ln_2 from w_publ_choice`ln_2 within w_user_report_style_list
boolean visible = false
end type

type cb_edit from uo_imflatbutton within w_user_report_style_list
integer x = 535
integer width = 165
integer height = 164
integer taborder = 30
boolean bringtotop = true
string text = "修改"
string normalpicname = "OPEN.BMP"
integer picsize = 16
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;Long ll_row
Long ll_empid
String ls_username

ll_row = dw_ch.GetRow()

IF ll_row <= 0 THEN
	MessageBox('系统提示','请选择要修改的方案')
	RETURN
END IF

ll_empid = dw_ch.Object.empid[ll_row]

IF NOT sys_power_issuper And (ll_empid <> sys_empid) THEN
	SELECT username INTO :ls_username
		FROM u_user
		Where empid = :ll_empid ;
	IF sqlca.SQLCode = 0 THEN
		MessageBox('系统提示','该查询方案是 '+ls_username+' 建立的,只有其本人或超级用户才能修改或删除')
		RETURN
	ELSE
		MessageBox('系统提示','该查询方案不是当前用户建立的,只有建立者本人或超级用户才能修改或删除')
		RETURN
	END IF
END IF

s_user_report_style s_style
s_style.empid = ll_empid
s_style.dwname = dw_ch.object.dwname[ll_row]
s_style.stylename = dw_ch.object.stylename[ll_row]
s_style.ifshare = dw_ch.object.ifshare[ll_row]

openwithparm(w_report_style_edit,s_style)

cb_retrieve.TriggerEvent(Clicked!)



end event

type cb_del from uo_imflatbutton within w_user_report_style_list
integer x = 699
integer width = 165
integer height = 164
integer taborder = 30
boolean bringtotop = true
string text = "删除"
string normalpicname = "OPEN.BMP"
integer picsize = 16
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;Long ll_row
Long ll_empid
String ls_dwname,ls_stylename
String ls_username

ll_row = dw_ch.GetRow()

IF ll_row <= 0 THEN
	MessageBox('系统提示','请选择要删除的方案')
	RETURN
END IF



ll_empid = dw_ch.Object.empid[ll_row]
ls_dwname = dw_ch.Object.dwname[ll_row]
ls_stylename = dw_ch.Object.stylename[ll_row]

IF NOT sys_power_issuper And (ll_empid <> sys_empid) THEN
	SELECT username INTO :ls_username
		FROM u_user
		Where empid = :ll_empid ;
	IF sqlca.SQLCode = 0 THEN
		MessageBox('系统提示','该查询方案是 '+ls_username+' 建立的,只有其本人或超级用户才能修改或删除')
		RETURN
	ELSE
		MessageBox('系统提示','该查询方案不是当前用户建立的,只有建立者本人或超级用户才能修改或删除')
		RETURN
	END IF
END IF

IF MessageBox('确认','是否确认要删除当前选中的查询方案?',question!,yesno!) = 2 THEN RETURN

DELETE FROM u_user_report_style
	WHERE empid = :ll_empid
	AND dwname = :ls_dwname
	AND stylename = :ls_stylename;
IF sqlca.SQLCode <> 0 THEN
	ROLLBACK;
	MessageBox('Error','删除操作失败,'+sqlca.SQLErrText)
	RETURN
END IF

COMMIT;
MessageBox('Error','删除操作成功!')
cb_retrieve.TriggerEvent(Clicked!)





end event

type ln_3 from line within w_user_report_style_list
long linecolor = 268435456
integer linethickness = 4
integer beginx = 498
integer beginy = -4
integer endx = 498
integer endy = 168
end type

type ln_4 from line within w_user_report_style_list
long linecolor = 16777215
integer linethickness = 4
integer beginx = 503
integer beginy = -4
integer endx = 503
integer endy = 168
end type

