$PBExportHeader$w_outware_sale_p_scanqty.srw forward global type w_outware_sale_p_scanqty from w_publ_base end type type cb_ok from uo_imflatbutton within w_outware_sale_p_scanqty end type type st_1 from statictext within w_outware_sale_p_scanqty end type type cb_1 from uo_imflatbutton within w_outware_sale_p_scanqty end type type cb_2 from uo_imflatbutton within w_outware_sale_p_scanqty end type type cb_3 from uo_imflatbutton within w_outware_sale_p_scanqty end type type sle_1 from multilineedit within w_outware_sale_p_scanqty end type type dw_1 from u_dw_rbtnfilter within w_outware_sale_p_scanqty end type type cb_4 from uo_imflatbutton within w_outware_sale_p_scanqty end type type dw_2 from u_dw_rbtnfilter within w_outware_sale_p_scanqty end type type cb_5 from uo_imflatbutton within w_outware_sale_p_scanqty end type type cb_6 from uo_imflatbutton within w_outware_sale_p_scanqty end type end forward global type w_outware_sale_p_scanqty from w_publ_base integer width = 5486 integer height = 2064 string title = "扫描窗口" windowstate windowstate = maximized! cb_ok cb_ok st_1 st_1 cb_1 cb_1 cb_2 cb_2 cb_3 cb_3 sle_1 sle_1 dw_1 dw_1 cb_4 cb_4 dw_2 dw_2 cb_5 cb_5 cb_6 cb_6 end type global w_outware_sale_p_scanqty w_outware_sale_p_scanqty type variables s_edit_index_tran s_tran long ins_scid,ins_inwareid string ins_inwarecode long cur_thflag long err_num=0 w_outware_sale parent_win long cur_storageid end variables forward prototypes public function string of_globalreplace (string as_source, string as_old, string as_new) end prototypes public function string of_globalreplace (string as_source, string as_old, string as_new);long ll_oldlen, ll_newlen, ll_pos as_source=trim(as_source) as_old=trim(as_old) ll_pos = Pos(as_source,as_old) IF ll_pos > 0 Then ll_oldlen = Len(as_old) ll_newlen = Len(as_new) DO WHILE ll_pos > 0 as_source = Replace(as_source,ll_pos,ll_oldlen,as_new) ll_pos = Pos(as_source,as_old,ll_pos + ll_newlen) LOOP END IF RETURN as_source end function on w_outware_sale_p_scanqty.create int iCurrent call super::create this.cb_ok=create cb_ok this.st_1=create st_1 this.cb_1=create cb_1 this.cb_2=create cb_2 this.cb_3=create cb_3 this.sle_1=create sle_1 this.dw_1=create dw_1 this.cb_4=create cb_4 this.dw_2=create dw_2 this.cb_5=create cb_5 this.cb_6=create cb_6 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_ok this.Control[iCurrent+2]=this.st_1 this.Control[iCurrent+3]=this.cb_1 this.Control[iCurrent+4]=this.cb_2 this.Control[iCurrent+5]=this.cb_3 this.Control[iCurrent+6]=this.sle_1 this.Control[iCurrent+7]=this.dw_1 this.Control[iCurrent+8]=this.cb_4 this.Control[iCurrent+9]=this.dw_2 this.Control[iCurrent+10]=this.cb_5 this.Control[iCurrent+11]=this.cb_6 end on on w_outware_sale_p_scanqty.destroy call super::destroy destroy(this.cb_ok) destroy(this.st_1) destroy(this.cb_1) destroy(this.cb_2) destroy(this.cb_3) destroy(this.sle_1) destroy(this.dw_1) destroy(this.cb_4) destroy(this.dw_2) destroy(this.cb_5) destroy(this.cb_6) end on event open;call super::open;parent_win=ParentWindow() s_tran=Message.PowerObjectParm cur_storageid=s_tran.c_long dw_2.visible=false sle_1.setfocus() end event event resize;call super::resize;dw_1.height=this.height - dw_1.y - 500 dw_1.width=this.width - 150 cb_ok.y=dw_1.y + dw_1.height + 50 cb_exit.y= dw_1.y + dw_1.height + 50 end event type cb_func from w_publ_base`cb_func within w_outware_sale_p_scanqty boolean visible = false end type type cb_exit from w_publ_base`cb_exit within w_outware_sale_p_scanqty integer x = 2025 integer y = 1860 integer picsize = 16 end type type cb_ok from uo_imflatbutton within w_outware_sale_p_scanqty integer x = 1371 integer y = 1868 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;dw_1.accepttext() //parent_win.dw_child.Reset() //dw_1.ShareData(parent_win.dw_child) dw_1.AcceptText() Long i,j parent_win.dw_child.reset() FOR i = 1 To dw_1.RowCount() IF dw_1.Object.u_warepdb_billmx_mtrlid[i] <> 0 THEN j++ parent_win.dw_child.object.u_outwaremx_mtrlid[j]=dw_1.Object.u_warepdb_billmx_mtrlid[i] parent_win.dw_child.object.u_mtrldef_mtrlcode[j]=dw_1.Object.u_mtrldef_mtrlcode[i] parent_win.dw_child.object.u_mtrldef_mtrlname[j]=dw_1.Object.u_mtrldef_mtrlname[i] parent_win.dw_child.object.u_mtrldef_mtrlmode[j]=dw_1.Object.u_mtrldef_mtrlmode[i] parent_win.dw_child.object.u_outwaremx_uqty[j]=dw_1.Object.u_warepdb_billmx_factqty[i] END IF NEXT close(parent) end event type st_1 from statictext within w_outware_sale_p_scanqty integer x = 64 integer y = 28 integer width = 402 integer height = 184 boolean bringtotop = true integer textsize = -20 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 255 long backcolor = 67108864 string text = "扫描框" long bordercolor = 255 boolean focusrectangle = false end type type cb_1 from uo_imflatbutton within w_outware_sale_p_scanqty integer x = 4151 integer y = 136 integer width = 411 integer height = 96 integer taborder = 40 boolean bringtotop = true string text = "清空数量" integer picsize = 16 end type event clicked;call super::clicked;long i for i=1 to dw_1.rowcount() dw_1.Object.u_warepdb_billmx_factqty[i]=0 next end event type cb_2 from uo_imflatbutton within w_outware_sale_p_scanqty integer x = 4151 integer y = 16 integer width = 411 integer height = 96 integer taborder = 50 boolean bringtotop = true string text = "清空扫描框" integer picsize = 16 end type event clicked;call super::clicked;long i sle_1.text='' end event type cb_3 from uo_imflatbutton within w_outware_sale_p_scanqty integer x = 3611 integer y = 20 integer width = 416 integer height = 200 integer taborder = 60 boolean bringtotop = true string text = "生成销售数据" integer picsize = 16 end type event clicked;call super::clicked;Long i,j,li_argcnt = 1 String ls_cmd,ls_arg[] ls_cmd = Trim(sle_1.Text) dw_1.AcceptText() ls_cmd = of_globalreplace(ls_cmd,';',';') DO WHILE Len(ls_cmd) > 0 i = Pos( ls_cmd, ";") IF i = 0 THEN i = Len(ls_cmd) + 1 ls_arg[li_argcnt] = Left(ls_cmd, i - 1) li_argcnt = li_argcnt + 1 ls_cmd = Replace(ls_cmd, 1, i, "") LOOP Long ll_mtrlid,ll_row,ll_mtrlwareid String ls_mtrlcode,ls_mtrlmode,ls_mtrlname Decimal dec_qty,dec_noqty dw_1.SetRedraw (False) FOR i = 1 To UpperBound(ls_arg) Step 2 dw_1.AcceptText() ls_mtrlcode = ls_arg[i] IF UpperBound(ls_arg) >= i+1 THEN dec_qty = Dec(ls_arg[i + 1]) ELSE dec_qty = 0 END IF ll_row = 0 FOR j = 1 To dw_1.RowCount() IF Pos(ls_mtrlcode, dw_1.Object.u_mtrldef_mtrlcode[j] ) > 0 THEN ll_row = j END IF NEXT IF ll_row = 0 THEN ll_row = dw_1.InsertRow(0) ll_mtrlid = 0 ls_mtrlmode = '' ls_mtrlname = '' SELECT top 1 mtrlid,mtrlmode,mtrlname INTO :ll_mtrlid,:ls_mtrlmode,:ls_mtrlname From u_mtrldef Where :ls_mtrlcode Like '%' + rtrim(ltrim(mtrlcode)) ; IF IsNull(ll_mtrlid) THEN ll_mtrlid = 0 // IF ll_mtrlid = 0 THEN CONTINUE dec_noqty = 0 SELECT top 1 mtrlwareid,sum(noallocqty) INTO :ll_mtrlwareid,:dec_noqty FROM u_mtrlware WHERE mtrlid = :ll_mtrlid AND storageid = :cur_storageid Group By mtrlwareid order by sum(noallocqty) desc; IF IsNull(dec_noqty) THEN dec_noqty = 0 dw_1.Object.u_warepdb_billmx_mtrlwareid[j] = ll_mtrlwareid dw_1.Object.u_warepdb_billmx_mtrlid[j] = ll_mtrlid dw_1.Object.u_mtrldef_mtrlcode[j] = ls_mtrlcode dw_1.Object.u_mtrldef_mtrlname[j] = ls_mtrlname dw_1.Object.u_mtrldef_mtrlmode[j] = ls_mtrlmode dw_1.Object.u_warepdb_billmx_qty[j] = dec_noqty dw_1.Object.u_warepdb_billmx_factqty[j] = dec_qty dw_1.Object.u_warepdb_billmx_printid[j]=j ELSE dw_1.Object.u_warepdb_billmx_printid[ll_row]=ll_row dw_1.Object.u_warepdb_billmx_factqty[ll_row] = dw_1.Object.u_warepdb_billmx_factqty[ll_row] + dec_qty END IF NEXT dw_1.SetRedraw (true) dw_1.AcceptText() IF dw_1.RowCount() > 0 THEN IF dw_1.Object.u_mtrldef_mtrlcode[1] = '' THEN dw_1.DeleteRow(1) END IF end event type sle_1 from multilineedit within w_outware_sale_p_scanqty integer x = 480 integer width = 3118 integer height = 236 integer taborder = 70 boolean bringtotop = true integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 boolean hscrollbar = true boolean vscrollbar = true boolean autohscroll = true boolean autovscroll = true borderstyle borderstyle = stylelowered! end type type dw_1 from u_dw_rbtnfilter within w_outware_sale_p_scanqty integer x = 23 integer y = 240 integer width = 3570 integer height = 1608 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_outware_sale_p_scanqty" boolean rbutton_filter_use = true boolean rbutton_setposition_use = true boolean titleclick_sort_use = true end type type cb_4 from uo_imflatbutton within w_outware_sale_p_scanqty integer x = 4631 integer y = 68 integer width = 411 integer height = 96 integer taborder = 60 boolean bringtotop = true string text = "显示错误列表" integer picsize = 16 end type event clicked;call super::clicked;dw_2.visible=true dw_2.x=10 dw_2.width=dw_1.width - 500 dw_2.Reset() dw_1.AcceptText() Long i,j FOR i = 1 To dw_1.RowCount() IF dw_1.Object.u_warepdb_billmx_mtrlid[i] = 0 THEN j++ dw_1.RowsCopy(i, i, Primary!, dw_2, j, Primary!) END IF NEXT end event type dw_2 from u_dw_rbtnfilter within w_outware_sale_p_scanqty integer x = 3621 integer y = 252 integer width = 3584 integer height = 1312 integer taborder = 50 boolean bringtotop = true boolean titlebar = true string title = "错误列表" string dataobject = "dw_outware_sale_p_scanqty" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean rbutton_filter_use = true boolean rbutton_setposition_use = true boolean titleclick_sort_use = true end type type cb_5 from uo_imflatbutton within w_outware_sale_p_scanqty integer x = 5079 integer y = 16 integer width = 411 integer height = 96 integer taborder = 60 boolean bringtotop = true string text = "导出当前表" integer picsize = 16 end type event clicked;call super::clicked; OpenWithParm(w_sentdataout,DW_1) end event type cb_6 from uo_imflatbutton within w_outware_sale_p_scanqty integer x = 5079 integer y = 136 integer width = 411 integer height = 96 integer taborder = 50 boolean bringtotop = true string text = "导出错误列表" integer picsize = 16 end type event clicked;call super::clicked;dw_2.Reset() dw_1.AcceptText() Long i,j FOR i = 1 To dw_1.RowCount() IF dw_1.Object.u_warepdb_billmx_mtrlid[i] = 0 THEN j++ dw_1.RowsCopy(i, i, Primary!, dw_2, j, Primary!) END IF NEXT OpenWithParm(w_sentdataout,DW_2) end event