$PBExportHeader$w_spt_price_change_erp.srw
$PBExportComments$供应商询价单(ERP的询价单)
forward
global type w_spt_price_change_erp from w_publ_base_style
end type
type cb_retrieve from uo_imflatbutton within w_spt_price_change_erp
end type
type cb_toppage from uo_imflatbutton within w_spt_price_change_erp
end type
type cb_page_ch from uo_imflatbutton within w_spt_price_change_erp
end type
type em_pagesize from editmask within w_spt_price_change_erp
end type
type cb_1 from uo_imflatbutton within w_spt_price_change_erp
end type
type st_1 from statictext within w_spt_price_change_erp
end type
type em_datea from editmask within w_spt_price_change_erp
end type
type st_2 from statictext within w_spt_price_change_erp
end type
type st_3 from statictext within w_spt_price_change_erp
end type
type em_datez from editmask within w_spt_price_change_erp
end type
type sle_likestr from singlelineedit within w_spt_price_change_erp
end type
type dw_main_ff from datawindow within w_spt_price_change_erp
end type
type dw_main from u_dw_rbtnfilter within w_spt_price_change_erp
end type
type dw_mx from u_dw_rbtnfilter within w_spt_price_change_erp
end type
type cb_2 from commandbutton within w_spt_price_change_erp
end type
end forward

global type w_spt_price_change_erp from w_publ_base_style
integer width = 4713
integer height = 2604
string title = "供应商询价单"
boolean maxbox = true
boolean resizable = true
long backcolor = 16777215
event ue_page_next ( )
event ue_page_before ( )
event ue_page_end ( )
cb_retrieve cb_retrieve
cb_toppage cb_toppage
cb_page_ch cb_page_ch
em_pagesize em_pagesize
cb_1 cb_1
st_1 st_1
em_datea em_datea
st_2 st_2
st_3 st_3
em_datez em_datez
sle_likestr sle_likestr
dw_main_ff dw_main_ff
dw_main dw_main
dw_mx dw_mx
cb_2 cb_2
end type
global w_spt_price_change_erp w_spt_price_change_erp

type variables
long ins_cur_pageNum = 1 // 用于记录当前页码
long ins_totalPages = 1 // 用于记录总页数
end variables

forward prototypes
public function integer wf_retrieve_sptprice ()
public function integer wf_retrieve_sptpricemx (readonly string a_sn)
end prototypes

event ue_page_next();// 下页
//if (ins_cur_pageNum = ins_totalPages) then return

ins_cur_pageNum ++
cb_retrieve.post event clicked()
end event

event ue_page_before();// 上页
if (ins_cur_pageNum = 1) then return

ins_cur_pageNum --
cb_retrieve.post event clicked()
end event

event ue_page_end();//// 末页
//if (ins_cur_pageNum = ins_totalPages) then return
//
//ins_cur_pageNum = ins_totalPages
end event

public function integer wf_retrieve_sptprice ();int rslt = 1

string arg_msg
long pageSize
pageSize = long(em_pagesize.Text)
if (pageSize <= 0) then
	rslt = 0
	arg_msg = '每页显示行数必须大于0'
	em_pagesize.SetFocus( )
	em_pagesize.SelectText(1, Len(em_pagesize.Text))
	goto ext
end if

long pageNum
pageNum = ins_cur_pageNum

datetime dateA, dateZ
dateA = DateTime(Date(em_dateA.Text), Time(0))
dateZ = DateTime(Date(em_dateZ.Text), Time('23:59:59'))

string likeStr
likeStr = Trim(sle_likestr.Text)

oleobject obj, parm, list, item
parm = FxAppCom.CreatePbDictionary()
parm.SetString('token', app_token_fx)
parm.SetInt('pageSize', pageSize)
parm.SetInt('pageNum', pageNum)
parm.SetDateTime('dateA', dateA)
parm.SetDateTime('dateZ', dateZ)
parm.SetString('likeStr', likeStr)
obj = FXAppCom.GetErpSptPriceChange(parm, ref arg_msg)
if (arg_msg <> '') then
	rslt = 0
	goto ext
