$PBExportHeader$w_saletaskmx_tracking.srw
forward
global type w_saletaskmx_tracking from w_publ_easyq
end type
type ddlb_status from dropdownlistbox within w_saletaskmx_tracking
end type
type st_1 from statictext within w_saletaskmx_tracking
end type
type cb_toppage from uo_imflatbutton within w_saletaskmx_tracking
end type
type cb_page_ch from uo_imflatbutton within w_saletaskmx_tracking
end type
type em_pagesize from editmask within w_saletaskmx_tracking
end type
type ddlb_1 from dropdownlistbox within w_saletaskmx_tracking
end type
type st_2 from statictext within w_saletaskmx_tracking
end type
type cbx_1 from checkbox within w_saletaskmx_tracking
end type
type cb_3 from commandbutton within w_saletaskmx_tracking
end type
type cb_4 from commandbutton within w_saletaskmx_tracking
end type
type cb_5 from commandbutton within w_saletaskmx_tracking
end type
type cb_receive from uo_imflatbutton within w_saletaskmx_tracking
end type
type cb_stop from uo_imflatbutton within w_saletaskmx_tracking
end type
type cb_6 from uo_imflatbutton within w_saletaskmx_tracking
end type
type cb_refuse from uo_imflatbutton within w_saletaskmx_tracking
end type
type cb_7 from uo_imflatbutton within w_saletaskmx_tracking
end type
type cb_canel from uo_imflatbutton within w_saletaskmx_tracking
end type
type cb_modify from uo_imflatbutton within w_saletaskmx_tracking
end type
type cbx_2 from checkbox within w_saletaskmx_tracking
end type
type st_5 from statictext within w_saletaskmx_tracking
end type
type st_6 from statictext within w_saletaskmx_tracking
end type
type st_7 from statictext within w_saletaskmx_tracking
end type
type sle_3 from singlelineedit within w_saletaskmx_tracking
end type
type ddplb_1 from dropdownpicturelistbox within w_saletaskmx_tracking
end type
type ddplb_2 from dropdownpicturelistbox within w_saletaskmx_tracking
end type
type dw_fx_outware from u_dw_rbtnfilter within w_saletaskmx_tracking
end type
type sp_v1 from u_lbs_stsplitbar within w_saletaskmx_tracking
end type
end forward

global type w_saletaskmx_tracking from w_publ_easyq
string title = "材料采购订单明细跟踪表"
event ue_page_next ( )
event ue_page_before ( )
event ue_date4 ( )
event ue_short_filter ( )
event ue_init_sp ( )
ddlb_status ddlb_status
st_1 st_1
cb_toppage cb_toppage
cb_page_ch cb_page_ch
em_pagesize em_pagesize
ddlb_1 ddlb_1
st_2 st_2
cbx_1 cbx_1
cb_3 cb_3
cb_4 cb_4
cb_5 cb_5
cb_receive cb_receive
cb_stop cb_stop
cb_6 cb_6
cb_refuse cb_refuse
cb_7 cb_7
cb_canel cb_canel
cb_modify cb_modify
cbx_2 cbx_2
st_5 st_5
st_6 st_6
st_7 st_7
sle_3 sle_3
ddplb_1 ddplb_1
ddplb_2 ddplb_2
dw_fx_outware dw_fx_outware
sp_v1 sp_v1
end type
global w_saletaskmx_tracking w_saletaskmx_tracking

type variables
long ins_cur_pageNum = 1 // 用于记录当前页码
long ins_totalPages = 1 // 用于记录总页数
int ins_sptflag = -1
int ins_status = -1
Decimal ins_spposition = 0.8
end variables

forward prototypes
public function integer wf_retrieve ()
public subroutine wf_change_mode (integer arg_mode)
public subroutine wf_retrieve_mx ()
end prototypes

event ue_page_next();ins_cur_pageNum ++
wf_retrieve()
end event

event ue_page_before();if ins_cur_pageNum > 1 THEN 
	ins_cur_pageNum --
	wf_retrieve()
END IF
end event

event ue_date4();em_1.Text = ProfileString (sys_fx_positon, this.ClassName(), 'em_1', em_1.Text)
em_2.Text = ProfileString (sys_fx_positon, this.ClassName(), 'em_2', em_2.Text)

end event

event ue_short_filter();string ls_filter = ''

IF ddplb_1.Text <> '' AND ddplb_1.Text <> '全部' THEN
	ls_filter = 'comname = "'+ddplb_1.Text+'"'
END IF

IF ddplb_2.Text <> '' AND ddplb_2.Text <> '全部' THEN
	IF ls_filter <> '' THEN
		ls_filter += ' AND '
	END IF
	ls_filter += 'fx_saletaskmx_sptflagstr = "'+ddplb_2.Text+'"'
END IF

IF TRIM(sle_3.Text) <> '' THEN
	IF ls_filter <> '' THEN
		ls_filter += ' AND '
	END IF
	ls_filter += '((mtrlcode LIKE "%'+TRIM(sle_3.Text)+'%") OR (mtrlname LIKE "%'+TRIM(sle_3.Text)+'%") OR (mtrlmode LIKE "%'+TRIM(sle_3.Text)+'%"))'
END IF

dw_1.curdw_filterstr = ls_filter
dw_1.SetFilter(ls_filter)
dw_1.Filter()

end event

event ue_init_sp();sp_v1.of_Reset() 
sp_v1.of_Register(dw_1, sp_v1.ABOVE)
sp_v1.of_Register(dw_fx_outware, sp_v1.BELOW)
sp_v1.uf_possplitbar(dw_fx_outware)
ins_spposition = 1 - (1100/this.workspaceheight())
this.postevent(resize!)
end event

public function integer wf_retrieve ();int rslt = 1

string arg_msg
oleobject request,response
request = FXAppCom.CreatePbDictionary()
request.SetString("token",app_token_fx)
request.SetString("dateBegin",em_1.Text)
request.SetString("dateEnd",em_2.Text)
long ll_onlyCanOut
IF cbx_2.Checked THEN
	ll_onlyCanOut = 1
ELSE
	ll_onlyCanOut = 0
END IF
request.SetInt("onlyCanOut",ll_onlyCanOut)
request.SetInt("status",ins_status)
request.SetInt("sptflag",ins_sptflag)
request.SetInt("pageindex",ins_cur_pageNum)
request.SetInt("pagesize",long(em_pagesize.Text))
response = FXAppCom.DoExecute("GetSaletaskmxTrackingList", request)
arg_msg = response.GetString("ErrMsg")

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

dw_1.Reset()
dw_fx_outware.Reset()
ddplb_1.Reset()
ddplb_2.Reset()

ddplb_1.AddItem('全部')
ddplb_2.AddItem('全部')

ddplb_1.Text = '全部'
ddplb_2.Text = '全部'

string ls_value
long ll_index

