function queryBatchData(){
	var isNull=false;
	var batchNo=$("#batchNo").val();
	if(batchNo!=""){
		isNull=true;
	}
	var fDate="";var lDate="";var flg=false;
	fDate=$("#firstDate").val();
	lDate=$("#lastDate").val();
	if(fDate!="" && lDate!=""){
		flg=true;
	}
	
	if((fDate=="" && lDate!="") || (fDate!="" && lDate=="")){
		alert("请输入完整日期区间!");
		return;
	}
	if(flg==false && isNull==false){
		alert("必须输入一种查询条件");
		return;
	}
	if(fDate>lDate){
		alert("开始日期大于结束日期");
		return;
	} 
	var fds1=fDate.split("-");
	var fds2=lDate.split("-");
	var year=fds2[0]-fds1[0];
	var month=fds2[1]-fds1[1];
	var day=fds2[2]-fds1[2];
	if(year>1){
		alert("时间必须在一年之内");
		return;
	}else if(year==1){
		if(month>0){
			alert("时间必须在一年之内");
			return;
		}else if(month==0){
			if(day>0){
				alert("时间必须在一年之内");
				return;
			}
		}
		
	}
	
	$("#queryBatch").attr('action','/claimserver/checkBatchDetails/queryBatchPaymentInfo.do');
	$("#queryBatch").submit();
}

function payInfo(){
	var checkboxs=document.getElementsByClassName("check_yes");//span
	if(checkboxs.length==0||checkboxs==null){
		alert("请勾选批次号");
		return;
	}
	//var batchNos=$("input[name=batchNos]");
	var batchNos=document.getElementsByName("batchNos");
	if (batchNos.length<1) {
		alert("支付失败!");
		return;
	}
	
	$("#payInfo").attr('action','/claimserver/checkBatchDetails/updateBatchDetailStatus.do');
	$("#payInfo").submit();
	alert("已转财务支付");
}

function choice(obj,n,status){
	var infos=document.getElementsByName("batchNos");
	if ($(obj).is(".check_no")){
		$(obj).className="check_yes";
		if(obj.className =='check_no'){
			infos[status].value=n;
		 }
		var s = $("span[name=checkBox]");
		var isAllChecked = true;
		for(var i in s){
			if(s[i].className=="check_no"){
				if (s[i].id != n){
					isAllChecked = false;
					break;
				}
			}
		}
		if (isAllChecked) {
			$("#ckAll").removeClass("check_no").addClass("check_yes");
		}
	} else {
		$(obj).className="check_no";
		$("#ckAll").removeClass("check_yes").addClass("check_no");
		infos[status].value="";
	}

}

function choiceAll(n){
	var checkboxs=document.getElementsByClassName("check_yes");
	var check=document.getElementsByName("batchNos");
	var s=$("span[name=checkBox]");
	if ($("#ckAll").is(".check_yes")) {
		for(var i in s){
			if(s[i].className=="check_yes"){
				s[i].className="check_no";
				for(var i=0;i<checkboxs.length;i++){
					check[i].value="";
					

					}
			}
		}
		$(n).className="check_no";
	} else {
		for(var i in s){
			if(s[i].className=="check_no"){
				s[i].className="check_yes";
				for(var i=0;i<checkboxs.length;i++){
					check[i].value=checkboxs[i].id;
					}
			}
		}
		$(n).className="check_yes";
	}
}
function excelExport(){
	var checkboxs=document.getElementsByClassName("check_yes");//span
	if(checkboxs==null||checkboxs.length==0){
		alert("请勾选批次");
		return;
	}
	//var batchNos=$("input[name=batchNos]");
	var batchNos=document.getElementsByName("batchNos");
	if (batchNos.length<1) {
		alert("导出失败!");
		return;
	}
	$("#payInfo").attr('action','/claimserver/checkBatchDetails/excelExport.do');
	$("#payInfo").submit();
}