var pageList=[''];
var pageCur = 0; 
/*
	当日成交展示字段
*/
var drcjList =	[
				[
				{field:'entrust_no',title:'委托号',width:100,rowspan:1,align:'center',resizable:false,sortable:true},
				{field:'stock_code',title:'证券代码',width:100,rowspan:1,align:'center',resizable:false,sortable:true},
				{field:'stock_name',title:'证券名称',width:100,rowspan:1,align:'center',resizable:false,sortable:true},
				{field:'entrust_bs',title:'买卖方向',width:100,rowspan:1,align:'center',resizable:false,sortable:true,formatter:formatMmfx},
				{field:'business_amount',title:'成交数量',width:100,rowspan:1,align:'center',resizable:false,sortable:true,sorter:sortNumber},
				{field:'business_price',title:'成交价格',width:100,rowspan:1,align:'center',resizable:false,sortable:true,sorter:sortNumber},
				{field:'business_balance',title:'成交金额',width:100,rowspan:1,align:'center',resizable:false,sortable:true,sorter:sortNumber}
				]
			    ];

$(function(){
	gf_dzjy_share.createGrid('dzjy_drcj_grid','tdx_center',null,drcjList,false);
	$("#dzjy_drcj_grid").datagrid("options").singleSelect = true;
	get_cjcx('');
})

/*
	成交查询
*/

function get_cjcx(sPos){
	var wtcfg ={
		"funcid":"332705",
		'en_entrust_prop':'AFC,AFW',
		"position_str":"",
		'@POS':sPos,
		"funcname":'ret_cjcx'
	};
	gf_dzjy_share.setIX(wtcfg);
}

function ret_cjcx(_fromid,_funid,_flagtype,data){
	if (_funid == '5010:SIMPLE.332705'){
		var data = FormatResult(data, 1);
		if (data.ErrorCode == 0){
			if($.inArray(data.POS, pageList)==-1){
				pageList.push(data.POS);
			}
			if(data.total>0){
				$('#count').text(data.total);
			}
			else{
				$('#count').text('0');
			}
			gridUpdateData('dzjy_drcj_grid',0,data);
		} 
		else{
			$.messager.alert("提示",data.ErrorInfo,"error");
		}
	} 
}

function refreshCjcx(){
	pageList=[''];
	pageCur = 0; 
	get_cjcx('');
}


/*
	下一页按钮响应
*/
function setNextPage() {
	if (pageCur < (pageList.length - 1)) {
		pageCur += 1;
		get_cjcx(pageList[pageCur]);
	}
}

/*
	上一页按钮响应
*/
function setPrePage() {
	if (pageCur > 0) {
		pageCur -= 1;
		get_cjcx(pageList[pageCur]);
	}
}