dw_1.SetRedraw(false)
long i, row
oleobject list, item
any taskdate, moddate, cusmoddate, cusrequiredate_pmc, requiredate, promisedate
list = response.GetArrOfPBDictionary('saletaskmxList')
for i = 1 to list.Count
	item = list.GetItem(i - 1)
	
	row = dw_1.InsertRow(0)

	dw_1.Object.fx_saletask_tid[row] = item.GetString("tid")
	taskdate = item.GetDateTime('taskdate')
	if (not IsNull(taskdate)) then
		dw_1.Object.fx_saletask_taskdate[row] = taskdate
	end if
	dw_1.Object.fx_saletask_taskstatus[row] = item.GetInt("taskstatus")
	dw_1.Object.taskid[row] = item.GetInt("taskid")
	dw_1.Object.printid[row] = item.GetInt("printid")
	dw_1.Object.fx_saletaskmx_sptflag[row] = item.GetInt("sptflag")
	dw_1.Object.fx_saletaskmx_cusflag[row] = item.GetInt("cusflag")
	dw_1.Object.fx_saletaskmx_modemp[row] = item.GetString("modemp")
	moddate = item.GetDateTime('moddate')
	IF NOT IsNull(moddate) THEN
		dw_1.Object.fx_saletaskmx_moddate[row] = moddate
	END IF
	dw_1.Object.fx_saletaskmx_modinfo[row] = item.GetString("modinfo")
	dw_1.Object.fx_saletaskmx_cusmodemp[row] = item.GetString("cusmodemp")
	cusmoddate = item.GetDateTime('cusmoddate')
	IF NOT IsNull(cusmoddate) THEN
		dw_1.Object.fx_saletaskmx_cusmoddate[row] = cusmoddate
	END IF
	dw_1.Object.fx_saletaskmx_cusmodinfo[row] = item.GetString("cusmodinfo")
	dw_1.Object.mxcode[row] = item.GetString("mxcode")
	dw_1.Object.fxmtrlid[row] = item.GetInt("fxmtrlid")
	dw_1.Object.mtrlid[row] = item.GetInt("mtrlid")
	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.status[row] = item.GetString("status")
	dw_1.Object.woodcode[row] = item.GetString("woodcode")
	dw_1.Object.pcode[row] = item.GetString("pcode")
	cusrequiredate_pmc = item.GetDateTime('cusrequiredate_pmc')
	IF NOT IsNull(cusrequiredate_pmc) THEN
		dw_1.Object.fx_saletaskmx_cusrequiredate_pmc[row] = cusrequiredate_pmc
	END IF
	requiredate = item.GetDateTime('requiredate')
	IF NOT IsNull(requiredate) THEN
		dw_1.Object.requiredate[row] = requiredate
	END IF
	promisedate = item.GetDateTime('promisedate')
	IF NOT IsNull(promisedate) THEN
		dw_1.Object.fx_saletaskmx_promisedate[row] = promisedate
		dw_1.Object.promisedate_ori[row] = promisedate
	END IF	
	dw_1.Object.qty[row] = item.GetDouble("qty")
	dw_1.Object.acceptQty[row] = item.GetDouble("acceptQty")
	dw_1.Object.qty_wait[row] = item.GetDouble("qty_wait")
	IF dw_1.Object.fx_saletask_taskstatus[row] = 2 OR dw_1.Object.fx_saletask_taskstatus[row] = 13 THEN
		// 退回 or 终止
		dw_1.Object.qty_todo[row] = 0 - item.GetDouble("qty_wait") - item.GetDouble("acceptQty")
	ELSE
		dw_1.Object.qty_todo[row] = item.GetDouble("qty") - item.GetDouble("qty_wait") - item.GetDouble("acceptQty") - item.GetDouble('stopQty')		
	END IF
	dw_1.Object.fx_saletaskmx_sptflagstr[row] = item.GetString('sptFlagStr')
	dw_1.Object.fx_saletaskmx_custflagstr[row] = item.GetString('custFlagStr')
	dw_1.Object.fx_saletask_taskcode[row] = item.GetString('taskcode')
	dw_1.Object.fx_saletaskmx_mtrlcuscode[row] = item.GetString('mtrlcuscode')
	dw_1.Object.date_confirm_flag[row] = item.GetInt("date_confirm_flag")
	
	dw_1.Object.fx_saletaskmx_stopQty[row] = item.GetDouble('stopQty')
	dw_1.Object.fx_saletaskmx_stopEmp[row] = item.GetString('stopEmp')
	IF NOT IsNull(item.GetDateTime('stopDate')) THEN
		dw_1.Object.fx_saletaskmx_stopDate[row] =  item.GetDateTime('stopDate')
	END IF
	dw_1.Object.fx_saletaskmx_stopReason[row] = item.GetString('stopReason')
	dw_1.Object.fx_saletaskmx_gydscrp[row] = item.GetString('gydscrp')
	dw_1.Object.comname[row] = item.GetString('comname')
	dw_1.Object.unit[row] = item.GetString('unit')
	dw_1.Object.fx_saletaskmx_mxdscrp[row] = item.GetString('mxdscrp')
	dw_1.Object.fx_saletaskmx_mxdscrp2[row] = item.GetString('mxdscrp2')
	dw_1.Object.order_mtrlname_str[row] = item.GetString('order_mtrlname_str')
	dw_1.Object.fx_saletaskmx_saletask_mxid[row] = item.GetInt('saletask_mxid')
	dw_1.Object.fx_saletaskmx_paichan_dscrp[row] = item.GetString('paichan_dscrp')
	dw_1.Object.fx_saletaskmx_ifpc[row] = item.GetInt('ifPC')
	dw_1.Object.fx_saletaskmx_l1unit[row] = item.GetString('L1unit')
	dw_1.Object.fx_saletaskmx_finishqty[row] = item.GetDouble('finishqty')
	dw_1.Object.fx_saletaskmx_storagename[row] = item.GetString('storagename')
	dw_1.Object.fx_saletaskmx_plancode[row] = item.GetString('plancode')
	dw_1.Object.fx_saletaskmx_relcodestr[row] = item.GetString('relcodestr')
	dw_1.Object.taskcodestr[row] = item.GetString('taskcodestr')
	
	dw_1.Object.fx_saletask_cus_rep[row] = item.GetString('cus_rep')
	dw_1.Object.fx_company_tele[row] = item.GetString('tele')
	dw_1.Object.fx_company_address[row] = item.GetString('address')
	dw_1.Object.fx_company_custype[row] = item.GetString('custype')
	dw_1.Object.fx_company_comname_spt[row] = item.GetString('comname_spt')
	dw_1.Object.fx_company_tele_spt[row] = item.GetString('tele_spt')
	dw_1.Object.fx_company_address_spt[row] = item.GetString('address_spt')
	dw_1.Object.fx_company_custype_spt[row] = item.GetString('custype_spt')
	dw_1.Object.fx_saletask_taskdate[row] = item.GetDateTime('taskdate')
	dw_1.SetItem(row, 'fx_saletask_temp1', item.GetString('temp1'))

	ls_value = dw_1.Object.comname[row]
	IF ddplb_1.FindItem(ls_value, 0) <= 0 THEN
		ddplb_1.AddItem(ls_value)
	END IF

	ls_value = dw_1.Object.fx_saletaskmx_sptflagstr[row]
	IF ddplb_2.FindItem(ls_value, 0) <= 0 THEN
		ddplb_2.AddItem(ls_value)
	END IF

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)
		dw_1.post event RowFocusChanged(1)
	end if
else
	MessageBox('提示', arg_msg)
end if

return rslt
end function

public subroutine wf_change_mode (integer arg_mode);//arg_mode   1---进入编辑模式  0---退出编辑模式
long i = 50
If arg_mode = 1 Then
	dw_1.SetTabOrder('fx_saletaskmx_paichan_dscrp', i)
	dw_1.SetTabOrder('fx_saletaskmx_ifpc', i + 10)
	
	cb_modify.Text = '保存'
	cb_canel.Enabled = True
	if_modify_mode = True
Else
	dw_1.SetTabOrder('fx_saletaskmx_paichan_dscrp', 0)
	dw_1.SetTabOrder('fx_saletaskmx_ifpc', 0)
	cb_modify.Text = '修改'
	cb_canel.Enabled = False
	if_modify_mode = False
End If


end subroutine

public subroutine wf_retrieve_mx ();dw_fx_outware.Reset()

Long ll_row
ll_row = dw_1.GetRow()
IF ll_row <= 0 THEN RETURN

Long ll_taskid, ll_printid
ll_taskid = dw_1.Object.taskid[ll_row]
ll_printid = dw_1.Object.printid[ll_row]
IF ISNull(ll_taskid) THEN RETURN

string arg_msg
oleobject request,response,FxOutwares,item

request = FXAppCom.CreatePbDictionary()
request.SetString('token', app_token_fx)
request.SetInt('saletaskid', ll_taskid)
request.SetInt('saletaskprintid', ll_printid)

response = FXAppCom.DoExecute('GetFxOutwareList', request)
arg_msg = response.GetString('ErrMsg')

