$PBExportHeader$w_mtrldef_edit_cost_rule.srw forward global type w_mtrldef_edit_cost_rule from w_publ_base end type type dw_1 from datawindow within w_mtrldef_edit_cost_rule end type type cb_2 from uo_imflatbutton within w_mtrldef_edit_cost_rule end type type cb_1 from uo_imflatbutton within w_mtrldef_edit_cost_rule end type type st_1 from statictext within w_mtrldef_edit_cost_rule end type end forward global type w_mtrldef_edit_cost_rule from w_publ_base integer width = 1778 integer height = 1468 string title = "统计设定" boolean minbox = false windowtype windowtype = response! dw_1 dw_1 cb_2 cb_2 cb_1 cb_1 st_1 st_1 end type global w_mtrldef_edit_cost_rule w_mtrldef_edit_cost_rule type variables s_edit_index_tran s_tran //传递参数使用 uo_mtrldef uo_mtrl end variables forward prototypes public function integer wf_save () public function integer wf_insertrow () end prototypes public function integer wf_save ();Int rslt = 1 Long li_row dw_1.AcceptText() li_row = dw_1.GetRow() IF li_row <= 0 THEN MessageBox('提示','记录错误',information!,ok!) rslt = 0 GOTO ext END IF String arg_msg s_mtrldef_cost s_cost s_cost.cmpid = dw_1.Object.cmpid[li_row] s_cost.dscrp = dw_1.Object.dscrp[li_row] s_cost.mtrltype = dw_1.Object.mtrltype[li_row] s_cost.emptype = dw_1.Object.emptype[li_row] s_cost.scformula = dw_1.Object.scformula[li_row] s_cost.glformula = dw_1.Object.glformula[li_row] IF uo_mtrl.save_cost(s_cost,arg_msg,TRUE) = 0 THEN MessageBox('错误',arg_msg,information!,ok!) rslt = 0 GOTO ext END IF ext: RETURN rslt end function public function integer wf_insertrow ();Long ll_row ll_row = dw_1.InsertRow(0) dw_1.SetFocus() dw_1.SetColumn('mtrltype') RETURN 1 end function on w_mtrldef_edit_cost_rule.create int iCurrent call super::create this.dw_1=create dw_1 this.cb_2=create cb_2 this.cb_1=create cb_1 this.st_1=create st_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 this.Control[iCurrent+2]=this.cb_2 this.Control[iCurrent+3]=this.cb_1 this.Control[iCurrent+4]=this.st_1 end on on w_mtrldef_edit_cost_rule.destroy call super::destroy destroy(this.dw_1) destroy(this.cb_2) destroy(this.cb_1) destroy(this.st_1) end on event open;call super::open;dw_1.SetTransObject(sqlca) s_tran = Message.PowerObjectParm uo_mtrl = CREATE uo_mtrldef uo_mtrl.commit_transaction = sqlca IF s_tran.b_long = 0 THEN wf_insertrow() ELSE dw_1.Retrieve(s_tran.b_long) END IF IF NOT f_power_ind(1374) THEN dw_1.Enabled = FALSE END IF end event event close;call super::close;destroy uo_mtrl end event type cb_func from w_publ_base`cb_func within w_mtrldef_edit_cost_rule boolean visible = false integer x = 1056 integer y = 580 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_mtrldef_edit_cost_rule integer x = 1330 integer y = 1228 integer taborder = 30 string text = "取消" end type type dw_1 from datawindow within w_mtrldef_edit_cost_rule event key pbm_dwnkey event dwnkey pbm_dwnkey integer x = 55 integer y = 140 integer width = 1641 integer height = 1044 integer taborder = 10 boolean bringtotop = true string dataobject = "dw_mtrldef_cost_edit" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event dwnkey;IF Key = KeyDownArrow! THEN RETURN 1 IF Key = keyenter! OR Key = KeyDownArrow! THEN // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 0 ELSEIF Key = keyuparrow! THEN keybd_event ( 16, 0, 0 , 0 ) keybd_event ( 9, 0, 0 , 0 ) keybd_event ( 9, 0, 2, 0 ) keybd_event ( 16, 0, 2, 0 ) RETURN 0 END IF end event event buttonclicked; IF dwo.Name = 'b_s' THEN s_edit_index_tran s_ch_tran //传递参数使用 s_ch_tran.if_retrieve_all = FALSE //是否一次RETRIEVE所有行 s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_ch_tran.arg_pkid = 0 //目标定位PKID (备用) OpenWithParm(w_station_edit,s_ch_tran) //调用 s_station S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 IF S_INSCUST.stationid > 0 THEN //正常返回值则可以取以下值 dw_1.SetRedraw(FALSE) dw_1.Object.freight[row] = S_INSCUST.stationname dw_1.Object.freight_tele[row] = S_INSCUST.tele dw_1.SetRedraw(TRUE) END IF END IF end event type cb_2 from uo_imflatbutton within w_mtrldef_edit_cost_rule integer x = 709 integer y = 1228 integer width = 517 integer height = 96 integer taborder = 40 string text = "保存[C^+S]" string normalpicname = "save.bmp" end type event clicked;call super::clicked;IF NOT f_power_ind(1374) THEN MessageBox('提示','你没有使用权限!', Information!, OK! ) RETURN END IF if wf_save() = 0 then return close(parent) end event type cb_1 from uo_imflatbutton within w_mtrldef_edit_cost_rule integer x = 110 integer y = 1228 integer width = 517 integer height = 96 integer taborder = 40 string text = "保存&新增[&S]" string normalpicname = "save.bmp" end type event clicked;call super::clicked;IF NOT f_power_ind(1374) THEN MessageBox('提示','你没有使用权限!', Information!, OK! ) RETURN END IF IF wf_save() = 0 THEN RETURN wf_insertrow() end event type st_1 from statictext within w_mtrldef_edit_cost_rule integer x = 55 integer y = 12 integer width = 1641 integer height = 112 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 255 long backcolor = 134217739 string text = "说明:生产/管理费用计算公式含参数: 物料成本、人力成本。例如: (人力成本 + 材料成本) * 0.5" boolean focusrectangle = false end type