$PBExportHeader$uo_ddlb_moneyid.sru
forward
global type uo_ddlb_moneyid from dropdownlistbox
end type
end forward

global type uo_ddlb_moneyid from dropdownlistbox
integer width = 247
integer height = 228
integer taborder = 10
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
boolean sorted = false
boolean vscrollbar = true
borderstyle borderstyle = stylelowered!
end type
global uo_ddlb_moneyid uo_ddlb_moneyid

type variables
long uo_moneyid
end variables

event constructor;Long ls_moneyid
String ls_name
Long cnt = 0
Long ll_i
String ls_space
Int li_spacenum


DECLARE money_cur CURSOR FOR
	SELECT cw_currency.moneyid,
	cw_currency.name
	FROM cw_currency order by cw_currency.moneyid desc;
OPEN money_cur;

FETCH money_cur INTO :ls_moneyid,:ls_name ;
DO WHILE sqlca.SQLCode = 0
	
	li_spacenum = 50 - Len(Trim(ls_name)) - 2 - Len(String(ls_moneyid))
	ls_space = Fill(' ',li_spacenum)
	
	THIS.AddItem (ls_name+ls_space+'['+String(ls_moneyid)+']')
	
	FETCH money_cur INTO :ls_moneyid,:ls_name ;
LOOP

CLOSE money_cur;

THIS.uo_moneyid = ls_moneyid

THIS.Text = ls_name+ls_space+'['+String(ls_moneyid)+']'

SELECT count(*)
	INTO :cnt
	FROM cw_currency ;
IF cnt > 1 THEN
	THIS.AddItem ('[全部]')
END IF

end event

event selectionchanged;IF THIS.Text = '[全部]' THEN
	uo_moneyid = -1	
ELSE
	uo_moneyid = Long(Mid ( THIS.Text,Pos(THIS.Text,'[') + 1,Len(THIS.Text) - Pos(THIS.Text,'[') - 1 ))
END IF



end event

on uo_ddlb_moneyid.create
end on

on uo_ddlb_moneyid.destroy
end on

