$PBExportHeader$w_item_cust_spt_mx_add.srw forward global type w_item_cust_spt_mx_add from w_publ_base end type type cb_1 from uo_imflatbutton within w_item_cust_spt_mx_add end type type cb_2 from uo_imflatbutton within w_item_cust_spt_mx_add end type type sle_mxcode from singlelineedit within w_item_cust_spt_mx_add end type type sle_mxname from singlelineedit within w_item_cust_spt_mx_add end type type st_1 from statictext within w_item_cust_spt_mx_add end type type st_2 from statictext within w_item_cust_spt_mx_add end type end forward global type w_item_cust_spt_mx_add from w_publ_base integer width = 1641 integer height = 812 string title = "增项目" boolean minbox = false windowtype windowtype = response! cb_1 cb_1 cb_2 cb_2 sle_mxcode sle_mxcode sle_mxname sle_mxname st_1 st_1 st_2 st_2 end type global w_item_cust_spt_mx_add w_item_cust_spt_mx_add type variables Long il_itemid end variables forward prototypes public subroutine wf_new () public function integer wf_save () end prototypes public subroutine wf_new ();sle_mxcode.Text = '' sle_mxname.Text = '' sle_mxcode.SetFocus() end subroutine public function integer wf_save ();Int rslt = 1 Long ll_mxid String arg_msg String ls_mxcode,ls_mxname Long cnt ls_mxcode = Trim(sle_mxcode.Text) ls_mxname = Trim(sle_mxname.Text) IF ls_mxcode = '' THEN arg_msg = '请输入编号' sle_mxcode.SetFocus() rslt = 0 END IF IF ls_mxname = '' THEN arg_msg = '请输入名称' sle_mxname.SetFocus() rslt = 0 END IF SELECT count(*) INTO :cnt FROM u_item_cust_spt_def Where itemid = :il_itemid; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询项目资料失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF IF cnt <> 1 THEN arg_msg = '项目资料不存在或重复' rslt = 0 GOTO ext END IF ll_mxid = f_sys_scidentity(0,"u_item_cust_spt_def_mx","mxid",arg_msg,TRUE,sqlca) IF ll_mxid <= 0 THEN rslt = 0 GOTO ext END IF INSERT INTO u_item_cust_spt_def_mx (mxid,itemid,mxcode,mxname) Values(:ll_mxid,:il_itemid,:ls_mxcode,:ls_mxname); IF sqlca.SQLCode <> 0 THEN arg_msg = '建立明细项目资料失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF ext: IF rslt = 0 THEN ROLLBACK; MessageBox('错误',arg_msg,stopsign!,ok!) ELSE COMMIT; END IF RETURN rslt end function on w_item_cust_spt_mx_add.create int iCurrent call super::create this.cb_1=create cb_1 this.cb_2=create cb_2 this.sle_mxcode=create sle_mxcode this.sle_mxname=create sle_mxname this.st_1=create st_1 this.st_2=create st_2 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_1 this.Control[iCurrent+2]=this.cb_2 this.Control[iCurrent+3]=this.sle_mxcode this.Control[iCurrent+4]=this.sle_mxname this.Control[iCurrent+5]=this.st_1 this.Control[iCurrent+6]=this.st_2 end on on w_item_cust_spt_mx_add.destroy call super::destroy destroy(this.cb_1) destroy(this.cb_2) destroy(this.sle_mxcode) destroy(this.sle_mxname) destroy(this.st_1) destroy(this.st_2) end on event open;call super::open;il_itemid = Message.DoubleParm wf_new() end event type cb_func from w_publ_base`cb_func within w_item_cust_spt_mx_add boolean visible = false integer x = 517 integer taborder = 40 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_item_cust_spt_mx_add integer x = 1065 integer y = 476 end type type cb_1 from uo_imflatbutton within w_item_cust_spt_mx_add integer x = 119 integer y = 476 integer width = 389 integer taborder = 50 boolean bringtotop = true string text = "保存&新增" string normalpicname = "new.bmp" end type event clicked;call super::clicked;IF wf_save( ) = 1 THEN wf_new() END IF end event type cb_2 from uo_imflatbutton within w_item_cust_spt_mx_add integer x = 585 integer y = 476 integer width = 402 integer taborder = 60 boolean bringtotop = true string text = "保存&退出" string normalpicname = "save.bmp" end type event clicked;call super::clicked;IF wf_save( ) = 1 THEN Close(PARENT) END IF end event type sle_mxcode from singlelineedit within w_item_cust_spt_mx_add integer x = 549 integer y = 160 integer width = 366 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 borderstyle borderstyle = stylelowered! end type type sle_mxname from singlelineedit within w_item_cust_spt_mx_add integer x = 549 integer y = 296 integer width = 558 integer height = 84 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type st_1 from statictext within w_item_cust_spt_mx_add integer x = 343 integer y = 176 integer width = 146 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "编号" alignment alignment = center! boolean focusrectangle = false end type type st_2 from statictext within w_item_cust_spt_mx_add integer x = 343 integer y = 312 integer width = 146 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "名称" alignment alignment = center! boolean focusrectangle = false end type