<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="pageKorName" scope="request">통합조회</c:set>
<div class="content-wrapper" data-doctx="${pageName}">
	<div class="container-xxl flex-grow-1 px-0">
		<div class="card wrapper-list">
			<jsp:include page="/WEB-INF/jsp/fims/sprt/sprt01011-info.jsp" />
			<jsp:include page="/WEB-INF/jsp/fims/sprt/sprt01012-info.jsp" />
			<jsp:include page="/WEB-INF/jsp/fims/sprt/sprt01013-info.jsp" />
		</div>
	</div>

	<div class="toast-container position-fixed bottom-0 end-0 p-3">
	  <div name="divToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
	    <div name="toastText" class="toast-body bg-black text-white">
	    </div>
	  </div>
	</div>

	<jsp:include page="/WEB-INF/jsp/fims/sprt/sprt01014-info.jsp" />
	<jsp:include page="/WEB-INF/jsp/fims/sprt/sprt01015-info.jsp" />

	<div class="content-backdrop fade"></div>
</div>

<script>
LoadScript("sprt01010Script","/resources/js/fims/sprt/sprt01010.js?ver=${ver}");

/**************************************************************************
 * Global Variable
 **************************************************************************/

// 공통 코드
var vltnCdGrps = {<c:forEach items="${vltnCdGrps}" var="entry" varStatus="status">
	${entry.key}: new CommonCodes(${requestScope[entry.value]}, true)<c:if test="${!status.last}">,</c:if></c:forEach>
};
pageObject["${pageName}"] = newDoctxFinder("${pageName}");