end if

dw_main.Reset()
dw_main_ff.Reset()
dw_mx.Reset()

dw_main.SetRedraw(false)
long i, row
list = obj.GetPBArray('list')
for i = 1 to list.Count
	item = list.GetPBDictionary(i - 1)
	row = dw_main.InsertRow(0)
	
	dw_main.Object.SerialNum[row] = item.GetString('SerialNum')
	dw_main.Object.SendSCcode[row] = item.GetString('SendSCcode')
	dw_main.Object.AddUser[row] = item.GetString('AddUser')
	if (not IsNull(item.GetDateTime('AddTime'))) then
		dw_main.Object.AddTime[row] = item.GetDateTime('AddTime')
	end if
	if (not IsNull(item.GetDateTime('SendTime'))) then
		dw_main.Object.LJFIEB_packet_SendTime[row] = item.GetDateTime('SendTime')
	end if
	if (not IsNull(item.GetDateTime('ConfirmTime'))) then
		dw_main.Object.ConfirmTime[row] = item.GetDateTime('ConfirmTime')
	end if
	dw_main.Object.ConfirmUser[row] = item.GetString('ConfirmUser')
	dw_main.Object.RelatedCode[row] = item.GetString('RelatedCode')
	dw_main.Object.billcode[row] = item.GetString('billcode')
	dw_main.Object.inrep[row] = item.GetString('inrep')
	dw_main.Object.dscrp[row] = item.GetString('dscrp')
	dw_main.Object.opemp[row] = item.GetString('opemp')
	if (not IsNull(item.GetDateTime('opdate'))) then
		dw_main.Object.LJFIEB_tempspt_price_change_opdate[row] = item.GetDateTime('opdate')
	end if
	dw_main.Object.LJFIEB_tempspt_price_change_moneyname[row] = item.GetString('moneyname')
	if (not IsNull(item.GetDateTime('requiredate'))) then
		dw_main.Object.requiredate[row] = item.GetDateTime('requiredate')
	end if
	dw_main.Object.comname[row] = item.GetString('comname')
	dw_main.Object.simplename[row] = item.GetString('simplename')
next
dw_main.SetRedraw(true)

ext:
if (rslt = 1) then
	if (dw_main.RowCount() > 0) then
		dw_main.SelectRow(0, false)
		dw_main.SelectRow(1, true)
		dw_main.SetRow(1)
		dw_main.post event RowFocusChanged(1)
	end if
else
	MessageBox('提示', arg_msg)
end if
return rslt
end function

public function integer wf_retrieve_sptpricemx (readonly string a_sn);int rslt = 1

if (IsNull(a_sn)) then return 0
if (a_sn = '') then return 0

string arg_msg = ''
oleobject obj, parm, list, item
parm = FxAppCom.CreatePbDictionary()
parm.SetString('token', app_token_fx)
parm.SetString('sn', a_sn)
obj = FXAppCom.GetErpSptPriceChangeMx(parm, ref arg_msg)
if (arg_msg <> '') then
	rslt = 0
	goto ext
end if

dw_mx.Reset()

