function extractData() {
	 $("#compFlag").val('');   //外包机构
	 $("#bussinessFlag").val('');   //外包模式
	 $("#caseSource").val('');   //赔案来源	
	 $("#amountTime").val('');   //统计周期
	 $("#startregdate").val('');     //统计起期
	 $("#endregdate").val('');     //统计终期

	 $("#claimStateSpan").attr("code","all").html("全部");
	 $("#claimState").val("all");
	 alert("重置成功！");
}



function doSubmit() {
	var url = getRootPath() + "/bpomanage/amountInfo/queryAmountInfoAndCon.do" ;
	document.forms["form"].action = url;
	var flag = true;
	
	if (flag) {
		document.forms["form"].submit();
	} 
	
//	var param = {};
//	param.batchno = $("#batchno").val();;   //BPO批次号
//	param.pname = $("#pname").val();   //被保险人全称
//	param.claimno = $("#claimno").val();   //赔案号
//	param.startregdate = $("#startregdate")val();     //立案开始日期
//	param.endregdate = $("#endregdate").val();     //立案结束日期
//	param.startenddate = $("#startenddate").val();     //结案开始日期
//	param.endenddate = $("#endenddate").val();     //结案结束日期
//	param.claimState = $("#claimState").attr("code");   //案件状态
//	
//	$.ajax({
//		 type: "POST",  
//	     url: "queryAmountInfoAndCon.do",
//	     data: param,
//		 //contentType:"application/json; charset=UTF-8",
//	     success:function(data){
//	    	 return;
//	     },error:function(data){
//	    	 return;
//	     }
//	});
	
	
	
	
	
	
}

function selClaimState(val){
	$("#claimState").val(val);
}

function go(){
	var url = getRootPath() + "/bpomanage/amountInfo/amountInfoExport.do" ;
	document.forms["excelform"].action = url;
	document.forms["excelform"].submit();
}

//翻页
function cur_skip(s,e){
	var pn = $(e).find("span").html();
	
	
	
	var compFlag = $("#compFlag").val();   //外包机构
	var bussinessFlag = $("#bussinessFlag").val();   //外包模式
	var caseSource = $("#caseSource").val();   //赔案来源	
	var amountTime = $("#amountTime").val();   //统计周期
	var startregdate = $("#startregdate").val();     //统计起期
	var endregdate = $("#endregdate").val();     //统计终期

	
	if(s=="1"){
		SkipByPost("queryAmountInfoAndCon.do", {
			'pageNo' : pn,
			'compFlag' : compFlag,
			'bussinessFlag' : bussinessFlag,
			'caseSource' : caseSource,
			'amountTime' : amountTime,
			'startregdate' : startregdate,
			'endregdate' : endregdate
		});
	}
	else if(s=="2"){
		SkipByPost("queryAmountInfoAndCon.do",{pageNo:pn});
	}
	$(".turn_cur").removeAttr("class");
	$(e).find("span").attr("class","turn_cur");
}

//前一页
function pre(s,e){
	var cur = $("#nav").find(".turn_cur").html();
	var compFlag = $("#compFlag").val();   //外包机构
	var bussinessFlag = $("#bussinessFlag").val();   //外包模式
	var caseSource = $("#caseSource").val();   //赔案来源	
	var amountTime = $("#amountTime").val();   //统计周期
	var startregdate = $("input[name='startregdate']").val();     //统计起期
	var endregdate = $("input[name='endregdate']").val();     //统计终期
	var endenddate = $("input[name='endenddate']").val();     //结案结束日期
	
	if(cur==1){
		return;
	}	
	if(cur>1){
	var pre = Number(cur)-Number(1);		
	if(s=="1"){
		SkipByPost("queryAmountInfoAndCon.do", {
			'pageNo' : pre,
			'compFlag' : compFlag,
			'bussinessFlag' : bussinessFlag,
			'caseSource' : caseSource,
			'amountTime' : amountTime,
			'startregdate' : startregdate,
			'endregdate' : endregdate
		});
		}
		else if(s=="2"){
		SkipByPost("queryAmountInfoAndCon.do",{pageNo:pre});
		}
	}
}
//下一页

function next(s,e){
	var cur = $("#nav").find(".turn_cur").html();
	var next = Number(cur)+Number(1);
	var maxPage = $("#max").val();
	var compFlag = $("#compFlag").val();   //外包机构
	var bussinessFlag = $("#bussinessFlag").val();   //外包模式
	var caseSource = $("#caseSource").val();   //赔案来源	
	var amountTime = $("#amountTime").val();   //统计周期
	var startregdate = $("input[name='startregdate']").val();     //统计起期
	var endregdate = $("input[name='endregdate']").val();     //统计终期
	var endenddate = $("input[name='endenddate']").val();     //结案结束日期
	
	if(parseInt(cur)==parseInt(maxPage)){			
		return;
	}
	
	if(parseInt(cur)<parseInt(maxPage)){
		if(s=="1"){
			SkipByPost("queryAmountInfoAndCon.do",{
				'pageNo':next,
				'compFlag' : compFlag,
				'bussinessFlag' : bussinessFlag,
				'caseSource' : caseSource,
				'amountTime' : amountTime,
				'startregdate' : startregdate,
				'endregdate' : endregdate
				});
			}
			else if(s=="2"){
			SkipByPost("queryAmountInfoAndCon.do",{pageNo:next});
			}
	}
}

