$PBExportHeader$w_buytask_urgemx.srw
forward
global type w_buytask_urgemx from w_publ_easyq
end type
type ddlb_1 from dropdownlistbox within w_buytask_urgemx
end type
type cb_aff from uo_imflatbutton within w_buytask_urgemx
end type
end forward

global type w_buytask_urgemx from w_publ_easyq
string title = "催货记录"
ddlb_1 ddlb_1
cb_aff cb_aff
end type
global w_buytask_urgemx w_buytask_urgemx

on w_buytask_urgemx.create
int iCurrent
call super::create
this.ddlb_1=create ddlb_1
this.cb_aff=create cb_aff
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.ddlb_1
this.Control[iCurrent+2]=this.cb_aff
end on

on w_buytask_urgemx.destroy
call super::destroy
destroy(this.ddlb_1)
destroy(this.cb_aff)
end on

type cb_func from w_publ_easyq`cb_func within w_buytask_urgemx
integer x = 370
end type

type cb_exit from w_publ_easyq`cb_exit within w_buytask_urgemx
integer x = 1335
end type

type cb_2 from w_publ_easyq`cb_2 within w_buytask_urgemx
integer x = 1033
end type

type cb_psetup from w_publ_easyq`cb_psetup within w_buytask_urgemx
integer x = 777
end type

type cb_1 from w_publ_easyq`cb_1 within w_buytask_urgemx
end type

event cb_1::clicked;call super::clicked;long li_flag
DateTime first_date,end_date
String arg_msg
Int rslt = 1

first_date = DateTime(Date(em_1.Text),Time(0))
end_date = DateTime(Date(em_2.Text),Time(0))


IF ddlb_1.TEXT = '全部'  THEN
	li_flag = -1
ELSEIF ddlb_1.TEXT = '未确认' THEN
	li_flag = 1
ELSEIF ddlb_1.TEXT = '已确认' THEN
	li_flag = 2
END IF
	
	
oleobject obj,request

request = FXAppCom.CreatePbDictionary()
request.SetString('token', app_token_fx)
request.SetDateTime('begindate', first_date)
request.SetDateTime('enddate', end_date)
request.SetInt('flag', String(li_flag))

obj = FXAppCom.DoExecute('GetBuytaskUrgemxList', request)
arg_msg = obj.GetString('ErrMsg')

if (arg_msg <> '') then
	rslt = 0
	goto ext
end if

dw_1.Reset( )


dw_1.SetRedraw(false)
long i, row
any requiredate,urgedate,affirmdate
oleobject list, item
list = obj.GetArrOfPBDictionary('mxList')

for i = 1 to list.Count
	item = list.GetItem(i - 1)
	row = dw_1.InsertRow(0)
	
	dw_1.object.id[row] = item.GetInt('id')
	dw_1.object.taskid[row] = item.GetInt('taskid')
	dw_1.object.printid[row] = item.GetInt('printid')
	dw_1.object.taskcode[row] = item.GetString('taskcode')
	dw_1.object.mtrlcode[row] = item.GetString('mtrlcode')
	dw_1.object.mtrlname[row] = item.GetString('mtrlname')
	dw_1.object.mtrlmode[row] = item.GetString('mtrlmode')
	dw_1.object.unit[row] = item.GetString('unit')
	dw_1.object.STATUS[row] = item.GetString('STATUS')
	dw_1.object.woodcode[row] = item.GetString('woodcode')
	dw_1.object.pcode[row] = item.GetString('pcode')
	dw_1.object.qty[row] = item.GetDouble('qty')
	dw_1.object.dscrp[row] = item.GetString('dscrp')
	dw_1.object.urgeemp[row] = item.GetString('urgeemp')
	dw_1.object.flag[row] = item.GetInt('flag')
	dw_1.object.affirmemp[row] = item.GetString('affirmemp')
	dw_1.object.feedback[row] = item.GetString('feedback')
	
	requiredate = item.GetDateTime('requiredate')
	urgedate = item.GetDateTime('urgedate')
	affirmdate = item.GetDateTime('affirmdate')
	
	IF NOT ISNULL(requiredate) THEN dw_1.object.requiredate[row] = requiredate
	IF NOT ISNULL(urgedate) THEN dw_1.object.urgedate[row] = urgedate
	IF NOT ISNULL(affirmdate) THEN dw_1.object.affirmdate[row] = affirmdate
	
	
next


dw_1.SetRedraw(true)


ext:
if (rslt = 1) then
	if (dw_1.RowCount() > 0) then
		dw_1.SelectRow(0, false)
		dw_1.SelectRow(1, true)
		dw_1.SetRow(1)
	end if
end if

return rslt




end event

type st_3 from w_publ_easyq`st_3 within w_buytask_urgemx
integer x = 581
integer y = 212
end type

