$PBExportHeader$w_aifmb_eb_price.srw forward global type w_aifmb_eb_price from window end type type cbx_1 from checkbox within w_aifmb_eb_price end type type cb_quote from uo_imflatbutton within w_aifmb_eb_price end type type cb_caudit from uo_imflatbutton within w_aifmb_eb_price end type type dw_3 from u_dw_rbtnfilter within w_aifmb_eb_price end type type dw_2 from u_dw_rbtnfilter within w_aifmb_eb_price end type type tv_1 from uo_tv_mtrltype within w_aifmb_eb_price end type type dw_1 from datawindow within w_aifmb_eb_price end type type cb_audit from uo_imflatbutton within w_aifmb_eb_price end type type cb_del from uo_imflatbutton within w_aifmb_eb_price end type type cb_edit from uo_imflatbutton within w_aifmb_eb_price end type type cb_exit from uo_imflatbutton within w_aifmb_eb_price end type type cb_reflash from uo_imflatbutton within w_aifmb_eb_price end type type ln_bar from line within w_aifmb_eb_price end type type ln_bar2 from line within w_aifmb_eb_price end type type r_bar from rectangle within w_aifmb_eb_price end type end forward global type w_aifmb_eb_price from window integer width = 3474 integer height = 1972 boolean titlebar = true string title = "亚洲国际电商报价" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean resizable = true windowtype windowtype = popup! windowstate windowstate = maximized! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true event ue_retrieve ( ) cbx_1 cbx_1 cb_quote cb_quote cb_caudit cb_caudit dw_3 dw_3 dw_2 dw_2 tv_1 tv_1 dw_1 dw_1 cb_audit cb_audit cb_del cb_del cb_edit cb_edit cb_exit cb_exit cb_reflash cb_reflash ln_bar ln_bar ln_bar2 ln_bar2 r_bar r_bar end type global w_aifmb_eb_price w_aifmb_eb_price type variables boolean dw_edit_mode = false long uc_int = 2 long uc_min = 2 end variables forward prototypes public subroutine wf_face () public function integer wf_save (ref string arg_msg) public function integer wf_del (ref string arg_msg) public function integer wf_audit (ref string arg_msg) public function integer wf_caudit (ref string arg_msg) public function integer wf_quote (ref string arg_msg) end prototypes event ue_retrieve();Long ll_row ll_row = dw_1.GetRow() IF ll_row <= 0 THEN dw_2.Reset() RETURN END IF Date ld_cur ld_cur = dw_1.Object.eb_date[ll_row] String ls_handtype ls_handtype = tv_1.uo_cur_info.handtype ls_handtype = ls_handtype + '%' dw_2.Retrieve(ld_cur, ls_handtype) end event public subroutine wf_face ();cb_reflash.Enabled = Not dw_edit_mode cb_audit.Enabled = Not dw_edit_mode cb_caudit.Enabled = Not dw_edit_mode cb_quote.Enabled = Not dw_edit_mode Long i FOR i = 1 To uc_min - 1 dw_2.SetTabOrder(i, i * 10) NEXT IF dw_edit_mode THEN FOR i = uc_min To uc_int dw_2.SetTabOrder(i, i * 10) NEXT cb_edit.Text = '保存' cb_edit.normalpicname = 'Save.bmp' cb_del.Text = '放弃' cb_del.normalpicname = 'Undo.bmp' ELSE FOR i = uc_min To uc_int dw_2.SetTabOrder(i, 0) NEXT cb_edit.Text = '修改' cb_edit.normalpicname = 'OPEN.bmp' cb_del.Text = '删除' cb_del.normalpicname = 'delete.bmp' END IF cb_edit.of_init_draw() cb_edit.of_paint() cb_edit.TriggerEvent('ue_textchange') cb_del.of_init_draw() cb_del.of_paint() cb_del.TriggerEvent('ue_textchange') end subroutine public function integer wf_save (ref string arg_msg);Int rslt = 1 Long i Long im_type String im_id, pros datetime opdate Decimal price Long auditflag FOR i = 1 To dw_2.RowCount() IF dw_2.Object.ch[i] <> 1 THEN CONTINUE im_type = dw_2.Object.im_type[i] im_id = dw_2.Object.im_id[i] pros = dw_2.Object.pros[i] price = dw_2.Object.price[i] auditflag = dw_2.Object.price[i] opdate = dw_2.Object.opdate[i] IF auditflag = 1 THEN rslt = 0 arg_msg = '第'+String(i)+'行,已经审核不能修改' GOTO ext END IF SELECT auditflag INTO :auditflag FROM eb_price WHERE im_type = :im_type AND im_id = :im_id And pros = :pros And opdate = :opdate; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,查询审核状态失败,' + sqlca.SQLErrText GOTO ext END IF IF auditflag = 1 THEN rslt = 0 arg_msg = '第'+String(i)+'行,已经审核不能修改' GOTO ext END IF UPDATE eb_price SET price = :price WHERE im_type = :im_type AND im_id = :im_id And pros = :pros AND opdate = :opdate; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,更新报价失败,' + sqlca.SQLErrText GOTO ext END IF NEXT GOTO ext ext: IF rslt = 1 THEN COMMIT; ELSE ROLLBACK; END IF RETURN rslt end function public function integer wf_del (ref string arg_msg);Int rslt = 1 Long i Long im_type String im_id, pros datetime opdate Long auditflag FOR i = 1 To dw_2.RowCount() IF dw_2.Object.ch[i] <> 1 THEN CONTINUE im_type = dw_2.Object.im_type[i] im_id = dw_2.Object.im_id[i] pros = dw_2.Object.pros[i] auditflag = dw_2.Object.price[i] opdate = dw_2.Object.opdate[i] IF auditflag = 1 THEN rslt = 0 arg_msg = '第'+String(i)+'行,已经审核不能删除' GOTO ext END IF SELECT auditflag INTO :auditflag FROM eb_price WHERE im_type = :im_type AND im_id = :im_id And pros = :pros and opdate = :opdate; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,查询审核状态失败,' + sqlca.SQLErrText GOTO ext END IF IF auditflag = 1 THEN rslt = 0 arg_msg = '第'+String(i)+'行,已经审核不能删除' GOTO ext END IF DELETE FROM eb_price WHERE im_type = :im_type AND im_id = :im_id And pros = :pros and opdate = :opdate; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,删除报价失败,' + sqlca.SQLErrText GOTO ext END IF NEXT GOTO ext ext: IF rslt = 1 THEN COMMIT; ELSE ROLLBACK; END IF RETURN rslt end function public function integer wf_audit (ref string arg_msg);Int rslt = 1 Long i Long im_type String im_id, pros datetime opdate Long auditflag FOR i = 1 To dw_2.RowCount() IF dw_2.Object.ch[i] <> 1 THEN CONTINUE im_type = dw_2.Object.im_type[i] im_id = dw_2.Object.im_id[i] pros = dw_2.Object.pros[i] auditflag = dw_2.Object.price[i] opdate = dw_2.Object.opdate[i] IF auditflag = 1 THEN rslt = 0 arg_msg = '第'+String(i)+'行,已经审核不能再审核' GOTO ext END IF SELECT auditflag INTO :auditflag FROM eb_price WHERE im_type = :im_type AND im_id = :im_id And pros = :pros and opdate = :opdate; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,查询审核状态失败,' + sqlca.SQLErrText GOTO ext END IF IF auditflag = 1 THEN rslt = 0 arg_msg = '第'+String(i)+'行,已经审核不能再审核' GOTO ext END IF UPDATE eb_price SET auditflag = 1, auditdate = GETDATE(), auditemp = :publ_operator WHERE im_type = :im_type AND im_id = :im_id And pros = :pros and opdate = :opdate; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,审核失败,' + sqlca.SQLErrText GOTO ext END IF NEXT GOTO ext ext: IF rslt = 1 THEN COMMIT; ELSE ROLLBACK; END IF RETURN rslt end function public function integer wf_caudit (ref string arg_msg);Int rslt = 1 Long i Long im_type String im_id, pros datetime opdate Long auditflag Long sendflag FOR i = 1 To dw_2.RowCount() IF dw_2.Object.ch[i] <> 1 THEN CONTINUE im_type = dw_2.Object.im_type[i] im_id = dw_2.Object.im_id[i] pros = dw_2.Object.pros[i] auditflag = dw_2.Object.price[i] sendflag = dw_2.Object.sendflag[i] opdate = dw_2.Object.opdate[i] IF sendflag = 1 THEN rslt = 0 arg_msg = '第'+String(i)+'行,已经发送不能撤审' GOTO ext END IF IF auditflag = 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,未审核不能撤审' GOTO ext END IF SELECT auditflag, sendflag INTO :auditflag, :sendflag FROM eb_price WHERE im_type = :im_type AND im_id = :im_id And pros = :pros and opdate = :opdate; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,查询审核状态失败,' + sqlca.SQLErrText GOTO ext END IF IF sendflag = 1 THEN rslt = 0 arg_msg = '第'+String(i)+'行,已经发送不能撤审' GOTO ext END IF IF auditflag = 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,未审核不能撤审' GOTO ext END IF UPDATE eb_price SET auditflag = 0, auditdate = NULL, auditemp = '' WHERE im_type = :im_type AND im_id = :im_id And pros = :pros and opdate = :opdate; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(i)+'行,撤审失败,' + sqlca.SQLErrText GOTO ext END IF NEXT GOTO ext ext: IF rslt = 1 THEN COMMIT; ELSE ROLLBACK; END IF RETURN rslt end function public function integer wf_quote (ref string arg_msg);Int rslt = 1 Long ll_row ll_row = dw_1.GetRow() IF ll_row <= 0 THEN rslt = 0 arg_msg = '请选择是手动报价的日期' GOTO ext END IF DateTime ld_cur ld_cur = DateTime(dw_1.Object.eb_date[ll_row], Time(0)) INSERT INTO eb_price(im_type, im_id, pros, opdate) SELECT eb_import_mtrlname.im_type, eb_import_mtrlname.im_id, '' AS pros, :ld_cur AS opdate FROM eb_import_mtrlname INNER JOIN u_mtrldef ON eb_import_mtrlname.mtrlid = u_mtrldef.mtrlid LEFT OUTER JOIN eb_price AS eb_price_1 ON eb_import_mtrlname.im_type = eb_price_1.im_type AND eb_import_mtrlname.im_id = eb_price_1.im_id AND CONVERT(varchar(10),eb_price_1.opdate,120) = CONVERT(varchar(10),:ld_cur,120) AND eb_price_1.pros = '' WHERE (eb_import_mtrlname.pricemode = 0) AND (eb_import_mtrlname.acceptflag = 1) And (eb_price_1.im_type Is Null); IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入手动报价失败,' + sqlca.SQLErrText GOTO ext END IF ext: IF rslt = 1 THEN COMMIT; ELSE ROLLBACK; END IF RETURN rslt end function on w_aifmb_eb_price.create this.cbx_1=create cbx_1 this.cb_quote=create cb_quote this.cb_caudit=create cb_caudit this.dw_3=create dw_3 this.dw_2=create dw_2 this.tv_1=create tv_1 this.dw_1=create dw_1 this.cb_audit=create cb_audit this.cb_del=create cb_del this.cb_edit=create cb_edit this.cb_exit=create cb_exit this.cb_reflash=create cb_reflash this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.r_bar=create r_bar this.Control[]={this.cbx_1,& this.cb_quote,& this.cb_caudit,& this.dw_3,& this.dw_2,& this.tv_1,& this.dw_1,& this.cb_audit,& this.cb_del,& this.cb_edit,& this.cb_exit,& this.cb_reflash,& this.ln_bar,& this.ln_bar2,& this.r_bar} end on on w_aifmb_eb_price.destroy destroy(this.cbx_1) destroy(this.cb_quote) destroy(this.cb_caudit) destroy(this.dw_3) destroy(this.dw_2) destroy(this.tv_1) destroy(this.dw_1) destroy(this.cb_audit) destroy(this.cb_del) destroy(this.cb_edit) destroy(this.cb_exit) destroy(this.cb_reflash) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.r_bar) end on event resize;ln_bar.EndX = THIS.Width ln_bar2.EndX = THIS.Width r_bar.Width = THIS.Width tv_1.Height = this.workspaceheight() - tv_1.Y dw_2.width = this.workspacewidth() - dw_2.X dw_2.height = this.workspaceheight() - dw_2.Y - dw_3.Height dw_3.width = dw_2.width dw_3.Y = dw_2.Y + dw_2.height end event event open;wf_face() dw_2.SetTransObject(sqlca) Date ld_today, ld_cur ld_today = Today() Long i, j FOR i = 1 To 20 ld_cur = RelativeDate(ld_today, - i + 1) j = dw_1.InsertRow(0) dw_1.Object.eb_date[j] = ld_cur NEXT triggerevent('ue_retrieve') end event type cbx_1 from checkbox within w_aifmb_eb_price integer x = 1216 integer y = 108 integer width = 274 integer height = 56 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 event clicked;Long i Long ll_check IF This.Checked THEN ll_check = 1 ELSE ll_check = 0 END IF FOR i = 1 To dw_2.RowCount() dw_2.Object.ch[i] = ll_check NEXT end event event constructor;this.backcolor = 14215660 end event type cb_quote from uo_imflatbutton within w_aifmb_eb_price integer x = 754 integer width = 274 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "手动报价" string normalpicname = "imexport.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;string ls_msg IF wf_quote(ls_msg) <> 1 THEN MessageBox('错误', ls_msg) RETURN END IF cb_reflash.TriggerEvent(Clicked!) end event type cb_caudit from uo_imflatbutton within w_aifmb_eb_price integer x = 603 integer width = 151 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "撤审" string normalpicname = "caudit.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;string ls_msg IF MessageBox('提问', '是否要撤审选中的记录?', Question!, YesNo!) <> 1 THEN RETURN END IF IF wf_caudit(ls_msg) <> 1 THEN MessageBox('错误', ls_msg) RETURN END IF cb_reflash.TriggerEvent(Clicked!) end event type dw_3 from u_dw_rbtnfilter within w_aifmb_eb_price integer x = 1024 integer y = 1248 integer width = 2057 integer height = 584 integer taborder = 50 end type type dw_2 from u_dw_rbtnfilter within w_aifmb_eb_price integer x = 1024 integer y = 188 integer width = 2267 integer height = 1048 integer taborder = 50 string dataobject = "dw_aifmb_eb_price" end type event clicked;call super::clicked;if row > 0 then this.SetRow(row) this.ScrollToRow(row) end if end event event rowfocuschanged;call super::rowfocuschanged;This.SelectRow(0, False) IF currentrow > 0 THEN This.SelectRow(currentrow, True) END IF end event type tv_1 from uo_tv_mtrltype within w_aifmb_eb_price integer y = 1084 integer width = 1024 integer height = 700 integer taborder = 40 boolean bringtotop = true integer textsize = -9 fontcharset fontcharset = gb2312charset! fontfamily fontfamily = anyfont! string facename = "宋体" string picturename[] = {"Application!","Structure5!"} end type event selectionchanged;call super::selectionchanged;parent.triggerevent('ue_retrieve') end event event selectionchanging;call super::selectionchanging;if dw_edit_mode then return 1 end event type dw_1 from datawindow within w_aifmb_eb_price integer y = 188 integer width = 1024 integer height = 892 integer taborder = 30 string title = "none" string dataobject = "dw_aifmb_eb_price_date" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event rowfocuschanged;This.SelectRow(0, False) IF currentrow > 0 THEN This.SelectRow(currentrow, True) END IF Parent.TriggerEvent('ue_retrieve') end event event clicked;if row > 0 then this.SetRow(row) this.ScrollToRow(row) end if end event event rowfocuschanging;if dw_edit_mode then return 1 end event type cb_audit from uo_imflatbutton within w_aifmb_eb_price integer x = 453 integer width = 151 integer height = 164 integer taborder = 50 boolean bringtotop = true string text = "审核" string normalpicname = "audit.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;string ls_msg IF MessageBox('提问', '是否要审核选中的记录?', Question!, YesNo!) <> 1 THEN RETURN END IF IF wf_audit(ls_msg) <> 1 THEN MessageBox('错误', ls_msg) RETURN END IF cb_reflash.TriggerEvent(Clicked!) end event type cb_del from uo_imflatbutton within w_aifmb_eb_price integer x = 302 integer width = 151 integer height = 164 integer taborder = 40 boolean bringtotop = true string text = "删除" string normalpicname = "delete.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;String ls_msg IF dw_edit_mode THEN dw_edit_mode = Not dw_edit_mode cb_reflash.TriggerEvent(Clicked!) wf_face() ELSE IF MessageBox('提问', '是否要删除选中的记录?', Question!, YesNo!) <> 1 THEN RETURN END IF IF wf_del(ls_msg) <> 1 THEN MessageBox('错误', ls_msg) RETURN END IF cb_reflash.TriggerEvent(Clicked!) END IF end event type cb_edit from uo_imflatbutton within w_aifmb_eb_price integer x = 151 integer width = 151 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;String arg_msg IF dw_edit_mode THEN IF dw_2.AcceptText() <> 1 THEN RETURN IF wf_save(arg_msg) <> 1 THEN MessageBox('错误', arg_msg) RETURN END IF END IF dw_edit_mode = Not dw_edit_mode IF Not dw_edit_mode THEN cb_reflash.TriggerEvent(Clicked!) ELSE Long i FOR i = 1 To dw_2.RowCount() IF dw_2.Object.auditflag[i] = 1 THEN dw_2.Object.ch[i] = 0 ELSE dw_2.Object.ch[i] = 1 END IF NEXT END IF wf_face() end event type cb_exit from uo_imflatbutton within w_aifmb_eb_price integer x = 1029 integer width = 151 integer height = 164 integer taborder = 20 string text = "退出" boolean cancel = true string normalpicname = "exit.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;Close(PARENT) end event type cb_reflash from uo_imflatbutton within w_aifmb_eb_price integer width = 151 integer height = 164 integer taborder = 10 string text = "刷新" string normalpicname = "refresh.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;parent.triggerevent('ue_retrieve') end event type ln_bar from line within w_aifmb_eb_price long linecolor = 268435456 integer linethickness = 4 integer beginy = 172 integer endx = 2007 integer endy = 172 end type type ln_bar2 from line within w_aifmb_eb_price long linecolor = 16777215 integer linethickness = 4 integer beginy = 176 integer endx = 2039 integer endy = 176 end type type r_bar from rectangle within w_aifmb_eb_price long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 2139 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