$PBExportHeader$w_inwaremx_buy_mod_price_p.srw forward global type w_inwaremx_buy_mod_price_p from w_publ_base end type type cb_ok from uo_imflatbutton within w_inwaremx_buy_mod_price_p end type type dw_1 from datawindow within w_inwaremx_buy_mod_price_p end type end forward global type w_inwaremx_buy_mod_price_p from w_publ_base integer width = 3616 integer height = 1628 string title = "采购收货单明细单价修改" boolean minbox = false windowtype windowtype = response! cb_ok cb_ok dw_1 dw_1 end type global w_inwaremx_buy_mod_price_p w_inwaremx_buy_mod_price_p type variables s_edit_index_tran s_tran long ins_scid,ins_inwareid string ins_inwarecode int ii_enamt_edit = 0//0:不使用录入,不能编辑; 1:使用录入,可以编辑 end variables on w_inwaremx_buy_mod_price_p.create int iCurrent call super::create this.cb_ok=create cb_ok this.dw_1=create dw_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_ok this.Control[iCurrent+2]=this.dw_1 end on on w_inwaremx_buy_mod_price_p.destroy call super::destroy destroy(this.cb_ok) destroy(this.dw_1) end on event open;call super::open;dw_1.settransobject(sqlca) s_tran=Message.PowerObjectParm ins_scid = s_tran.b_long ins_inwareid = s_tran.c_long ins_inwarecode = s_tran.c_string ii_enamt_edit = s_tran.d_long dw_1.retrieve( ins_scid,ins_inwareid) IF ii_enamt_edit = 0 THEN dw_1.Modify('u_inwaremx_uamt.protect = 1~t u_inwaremx_uamt.Color = 0') dw_1.Modify('u_inwaremx_uamt_t.Color = 0') ELSE dw_1.Modify('u_inwaremx_uamt.protect = 0~t u_inwaremx_uamt.Color = "0~trgb(0,0,255)"') dw_1.Modify('u_inwaremx_uamt_t.Color = "0~trgb(0,0,255)"') END IF dw_1.setfocus() end event type cb_func from w_publ_base`cb_func within w_inwaremx_buy_mod_price_p boolean visible = false end type type cb_exit from w_publ_base`cb_exit within w_inwaremx_buy_mod_price_p integer x = 2025 integer y = 1404 integer picsize = 16 end type type cb_ok from uo_imflatbutton within w_inwaremx_buy_mod_price_p integer x = 1458 integer y = 1404 integer width = 311 integer height = 96 integer taborder = 20 boolean bringtotop = true string normalpicname = "ok.bmp" integer picsize = 16 end type event clicked;call super::clicked; Long rslt = 1 Long i long ll_printid Decimal ld_uprice,ld_jgprice, lde_rebate, lde_tax String arg_msg dw_1.AcceptText() uo_inware uo_ware uo_ware = create uo_inware uo_ware.commit_transaction = sqlca i = dw_1.GetNextModified(0 , Primary!) IF i = 0 THEN arg_msg = "单价没有修改" rslt = 0 GOTO ext END IF DO WHILE i > 0 ll_printid = dw_1.Object.u_inwaremx_printid[i] ld_uprice = abs(dw_1.Object.u_inwaremx_uprice[i]) ld_jgprice = 0 lde_rebate = dw_1.Object.u_inwaremx_rebate[i] lde_tax = dw_1.Object.u_inwaremx_tax[i] IF uo_ware.mod_price(ins_scid,ins_inwareid,ll_printid,ld_uprice,ld_jgprice,lde_rebate, lde_tax,arg_msg,false) = 0 THEN arg_msg = "行:"+string(i)+","+arg_msg rslt = 0 GOTO ext END IF i = dw_1.GetNextModified(i, Primary!) LOOP ext: destroy uo_ware IF rslt = 0 THEN ROLLBACK; MessageBox('错误',arg_msg, StopSign!, OK! ) RETURN ELSE COMMIT; MessageBox('提示','修改单价成功!', Information!, OK! ) Close(Parent) END IF end event type dw_1 from datawindow within w_inwaremx_buy_mod_price_p integer width = 3584 integer height = 1348 integer taborder = 30 boolean bringtotop = true string title = "none" string dataobject = "dw_inwaremx_buy_mod_price_p" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event constructor;f_title_change(this) end event event itemchanged;IF row <= 0 THEN RETURN IF row > dw_1.RowCount() THEN RETURN This.AcceptText() //由金额计算单价 IF sys_option_outware_if_buyqty = 0 THEN IF ii_enamt_edit = 1 THEN IF dw_1.Object.u_inwaremx_uamt[row] <> 0 THEN IF dw_1.Object.u_inwaremx_rebate[row] <> 0 And dw_1.Object.u_inwaremx_uqty[row] <> 0 THEN dw_1.Object.u_inwaremx_uprice[row] = abs(dw_1.Object.u_inwaremx_uamt[row] / dw_1.Object.u_inwaremx_rebate[row] / dw_1.Object.u_inwaremx_uqty[row]) END IF END IF ELSE dw_1.Object.u_inwaremx_uamt[row] = Round(dw_1.Object.u_inwaremx_uprice[row]*dw_1.Object.u_inwaremx_rebate[row]*dw_1.Object.u_inwaremx_uqty[row],2) END IF ELSE IF ii_enamt_edit = 1 THEN IF dw_1.Object.u_inwaremx_uamt[row] <> 0 THEN IF dw_1.Object.u_inwaremx_rebate[row] <> 0 And dw_1.Object.u_inwaremx_uqty[row] <> 0 THEN dw_1.Object.u_inwaremx_uprice[row] = abs(dw_1.Object.u_inwaremx_uamt[row] / dw_1.Object.u_inwaremx_rebate[row] / dw_1.Object.u_inwaremx_buyqty[row]) END IF END IF ELSE dw_1.Object.u_inwaremx_uamt[row] = Round(dw_1.Object.u_inwaremx_uprice[row]*dw_1.Object.u_inwaremx_rebate[row]*dw_1.Object.u_inwaremx_buyqty[row],2) END IF END IF end event