$PBExportHeader$w_outwaremx_tracking.srw
forward
global type w_outwaremx_tracking from w_publ_easyq
end type
type cb_toppage from uo_imflatbutton within w_outwaremx_tracking
end type
type cb_page_ch from uo_imflatbutton within w_outwaremx_tracking
end type
type em_pagesize from editmask within w_outwaremx_tracking
end type
type ddlb_1 from dropdownlistbox within w_outwaremx_tracking
end type
type st_2 from statictext within w_outwaremx_tracking
end type
type cbx_1 from checkbox within w_outwaremx_tracking
end type
type cb_6 from uo_imflatbutton within w_outwaremx_tracking
end type
type cb_7 from uo_imflatbutton within w_outwaremx_tracking
end type
end forward

global type w_outwaremx_tracking from w_publ_easyq
string title = "发货单明细报表"
event ue_page_next ( )
event ue_page_before ( )
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_6 cb_6
cb_7 cb_7
end type
global w_outwaremx_tracking w_outwaremx_tracking

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

end variables

forward prototypes
public function integer wf_retrieve ()
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

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)
request.SetInt("pageindex",ins_cur_pageNum)
request.SetInt("pagesize",long(em_pagesize.Text))
response = FXAppCom.DoExecute("GetOutwaremxTrackingList", request)
arg_msg = response.GetString("ErrMsg")

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

dw_1.Reset()

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")
	dw_1.Object.qty_todo[row] = item.GetDouble("qty") - item.GetDouble("qty_wait") - item.GetDouble("acceptQty") - item.GetDouble('stopQty')
	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'))
	
	dw_1.SetItem(row, 'outwarecode', item.GetString('outwarecode'))
	dw_1.SetItem(row, 'dscrp_out', item.GetString('dscrp_out'))
	dw_1.SetItem(row, 'outwaredate', item.GetDateTime('outwaredate'))
	dw_1.SetItem(row, 'driver', item.GetString('driver'))
	dw_1.SetItem(row, 'carnum', item.GetString('carnum'))
	dw_1.SetItem(row, 'qty_out', item.GetDouble('qty_out'))
	dw_1.SetItem(row, 'mxcode_out', item.GetString('mxcode_out'))
	dw_1.SetItem(row, 'packqty', item.GetDouble('packqty'))
	dw_1.SetItem(row, 'productdate', item.GetDateTime('productdate'))
	dw_1.SetItem(row, 'plancode_out', item.GetString('plancode_out'))
	dw_1.SetItem(row, 'auditdate', item.GetDateTime('auditdate'))
	dw_1.SetItem(row, 'auditemp', item.GetString('auditemp'))
	
	dw_1.SetItem(row, 'username', item.GetString('username'))
	dw_1.SetItem(row, 'logstatus', item.GetInt('logstatus'))
	dw_1.SetItem(row, 'acceptusername', item.GetString('acceptusername'))
	dw_1.SetItem(row, 'acceptdate', item.GetDateTime('acceptdate'))
	dw_1.SetItem(row, 'inwarecode_erp', item.GetString('inwarecode_erp'))
	dw_1.SetItem(row, 'tmpacceptemp', item.GetString('tmpacceptemp'))
	dw_1.SetItem(row, 'checkqty', item.GetDouble('checkqty'))
	dw_1.SetItem(row, 'badinqty', item.GetDouble('badinqty'))
	dw_1.SetItem(row, 'tmpacceptqty', item.GetDouble('tmpacceptqty'))
	dw_1.SetItem(row, 'goodinqty', item.GetDouble('goodinqty'))
	dw_1.SetItem(row, 'barcode', item.GetString('barcode'))
	dw_1.SetItem(row, 'backqty', item.GetDouble('backqty'))
	dw_1.SetItem(row, 'billtype', item.GetInt('billtype'))
	dw_1.SetItem(row, 'goodqty', item.GetDouble('goodqty'))
	dw_1.SetItem(row, 'badqty', item.GetDouble('badqty'))
	dw_1.SetItem(row, 'notqty', item.GetDouble('notqty'))
	dw_1.SetItem(row, 'earliestsenddate', item.GetDateTime('earliestsenddate'))
	dw_1.SetItem(row, 'cus_mtrldef_senddays', item.GetDouble('cus_mtrldef_senddays'))
	
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
else
	MessageBox('提示', arg_msg)
end if

return rslt
end function