$(document).ready(function() {
	var $P = pageObject["${pageName}"];
	$P.integrationSearch = {};

	/**************************************************************************
	* DatasetControl, DatasetSupport, FormFields
	**************************************************************************/
	var ctrl = newSprt01010Control($P);

	// Dataset 변경 이벤트
	ctrl.upDataset.onDatasetChange = (obj, option) => {
		var upActiveTab = $P.$findn("upGridTabs").find("button.active").text().trim();
		$P.renderList("up", upActiveTab);
	};

	ctrl.downDataset.onDatasetChange = (obj, option) => {
		var downActiveTab = $P.$findn("downGridTabs").find("button.active").text().trim();
		$P.renderList("down", downActiveTab);
	};

	// 현재 선택 자료 변경 이벤트
	ctrl.upDataset.onCurrentChange = (dataItem) => {
		if (!dataItem) {
			return;
		}
		$P.$findn("upTbody").setCurrentRow(dataItem.index);
	};

	ctrl.downDataset.onCurrentChange = (dataItem) => {
		if (!dataItem) {
			return;
		}
		$P.$findn("downTbody").setCurrentRow(dataItem.index);
	};

	// 선택(체크) 변경 이벤트
	ctrl.upDataset.onSelectionChange = (selectedArr) => {
		var DS = ctrl.upDataset;
		var keys = selectedArr.map(item => DS.getKey(item));

		$P.$findn("upTbody").find("input[type='checkbox']").each(function() {
			var checkbox = $(this);
			checkbox.prop("checked", keys.includes(checkbox.val()));
		});

		let status = getCheckboxesStatus($P.$findn("upTbody").find("input[type='checkbox']"));
		let thc = $P.$findn("upTheadTr").find("input[type='checkbox']");

		if (status == 1 && !thc.is(":checked")) {
			thc.prop("checked", true);
		} else if (status == -1 && thc.is(":checked")) {
			thc.prop("checked", false);
		}

	};

	ctrl.downDataset.onSelectionChange = (selectedArr) => {
		var DS = ctrl.downDataset;
		var keys = selectedArr.map(item => DS.getKey(item));

		$P.$findn("downTbody").find("input[type='checkbox']").each(function() {
			var checkbox = $(this);
			checkbox.prop("checked", keys.includes(checkbox.val()));
		});

		let status = getCheckboxesStatus($P.$findn("downTbody").find("input[type='checkbox']"));
		let thc = $P.$findn("downTheadTr").find("input[type='checkbox']");

		if (status == 1 && !thc.is(":checked")) {
			thc.prop("checked", true);
		} else if (status == -1 && thc.is(":checked")) {
			thc.prop("checked", false);
		}
	};

	//그리드 체크박스
	$P.selectCheckbox = (obj, arg1, arg2) => {
		let table = $(obj).parent().parent().parent().parent();
		let id = table.attr("name");
		if (id.startsWith("up")) {
			if (arg2 != null) {
				ctrl.upDataset.select(arg1, arg2);
			} else {
				ctrl.upDataset.select(arg1);
			}
		} else if (id.startsWith("down")) {
			if (arg2 != null) {
				ctrl.downDataset.select(arg1, arg2);
			} else {
				ctrl.downDataset.select(arg1);
			}
		}
	}

	$P.toast = new bootstrap.Toast($P.findn("divToast"), {
	    animation: true,
	    autohide: true,
	    delay: 2000
	});

	// 초기화
	$P.fnResetAndChangeBiz = (taskSeCd) => {
		$P.$findn("ischVltnCd").empty();
		$P.$findn("ischVltnCd").append("<option value=''>" + "전체" + "</option>");
		
		let cdGrps = vltnCdGrps[taskSeCd];
		// 업무에 따른 위반 내용
		var vltnIdCode = cdGrps ? cdGrps.list() : [];
		if (taskSeCd) {
			$(vltnIdCode).each(function(index, item) {
				$P.$findn("ischVltnCd").append("<option value='" + vltnIdCode[index].code +"'>" + vltnIdCode[index].value + "</option>");
			})
		}

		$P.fnReset();
	}

	$P.fnReset = () => {
		ctrl.upDataset.clear();
		ctrl.downDataset.clear();
	}

	// 검색 조건 파라미터 가져오기
	$P.getParams = () => {
		var formFields = new FimsFormFields($P.selectorn("frmSearch"));
		return formFields.get();
	}

	// 검색
	$P.fnSearchList = () => {
		// 검색조건
		ctrl.query = $P.getParams();

		var query = ctrl.query;
		var minKeyword = false;
		var keys = Object.keys(query);
		for(var i=0; i < keys.length; i++) {
			var key = keys[i];
			if (!key.startsWith("isch"))
				continue;

			if (key.startsWith("ischOnlyData")
			 || key.startsWith("ischExclData")
			 || key.endsWith("Similar"))
				continue;

			var value = query[key];
			if (value) {
				minKeyword = true;
				break;
			}
		}

		if (!minKeyword)
			return dialog.alert("검색조건을 입력하세요.");

		if (query.ischRtpyrNo.length == 6) {
			query.ischRtpyrBrdt = query.ischRtpyrNo;
			query.ischRtpyrNo = "";
		}

		$P.$findn("upGridTabs").find("button").not(":eq(0)").removeClass("active");
		$P.$findn("upGridTabs").find("button").eq(0).addClass("active");
		$P.$findn("downGridTabs").find("button").not(":eq(0)").removeClass("active");
		$P.$findn("downGridTabs").find("button").eq(0).addClass("active");
		ctrl.upDataset.clear();
		ctrl.downDataset.clear();

		ctrl.load();
	}

	// 엑셀
	$P.fnExcel = (updown) => {
		var cellDefs;

		if (updown == "up") {
			if (ctrl.upDataset.empty)
				return dialog.alert("조회된 자료가 없습니다.");

			cellDefs = AppSupport.getCellDefs(
				$P.$findn("upTheadTr").find("th").not(".dummy-th").not(":eq(0)"),
				$($P.findn("row").content).find("td").not(".dummy-td").not(":eq(0)"),
				FimsSupport.getCellDefsForPrivacyCell
			);

			ctrl.query.gridType = "up";
		} else {
			if (ctrl.downDataset.empty)
				return alert("조회된 자료가 없습니다.");

			cellDefs = AppSupport.getCellDefs(
				$P.$findn("downTheadTr").find("th").not(".dummy-th").not(":eq(0)"),
				$($P.findn("row").content).find("td").not(".dummy-td").not(":eq(0)"),
				FimsSupport.getCellDefsForPrivacyCell
			);

			ctrl.query.gridType = "down";
		}
		ctrl.query.cellDefs = cellDefs;

		ctrl.download();
	}

	$P.renderList = (updown, tabGroup) => {
		var tbodyName = updown == "up" ? "upTbody" : "downTbody";
		var trs = "";
		var notFound = [$P.findn("notFound").innerHTML];
		var found = $P.findn("row").innerHTML;
		var DS = updown == "up" ? ctrl.upDataset : ctrl.downDataset;

		var replacer;
		if (updown == "up") {
			replacer = (str, dataItem) => str
			.replace(/{onclick}/gi, "pageObject['${pageName}'].ctrl.upDataset.setCurrent('{DATA-INDEX}');")
			.replace(/{ondblclick}/gi, "pageObject['${pageName}'].getInfo('{DATA-INDEX}', '" + dataItem.getValue("CRDN_ID") + "');")
		} else {
			replacer = (str, dataItem) => str
			.replace(/{onclick}/gi, "pageObject['${pageName}'].ctrl.downDataset.setCurrent('{DATA-INDEX}');")
            .replace(/{ondblclick}/gi, "pageObject['${pageName}'].getInfo('{DATA-INDEX}', '" + dataItem.getValue("CRDN_ID") + "');")
		}

		var empty = DS.empty;
		if (empty) {
			trs = notFound;
			$P.setTotalData(updown, []);
		} else if (tabGroup == "전체") {
			trs = DS.inStrings(found, replacer);
			$P.setTotalData(updown, DS._items);
		} else {
			var temp = DS._items;
			var filtered = filtered = temp.filter(item => item.data.TAB_GROUP == tabGroup);

			$P.setTotalData(updown, filtered);

			if (filtered.lenth < 1) {
				trs = notFound;
			} else {
				DS._items = filtered;

				trs = DS.inStrings(found, replacer);

				DS._items = temp;
			}
		}

		$P.$findn(tbodyName).html(trs.join());

		//보안모드
	    fn_securityModeToggle($("#securityMode--top").is(":checked"));
	}

	//합계 표시
	$P.setTotalData = (updown, list) => {
		if (updown == "up") {
			$P.$findn("minapCnt").set(list.length);
			var minapAmt = list.reduce((a, b) => a + ifEmpty(b.data.MINAP_AMT,0), 0);
			$P.$findn("minapAmt").set(minapAmt);

			var listForSgg = list.filter(item => MY_INFO.info.sggCd == item.data.SGG_CD);
			$P.$findn("minapCntForSgg").set(listForSgg.length);
			var minapAmtForSgg = listForSgg.reduce((a, b) => a + ifEmpty(b.data.MINAP_AMT,0), 0);
			$P.$findn("minapAmtForSgg").set(minapAmtForSgg);
		} else {
			var sunapList = list.filter(item => item.data.TAB_GROUP == '수납');
			var sonList = list.filter(item => item.data.TAB_GROUP == '결손');

			$P.$findn("sunapCnt").set(sunapList.length);
			var sunapAmt = sunapList.reduce((a, b) => a + ifEmpty(b.data.RCVMT_AMT,0), 0);
			$P.$findn("sunapAmt").set(sunapAmt);

			var sunapListForSgg = sunapList.filter(item => MY_INFO.info.sggCd == item.data.SGG_CD);
			$P.$findn("sunapCntForSgg").set(sunapListForSgg.length);
			var sunapAmtForSgg = sunapListForSgg.reduce((a, b) => a + ifEmpty(b.data.RCVMT_AMT,0), 0);
			$P.$findn("sunapAmtForSgg").set(sunapAmtForSgg);

			var sonListForSgg = sonList.filter(item => MY_INFO.info.sggCd == item.data.SGG_CD);
			$P.$findn("sonCntForSgg").set(sonListForSgg.length);
			var sonAmtForSgg = sonListForSgg.reduce((a, b) => a + ifEmpty(b.data.LAST_AMT,0), 0);
			$P.$findn("sonAmtForSgg").set(sonAmtForSgg);
		}
	};

	//납부자번호 복사
	$P.fnCopyPyrNo = (updown) => {
		var cur = updown == "up" ? ctrl.upDataset.getCurrent() : ctrl.downDataset.getCurrent();
		clipboardCopy(cur.RTPYR_NO);

		$P.$findn("toastText").html("납부자번호가 복사되었습니다.");
		$P.toast.show();
	}

	//특기사항관리
	$P.fnManageEtcCn = (updown) => {
		var cur = updown == "up" ? ctrl.upDataset.getCurrent() : ctrl.downDataset.getCurrent();
		if (cur.length <= 0)
			return dialog.alert("처리할 자료가 없습니다.");
	}

	//특기사항일괄입력
	$P.fnInputEtcCn = (updown) => {
		var cur = updown == "up" ? ctrl.upDataset : ctrl.downDataset;
		if (cur.length <= 0)
			return dialog.alert("처리할 자료가 없습니다.");

		var list = cur.getDataset();
		var grouped = Object.groupBy(list, ({ CRDN_ID }) => CRDN_ID);
		var crdnIds = Object.keys(grouped);

		ajax.get({
			url : wctx.url("/sprt/sprt01/100/info.do")
			, data : { crdnIds : crdnIds.join(",") }
			, success : (resp) => {
				let dialogName = "inputEtcCnDialog";
				let dialogId = dialogName+"-"+uuid();

				dialog.open({
					  id : dialogId
					, title : "특기사항입력-일괄"
					, size : "xl"
					, content : resp
					, init : () => {
						$("#"+dialogId).attr("name", dialogName);
						$("#"+dialogId).attr("data-ref-doctx","${pageName}");
						let refDlgId = $P.refDlgId(dialogName);

						var found = $("#"+refDlgId).find("table template")[0].innerHTML;
						var trs = cur.inStrings(found, null);
						$("#"+refDlgId).find("tbody").html(trs.join());
					}
					, onClose : () => { }
				});
			}
		});

	}

	//단속내역서,단속확인서
	$P.fnPrintCrdn = () => {
		var upDataset = ctrl.upDataset;
		var downDataset = ctrl.downDataset;

		if ((upDataset.length <= 0) && (downDataset.length <= 0))
			return dialog.alert("출력할 자료가 없습니다.");

		var upArr = upDataset.getDataset();
		var downArr = downDataset.getDataset();
		var unionArray = [...upArr, ...downArr];
		var crdnIds = Object.keys(Object.groupBy(unionArray, ({ CRDN_ID }) => CRDN_ID));

		ajax.get({
			url : wctx.url("/sprt/sprt01/110/info.do")
			, data : { crdnIds : crdnIds.join(",") }
			, success : (resp) => {
				let dialogName = "printCrdnDialog";
				let dialogId = dialogName+"-"+uuid();

				dialog.open({
					 id : dialogId
					, title : "종합조회-단속내역"
					, size : "xl"
					, content : resp
					, init : () => {
						$("#"+dialogId).attr("name", dialogName);
						$("#"+dialogId).attr("data-ref-doctx","${pageName}");
						let refDlgId = $P.refDlgId(dialogName);

						var found = $("#"+refDlgId).find("table template")[0].innerHTML;
						var trs1 = upDataset.inStrings(found, null);
						var trs2 = downDataset.inStrings(found, null);
						$("#"+refDlgId).find("tbody").html(trs1.join()+trs2.join());
					}
					, onClose : () => { }
				});
			}
		});

	}

	//교부청구서,채권신고서
	$P.fnPrintBill = () => {
		var upDataset = ctrl.upDataset;
		if (upDataset.length <= 0)
			return dialog.alert("출력할 자료가 없습니다.");

		var upArr = upDataset.getDataset();
		var crdnIds = Object.keys(Object.groupBy(upArr, ({ CRDN_ID }) => CRDN_ID));

		ajax.get({
			url : wctx.url("/sprt/sprt01/120/info.do")
			, data : { crdnIds : crdnIds.join(",") }
			, success : (resp) => {
				let dialogName = "printBillDialog";
				let dialogId = dialogName+"-"+uuid();

				dialog.open({
					 id : dialogId
					, title : "종합조회-교부청구서,채권신고서"
					, size : "xl"
					, content : resp
					, init : () => {
						$("#"+dialogId).attr("name", dialogName);
						$("#"+dialogId).attr("data-ref-doctx","${pageName}");
						let refDlgId = $P.refDlgId(dialogName);

						var found = $("#"+refDlgId).find("table template")[0].innerHTML;
						var trs = upDataset.inStrings(found, null);
						$("#"+refDlgId).find("tbody").html(trs.join());


						var parentRes = new Object();
						var childReq = pageObject.childReq.pop();

						for(var reqKey in childReq) {
						    if ($P.provide[reqKey]) {
						    	parentRes[reqKey] = $P.provide[reqKey];
						    } else {
						    	parentRes[reqKey] = function() {};
						    }
						}

						pageObject.parentRes.push(parentRes);
					}
					, onClose : () => { }
				});
			}
		});
	}

	//납부확인서
	$P.fnPrintRcvmtConfirm = () => {
		var downDataset = ctrl.downDataset;
		if (downDataset.length <= 0)
			return dialog.alert("출력할 자료가 없습니다.");

		var downArr = downDataset.getDataset();
		var crdnIds = Object.keys(Object.groupBy(downArr, ({ CRDN_ID }) => CRDN_ID));
		var parameter = toQuery({
			crdnIds : crdnIds.join(",")
		});

		document.location.href = wctx.url("/sprt/sprt01/130/makeRcvmtConfirmFileFromHwpFormat.do") + "?" + parameter;
	}

	//사전통지서
	$P.fnPrintAdvntce = () => {
		var upDataset = ctrl.upDataset;
		if (upDataset.length <= 0)
			return dialog.alert("출력할 자료가 없습니다.");

		var upArr = upDataset.getDataset();
		var crdnIds = Object.keys(Object.groupBy(upArr, ({ CRDN_ID }) => CRDN_ID));

		ajax.get({
			url : wctx.url("/sprt/sprt01/140/info.do")
			, data : { crdnIds : crdnIds.join(",") }
			, success : (resp) => {
				let dialogName = "printAdvntceDialog";
				let dialogId = dialogName+"-"+uuid();

				dialog.open({
					id : dialogId,
					title : "종합조회-사전통지서",
					size : "xl",
					content : resp,
					init : () => {
						$("#"+dialogId).attr("name", dialogName);
						$("#"+dialogId).attr("data-ref-doctx","${pageName}");
						let refDlgId = $P.refDlgId(dialogName);

						var found = $("#"+refDlgId).find("table template")[0].innerHTML;
						var trs = upDataset.inStrings(found, null);
						$("#"+refDlgId).find("tbody").html(trs.join());


						var parentRes = new Object();
						var childReq = pageObject.childReq.pop();

						for(var reqKey in childReq) {
						    if ($P.provide[reqKey]) {
						    	parentRes[reqKey] = $P.provide[reqKey];
						    } else {
						    	parentRes[reqKey] = function() {};
						    }
						}

						pageObject.parentRes.push(parentRes);
					},
					onClose : () => { }
				});
			}
		});
	}

	//고지서
	$P.fnPrintNht = () => {
		var upDataset = ctrl.upDataset;
		if (upDataset.length <= 0)
			return dialog.alert("출력할 자료가 없습니다.");

		var upArr = upDataset.getDataset();
		var crdnIds = Object.keys(Object.groupBy(upArr, ({ CRDN_ID }) => CRDN_ID));

		ajax.get({
			url : wctx.url("/sprt/sprt01/150/info.do")
			, data : { crdnIds : crdnIds.join(",") }
			, success : (resp) => {
				let dialogName = "printNhtDialog";
				let dialogId = dialogName+"-"+uuid();

				dialog.open({
					id : dialogId,
					title : "종합조회-고지서",
					size : "xl",
					content : resp,
					init : () => {
						$("#"+dialogId).attr("name", dialogName);
						$("#"+dialogId).attr("data-ref-doctx","${pageName}");
						let refDlgId = $P.refDlgId(dialogName);

						var found = $("#"+refDlgId).find("table template")[0].innerHTML;
						var trs = upDataset.inStrings(found, null);
						$("#"+refDlgId).find("tbody").html(trs.join());

						var parentRes = new Object();
						var childReq = pageObject.childReq.pop();

						for(var reqKey in childReq) {
						    if ($P.provide[reqKey]) {
						    	parentRes[reqKey] = $P.provide[reqKey];
						    } else {
						    	parentRes[reqKey] = function() {};
						    }
						}

						pageObject.parentRes.push(parentRes);
					},
					onClose : () => { }
				});
			}
		});

	}

	//개별총정보 dialog
	$P.getInfo = (dataIndex, crdnId) => {
		if (!dataIndex) return;
        if (!crdnId) return;

		var upDataset = ctrl.upDataset;
		var downDataset = ctrl.downDataset;

		if (upDataset.length > 0) {
			var info = upDataset.getData(dataIndex);
			if (info != null) {
				ctrl.flag = "up";
			}
		}

		if (downDataset.length > 0) {
			var info = downDataset.getData(dataIndex);
			if (info != null) {
				ctrl.flag = "down";
			}
		}

		crdnTotalInfo({
			callPageName : "${pageName}",
			crdnId : crdnId
		});
	}

	$P.provide = {
		"getInfo" : function(crdnId) {
			var upDataset = ctrl.upDataset;
			var downDataset = ctrl.downDataset;

			if (upDataset.length > 0) {
				let filtered = upDataset.getDataset("item").filter(item=>item.data.CRDN_ID == crdnId);
				if (filtered != null && filtered.length > 0)
					return upDataset.getData(filtered[0].index);
			}

			if (downDataset.length > 0) {
				let filtered = downDataset.getDataset("item").filter(item=>item.data.CRDN_ID == crdnId);
				if (filtered != null && filtered.length > 0)
					return downDataset.getData(filtered[0].index);
			}

			return null;
	   	},
	   	"isAllSameTask" : function(crdnIdArr) {
	   		var upArr = ctrl.upDataset.getDataset();
	   		var downArr = ctrl.downDataset.getDataset();
	   		var unionArr = [...upArr, ...downArr];

	   		var filtered = unionArr.filter(item => crdnIdArr.includes(item.CRDN_ID));
	   		var taskSeCd = filtered[0].TASK_SE_CD;
	   		return filtered.every(item => item.TASK_SE_CD == taskSeCd);
	   	}
	};
	/**************************************************************************
	 * Event
	 **************************************************************************/
	//이벤트
	$P.setEvent = () => {
		$P.$findn("btnReset").on("click", function() { $P.fnReset(); });
		$P.$findn("btnSearch").on("click", function() { $P.fnSearchList(); });
		// 동적검색에서 엔터(Enter) 키를 누르면 검색한다.
		$P.$findn("term").onEnterPress($P.fnSearchList);
		$P.$findn("btnPrintCrdn").on("click", function() { $P.fnPrintCrdn(); });
		$P.$findn("btnPrintBill").on("click", function() { $P.fnPrintBill(); });

		$P.$findn("btnUpExcel").on("click", function() { $P.fnExcel("up"); });
		$P.$findn("btnDownExcel").on("click", function() { $P.fnExcel("down"); });

		$P.$findn("btnUpCopyPyrNo").on("click", function() { $P.fnCopyPyrNo("up"); });
		$P.$findn("btnDownCopyPyrNo").on("click", function() { $P.fnCopyPyrNo("down"); });

		$P.$findn("btnUpManageEtcCn").on("click", function() { $P.fnManageEtcCn("up"); });
		$P.$findn("btnDownManageEtcCn").on("click", function() { $P.fnManageEtcCn("down"); });

		$P.$findn("btnUpInputEtcCn").on("click", function() { $P.fnInputEtcCn("up"); });
		$P.$findn("btnDownInputEtcCn").on("click", function() { $P.fnInputEtcCn("down"); });

		$P.$findn("btnDownPrintRcvmtConfirm").on("click", function() { $P.fnPrintRcvmtConfirm(); });

		$P.$findn("btnUpPrintAdvntce").on("click", function() { $P.fnPrintAdvntce(); });
		$P.$findn("btnPrintNht").on("click", function() { $P.fnPrintNht(); });

		//$("#btn").on("click", function() { });

		// 달력 초기화
		AppSupport.initDatepicker($P.findn("frmSearch"));
		AppSupport.initDetailSearchButton($P.findn("frmSearch"));

		$P.$findn("frmSearch").find(".form-time").each(function() {
			$(this).on("input",function() {
				var value = this.value.replaceAll(":","");

				if (value.length > 5) {
					this.value = value.substring(0,2)+":"+value.substring(2,4)+":"+value.substring(4);
				} else if (value.length > 3) {
					this.value = value.substring(0,2)+":"+value.substring(2);
				}

			});
		});

		// DataTables width 변경 조정
		Componentization.fnMakeResizableTable($P.findn("table-responsive-up"));
		Componentization.fnMakeResizableTable($P.findn("table-responsive-down"));
	}

	/**************************************************************************
	* script 진입
	**************************************************************************/
	$P.$findn("upTheadTr").html($P.findn("cols").innerHTML);
	$P.$findn("downTheadTr").html($P.findn("cols").innerHTML);

	// 이벤트 설정
	$P.setEvent();

	// 보안모드
    fn_securityModeToggle($("#securityMode--top").is(":checked"));

	$P.fnResetAndChangeBiz("");

	if (fastSearch) {
		fastSearch = false;

		if ($("#fastBy--top").val() == "vhrno") {
			$P.$findn("ischVhrno").val($("#fastTerm--top").val());
		} else if ($("#fastBy--top").val() == "rtpyrNm") {
			$P.$findn("ischRtpyrNm").val($("#fastTerm--top").val());
		} else if ($("#fastBy--top").val() == "rtpyrNo") {
			$P.$findn("ischRtpyrNo").val($("#fastTerm--top").val());
		} else if ($("#fastBy--top").val() == "cvlcptAplcntNm") {
			$P.$findn("ischCvlcptAplcntNm").val($("#fastTerm--top").val());
		} else {
			return;
		}

		$P.$findn("btnSearch").click();
	}
});

function getCheckboxesStatus($checkboxes) {
	return $checkboxes.length == 0 ? 0 :
		   $checkboxes.filter(":checked").length == $checkboxes.length ? 1 : -1;
}
//# sourceURL=sprt01010-main.jsp
</script>