if (arg_msg <> '') then
    messagebox('提示', '获取发货单列表失败，原因：' + arg_msg)
    return
end if

dw_fx_outware.SetRedraw(false)

FxOutwares = response.GetArrOfPBDictionary('FxOutwares')
long i,row
for i = 1 to FxOutwares.Count
    item = FxOutwares.GetItem(i - 1)
    
    row = dw_fx_outware.InsertRow(0)

    dw_fx_outware.Object.outwareid[row] = item.GetInt('outwareid')
    dw_fx_outware.Object.outwarecode[row] = item.GetString('outwarecode')
    dw_fx_outware.Object.outwaredate[row] = item.GetDateTime('outwaredate')
    dw_fx_outware.Object.sptcomid[row] = item.GetInt('sptcomid')
    dw_fx_outware.Object.cuscomid[row] = item.GetInt('cuscomid')
    dw_fx_outware.Object.dscrp[row] = item.GetString('dscrp')
    dw_fx_outware.Object.status[row] = item.GetInt('status')
    dw_fx_outware.Object.statusStr[row] = item.GetString('statusStr')
    dw_fx_outware.Object.thflag[row] = item.GetInt('thflag')
    dw_fx_outware.Object.opemp[row] = item.GetString('opemp')
    dw_fx_outware.Object.opdate[row] = item.GetDateTime('opdate')
    dw_fx_outware.Object.modifyemp[row] = item.GetString('modifyemp')
	if not IsNull(item.GetDateTime('modifydate')) then
		dw_fx_outware.Object.modifydate[row] = item.GetDateTime('modifydate')
	end if
    dw_fx_outware.Object.auditemp[row] = item.GetString('auditemp')
	if not IsNull(item.GetDateTime('auditdate')) then
    		dw_fx_outware.Object.auditdate[row] = item.GetDateTime('auditdate')
	end if
     dw_fx_outware.Object.cusname[row] = item.GetString('cusname')
	dw_fx_outware.Object.carnum[row] = item.GetString('carnum')
	dw_fx_outware.Object.driver[row] = item.GetString('driver')
	if not IsNull(item.GetDateTime('estimated_arrival_date')) then
    		dw_fx_outware.Object.estimated_arrival_date[row] = item.GetDateTime('estimated_arrival_date')
	end if
		
	dw_fx_outware.Object.billtype[row] = item.GetInt('billtype')
	dw_fx_outware.Object.relsendoutid[row] = item.GetInt('relsendoutid')
	dw_fx_outware.Object.relsendoutcode[row] = item.GetString('relsendoutcode')
next

dw_fx_outware.SetRedraw(true)

end subroutine

on w_saletaskmx_tracking.create
int iCurrent
call super::create
this.ddlb_status=create ddlb_status
this.st_1=create st_1
this.cb_toppage=create cb_toppage
this.cb_page_ch=create cb_page_ch
this.em_pagesize=create em_pagesize
this.ddlb_1=create ddlb_1
this.st_2=create st_2
this.cbx_1=create cbx_1
this.cb_3=create cb_3
this.cb_4=create cb_4
this.cb_5=create cb_5
this.cb_receive=create cb_receive
this.cb_stop=create cb_stop
this.cb_6=create cb_6
this.cb_refuse=create cb_refuse
this.cb_7=create cb_7
this.cb_canel=create cb_canel
this.cb_modify=create cb_modify
this.cbx_2=create cbx_2
this.st_5=create st_5
this.st_6=create st_6
this.st_7=create st_7
this.sle_3=create sle_3
this.ddplb_1=create ddplb_1
this.ddplb_2=create ddplb_2
this.dw_fx_outware=create dw_fx_outware
this.sp_v1=create sp_v1
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.ddlb_status
this.Control[iCurrent+2]=this.st_1
this.Control[iCurrent+3]=this.cb_toppage
this.Control[iCurrent+4]=this.cb_page_ch
this.Control[iCurrent+5]=this.em_pagesize
this.Control[iCurrent+6]=this.ddlb_1
this.Control[iCurrent+7]=this.st_2
this.Control[iCurrent+8]=this.cbx_1
this.Control[iCurrent+9]=this.cb_3
this.Control[iCurrent+10]=this.cb_4
this.Control[iCurrent+11]=this.cb_5
this.Control[iCurrent+12]=this.cb_receive
this.Control[iCurrent+13]=this.cb_stop
this.Control[iCurrent+14]=this.cb_6
this.Control[iCurrent+15]=this.cb_refuse
this.Control[iCurrent+16]=this.cb_7
this.Control[iCurrent+17]=this.cb_canel
this.Control[iCurrent+18]=this.cb_modify
this.Control[iCurrent+19]=this.cbx_2
this.Control[iCurrent+20]=this.st_5
this.Control[iCurrent+21]=this.st_6
this.Control[iCurrent+22]=this.st_7
this.Control[iCurrent+23]=this.sle_3
this.Control[iCurrent+24]=this.ddplb_1
this.Control[iCurrent+25]=this.ddplb_2
this.Control[iCurrent+26]=this.dw_fx_outware
this.Control[iCurrent+27]=this.sp_v1
end on

on w_saletaskmx_tracking.destroy
call super::destroy
destroy(this.ddlb_status)
destroy(this.st_1)
destroy(this.cb_toppage)
destroy(this.cb_page_ch)
destroy(this.em_pagesize)
destroy(this.ddlb_1)
destroy(this.st_2)
destroy(this.cbx_1)
destroy(this.cb_3)
destroy(this.cb_4)
destroy(this.cb_5)
destroy(this.cb_receive)
destroy(this.cb_stop)
destroy(this.cb_6)
destroy(this.cb_refuse)
destroy(this.cb_7)
destroy(this.cb_canel)
destroy(this.cb_modify)
destroy(this.cbx_2)
destroy(this.st_5)
destroy(this.st_6)
destroy(this.st_7)
destroy(this.sle_3)
destroy(this.ddplb_1)
destroy(this.ddplb_2)
destroy(this.dw_fx_outware)
destroy(this.sp_v1)
end on

event open;call super::open;triggerevent('ue_date4')
em_2.Text = String(Today(),'yyyy-MM-dd')
wf_retrieve()

postevent("ue_init_sp")
end event

event close;call super::close;SetProfileString (sys_fx_positon, this.ClassName(), 'em_1', em_1.Text)
SetProfileString (sys_fx_positon, this.ClassName(), 'em_2', em_2.Text)
end event

event resize;call super::resize;sp_v1.Width = dw_1.Width
sp_v1.X = dw_1.X
dw_fx_outware.Width = dw_1.Width
dw_fx_outware.X = dw_1.X
dw_1.Height = this.workspaceheight() * ins_spposition - dw_1.Y
sp_v1.Y = dw_1.Y + dw_1.Height + 3
sp_v1.Height = 10
dw_fx_outware.Y = sp_v1.Y + sp_v1.Height + 3
dw_fx_outware.Height = this.workspaceheight() - dw_fx_outware.Y - 20
end event

type cb_func from w_publ_easyq`cb_func within w_saletaskmx_tracking
boolean visible = false
integer x = 146
end type

type cb_exit from w_publ_easyq`cb_exit within w_saletaskmx_tracking
integer x = 1344
end type

type cb_2 from w_publ_easyq`cb_2 within w_saletaskmx_tracking
boolean visible = false
end type

type cb_psetup from w_publ_easyq`cb_psetup within w_saletaskmx_tracking
boolean visible = false
end type

type cb_1 from w_publ_easyq`cb_1 within w_saletaskmx_tracking
end type

event cb_1::clicked;call super::clicked;wf_retrieve()
end event

type st_3 from w_publ_easyq`st_3 within w_saletaskmx_tracking
integer x = 722
integer height = 72
end type

type st_4 from w_publ_easyq`st_4 within w_saletaskmx_tracking
integer x = 1431
integer y = 212
end type

type em_1 from w_publ_easyq`em_1 within w_saletaskmx_tracking
integer x = 923
integer y = 196
end type