long i, row
list = obj.GetPBArray('list')
for i = 1 to list.Count
	item = list.GetPBDictionary(i - 1)
	row = dw_mx.InsertRow(0)
	
	dw_mx.Object.billid[row] = item.GetInt('billid')
	dw_mx.Object.printid[row] = item.GetInt('printid')
	dw_mx.Object.mtrlid[row] = item.GetInt('mtrlid')
	dw_mx.Object.sptmtrlcode[row] = item.GetString('sptmtrlcode')
	dw_mx.Object.sptmtrlname[row] = item.GetString('sptmtrlname')
	dw_mx.Object.sptmtrlmode[row] = item.GetString('sptmtrlmode')
	dw_mx.Object.unit[row] = item.GetString('unit')
	dw_mx.Object.ljfieb_tempspt_price_changemx_price[row] = item.GetDouble('price')
	dw_mx.Object.qty[row] = item.GetDouble('qty')
	dw_mx.Object.qty1[row] = item.GetDouble('qty1')
	dw_mx.Object.dscrp[row] = item.GetString('dscrp')
	dw_mx.Object.status[row] = item.GetString('status')
	dw_mx.Object.woodcode[row] = item.GetString('woodcode')
	dw_mx.Object.pcode[row] = item.GetString('pcode')
	dw_mx.Object.jgdscrp[row] = item.GetString('jgdscrp')
	dw_mx.Object.buydays[row] = item.GetDouble('buydays')
	
	if (not IsNull(item.GetDouble('reprice'))) then
		dw_mx.Object.ljfieb_tempquotemx_price[row] = item.GetDouble('reprice')
	end if
	if (not IsNull(item.GetDouble('rebate'))) then
		dw_mx.Object.ljfieb_tempquotemx_rebate[row] = item.GetDouble('rebate')
	end if
	if (not IsNull(item.GetDouble('reBuyDays'))) then
		dw_mx.Object.reBuyDays[row] = item.GetDouble('reBuyDays')
	end if
	
	if (not IsNull(item.GetDouble('latestQuotePrice'))) then
		dw_mx.Object.zxbj_price[row] = item.GetDouble('latestQuotePrice')
	end if
	if (not IsNull(item.GetDouble('latestQuoteRebate'))) then
		dw_mx.Object.zxbj_rebate[row] = item.GetDouble('latestQuoteRebate')
	end if
	if (not IsNull(item.GetDouble('latestAcceptPrice'))) then
		dw_mx.Object.zxjsbj_price[row] = item.GetDouble('latestAcceptPrice')
	end if
	if (not IsNull(item.GetDouble('latestAcceptRebate'))) then
		dw_mx.Object.zxjsbj_rebate[row] = item.GetDouble('latestAcceptRebate')
	end if
next

if (f_find_fx_user_power(11, ref arg_msg) <> 1) then // 11-供应商询价单查看(单价)
	dw_mx.Modify('destroy ljfieb_tempspt_price_changemx_price_t ~r~n destroy ljfieb_tempspt_price_changemx_price ~r~n')
	dw_mx.Modify('destroy ljfieb_tempquotemx_price_t ~r~n destroy ljfieb_tempquotemx_price ~r~n')
	dw_mx.Modify('destroy ljfieb_tempquotemx_rebate_t ~r~n destroy ljfieb_tempquotemx_rebate ~r~n')
	dw_mx.Modify('destroy ljfieb_tempquotemx_price_t ~r~n destroy ljfieb_tempquotemx_price ~r~n')
	dw_mx.Modify('destroy ljfieb_tempquotemx_rebate_t ~r~n destroy ljfieb_tempquotemx_rebate ~r~n')
	dw_mx.Modify('destroy zxbj_price_t ~r~n destroy zxbj_price ~r~n')
	dw_mx.Modify('destroy zxbj_rebate_t ~r~n destroy zxbj_rebate ~r~n')
	dw_mx.Modify('destroy zxjsbj_price_t ~r~n destroy zxjsbj_price ~r~n')
	dw_mx.Modify('destroy zxjsbj_rebate_t ~r~n destroy zxjsbj_rebate ~r~n')
	dw_mx.Modify('destroy compute_1_t ~r~n destroy compute_1 ~r~n')
	dw_mx.Modify('destroy compute_2_t ~r~n destroy compute_2 ~r~n')
	dw_mx.Modify('destroy compute_3_t ~r~n destroy compute_3 ~r~n')
end if

ext:
if (rslt <> 1) then
	MessageBox('提示', arg_msg)
end if

return rslt



end function