type st_4 from w_publ_easyq`st_4 within w_buytask_urgemx
integer x = 1289
integer y = 212
end type

type em_1 from w_publ_easyq`em_1 within w_buytask_urgemx
integer x = 782
integer y = 196
end type

type em_2 from w_publ_easyq`em_2 within w_buytask_urgemx
integer x = 1394
integer y = 196
end type

type ddlb_yl from w_publ_easyq`ddlb_yl within w_buytask_urgemx
integer x = 1755
end type

type cbx_yl from w_publ_easyq`cbx_yl within w_buytask_urgemx
integer x = 1536
end type

type dw_1 from w_publ_easyq`dw_1 within w_buytask_urgemx
integer y = 308
string dataobject = "dw_buytask_urgemx"
end type

type sle_mtrl from w_publ_easyq`sle_mtrl within w_buytask_urgemx
end type

type sle_cust from w_publ_easyq`sle_cust within w_buytask_urgemx
end type

type st_mtrl from w_publ_easyq`st_mtrl within w_buytask_urgemx
end type

type st_cust from w_publ_easyq`st_cust within w_buytask_urgemx
end type

type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_buytask_urgemx
end type

type pb_em1 from w_publ_easyq`pb_em1 within w_buytask_urgemx
integer x = 1198
integer y = 196
end type

type pb_em2 from w_publ_easyq`pb_em2 within w_buytask_urgemx
integer x = 1810
integer y = 196
end type

type pb_2 from w_publ_easyq`pb_2 within w_buytask_urgemx
integer x = 1920
integer y = 196
end type

type cb_help from w_publ_easyq`cb_help within w_buytask_urgemx
integer x = 1184
end type

type cb_copyself from w_publ_easyq`cb_copyself within w_buytask_urgemx
integer x = 521
end type

type gb_1 from w_publ_easyq`gb_1 within w_buytask_urgemx
end type

type ln_bar from w_publ_easyq`ln_bar within w_buytask_urgemx
end type

type ln_bar2 from w_publ_easyq`ln_bar2 within w_buytask_urgemx
end type

type r_bar from w_publ_easyq`r_bar within w_buytask_urgemx
end type

type ln_1 from w_publ_easyq`ln_1 within w_buytask_urgemx
end type

type ln_2 from w_publ_easyq`ln_2 within w_buytask_urgemx
end type

type ln_3 from w_publ_easyq`ln_3 within w_buytask_urgemx
end type

type ln_4 from w_publ_easyq`ln_4 within w_buytask_urgemx
end type

type ddlb_1 from dropdownlistbox within w_buytask_urgemx
integer x = 9
integer y = 204
integer width = 549
integer height = 476
integer taborder = 130
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string text = "全部"
string item[] = {"全部","未确认","已确认"}
borderstyle borderstyle = stylelowered!
end type

type cb_aff from uo_imflatbutton within w_buytask_urgemx
integer x = 151
integer width = 233
integer height = 164
integer taborder = 50
boolean bringtotop = true
string text = "批确认"
string normalpicname = "fj.bmp"
integer picsize = 16
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;Long i,cnt

cnt = dw_1.find("ch = 1",1,dw_1.rowcount())

IF cnt <= 0 THEN
	Messagebox("提示","请勾选要确认的行")
	Return
END IF

Long arr[]
s_edit_index_tran s_open
for i  = 1 to dw_1.rowcount()
	IF dw_1.Object.ch[i] = 0 then continue
	arr[upperbound(arr)+1] = dw_1.Object.id[i] 
next

s_open.arr_long = arr

OpenWithParm(w_buytask_urgemx_aff,s_open)
end event