event em_1::destructor;call super::destructor;f_SetProfileString (sys_empid,dw_1.DataObject, "em_1", em_1.Text)
end event

type em_2 from w_publ_easyq`em_2 within w_saletaskmx_tracking
integer x = 1536
integer y = 196
end type

event em_2::modified;call super::modified;f_SetProfileString (sys_empid,dw_1.DataObject, "em_2", em_2.Text)
end event

type ddlb_yl from w_publ_easyq`ddlb_yl within w_saletaskmx_tracking
boolean visible = false
end type

type cbx_yl from w_publ_easyq`cbx_yl within w_saletaskmx_tracking
boolean visible = false
end type

type dw_1 from w_publ_easyq`dw_1 within w_saletaskmx_tracking
integer y = 416
integer height = 1048
string dataobject = "dw_fx_saletaskmx_tracking"
end type

event dw_1::clicked;call super::clicked;If row > 0 Then
	This.SelectRow(0,False)
	This.SelectRow(row,True)
	This.SetRow(row)
	
	//采购延后待读状态取消 俊20190417
//	string ls_sptflagstr 
//	ls_sptflagstr = dw_1.Object.fx_saletaskmx_sptflagstr[row]
//	
//	IF ls_sptflagstr = '采购延后待读' THEN
//		
//		string arg_msg
//		oleobject request,response, list, item
//		list = FXAppCom.NewPBArray()
//
//		item = FXAppCom.CreatePbDictionary()
//		item.SetString("tid",dw_1.Object.fx_saletask_tid[row])
//		item.SetInt("taskid",dw_1.Object.taskid[row])
//		item.SetInt("printid",dw_1.Object.printid[row])
//		item.SetDateTime("promisedate",dw_1.Object.requiredate[row]);
//		list.AddObject(item)
//		
//		request = FXAppCom.CreatePbDictionary()
//		request.SetString("token",app_token_fx)
//		request.SetInt("changetype",1)
//		request.SetObject("saletaskmxList",list)
//		response = FXAppCom.DoExecute("SaveSaletaskmxDateSpt", request)
//		arg_msg = response.GetString("ErrMsg")
//		
//		IF (arg_msg <> '') THEN
//			MessageBox('提示', '更新协同状态失败，原因：' + arg_msg)
//			RETURN
//		END IF
//		cb_1.post event clicked()
//	END IF
	
End If

end event

event dw_1::rowfocuschanged;call super::rowfocuschanged;if IsNull(currentrow) then
	IF THIS.rowcount() > 0 then
		THIS.SelectRow(0,FALSE)
		THIS.SelectRow(1,TRUE)
		THIS.setrow(1)
		currentrow =1
	end if
end if

if IsNull(currentrow) then return
if (currentrow <= 0) then return

this.SelectRow(0, false)
this.SelectRow(currentrow, true)

wf_retrieve_mx()
end event

type sle_mtrl from w_publ_easyq`sle_mtrl within w_saletaskmx_tracking
end type

type sle_cust from w_publ_easyq`sle_cust within w_saletaskmx_tracking
end type

type st_mtrl from w_publ_easyq`st_mtrl within w_saletaskmx_tracking
end type

type st_cust from w_publ_easyq`st_cust within w_saletaskmx_tracking
end type

type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_saletaskmx_tracking
end type

type pb_em1 from w_publ_easyq`pb_em1 within w_saletaskmx_tracking
integer x = 1339
integer y = 196
end type

type pb_em2 from w_publ_easyq`pb_em2 within w_saletaskmx_tracking
integer x = 1947
integer y = 196
end type

type pb_2 from w_publ_easyq`pb_2 within w_saletaskmx_tracking
integer x = 2057
integer y = 196
end type

event pb_2::clicked;m_Dfc_Control_PopupMenu dmPopupMenu
string menustr


menustr="Text=本日~tEvent=ue_date1"
menustr = menustr + "|" + "Text=本周~tEvent=ue_date2"
menustr = menustr + "|" + "Text=本月~tEvent=ue_date3"
menustr = menustr + "|" + "Text=上次条件~tEvent=ue_date4"
	
if len(trim(menustr))<>0 then
	dmPopupMenu = Create m_Dfc_Control_PopupMenu
	dmPopupMenu.mf_BuildMenu(This, menustr)
	dmPopupMenu.mf_PopMenu()
	Destroy dmPopupMenu
end if
end event

type cb_help from w_publ_easyq`cb_help within w_saletaskmx_tracking
boolean visible = false
end type

type cb_copyself from w_publ_easyq`cb_copyself within w_saletaskmx_tracking
boolean visible = false
end type

type gb_1 from w_publ_easyq`gb_1 within w_saletaskmx_tracking
end type

type ln_bar from w_publ_easyq`ln_bar within w_saletaskmx_tracking
end type

type ln_bar2 from w_publ_easyq`ln_bar2 within w_saletaskmx_tracking
end type

type r_bar from w_publ_easyq`r_bar within w_saletaskmx_tracking
end type

type ln_1 from w_publ_easyq`ln_1 within w_saletaskmx_tracking
end type

type ln_2 from w_publ_easyq`ln_2 within w_saletaskmx_tracking
end type

type ln_3 from w_publ_easyq`ln_3 within w_saletaskmx_tracking
end type