//跳转至
function custom(s){		
	
	var maxPage = $("#max").val();
	var pn = $.trim($("#turn_inp").val());
	var compFlag = $("#compFlag").val();   //外包机构
	var bussinessFlag = $("#bussinessFlag").val();   //外包模式
	var caseSource = $("#caseSource").val();   //赔案来源	
	var amountTime = $("#amountTime").val();   //统计周期
	var startregdate = $("input[name='startregdate']").val();     //统计起期
	var endregdate = $("input[name='endregdate']").val();     //统计终期
	var endenddate = $("input[name='endenddate']").val();     //结案结束日期
	
	if(isNaN(pn)){
		return ;
	}
	if(pn == "") {
		return;
	}
	if(Number(pn)==0){
		return;
	}	
	if(Number(pn) > Number(maxPage)){
		return;
	}	
	if(s=="1"){
		SkipByPost("queryAmountInfoAndCon.do",{
			'pageNo':Number(pn),
			'compFlag' : compFlag,
			'bussinessFlag' : bussinessFlag,
			'caseSource' : caseSource,
			'amountTime' : amountTime,
			'startregdate' : startregdate,
			'endregdate' : endregdate
			});
		}
		else if(s=="2"){
		SkipByPost("queryAmountInfoAndCon.do",{pageNo:Number(pn)});
	}
}
//判断是否全选
function checkAll(flag1,flag2){
	if(flag2=="1"){//总开关
		if($(flag1).attr("class")=="check_no"){
			$("#endCaseListTbl tr:gt(0)").each(function (){
				$(this).find("span").attr("class","check_yes");
			});
		}else{
			$("#endCaseListTbl tr:gt(0)").each(function (){
				$(this).find("span").attr("class","check_no");
			});
		}
	}else{//子开关
		if($(flag1).attr("class")=="check_yes"){
			var bool=false;
			$("#endCaseListTbl tr:gt(0)").each(function (){
				if($(this).find("span").attr("class")=="check_no"){
					bool=true;
					return;
				}
			});
			if(!bool){
				$("#titSpan").attr("class","check_yes");
			}
		}else{
			$("#titSpan").attr("class","check_no");
		}
	}
}
//清空所有全选按钮选框
function clearChecked(){
	$("#endCaseListTbl tr").each(function (){
		$(this).find("span").attr("class","check_no");
	});
}
//结案批量发送保存数据
function batchSend_btn(mtype){
	var n=0;
	var objlist= new Array();
	$("#endCaseListTbl tr:gt(0)").each(function (){
		if($(this).find("span").attr("class")=="check_yes"){
			var obj = new Object();
			n++;
			var check=$(this).attr("id");
			var num="claimno_"+check;
			var claimNo=$("#"+num).val();
			obj.claimNo = claimNo;
			obj.mtype = mtype;
			objlist.push(obj);
		}
	});
	if(n==0){
		alert("请先选择赔案！");
		return;
	}		
	if(mtype=='4'){			
		var str=isSendAnyone_btn();
		if(str==0){
			return;
		}
	}
	$.ajax({
		type : "post",
		url : "savebatchendcase.do",
		data : JSON.stringify(objlist),
		contentType:"application/json; charset=UTF-8",
		error:function(){
			alert("操作失败！");
			return;
		},
		success:function(data){
			if(data.message =="success"){
				alert("操作成功！");
			}
			else{
				alert("操作失败！");	
			}
		}
	});		
}

//判断是否需要打印、发短信或发邮件
function isSendAnyone_btn(){
	var objlist= new Array();
	var isconfirm=1;
	$("#endCaseListTbl tr:gt(0)").each(function (){
		if($(this).find("span").attr("class")=="check_yes"){
			var obj = new Object();
			var check=$(this).attr("id");
			var num="claimno_"+check;
			var claimNo=$("#"+num).val();
			obj.claimNo = claimNo;
			objlist.push(obj);
		}
	});
	$.ajax({
		type : "post",
		url : "issenddate.do",
		data : JSON.stringify(objlist),
		contentType:"application/json; charset=UTF-8",
		async:false,
		error:function(){
			
		},
		success:function(data){
			if(data == "0"){
				if (confirm("是否需要发短信？") == true) {
					isconfirm=0;
				}
			}
		}
	});	
	return isconfirm;		
}

