//初始化
var g;
var DirectPaymentData = {Rows:[],Total:0};
var isQueryNull = true;
var syncType = false;
$(function (){
	$("#maingrid4").ligerGrid({
		columns: [
		          {display: '赔案号', name: 'claimNo', align: 'center', width: 120 },
		          {display: '被保人姓名', name: 'name', align: 'center', width: 120 },
		          {display: '证件类型', name: 'idtype', align: 'center', 
		        	  render:function(n){
						if(n.idtype == '01' ){
							return '身份证';
						}else if(n.idtype == 'a' ){
							return '身份证';
						}else if(n.idtype == 'b' ){
							return '中国新身份证';
						}else if(n.idtype == 'c' ){
							return '护照';
						}else if(n.idtype == 'd' ){
							return '军官证';
						}else if(n.idtype == '1' ){
							return '';
						}else if(n.idtype == 'e' ){
							return '身份证号码';
						}else if(n.idtype == 'f' ){
							return '驾照';
						}else if(n.idtype == 'g' ){
							return '虚拟身份证';
						}else if(n.idtype == 'h' ){
							return '出生证书';
						}else if(n.idtype == 'i' ){
							return '其他';
						}else if(n.idtype == 'j' ){
							return '港澳台护照';
						}else if(n.idtype == 'k' ){
							return '临时身份证';
						}else if(n.idtype == 'l' ){
							return '台湾居民通行证';
						}else if(n.idtype == 'm' ){
							return '户口薄';
						}else if(n.idtype == 'n' ){
							return '出生证';
						}else{
							return '其他';
						}
				    },
		           width: 120 },
		          {display: '证件号码', name: 'pid', align: 'center', width: 130 },
		          {display: '投保单位', name: 'sappName', align: 'center', width: 180 },
		          {display: '赔付金额', name: 'payAmt', align: 'center', width: 130 },
		          {display: '直付限额内金额', name: 'directpaymentamount1', align: 'center', width: 130 },
		          {display: '直付限额外金额', name: 'directpaymentamount2', align: 'center', width: 130 },
		          {display: '剩余直付限额', name: 'remainPrem', align: 'center', width: 130 },
		          {display: '抵扣个人账户金额', name: 'depersonalAccountamt', align: 'center', width: 130 },
		          {display: '个人账户余额', name: 'paypersonalAccountamt', align: 'center', width: 130 },
		          {display: '抵扣公共账户金额', name: 'decommonAccountamt', align: 'center', width: 130 },
		          {display: '公共账户余额', name: 'paycommonAccountamt', align: 'center', width: 130 },
		          {display: '无法抵扣金额', name: 'unableamount', align: 'center', width: 130 }
		],
		data: '', 
		pageSize: 50, 
		sortName: 'claimNo',
		sortorder : 'asc',
		width: '99.85%', 
		height: '500px', 
		checkbox: false
	});
	g = $("#maingrid4").ligerGrid();
});

function queryInfo(){
	var param = {};
	param.dirBatchNum = $("#dirBatchNum").val();
	param.directObj = $("#directObj").val();
	param.bankAccount = $("#bankAccount").val();
	$.ajax({
		type:'POST',
		url:'queryDirectPaymentCases.do',
		data : param,
		success:function(data){
			$(".l-bar-btnfirst").click();
			g.loadData(DirectPaymentData);
			if(data ==""){
				alert("查询不到相关内容!");
			}else{
				var datastr = '('+data+')';
				g.set("data",eval(datastr));
				g.reload();
			}
		},
		error:function(){
			alert("查询出错啦！");
		}
	});
}