type ln_4 from w_publ_easyq`ln_4 within w_saletaskmx_tracking
end type

type ddlb_status from dropdownlistbox within w_saletaskmx_tracking
integer x = 270
integer y = 196
integer width = 416
integer height = 496
integer taborder = 80
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
boolean sorted = false
boolean vscrollbar = true
string item[] = {"全部","待接收[12]","已终止[13]","已拒绝[14]","待回复[15]","在进行[6]","完成[7]"}
borderstyle borderstyle = stylelowered!
end type

event constructor;selectItem(1);
postEvent('SelectionChanged');
end event

event selectionchanged;CHOOSE CASE Index
	CASE 1
		ins_status = -1
	CASE 2
		ins_status = 12
	CASE 3
		ins_status = 13
	CASE 4
		ins_status = 14
	CASE 5
		ins_status =15
	CASE 6
		ins_status = 6
	CASE 7
		ins_status = 7
END CHOOSE

cb_1.PostEvent(Clicked!)

end event

type st_1 from statictext within w_saletaskmx_tracking
integer x = 23
integer y = 212
integer width = 247
integer height = 48
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "订单状态"
boolean focusrectangle = false
end type

type cb_toppage from uo_imflatbutton within w_saletaskmx_tracking
integer x = 1879
integer width = 151
integer height = 164
integer taborder = 30
boolean bringtotop = true
string text = "首页"
boolean border = false
end type

event clicked;call super::clicked;ins_cur_pageNum = 1
wf_retrieve( )
end event

type cb_page_ch from uo_imflatbutton within w_saletaskmx_tracking
integer x = 2030
integer width = 82
integer height = 164
integer taborder = 40
boolean bringtotop = true
string text = "▼"
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;m_Dfc_Control_PopupMenu dmPopupMenu
string menustr

menustr="Text=下页~tEvent=ue_page_next"
menustr = menustr + "|" + "Text=上页~tEvent=ue_page_before"
	
if len(trim(menustr))<>0 then
	dmPopupMenu = Create m_Dfc_Control_PopupMenu
	dmPopupMenu.mf_BuildMenu(This, menustr)
	dmPopupMenu.mf_PopMenu()
	Destroy dmPopupMenu
end if
end event

type em_pagesize from editmask within w_saletaskmx_tracking
integer x = 1568
integer y = 44
integer width = 306
integer height = 84
integer taborder = 40
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string text = "10000"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "#####0"
boolean spin = true
double increment = 1
string minmax = "1~~"
end type

type ddlb_1 from dropdownlistbox within w_saletaskmx_tracking
boolean visible = false
integer x = 960
integer y = 196
integer width = 416
integer height = 496
integer taborder = 90
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
boolean sorted = false
boolean vscrollbar = true
string item[] = {"全部","无","待回复","待查阅","已回复","已查阅"}
borderstyle borderstyle = stylelowered!
end type

event constructor;selectItem(1);
postEvent('SelectionChanged');
end event

event selectionchanged;CHOOSE CASE Index
	CASE 1
		ins_sptflag = -1
	CASE 2
		ins_sptflag = 0
	CASE 3
		ins_sptflag = 1
	CASE 4
		ins_sptflag = 2
	CASE 5
		ins_sptflag = 3
	CASE 6
		ins_sptflag = 4
	CASE ELSE
		ins_sptflag = -1
END CHOOSE
end event

type st_2 from statictext within w_saletaskmx_tracking
boolean visible = false
integer x = 713
integer y = 212
integer width = 247
integer height = 48
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "待读状态"
boolean focusrectangle = false
end type

type cbx_1 from checkbox within w_saletaskmx_tracking
integer x = 23
integer y = 316
integer width = 201
integer height = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "全选"
boolean lefttext = true
end type

event clicked;IF dw_1.RowCount() <= 0 THEN RETURN
Int ch
IF checked THEN 
	ch = 1
ELSE
	ch = 0
END IF
Long row
FOR row = 1 TO dw_1.RowCount()
	dw_1.Object.ch[row] = ch
NEXT
end event

type cb_3 from commandbutton within w_saletaskmx_tracking
integer x = 320
integer y = 308
integer width = 389
integer height = 84
integer taborder = 130
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "同意修改交期"
end type

event clicked;IF dw_1.RowCount() <= 0 THEN RETURN
int rslt = 1

dw_1.AcceptText()
string arg_msg,ls_sptflagstr
oleobject request,response, list, item
list = FXAppCom.NewPBArray()
Long row
DateTime promisedate
FOR row = 1 TO dw_1.RowCount()
	IF dw_1.Object.ch[row] <> 1 THEN CONTINUE
//	IF dw_1.Object.fx_saletaskmx_sptflag[row] <> 1 AND dw_1.Object.fx_saletaskmx_sptflag[row] <> 2 THEN CONTINUE
	
	ls_sptflagstr = Trim(dw_1.Object.fx_saletaskmx_sptflagstr[row]) 
	
	IF ls_sptflagstr <>  '采购提前待回复' AND ls_sptflagstr <> '采购延后待回复' THEN
		arg_msg = "第"+String(row)+"行协同状态为【" + ls_sptflagstr + "】, 不能操作！"
			rslt = 0
		GOTO ext
	END IF
	
	item = FXAppCom.CreatePbDictionary()
	item.SetString("tid",dw_1.Object.fx_saletask_tid[row])
	item.SetInt("taskid",dw_1.Object.taskid[row])
	item.SetInt("printid",dw_1.Object.printid[row])
	
	promisedate = dw_1.Object.requiredate[row]
//	IF dw_1.Object.fx_saletaskmx_sptflag[row] = 1 THEN
//		// 同意，取对方要求完成时间作为回复时间
//		promisedate = dw_1.Object.requiredate[row]
//		IF IsNull(promisedate) THEN
//			arg_msg = "第"+String(row)+"行对方要求交货时间为空，无法回复"
//			rslt = 0
//			GOTO ext
//		END IF
//	ELSEIF dw_1.Object.fx_saletaskmx_sptflag[row] = 2 THEN
//		// 已阅，不修改回复时间
//		promisedate = dw_1.Object.promisedate_ori[row]
//		IF IsNull(promisedate) THEN
//			arg_msg = "第"+String(row)+"行原回复时间为空，无法确认"
//			rslt = 0
//			GOTO ext
//		END IF
//	END IF
	item.SetDateTime("promisedate",promisedate);
	list.AddObject(item)
NEXT
IF list.Count = 0 THEN
	arg_msg = "未选中记录"
	rslt = 0
	GOTO ext
END IF
IF MessageBox('询问', '是否同意修改交期？', Question!, YesNo!, 1) <> 1 THEN RETURN

request = FXAppCom.CreatePbDictionary()
request.SetString("token",app_token_fx)
request.SetInt("changetype",1)
request.SetObject("saletaskmxList",list)
response = FXAppCom.DoExecute("SaveSaletaskmxDateSpt", request)
arg_msg = response.GetString("ErrMsg")

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

ext:
if (rslt = 1) then
	MessageBox('提示', '修改成功')
	wf_retrieve()
else
	MessageBox('提示', arg_msg)
end if

return rslt
end event

type cb_4 from commandbutton within w_saletaskmx_tracking
boolean visible = false
integer x = 718
integer y = 308
integer width = 389
integer height = 84
integer taborder = 130
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "拒绝修改交期"
end type

event clicked;IF dw_1.RowCount() <= 0 THEN RETURN
int rslt = 1

dw_1.AcceptText()
string arg_msg,ls_sptflagstr
oleobject request,response, list, item
list = FXAppCom.NewPBArray()
Long row
DateTime promisedate
FOR row = 1 TO dw_1.RowCount()
	IF dw_1.Object.ch[row] <> 1 THEN CONTINUE
//	IF dw_1.Object.fx_saletaskmx_sptflag[row] <> 1 AND dw_1.Object.fx_saletaskmx_sptflag[row] <> 2 THEN CONTINUE
	
	ls_sptflagstr = Trim(dw_1.Object.fx_saletaskmx_sptflagstr[row]) 
	
	IF ls_sptflagstr <>  '采购提前待回复' AND ls_sptflagstr <> '采购延后待回复' THEN
		arg_msg = "第"+String(row)+"行协同状态为【" + ls_sptflagstr + "】, 不能操作！"
			rslt = 0
		GOTO ext
	END IF

	item = FXAppCom.CreatePbDictionary()
	item.SetString("tid",dw_1.Object.fx_saletask_tid[row])
	item.SetInt("taskid",dw_1.Object.taskid[row])
	item.SetInt("printid",dw_1.Object.printid[row])
	promisedate = dw_1.Object.promisedate_ori[row]
	// 已阅，不修改回复时间
	IF IsNull(promisedate) THEN
		arg_msg = "第"+String(row)+"行原回复时间为空，无法确认"
		rslt = 0
		GOTO ext
	END IF
	item.SetDateTime("promisedate",promisedate);
	list.AddObject(item)
NEXT
IF list.Count = 0 THEN
	arg_msg = "未选中记录"
	rslt = 0
	GOTO ext
END IF
IF MessageBox('询问', '是否拒绝当前要求交期？', Question!, YesNo!, 1) <> 1 THEN RETURN

request = FXAppCom.CreatePbDictionary()
request.SetString("token",app_token_fx)
request.SetInt("changetype",1)
request.SetObject("saletaskmxList",list)
response = FXAppCom.DoExecute("SaveSaletaskmxDateSpt", request)
arg_msg = response.GetString("ErrMsg")

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

ext:
if (rslt = 1) then
	MessageBox('提示', '修改成功')
	wf_retrieve()
else
	MessageBox('提示', arg_msg)
end if

return rslt
end event

type cb_5 from commandbutton within w_saletaskmx_tracking
string tag = "IF list.Count = 0 THEN"
boolean visible = false
integer x = 1120
integer y = 308
integer width = 302
integer height = 84
integer taborder = 130
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "变更交期"
end type

event clicked;IF dw_1.RowCount() <= 0 THEN RETURN
int rslt = 1

dw_1.AcceptText()
string arg_msg,ls_sptflagstr
oleobject request,response, list, item
list = FXAppCom.NewPBArray()
Long row
Int ch
DateTime promisedate
FOR row = 1 TO dw_1.RowCount()
	ch = dw_1.Object.ch[row]
	IF dw_1.Object.ch[row] <> 1 THEN CONTINUE
	
	ls_sptflagstr = Trim(dw_1.Object.fx_saletaskmx_sptflagstr[row]) 
	
	IF ls_sptflagstr <>  '同意' AND ls_sptflagstr <>  '采购提前待回复' AND ls_sptflagstr <>  '采购延后待回复' AND &
	   ls_sptflagstr <>  '延后待采购回复' AND ls_sptflagstr <>  '提前待采购回复'   THEN
		arg_msg = "第"+String(row)+"行协同状态为【" + ls_sptflagstr + "】, 不能操作！"
			rslt = 0
		GOTO ext
	END IF
	
	item = FXAppCom.CreatePbDictionary()
	item.SetString("tid",dw_1.Object.fx_saletask_tid[row])
	item.SetInt("taskid",dw_1.Object.taskid[row])
	item.SetInt("printid",dw_1.Object.printid[row])
	promisedate = dw_1.Object.fx_saletaskmx_promisedate[row]
	IF IsNull(promisedate) OR promisedate < DateTime(Date('2000-01-01'),Time("00:00:00")) THEN
		arg_msg = "第"+String(row)+"行回复时间为空，无法确认"
		rslt = 0
		GOTO ext
	END IF
	
	IF promisedate < DateTime(today(),Time("00:00:00")) THEN
		arg_msg = "第"+String(row)+"行回复时间不能早于当前时间，无法确认"
		rslt = 0
		GOTO ext
	END IF
	item.SetDateTime("promisedate",promisedate);
	list.AddObject(item)
NEXT
IF list.Count = 0 THEN
	arg_msg = "未选中记录"
	rslt = 0
	GOTO ext
END IF
IF MessageBox('询问', '是否修改当前勾选的要求交期？', Question!, YesNo!, 1) <> 1 THEN RETURN

request = FXAppCom.CreatePbDictionary()
request.SetString("token",app_token_fx)
request.SetInt("changetype",1)
request.SetObject("saletaskmxList",list)
response = FXAppCom.DoExecute("SaveSaletaskmxDateSpt", request)
arg_msg = response.GetString("ErrMsg")

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

ext:
if (rslt = 1) then
	MessageBox('提示', '修改成功')
	wf_retrieve()
else
	MessageBox('提示', arg_msg)
end if

return rslt
end event

type cb_receive from uo_imflatbutton within w_saletaskmx_tracking
integer x = 151
integer width = 219
integer height = 164
integer taborder = 30
boolean bringtotop = true
string text = "批接收"
string normalpicname = "ok.bmp"
integer picsize = 16
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;IF dw_1.RowCount() <= 0 THEN RETURN
int rslt = 1

dw_1.AcceptText()
string arg_msg
oleobject request,response, list, item
list = FXAppCom.NewPBArray()
Long row
DateTime promisedate
FOR row = 1 TO dw_1.RowCount()
	IF dw_1.Object.ch[row] <> 1 THEN CONTINUE

	IF Trim(dw_1.Object.fx_saletaskmx_sptflagstr[row]) <> '待接收' THEN
		arg_msg = "只能选择协同状态为【待接收】订单明细操作！订单号："  + string(dw_1.Object.fx_saletask_tid[row]) + "序："  + string(dw_1.Object.printid[row])
		rslt = 0
		GOTO ext
	END IF
	
	item = FXAppCom.CreatePbDictionary()
	item.SetString("tid",dw_1.Object.fx_saletask_tid[row])
	item.SetInt("taskid",dw_1.Object.taskid[row])
	item.SetInt("printid",dw_1.Object.printid[row])

	promisedate = dw_1.Object.fx_saletaskmx_promisedate[row]
	IF IsNull(promisedate) THEN
		promisedate = dw_1.Object.requiredate[row]
	END IF	
	item.SetDateTime("promisedate",promisedate);
	item.SetString("sptFlagStr",  '同意并回复交期');
	
	
	list.AddObject(item)
NEXT
IF list.Count = 0 THEN
	arg_msg = "未选中明细记录"
	rslt = 0
	GOTO ext
END IF
IF MessageBox('询问', '是否批接收所选订单(整单接收)？', Question!, YesNo!, 1) <> 1 THEN RETURN

request = FXAppCom.CreatePbDictionary()
request.SetString("token",app_token_fx)
request.SetObject("Saletaskmxes",list)
response = FXAppCom.DoExecute("UpdateSptFlagStr", request)
arg_msg = response.GetString("ErrMsg")

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

ext:
if (rslt = 1) then
	MessageBox('提示', '批接收成功')
	wf_retrieve()
else
	MessageBox('提示', arg_msg)
end if

return rslt
end event

type cb_stop from uo_imflatbutton within w_saletaskmx_tracking
boolean visible = false
integer x = 370
integer width = 329
integer height = 164
integer taborder = 30
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;IF dw_1.RowCount() <= 0 THEN RETURN
int rslt = 1

dw_1.AcceptText()
string arg_msg,ls_sptflagstr
oleobject request,response, list, item
list = FXAppCom.NewPBArray()
Long row
DateTime promisedate
FOR row = 1 TO dw_1.RowCount()
	IF dw_1.Object.ch[row] <> 1 THEN CONTINUE
	
	ls_sptflagstr = Trim(dw_1.Object.fx_saletaskmx_sptflagstr[row]) 
	IF ls_sptflagstr = '同意待采购读' OR ls_sptflagstr = '已发货' THEN
		arg_msg = "订单号："  + string(dw_1.Object.fx_saletask_tid[row]) + "序："  + string(dw_1.Object.printid[row]) + " 协同状态【" + ls_sptflagstr + "】,不能终止"
		rslt = 0
		GOTO ext
	END IF
	
	item = FXAppCom.CreatePbDictionary()
	item.SetString("tid",dw_1.Object.fx_saletask_tid[row])
	item.SetInt("taskid",dw_1.Object.taskid[row])
	item.SetInt("printid",dw_1.Object.printid[row])
	
	IF ls_sptflagstr = '采购撤审待读' THEN
		item.SetString('sptFlagStr',ls_sptflagstr)
	ELSE
		item.SetString('sptFlagStr','终止')
	END IF
	
	
	list.AddObject(item)
NEXT
IF list.Count = 0 THEN
	arg_msg = "未选中明细记录"
	rslt = 0
	GOTO ext
END IF
IF MessageBox('询问', '是否批终止所选订单明细', Question!, YesNo!, 1) <> 1 THEN RETURN

request = FXAppCom.CreatePbDictionary()
request.SetString("token",app_token_fx)
request.SetObject("Saletaskmxes",list)
response = FXAppCom.DoExecute("UpdateSptFlagStr", request)
arg_msg = response.GetString("ErrMsg")

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

ext:
if (rslt = 1) then
	MessageBox('提示', '批终止成功')
	wf_retrieve()
else
	MessageBox('提示', arg_msg)
end if


end event

type cb_6 from uo_imflatbutton within w_saletaskmx_tracking
integer x = 1065
integer width = 274
integer height = 164
integer taborder = 30
boolean bringtotop = true
string text = "数据发送"
string normalpicname = "excel.bmp"
integer picsize = 16
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;OpenWithParm(w_sentdataout,DW_1)
end event

type cb_refuse from uo_imflatbutton within w_saletaskmx_tracking
integer x = 370
integer width = 174
integer height = 164
integer taborder = 30
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;IF dw_1.RowCount() <= 0 THEN RETURN
int rslt = 1
String arg_msg


dw_1.AcceptText()
oleobject request,response, list, item
list = FXAppCom.NewPBArray()
Long row
//DateTime promisedate
//FOR row = 1 TO dw_1.RowCount()z
//	IF dw_1.Object.ch[row] <> 1 THEN CONTINUE
	
	row = dw_1.GetRow()
	
	IF Trim(dw_1.Object.fx_saletaskmx_sptflagstr[row]) <> '待接收' THEN
		arg_msg = "只能选择协同状态为【待接收】订单明细操作！订单号："  + string(dw_1.Object.fx_saletask_tid[row]) + "序："  + string(dw_1.Object.printid[row])
		rslt = 0
		GOTO ext
	END IF
	
	IF MessageBox('询问', '是否拒绝当前所选订单明细(整单拒绝)', Question!, YesNo!, 1) <> 1 THEN RETURN
	
	OpenWithParm(w_fx_refuse_reason_edit, arg_msg)
	
	s_open_packet s_ret
	s_ret = Message.PowerObjectParm
	if (s_ret.returnflag = 0) then
		 RETURN
	end if


	String reason
	reason = s_ret.postscript
	if IsNull(reason) OR reason = '' then
		 arg_msg = '拒绝原因不能为空'
		 rslt = 0
		 GOTO ext
	end if
	
	
	item = FXAppCom.CreatePbDictionary()
	item.SetString("tid",dw_1.Object.fx_saletask_tid[row])
	item.SetInt("taskid",dw_1.Object.taskid[row])
	item.SetInt("printid",dw_1.Object.printid[row])
	item.SetString('modinfo', reason)
	item.SetString("sptFlagStr",  '拒绝待采购回复');
	list.AddObject(item)
//NEXT
//IF list.Count = 0 THEN
//	arg_msg = "未选中明细记录"
//	rslt = 0
//	GOTO ext
//END IF
//IF MessageBox('询问', '是否批拒绝所选订单明细', Question!, YesNo!, 1) <> 1 THEN RETURN

request = FXAppCom.CreatePbDictionary()
request.SetString("token",app_token_fx)
request.SetObject("Saletaskmxes",list)
response = FXAppCom.DoExecute("UpdateSptFlagStr", request)
arg_msg = response.GetString("ErrMsg")

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

ext:
if (rslt = 1) then
	MessageBox('提示', '批拒绝成功')
	wf_retrieve()
else
	MessageBox('提示', arg_msg)
end if

return rslt
end event

type cb_7 from uo_imflatbutton within w_saletaskmx_tracking
integer x = 878
integer width = 187
integer height = 164
integer taborder = 90
boolean bringtotop = true
string text = "打印"
string normalpicname = "print.bmp"
integer picsize = 16
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;long ll_row

IF dw_1.RowCount() <= 0 THEN RETURN

datastore ds_report
ds_report = create datastore

string dwSyntax,rs_dname,arg_errmsg,dwname
int result_po
dwname = 'dw_print_saletask_fx_mx'
result_po = f_getprintout(dwname,'',1,rs_dname,dwSyntax,arg_errmsg)
if dwSyntax <> '' then
	result_po = ds_report.create(dwSyntax)
	if result_po <> 1 then
		ds_report.dataobject = dwname
	end if
else
	ds_report.dataobject = dwname
end if

long mx_row, i

for i = 1 to dw_1.rowcount()
	IF dw_1.Object.ch[i] = 0 THEN CONTINUE
	
	mx_row = ds_report.InsertRow(0)
	if ds_report.Describe("fx_company_comname.ColType") <> '!' then ds_report.setitem(mx_row,'fx_company_comname', dw_1.Object.comname[i])
	if ds_report.Describe("fx_saletask_taskcode.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletask_taskcode', dw_1.Object.fx_saletask_taskcode[i])
	if ds_report.Describe("cus_mtrlcode.ColType") <> '!' then ds_report.setitem(mx_row,'cus_mtrlcode', dw_1.Object.mtrlcode[i])
	if ds_report.Describe("cus_mtrlname.ColType") <> '!' then ds_report.setitem(mx_row,'cus_mtrlname', dw_1.Object.mtrlname[i])
	if ds_report.Describe("cus_mtrlmode.ColType") <> '!' then ds_report.setitem(mx_row,'cus_mtrlmode', dw_1.Object.mtrlmode[i])
	if ds_report.Describe("fx_mtrldef_unit.ColType") <> '!' then ds_report.setitem(mx_row,'fx_mtrldef_unit', dw_1.Object.unit[i])
	if ds_report.Describe("fx_saletaskmx_qty.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletaskmx_qty', dw_1.Object.qty[i])
	if ds_report.Describe("fx_saletaskmx_requiredate.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletaskmx_requiredate', dw_1.Object.requiredate[i])
	if ds_report.Describe("fx_saletaskmx_gydscrp.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletaskmx_gydscrp', dw_1.Object.fx_saletaskmx_gydscrp[i])
	IF dw_1.Object.fx_saletaskmx_mtrlcuscode[i] = '' THEN
		if ds_report.Describe("fx_saletaskmx_mtrlcuscode.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletaskmx_mtrlcuscode', dw_1.Object.fx_saletaskmx_mxdscrp[i])
	 ELSE
		if ds_report.Describe("fx_saletaskmx_mtrlcuscode.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletaskmx_mtrlcuscode', dw_1.Object.fx_saletaskmx_mtrlcuscode[i])
	END IF
	if ds_report.Describe("fx_saletaskmx_saletask_mxid.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletaskmx_saletask_mxid', dw_1.Object.fx_saletaskmx_saletask_mxid[i])
	if ds_report.Describe("fx_saletaskmx_order_mtrlname_str.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletaskmx_order_mtrlname_str', dw_1.Object.order_mtrlname_str[i])
	
	if ds_report.Describe("fx_saletask_cus_rep.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletask_cus_rep', dw_1.Object.fx_saletask_cus_rep[i])
	if ds_report.Describe("fx_company_tele.ColType") <> '!' then ds_report.setitem(mx_row,'fx_company_tele', dw_1.Object.fx_company_tele[i])
	if ds_report.Describe("fx_company_address.ColType") <> '!' then ds_report.setitem(mx_row,'fx_company_address', dw_1.Object.fx_company_address[i])
	if ds_report.Describe("fx_company_custype.ColType") <> '!' then ds_report.setitem(mx_row,'fx_company_custype', dw_1.Object.fx_company_custype[i])
	if ds_report.Describe("fx_company_comname_spt.ColType") <> '!' then ds_report.setitem(mx_row,'fx_company_comname_spt', dw_1.Object.fx_company_comname_spt[i])
	if ds_report.Describe("fx_company_tele_spt.ColType") <> '!' then ds_report.setitem(mx_row,'fx_company_tele_spt', dw_1.Object.fx_company_tele_spt[i])
	if ds_report.Describe("fx_company_address_spt.ColType") <> '!' then ds_report.setitem(mx_row,'fx_company_address_spt', dw_1.Object.fx_company_address_spt[i])
	if ds_report.Describe("fx_company_custype_spt.ColType") <> '!' then ds_report.setitem(mx_row,'fx_company_custype_spt', dw_1.Object.fx_company_custype_spt[i])
	if ds_report.Describe("fx_saletask_taskdate.ColType") <> '!' then ds_report.setitem(mx_row,'fx_saletask_taskdate', dw_1.Object.fx_saletask_taskdate[i])
	
//	ds_report.Object.fx_company_comname[mx_row] = dw_1.Object.comname[i]
//	ds_report.Object.fx_saletask_taskcode[mx_row] = dw_1.Object.fx_saletask_taskcode[i]
//	ds_report.Object.cus_mtrlcode[mx_row] = dw_1.Object.mtrlcode[i]
//	ds_report.Object.cus_mtrlname[mx_row] = dw_1.Object.mtrlname[i]
//	ds_report.Object.cus_mtrlmode[mx_row] = dw_1.Object.mtrlmode[i]
//	ds_report.Object.fx_mtrldef_unit[mx_row] = Trim(dw_1.Object.unit[i])	
//	ds_report.Object.fx_saletaskmx_qty[mx_row] = dw_1.Object.qty[i]
//	ds_report.Object.fx_saletaskmx_requiredate[mx_row] = dw_1.Object.requiredate[i]
//     ds_report.Object.fx_saletaskmx_gydscrp[mx_row] = dw_1.Object.fx_saletaskmx_gydscrp[i]
//	IF dw_1.Object.fx_saletaskmx_mtrlcuscode[i] = '' THEN
//		ds_report.Object.fx_saletaskmx_mtrlcuscode[mx_row] = dw_1.Object.fx_saletaskmx_mxdscrp[i]
//	 ELSE
//		ds_report.Object.fx_saletaskmx_mtrlcuscode[mx_row] = dw_1.Object.fx_saletaskmx_mtrlcuscode[i]
//	END IF
//	ds_report.Object.fx_saletaskmx_saletask_mxid[mx_row] = dw_1.Object.fx_saletaskmx_saletask_mxid[i]
//	
//	ds_report.Object.fx_saletaskmx_order_mtrlname_str[mx_row] = dw_1.Object.order_mtrlname_str[i]
//	
next

IF ds_report.RowCount() <= 0 THEN
	MessageBox('提示', '请先勾选要打印的单据明细!')
	RETURN
END IF


ds_report.SetSort(" fx_saletaskmx_mtrlcuscode A, cus_mtrlname A, cus_mtrlmode A")

ds_report.Sort()

S_print_MSG LS_PRMSG

LS_PRMSG.obj_dwNAME='dw_print_saletask_fx_mx'
LS_PRMSG.SHARE_DW=ds_report
LS_PRMSG.TAG_TEXT='订单明细'
LS_PRMSG.SETUP_FLAG=0
LS_PRMSG.PAGECH_FLAG=1

Openwithparm(w_publ_preview,LS_PRMSG)





end event

type cb_canel from uo_imflatbutton within w_saletaskmx_tracking
integer x = 713
integer width = 165
integer height = 164
integer taborder = 20
boolean bringtotop = true
boolean enabled = false
string text = "取消"
string normalpicname = "new.bmp"
integer picsize = 16
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;If if_modify_mode Then
	If MessageBox ("IF","是否确定要放弃保存?",Question!,YesNo! ) = 2 Then Return
	wf_change_mode(0)
	wf_retrieve()
End If




end event

type cb_modify from uo_imflatbutton within w_saletaskmx_tracking
integer x = 544
integer width = 165
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;If if_modify_mode Then
	
	Long row_count
	row_count = dw_1.RowCount()
	If row_count <= 0 Then
		MessageBox('提示','没有保存的明细，请检查')
		Return
	End If
	
	dw_1.AcceptText()
	String arg_msg
	oleobject request,response, list, Item
	list = FXAppCom.NewPBArray()
	Long row
	For row = 1 To row_count
		
		Item = FXAppCom.CreatePbDictionary()
		Item.SetString("tid",dw_1.Object.fx_saletask_tid[row])
		Item.SetInt("taskid",dw_1.Object.taskid[row])
		Item.SetInt("printid",dw_1.Object.printid[row])
		Item.SetString("paichan_dscrp",dw_1.Object.fx_saletaskmx_paichan_dscrp[row])
		Item.SetInt("ifPC",dw_1.Object.fx_saletaskmx_ifpc[row])
		
		list.AddObject(Item)
	Next
	
	request = FXAppCom.CreatePbDictionary()
	request.SetString("token",app_token_fx)
	request.SetObject("Saletaskmxes",list)
	response = FXAppCom.DoExecute("UpdatePCfromSaletaskMx", request)
	arg_msg = response.GetString("ErrMsg")
	
	If (arg_msg <> '') Then
		MessageBox('提示', arg_msg)
		Return
	Else
		MessageBox('提示', '修改成功')
		wf_retrieve()
		wf_change_mode(0)
	End If
Else
	wf_change_mode(1)
End If


end event

type cbx_2 from checkbox within w_saletaskmx_tracking
integer x = 2281
integer y = 196
integer width = 402
integer height = 80
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 16711680
long backcolor = 134217739
string text = "只看可发货"
end type

event clicked;ddlb_status.Enabled = NOT this.checked
em_1.Enabled = NOT this.checked
em_2.Enabled = NOT this.checked

cb_1.TriggerEvent(clicked!)

end event

type st_5 from statictext within w_saletaskmx_tracking
integer x = 791
integer y = 324
integer width = 233
integer height = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "客户名称"
boolean focusrectangle = false
end type

type st_6 from statictext within w_saletaskmx_tracking
integer x = 1627
integer y = 324
integer width = 137
integer height = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "协同"
boolean focusrectangle = false
end type

type st_7 from statictext within w_saletaskmx_tracking
integer x = 2359
integer y = 324
integer width = 562
integer height = 60
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "物料编码/名称/规格含"
boolean focusrectangle = false
end type

type sle_3 from singlelineedit within w_saletaskmx_tracking
event ue_keyup pbm_keyup
integer x = 2921
integer y = 312
integer width = 613
integer height = 84
integer taborder = 20
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type

event ue_keyup;parent.triggerevent('ue_short_filter')
end event

event modified;parent.triggerevent('ue_short_filter')
end event

type ddplb_1 from dropdownpicturelistbox within w_saletaskmx_tracking
integer x = 1024
integer y = 304
integer width = 571
integer height = 1368
integer taborder = 30
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
boolean sorted = false
borderstyle borderstyle = stylelowered!
long picturemaskcolor = 536870912
end type

event selectionchanged;parent.triggerevent('ue_short_filter')
end event

type ddplb_2 from dropdownpicturelistbox within w_saletaskmx_tracking
integer x = 1765
integer y = 304
integer width = 571
integer height = 1620
integer taborder = 40
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
boolean sorted = false
borderstyle borderstyle = stylelowered!
long picturemaskcolor = 536870912
end type

event selectionchanged;parent.triggerevent('ue_short_filter')
end event

type dw_fx_outware from u_dw_rbtnfilter within w_saletaskmx_tracking
integer x = 9
integer y = 1540
integer width = 3538
integer height = 724
integer taborder = 30
boolean bringtotop = true
boolean titlebar = true
string title = "发货单明细"
string dataobject = "dw_fx_outware_mutiple"
boolean maxbox = true
boolean hscrollbar = true
boolean vscrollbar = true
boolean border = false
boolean hsplitscroll = true
borderstyle borderstyle = styleshadowbox!
boolean rbutton_filter_use = true
boolean rbutton_setposition_use = true
boolean titleclick_sort_use = true
boolean autosave_setlayout_use = false
boolean autosave_columnvisible_use = false
end type

event rowfocuschanged;call super::rowfocuschanged;//if IsNull(currentrow) then
//	IF THIS.rowcount() > 0 then
//		THIS.SelectRow(0,FALSE)
//		THIS.SelectRow(1,TRUE)
//		THIS.setrow(1)
//		currentrow =1
//	end if
//end if
//
//if IsNull(currentrow) then return
//if (currentrow <= 0) then return
//
//this.SelectRow(0, false)
//this.SelectRow(currentrow, true)
//
//dw_fx_outware_free.Reset( )
//this.RowsCopy(currentrow, currentrow, Primary!, dw_fx_outware_free, 1, Primary!)
//
//long ll_outwareid
//ll_outwareid = this.Object.outwareid[currentrow]
//
//wf_retrieve_outware_mx(ll_outwareid)
end event

event doubleclicked;call super::doubleclicked;IF row <= 0 THEN RETURN

IF dwo.Name = "outwarecode" THEN
	String ls_outwarecode
	ls_outwarecode = This.GetItemString(row,"outwarecode")
	IF IsNull(ls_outwarecode) OR ls_outwarecode = "" THEN RETURN
	s_edit_index_tran s_tran
	s_tran.arg_string_code = ls_outwarecode
	window openwin
	OpenWithParm(openwin,s_tran,"w_outware_fx_mutiple")
END IF
//OpenWithParm(openwin,s_tran,ls_win1)
end event

type sp_v1 from u_lbs_stsplitbar within w_saletaskmx_tracking
integer x = 178
integer y = 1488
boolean bringtotop = true
long backcolor = 33554432
end type

event lbuttonup;call super::lbuttonup;ins_spposition = (dw_1.Y + dw_1.Height)/parent.workspaceheight()
IF ins_spposition > 0.9 THEN ins_spposition = 0.9
parent.postevent(resize!)
end event