//获取反馈件数具体详细信息
function getCaseDetlInfo(compFlag, bussinessFlag, claim_sys, amountTime, caseType, exportType,startregdate,endregdate){
	var exportUrl="";
	if(exportType==1){
		exportUrl=getRootPath()+"/bpomanage/amountInfo/queryAmountInfoDetl.do";
	}else if(exportType==2){
		exportUrl=getRootPath()+"/bpomanage/amountInfo/queryFeedbackDetl.do";
	}else if(exportType==3){
		exportUrl=getRootPath()+"/bpomanage/amountInfo/queryUnFeedBackInfoDetl.do";
	}
	$.ajax({
        cache: true,
        type: "POST",
        url: exportUrl,
        data:{"compFlag":compFlag,"bussinessFlag":bussinessFlag,"claim_sys":claim_sys,"amountTime":amountTime,"caseType":caseType,"exportType":exportType,"startregdate":startregdate,"endregdate":endregdate},
        async: false,
        error: function(request) {
            alert("获取信息失败！");
        },
        success: function(map) {
        	var list=map.list;
        	var html='';
        	html+="<tr>"+
	        	"<th>序号</th>"+
	        	"<th>赔案号</th>"+
	        	"<th>赔案来源</th>"+
	        	"<th>外包机构</th>"+
	        	"<th>外包模式</th>"+
	        	"<th>提交BPO时间</th>"+
	        	"<th>外包反馈日期</th>"+
	        	"<th>发票张数</th>"+
	        	"<th>账单总金额</th>"+
	        	"<th>是否为住院件</th>"+
	        	"<th>是否问题件</th>"+
	        	"<th>问题件分类</th>"+
	        	"<th>时效</th>"+
	        	"<th>影像发送时间</th>"+
				"</tr>";
			for(var i=0;i<list.length;i++){
				
				var caseSource=list[i].caseSource;
				if(caseSource !=null){
					if(caseSource==1){
						caseSource="产险";
					}
					if(caseSource==2){
						caseSource="寿险";
					}
					if(caseSource==3){
						caseSource="健康险";
					}
				}
				var sendRequestToImg=list[i].sendRequestToImg;
				if (sendRequestToImg != null ){
						bussinessFlag="半外包";
				}else{
					bussinessFlag="全外包";
				}
				var caseType=list[i].caseType;
				if (caseType != null ){
					if(caseType=='2'){
						caseType="是";
					}
					if(caseType=='1'||caseType=='3'||caseType=='4'){
						caseType="否";
					}
				}
				html+="<tr>"+
						"<td>"+(i+1)+"</td>"+
						"<td>"+(list[i].claimNo!=null?list[i].claimNo:'')+"</td>"+
						"<td>"+(caseSource!=null?caseSource:'')+"</td>"+
						"<td>"+(list[i].compFlag!=null?list[i].compFlag:'')+"</td>"+
						"<td>"+(bussinessFlag!=null?bussinessFlag:'')+"</td>"+
						"<td>"+(list[i].sendRequestToImg!=null?list[i].sendRequestToImg:'')+"</td>"+
						"<td>"+(list[i].createDate!=null?list[i].createDate:'')+"</td>"+
						"<td>"+(list[i].invoiceCount!=null?list[i].invoiceCount:'')+"</td>"+
						"<td>"+(list[i].totalAmts!=null?list[i].totalAmts:'')+"</td>"+
						"<td>"+(list[i].isHospital!=null?list[i].isHospital:'')+"</td>"+
						"<td>"+(caseType!=null?caseType:'')+"</td>"+
						"<td>"+(list[i].caseReason!=null?list[i].caseReason:'')+"</td>"+
						"<td>"+(list[i].timeliness!=null?list[i].timeliness:'')+"</td>"+
						"<td>"+(list[i].imgHjReseveTime!=null?list[i].imgHjReseveTime:'')+"</td>"+
					  "</tr>";
			}
			$("#amountInfoDetl").html(html);
			$('#export').removeAttr('disabled');
			$("#compFlagExcel").val(map.compFlag);
			$("#bussinessFlagExcel").val(map.bussinessFlag);
			$("#claimSourceExcel").val(map.caseSource);
			$("#amountTimeExcel").val(map.amountTime);
			$("#caseTypeExcel").val(map.caseType);
			$("#exportTypeExcel").val(map.exportType);
			$("#startRegDateExcel").val(map.startRegDate);
			$("#endRegDateExcel").val(map.endRegDate);
			
			if(list.length==0){
				$('#excelExport button[name=export]').attr('disabled','disabled');
				$('#export').attr('disabled','disabled');
			}
			showDiv('openAmountInfoDel');
        }
    });
}