on w_spt_price_change_erp.create
int iCurrent
call super::create
this.cb_retrieve=create cb_retrieve
this.cb_toppage=create cb_toppage
this.cb_page_ch=create cb_page_ch
this.em_pagesize=create em_pagesize
this.cb_1=create cb_1
this.st_1=create st_1
this.em_datea=create em_datea
this.st_2=create st_2
this.st_3=create st_3
this.em_datez=create em_datez
this.sle_likestr=create sle_likestr
this.dw_main_ff=create dw_main_ff
this.dw_main=create dw_main
this.dw_mx=create dw_mx
this.cb_2=create cb_2
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.cb_retrieve
this.Control[iCurrent+2]=this.cb_toppage
this.Control[iCurrent+3]=this.cb_page_ch
this.Control[iCurrent+4]=this.em_pagesize
this.Control[iCurrent+5]=this.cb_1
this.Control[iCurrent+6]=this.st_1
this.Control[iCurrent+7]=this.em_datea
this.Control[iCurrent+8]=this.st_2
this.Control[iCurrent+9]=this.st_3
this.Control[iCurrent+10]=this.em_datez
this.Control[iCurrent+11]=this.sle_likestr
this.Control[iCurrent+12]=this.dw_main_ff
this.Control[iCurrent+13]=this.dw_main
this.Control[iCurrent+14]=this.dw_mx
this.Control[iCurrent+15]=this.cb_2
end on

on w_spt_price_change_erp.destroy
call super::destroy
destroy(this.cb_retrieve)
destroy(this.cb_toppage)
destroy(this.cb_page_ch)
destroy(this.em_pagesize)
destroy(this.cb_1)
destroy(this.st_1)
destroy(this.em_datea)
destroy(this.st_2)
destroy(this.st_3)
destroy(this.em_datez)
destroy(this.sle_likestr)
destroy(this.dw_main_ff)
destroy(this.dw_main)
destroy(this.dw_mx)
destroy(this.cb_2)
end on

event open;call super::open;string arg_msg // 30-采购订单 31-采购订单查看(单价)
if (f_find_fx_user_power(30, ref arg_msg) <> 1 &
		and f_find_fx_user_power(31, ref arg_msg) <> 1) then
	MessageBox('权限提示', arg_msg)
	Close(this)
	return
end if

em_datea.Text = String(RelativeDate(Today(), - 30))
em_datez.Text = String(Today())

wf_retrieve_sptprice()
end event

event resize;call super::resize;if (this.Width < 4100) then this.Width = 4100
if (this.Height < 2500) then this.Height = 2500

dw_main.Width = this.workspacewidth( ) - dw_main.X

dw_mx.Width = this.workspacewidth( )
dw_mx.Height = this.workspaceheight( ) - dw_mx.Y
end event

type cb_func from w_publ_base_style`cb_func within w_spt_price_change_erp
boolean visible = false
integer x = 3113
boolean enabled = false
end type

type cb_exit from w_publ_base_style`cb_exit within w_spt_price_change_erp
integer x = 155
end type

type ln_bar from w_publ_base_style`ln_bar within w_spt_price_change_erp
end type

type ln_bar2 from w_publ_base_style`ln_bar2 within w_spt_price_change_erp
end type

