
function choice(n) {
	var s=$("span[name=checkBox]");
	var infos=document.getElementsByName("checkBillNos");
	var checkboxs=$(".check_yes");
	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++){
					infos[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++){
					infos[i].value=checkboxs[i].id;
					}
			}
		}
		$(n).className="check_yes";
	}
}

function choice1(obj, n, status) {
	var infos=document.getElementsByName("checkBillNos");
	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 ssss(){
//	var selectAll = $("#is-select-all").val();//对账单生成全选
	var checkyesStr = '';
	var hospitalName = $("#hospitalName").html();
	var partnerType = $("#partnerType").html();
	var accountName = $("#accountName").html();
	var bankNumber = $("#bankNumber").html();
	var orgId = $("#org-id").val();
	$("#billinfo").find("tr").each(function(){
		if($(this).find("span").is(".check_yes")){
			var batchNo = $(this).find("td:eq(1)").html();
			var claimNo = $(this).find("td:eq(3)").html();
			var claimState = $(this).find("td:eq(4)").attr("data-claim-state");
			var claimSubState = $("#claim-sub-state").val();
			var claimSource = $(this).find("td:eq(5)").html();
			var firstDiagnoseDate = $(this).find("td:eq(6)").html();
			var insuredName = $(this).find("td:eq(7)").html();
			var billsMoney = $(this).find("td:eq(8)").html();
			var deductionsAmt = $(this).find("td:eq(9)").html();
			var payAmt = $(this).find("td:eq(10)").html();
			var denyingAmt = $(this).find("td:eq(11)").html();
			var denyingReason = $(this).find("td:eq(12)").html();
			
			checkyesStr+='{"batchNo":"'+batchNo+'","claimNo":"'+claimNo+'","claimState":"'+claimState+'","claimSubState":"'+claimSubState+'","claimSource":"'+claimSource+'","firstDiagnoseDate":"'+firstDiagnoseDate+'","insuredName":"'+insuredName+'","billsMoney":"'+billsMoney+'","deductionsAmt":"'+deductionsAmt+'","payAmt":"'+payAmt+'","denyingAmt":"'+denyingAmt+'","denyingReason":"'+denyingReason+'"},';
			
		}
	});
	
	if(checkyesStr ==''||checkyesStr==undefined||checkyesStr==null){
			alert("请选择赔案号");
			return;
	}
	
	checkyesStr = "["+checkyesStr.substring(0,checkyesStr.length-1)+"]";
	 SkipByPost("generate.do",{checkyesStrs:checkyesStr,hospitalN:hospitalName,
		 partnerTypeN:partnerType,accountN:accountName,bankNo:bankNumber,orgId:orgId});
	
}

//翻页
function cur_skip(e){
	var pn = $(e).find("span").html();
	SkipByPost("currentpage.do",{pageNo:pn});
	$(".turn_cur").removeAttr("class");
	$(e).find("span").attr("class","turn_cur");
}

//前一页
function pre(e){
	var maxPage = $("#max").val();
	var cur = $("#nav").find(".turn_cur").html();
	if(cur>1){
	var pre = Number(cur)-Number(1);
	SkipByPost("currentpage.do",{pageNo:pre});
	}else{
		SkipByPost("currentpage.do",{pageNo:maxPage});
	}
}
//下一页
function next(e){
	var cur = $("#nav").find(".turn_cur").html();
	var next = Number(cur)+Number(1);
	var maxPage = $("#max").val();
	if(parseInt(cur)<parseInt(maxPage)){
		SkipByPost("currentpage.do",{pageNo:next});
	}else{
		SkipByPost("currentpage.do",{pageNo:1});
	}
}
//跳转至
function custom(){
	
	
	var pn = $.trim($("#turn_inp").val());
	
	if(pn == "") return;
	SkipByPost("currentpage.do",{pageNo:Number(pn)});
}

//全选
function selAll(e){
//	var check = $(e).attr("class");
	
	$("#is-select-all").val("YES");
}