on w_outwaremx_tracking.create
int iCurrent
call super::create
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_6=create cb_6
this.cb_7=create cb_7
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.cb_toppage
this.Control[iCurrent+2]=this.cb_page_ch
this.Control[iCurrent+3]=this.em_pagesize
this.Control[iCurrent+4]=this.ddlb_1
this.Control[iCurrent+5]=this.st_2
this.Control[iCurrent+6]=this.cbx_1
this.Control[iCurrent+7]=this.cb_6
this.Control[iCurrent+8]=this.cb_7
end on

on w_outwaremx_tracking.destroy
call super::destroy
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_6)
destroy(this.cb_7)
end on

event open;call super::open;em_1.Text =  String(Today(),'YYYY-MM')+'-01'
em_2.Text = String(Today(),'YYYY-MM-DD')
wf_retrieve()
end event

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

type cb_exit from w_publ_easyq`cb_exit within w_outwaremx_tracking
integer x = 631
end type

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

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

type cb_1 from w_publ_easyq`cb_1 within w_outwaremx_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_outwaremx_tracking
integer x = 32
integer width = 315
integer height = 72
string text = "发货日期从:"
end type

type st_4 from w_publ_easyq`st_4 within w_outwaremx_tracking
integer x = 873
integer y = 212
end type

type em_1 from w_publ_easyq`em_1 within w_outwaremx_tracking
integer x = 366
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_outwaremx_tracking
integer x = 978
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_outwaremx_tracking
boolean visible = false
end type

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

type dw_1 from w_publ_easyq`dw_1 within w_outwaremx_tracking
integer y = 416
string dataobject = "dw_fx_outwaremx_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

type sle_mtrl from w_publ_easyq`sle_mtrl within w_outwaremx_tracking
end type

type sle_cust from w_publ_easyq`sle_cust within w_outwaremx_tracking
end type

type st_mtrl from w_publ_easyq`st_mtrl within w_outwaremx_tracking
end type

type st_cust from w_publ_easyq`st_cust within w_outwaremx_tracking
end type

type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_outwaremx_tracking
end type

type pb_em1 from w_publ_easyq`pb_em1 within w_outwaremx_tracking
integer x = 782
integer y = 196
end type

type pb_em2 from w_publ_easyq`pb_em2 within w_outwaremx_tracking
integer x = 1390
integer y = 196
end type

type pb_2 from w_publ_easyq`pb_2 within w_outwaremx_tracking
integer x = 1499
integer y = 196
end type

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

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

type gb_1 from w_publ_easyq`gb_1 within w_outwaremx_tracking
end type

type ln_bar from w_publ_easyq`ln_bar within w_outwaremx_tracking
end type

type ln_bar2 from w_publ_easyq`ln_bar2 within w_outwaremx_tracking
end type

type r_bar from w_publ_easyq`r_bar within w_outwaremx_tracking
end type

type ln_1 from w_publ_easyq`ln_1 within w_outwaremx_tracking
end type

type ln_2 from w_publ_easyq`ln_2 within w_outwaremx_tracking
end type

type ln_3 from w_publ_easyq`ln_3 within w_outwaremx_tracking
end type

type ln_4 from w_publ_easyq`ln_4 within w_outwaremx_tracking
end type

type cb_toppage from uo_imflatbutton within w_outwaremx_tracking
integer x = 1166
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_outwaremx_tracking
integer x = 1317
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_outwaremx_tracking
integer x = 855
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_outwaremx_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_outwaremx_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_outwaremx_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_6 from uo_imflatbutton within w_outwaremx_tracking
integer x = 352
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_7 from uo_imflatbutton within w_outwaremx_tracking
integer x = 165
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

Long i, ll_cuscomid
for i = 1 to dw_1.rowcount()
	IF dw_1.Object.ch[i] = 0 THEN CONTINUE
	IF ll_cuscomid = 0 THEN
		ll_cuscomid = dw_1.Object.cuscomid[ll_row]
	ELSEIF ll_cuscomid <> dw_1.Object.cuscomid[ll_row] THEN
		MessageBox('提示', '只能选择同一个客户打印')
		RETURN
	END IF
NEXT

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_bycus(dwname,ll_cuscomid,ref rs_dname,ref dwSyntax,ref 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

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
LS_PRMSG.cuscomid = ll_cuscomid

Openwithparm(w_publ_preview,LS_PRMSG)





end event

