function query(){
	var param = {};
	var policyName = $("#policyName").val();
	var receiptDate= $("#receiptDate").val();
	
	if(policyName==null || policyName==""){
		alert("请选择投保单位！");
		return;
	}
	if(receiptDate==null || receiptDate==""){
		alert("请选择收单日期区间！");
		return;
		
	}
	param.policyName = policyName;
	param.receiptDate =receiptDate;
	$.ajax({
		 type: "POST",  
	     url: "queryNoticeofreasonInfo.do",
	     data: param,
	     success:function(data){
	    	 if(data.length > 0){
	    		 $("#count").html(data.length+"");
	    		 $("#fileName").html(policyName+$("#receiptDate").val()+".xls");
	    		 $("#excelUpload").css("visibility","");
	    		 $("#pdfUpload").css("visibility","");
	    	 }else{
	    		 alert("无数据!");
	    		 $("#count").html("0"); 
	    		 $("#fileName").html("");
	    		 $("#excelUpload").css("visibility","hidden");
	    		 $("#pdfUpload").css("visibility","hidden");
	    	 }
	     },
	     error:function(data){
	    	 alert("无数据!");
	    	return;
	     }
	});
}

//查询投保单位
function queryPolicyName(){
	var param = {};
	var policyName = $("#policyName").val();
	param.policyName = policyName;
	$.ajax({
		 type: "POST",  
	     url: "queryPolicyName.do",
	     data: param,
	     success:function(data){
	    	 if (data.length > 0) {
	    		var ul = $("<ul id=\"tip\"></ul>");
				for ( var i = 0; i < data.length; i++) {
					$(ul).append(
					"<li style=\"background-color:#FFFFFF\" onmouseover=\"changbackclrFn(this)\" onblur=\"displayNone('1')\" onclick=\"selectedPolicyNameFn('"
							+ data[i] + "')\">"
							+ data[i]
							+ "</li>");
				}
				$("#tip-div").html(ul);
				$("#tip-div").css("display", "");
			} else {
				$("#tip-div").css("display", "none");
			}
	     },
	     error:function(data){
	    	 alert("无数据!");
	    	return;
	     }
	});
}

function selectedPolicyNameFn(policyName){
	$("#policyName").val(policyName);
	$("#tip-div").css("display", "none");
}

function selPolicyName(obj){
	$("#tip-div").remove();
	
//	var left = obj.getBoundingClientRect().left - 50;
//	var top = obj.getBoundingClientRect().top + 125;
	
	var left = obj.getBoundingClientRect().left + document.documentElement.scrollLeft - 54;
	var top = obj.getBoundingClientRect().top + document.documentElement.scrollTop + 120;
	left=$(obj).position().left;
	top =$(obj).position().top;
	//position:absolute;
//	var html = "<div class=\"\" id=\"tip-div\" style=\"display:block;left:"+left+"px;top:"+top+"px; margin:0 0 0 53px; width:164px; z-index: 999;position:absolute\"></div>";
	var html = "<div class=\"sel_list i_ul_265\" id=\"tip-div\"></div>";
//	alert($(obj).parent("td:eq(0)").html());
//	$(obj).parent("td:eq(0)").append(html);
	$(obj).parent().append(html);
}

function excelUpload(){
	var param = {};
	var policyName = $("#policyName").val();
	param.policyName = policyName;
	param.receiptDate = $("#receiptDate").val();
	SkipByPost("execlExport.do",param);
}

function pdfUpload(){
	var param = {};
	var policyName = $("#policyName").val();
	param.policyName = policyName;
	param.receiptDate = $("#receiptDate").val();
	SkipByPost("pdfExport.do",param);
}
function changbackclrFn(flag){
	$(flag).css("background-color", "#e5e5e5").siblings().css("background-color", "#FFFFFF");
}
function getData(){
	
	var policyName=$("#policyName").val();
	var begDate=$("#receiptDateBeg").val();
	var endDate=$("#receiptDateEnd").val();
	if(policyName==null && policyName==""){
		alert("投保单位不能为空!请选择!");
		return;
	}
	if((begDate!=null && endDate!=null) && (begDate!="" && endDate!="")){
		var param = {};
		param.policyName = policyName;
		param.begDate=begDate;
		param.endDate=endDate;
		
		$.ajax({
			 type: "POST",  
		     url: "queryDateInterval.do",
		     data: param,
		     success:function(data){
		    	 if (data.length > 0) {
		    		var ul = $("<ul id=\"tip\"></ul>");
					for ( var i = 0; i < data.length; i++) {
						$(ul).append(
						"<li style=\"background-color:#FFFFFF\" onmouseover=\"changbackclrFn(this)\" onblur=\"displayNone('1')\" onclick=\"selectedDateIntervalFn('"
								+ data[i] + "')\">"
								+ data[i]
								+ "</li>");
					}
					$("#dateIntervalDivValue").html(ul);
					$("#dateIntervalDiv").css("display", "");
				} else {
					alert("无数据!");
					$("#dateIntervalDiv").css("display", "none");
				}
		     
		     },
		     error:function(data){
		    	 alert("无数据!");
		    	return;
		     }
		});
	}
}
	function selectedDateIntervalFn(receiptDate){
		$("#receiptDate").val(receiptDate);
		$("#dateIntervalDiv").css("display", "none");
	}