type r_bar from w_publ_base_style`r_bar within w_spt_price_change_erp
end type

type cb_retrieve from uo_imflatbutton within w_spt_price_change_erp
integer width = 151
integer height = 164
integer taborder = 20
boolean bringtotop = true
string text = "刷新"
string normalpicname = "refresh.bmp"
integer picsize = 16
toolbaralignment pic_align = alignattop!
boolean border = false
end type

event clicked;call super::clicked;wf_retrieve_sptprice()
end event

type cb_toppage from uo_imflatbutton within w_spt_price_change_erp
integer x = 626
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

cb_retrieve.post event clicked()
end event

type cb_page_ch from uo_imflatbutton within w_spt_price_change_erp
integer x = 782
integer width = 82
integer height = 164
integer taborder = 40
boolean bringtotop = true
string text = "▼"
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"
//menustr = menustr + "|" + "Text=末页~tEvent=ue_page_end"
	
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_spt_price_change_erp
integer x = 315
integer y = 44
integer width = 302
integer height = 84
integer taborder = 30
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string text = "100"
alignment alignment = right!
borderstyle borderstyle = stylelowered!
string mask = "#####"
boolean spin = true
double increment = 1
string minmax = "1~~"
end type

type cb_1 from uo_imflatbutton within w_spt_price_change_erp
boolean visible = false
integer x = 2496
integer width = 151
integer height = 164
integer taborder = 20
boolean bringtotop = true
boolean enabled = false
string text = "打印"
end type

type st_1 from statictext within w_spt_price_change_erp
integer x = 14
integer y = 200
integer width = 183
integer height = 56
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 16777215
string text = "日期从"
boolean focusrectangle = false
end type

type em_datea from editmask within w_spt_price_change_erp
integer x = 192
integer y = 184
integer width = 389
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 = "0000-00-00"
borderstyle borderstyle = stylelowered!
maskdatatype maskdatatype = datemask!
string mask = "yyyy-mm-dd"
boolean spin = true
end type

type st_2 from statictext within w_spt_price_change_erp
integer x = 599
integer y = 200
integer width = 87
integer height = 56
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 16777215
string text = "到"
boolean focusrectangle = false
end type

type st_3 from statictext within w_spt_price_change_erp
integer x = 1129
integer y = 200
integer width = 178
integer height = 56
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 16777215
string text = "单号含"
boolean focusrectangle = false
end type

type em_datez from editmask within w_spt_price_change_erp
integer x = 672
integer y = 184
integer width = 389
integer height = 84
integer taborder = 50
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string text = "0000-00-00"
borderstyle borderstyle = stylelowered!
maskdatatype maskdatatype = datemask!
string mask = "yyyy-mm-dd"
boolean spin = true
end type

type sle_likestr from singlelineedit within w_spt_price_change_erp
integer x = 1307
integer y = 184
integer width = 503
integer height = 84
integer taborder = 60
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 modified;cb_retrieve.post event clicked()
end event

type dw_main_ff from datawindow within w_spt_price_change_erp
integer y = 280
integer width = 1714
integer height = 936
integer taborder = 50
boolean bringtotop = true
string title = "none"
string dataobject = "dw_erp_spt_price_change_ff"
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

type dw_main from u_dw_rbtnfilter within w_spt_price_change_erp
integer x = 1714
integer y = 280
integer width = 2935
integer height = 936
integer taborder = 20
boolean bringtotop = true
boolean titlebar = true
string title = "单据列表"
string dataobject = "dw_erp_spt_price_change"
boolean controlmenu = true
boolean maxbox = true
boolean hscrollbar = true
boolean vscrollbar = true
boolean resizable = true
boolean hsplitscroll = true
boolean rbutton_filter_use = true
boolean rbutton_setposition_use = true
boolean titleclick_sort_use = true
end type

event rowfocuschanged;call super::rowfocuschanged;if IsNull(currentrow) then
	currentrow = this.GetRow()
	if IsNull(currentrow) then return
end if
if (currentrow <= 0) then return

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

dw_main_ff.Reset( )
this.RowsCopy(currentrow, currentrow, Primary!, dw_main_ff, 1, Primary!)

string sn
sn = this.Object.SerialNum[currentrow]
wf_retrieve_sptpricemx(sn)
end event

type dw_mx from u_dw_rbtnfilter within w_spt_price_change_erp
integer y = 1216
integer width = 4005
integer height = 1072
integer taborder = 20
boolean titlebar = true
string title = "明细内容"
string dataobject = "dw_erp_spt_price_changemx"
boolean controlmenu = true
boolean maxbox = true
boolean hscrollbar = true
boolean vscrollbar = true
boolean resizable = true
boolean hsplitscroll = true
boolean rbutton_filter_use = true
boolean rbutton_setposition_use = true
boolean titleclick_sort_use = true
end type

event clicked;call super::clicked;if (row > 0) then
	this.SelectRow(0, false)
	this.SelectRow(row, true)
	this.SetRow(row)
end if
end event

event rowfocuschanged;call super::rowfocuschanged;if (currentrow > 0) then
	this.SelectRow(0, false)
	this.SelectRow(currentrow, true)
	this.SetRow(currentrow)
end if
end event

type cb_2 from commandbutton within w_spt_price_change_erp
integer width = 4192
integer height = 2384
integer taborder = 30
boolean bringtotop = true
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "废弃"
end type

