$(window).load(function(){ // 타이틀변경 $(document).attr("title",'한국소비자원 참가격'+' 상품별 가격동향'); if(($("#keyword").val()).length > 0){ var remake = ($("#keyword").val()).split(","); var remakename = ($("#keywordname").val()).split(","); //alert(remake.length); var cnt = (remake.length)-1; for(var i = 0 ; i <= cnt ; i++){ fn_addRow(remake[i],remakename[i]); } } var sear = $("#Searchflag").val(); var term = $("#termflag").val(); //입력기간 if(term == 0){ $("[id=mon1]").css("display",""); $("[id=mon2]").css("display",""); $("[id=bon1]").css("display","none"); $("[id=bon2]").css("display","none"); $("[id=year1]").css("display","none"); $("[id=year2]").css("display","none"); $("[id=half1]").css("display","none"); $("[id=half2]").css("display","none"); }else if(term == 1){ $("[id=mon1]").css("display","none"); $("[id=mon2]").css("display","none"); $("[id=bon1]").css("display",""); $("[id=bon2]").css("display",""); $("[id=year1]").css("display","none"); $("[id=year2]").css("display","none"); $("[id=half1]").css("display","none"); $("[id=half2]").css("display","none"); }else if(term == 2){ $("[id=mon1]").css("display","none"); $("[id=mon2]").css("display","none"); $("[id=bon1]").css("display","none"); $("[id=bon2]").css("display","none"); $("[id=year1]").css("display",""); $("[id=year2]").css("display",""); $("[id=half1]").css("display","none"); $("[id=half2]").css("display","none"); }else if(term == 3){ $("[id=mon1]").css("display","none"); $("[id=mon2]").css("display","none"); $("[id=bon1]").css("display","none"); $("[id=bon2]").css("display","none"); $("[id=year1]").css("display","none"); $("[id=year2]").css("display","none"); $("[id=half1]").css("display",""); $("[id=half2]").css("display",""); } // 조건별 그리드 if(sear == '1' && term == '0' ){ $("#exceldn").css("display",""); $("#exceldnChart").css("display",""); $("#op1").css("display",""); $("#op4").css("display","none"); }else if(sear == '1' && term == '1'){ $("#exceldn").css("display",""); $("#exceldnChart").css("display",""); $("#op1").css("display",""); $("#op4").css("display","none"); }else if(sear == '1' && term == '2'){ $("#exceldn").css("display",""); $("#exceldnChart").css("display",""); $("#op1").css("display",""); $("#op4").css("display","none"); }else if(sear == '1' && term == '3'){ $("#exceldn").css("display",""); $("#exceldnChart").css("display",""); $("#op1").css("display",""); $("#op4").css("display","none"); }else if(sear == '0' && term == '0'){ $("#exceldn").css("display",""); $("#exceldnChart").css("display",""); $("#op1").css("display","none"); $("#op4").css("display",""); }else if(sear == '0' && term == '1'){ $("#exceldn").css("display",""); $("#exceldnChart").css("display",""); $("#op1").css("display","none"); $("#op4").css("display",""); }else if(sear == '0' && term == '2'){ $("#exceldn").css("display",""); $("#exceldnChart").css("display",""); $("#op1").css("display","none"); $("#op4").css("display",""); }else if(sear == '0' && term == '3'){ $("#exceldn").css("display",""); $("#exceldnChart").css("display",""); $("#op1").css("display","none"); $("#op4").css("display",""); } //개월 조정을 위한 부분 if(($("#categories").val()).length > 0){ var startbun = Number($("#startNum").val()); var endbun = Number($("#endNum").val()); var countbun = Number($("#countNum").val()); //alert(startbun); //alert(endbun); if(endbun > 5){ for(i = startbun ; i <= countbun ; i++){ $("[name="+i+"]").css("display",""); } if(endbun == countbun){ $("[name=prevGo]").show(); $("[name=nextGo]").hide(); $("[name=pre_btn]").show(); $("[name=next_btn]").hide(); }else if(startbun == 1){ $("[name=prevGo]").hide(); $("[name=nextGo]").show(); $("[name=pre_btn]").hide(); $("[name=next_btn]").show(); }else{ $("[name=prevGo]").show(); $("[name=nextGo]").show(); $("[name=pre_btn]").show(); $("[name=next_btn]").show(); } }else{ for(i=startbun ; i<= endbun ;i++){ $("[name="+i+"]").css("display",""); $("[name=prevGo]").hide(); $("[name=nextGo]").hide(); $("[name=pre_btn]").hide(); $("[name=next_btn]").hide(); } } } // 상품 대분류코드 fn_getCodeStatI("selectD","1","",$("#dflag").val(),""); // 상품 중분류코드 if($("#dflag").val() != ""){ fn_getCodeStatI("selectJ","2",$("#dflag").val(),$("#jflag").val(),""); }else{ $("#selectD").trigger('change'); } // 상품 소분류코드 if($("#jflag").val() != ""){ fn_getCodeStatI("selectS","3",$("#jflag").val(),$("#sflag").val()); }else{ $("#selectJ").trigger('change'); } // 상품 코드 if($("#sflag").val() != ""){ fn_getCodeTGood($("#sflag").val(), "selectP", ""); } var searchManu = $("#searchManu").val(); if(searchManu == '1'){ $("[id=search1]").hide(); $("#menu1").attr('class','on'); $("#menu2").attr('class',''); $("#tabText").html("상품별 가격동향"); }else if (searchManu == '2'){ $("[id=search1]").show(); $("#menu1").attr('class',''); $("#menu2").attr('class','on'); $("#tabText").html("선택상품별 가격동향"); } // 2024.04.12 웹접근성 viewflag 재정리 by 이승진 var viewflag = $("#viewflag").val(); if(viewflag == '3'){ $("#all").attr('class','btn_sort on'); $("#sall").attr('class','btn_sort'); $("#base").attr('class','btn_sort'); $('#hContentTitle').text('선택상품별 전체가격 생필품 가격동향 목록'); var title = $(document).attr("title") + " - 전체가격"; $(document).attr("title", title); }else if(viewflag == '1'){ $("#all").attr('class','btn_sort'); $("#sall").attr('class','btn_sort on'); $("#base").attr('class','btn_sort'); $('#hContentTitle').text('선택상품별 판매가격 생필품 가격동향 목록'); var title = $(document).attr("title") + " - 판매가격"; $(document).attr("title", title); }else if(viewflag == '0'){ $("#all").attr('class','btn_sort'); $("#sall").attr('class','btn_sort'); $("#base").attr('class','btn_sort on'); $('#hContentTitle').text('선택상품별 단위가격 생필품 가격동향 목록'); var title = $(document).attr("title") + " - 단위가격"; $(document).attr("title", title); } // 버튼 선택됨 표시 $('#exceldn a.btn_sort').each(function(){ var title = $(this).attr('title'); if($(this).hasClass('on')) { title += ' 선택됨'; } $(this).attr('title',title); }); }); $(document).ready(function(){ // 엔터 입력 시 submit 방지 // $("form").keydown(function (key) { // if(key.keyCode == 13){ // return false; // } // }); //페이지 UNIT 갯수 수정 $("#pageUnit").change(function() { $("#searchOrExcel").val("search"); var termflag = $("#termflag").val(); var Searchflag = $("#Searchflag").val(); var url = ""; if(Searchflag == '1' && termflag == '0'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendMList.do"; }else if(Searchflag == '0' && termflag == '0'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendMtomList.do"; }else if(Searchflag == '1' && termflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendBList.do"; }else if(Searchflag == '0' && termflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendBtobList.do"; }else if(Searchflag == '1' && termflag == '2'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendYList.do"; }else if(Searchflag == '0' && termflag == '2'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendYtoyList.do"; }else if(Searchflag == '1' && termflag == '3'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendHList.do"; }else if(Searchflag == '0' && termflag == '3'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendHtohList.do"; } // 프로그래스바 시작 fn_progressPop(); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); }); $("input[type=checkbox]").click(function() { var intLength = $("input[type=checkbox]:checked").length; if(intLength > 5) { alert("차트보기 상품은 5개 까지 가능합니다."); $(this).attr("checked", false); return; } }); $("[name=prevGo]").click(function(){ var startbun = $("#startNum").val();//시작 var endbun = $("#endNum").val();//끝 var countbun = $("#countNum").val();//디스플레이 번호 var end = Number(endbun); var count = Number(countbun) - 1; var start = Number(startbun) - 1; if(count >4){ $("#countNum").val(count); $("#startNum").val(start); $("[name="+countbun+"]").css("display","none"); $("[name="+start+"]").css("display",""); } if(start == '1'){ $("[name=prevGo]").hide(); $("[name=pre_btn]").hide(); }else{ $("[name=prevGo]").show(); $("[name=pre_btn]").show(); } if(count == end){ $("[name=nextGo]").hide(); $("[name=next_btn]").hide(); }else { $("[name=nextGo]").show(); $("[name=next_btn]").show(); } }); $("[name=nextGo]").click(function(){ var startbun = $("#startNum").val(); var endbun = $("#endNum").val(); var countbun = $("#countNum").val(); var end = Number(endbun); var count = Number(countbun) + 1; var start = Number(startbun) + 1; //alert(startbun +"/"+ endbun +"/"+ countbun ); if( end >= count){ $("#countNum").val(count); $("#startNum").val(start); $("[name="+count+"]").css("display",""); $("[name="+startbun+"]").css("display","none"); } if(count == end){ $("[name=nextGo]").hide(); $("[name=next_btn]").hide(); }else{ $("[name=nextGo]").show(); $("[name=next_btn]").show(); } if(start > 1){ $("[name=prevGo]").show(); $("[name=pre_btn]").show(); }else{ $("[name=prevGo]").hide(); $("[name=pre_btn]").hide(); } }); $("#all").click(function(){ $("#viewflag").val("3"); $("#all").css('color','blue'); $("#search_btn").trigger("click"); }); $("#base").click(function(){ $("#viewflag").val("0"); $("#base").css('color','blue'); $("#search_btn").trigger("click"); }); $("#sall").click(function(){ $("#viewflag").val("1"); $("#sall").css('color','blue'); $("#search_btn").trigger("click"); }); $("#menu1").click(function(){ $("#searchManu").val("1"); $("#menu1").attr('class','on'); $("#menu2").attr('class',''); $("#ul_searchGood li").remove(); $("[id=search1]").hide(); $("#search_h").text("상품별 가격동향 검색"); $('#menu1 a').attr('title', $('#menu1 a').text() + ' 선택됨'); $('#menu2 a').attr('title', $('#menu2 a').text()); }); $("#menu2").click(function(){ $("#searchManu").val("2"); $("#menu1").attr('class',''); $("#menu2").attr('class','on'); $("[id=search1]").show(); $("#search_h").text("선택 상품별 가격동향 검색"); $('#menu1 a').attr('title', $('#menu1 a').text()); $('#menu2 a').attr('title', $('#menu2 a').text() + ' 선택됨'); }); // 중분류값 $("#selectD").change(function(){ $('#selectJ, #selectS, #selectP').find("option").each(function(){ $(this).remove(); }); $('#selectJ').append(""); $('#selectS').append(""); $('#selectP').append(""); var highCode = $(this).val(); if(highCode != '0'){ fn_getCodeStatI("selectJ","2",highCode,"",""); } }); // 소분류값 $("#selectJ").change(function(){ $('#selectS, #selectP').find("option").each(function(){ $(this).remove(); }); $('#selectS').append(""); $('#selectP').append(""); var highCode = $(this).val(); if(highCode != '0'){ fn_getCodeStatI("selectS","3",highCode,""); } }); // 상품값 $("#selectS").change(function(){ $('#selectP').find("option").each(function(){ $(this).remove(); }); var goodSmlclsCode = $(this).val(); fn_getCodeTGood(goodSmlclsCode, "selectP",""); }); // 기간유형 변경시 날짜 박스 컨트롤 $("[name=term]").change(function(){ var term = $("#term option:selected").val(); $("#termflag").val(term); if(term == 0){ $("#mon1").css("display",""); $("#mon2").css("display",""); $("#bon1").css("display","none"); $("#bon2").css("display","none"); $("#year1").css("display","none"); $("#year2").css("display","none"); $("#half1").css("display","none"); $("#half2").css("display","none"); $("#mon1").find('option:first').attr('selected', 'selected'); $("#mon2").find('option:first').attr('selected', 'selected'); }else if(term == 1){ $("#mon1").css("display","none"); $("#mon2").css("display","none"); $("#bon1").css("display",""); $("#bon2").css("display",""); $("#year1").css("display","none"); $("#year2").css("display","none"); $("#half1").css("display","none"); $("#half2").css("display","none"); $("#bon1").find('option:first').attr('selected', 'selected'); $("#bon2").find('option:first').attr('selected', 'selected'); }else if(term == 2){ $("#mon1").css("display","none"); $("#mon2").css("display","none"); $("#bon1").css("display","none"); $("#bon2").css("display","none"); $("#year1").css("display",""); $("#year2").css("display",""); $("#half1").css("display","none"); $("#half2").css("display","none"); $("#year1").find('option:first').attr('selected', 'selected'); $("#year2").find('option:first').attr('selected', 'selected'); }else if(term == 3){ $("#mon1").css("display","none"); $("#mon2").css("display","none"); $("#bon1").css("display","none"); $("#bon2").css("display","none"); $("#year1").css("display","none"); $("#year2").css("display","none"); $("#half1").css("display",""); $("#half2").css("display",""); $("#half1").find('option:first').attr('selected', 'selected'); $("#half2").find('option:first').attr('selected', 'selected'); } }); //조회 $("#search_btn").click(function(){ $("#searchOrExcel").val("search"); // 페이지 번호 초기화 $("[name=pageNo]").val("1"); //리스트테이블 기간 값 셋팅 $("#startNum").val("1"); $("#countNum").val("5"); // 검색조건 유지값 셋팅 var sflag = $("#selectS option:selected").val(); $("#sflag").val(sflag); var jflag = $("#selectJ option:selected").val(); $("#jflag").val(jflag); var dflag = $("#selectD option:selected").val(); $("#dflag").val(dflag); var termflag = $("#term option:selected").val(); $("#termflag").val(termflag); var Searchflag = $("#sear option:selected").val(); $("#Searchflag").val(Searchflag); var viewflag = $("#viewflag").val(); if(viewflag != '0' && viewflag != '1'&& viewflag != '2' && viewflag != '3'){ $("#viewflag").val("3"); } if(termflag =='1'){ $("#datename").val("분 기"); }else if(termflag =='3'){ $("#datename").val("반 기"); }else if(termflag =='2'){ $("#datename").val("년 도"); }else{ $("#datename").val("월"); } //초기화 $("#twelve").val(""); $("#eleven").val(""); $("#ten").val(""); $("#nine").val(""); $("#eight").val(""); $("#seven").val(""); $("#six").val(""); $("#five").val(""); $("#four").val(""); $("#three").val(""); $("#two").val(""); $("#one").val(""); //조회상품 LIST 작성 var keyword = new Array(); var keywordname = new Array(); $("#ul_searchGood li").each(function(i){ keyword.push($(this).children("#val").val()); keywordname.push($(this).children("#text").val()); }); $("#keyword").val(keyword); $("#keywordname").val(keywordname); var url = ""; if(Searchflag == '1' && termflag == '0'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendMList.do"; }else if(Searchflag == '0' && termflag == '0'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendMtomList.do"; }else if(Searchflag == '1' && termflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendBList.do"; }else if(Searchflag == '0' && termflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendBtobList.do"; }else if(Searchflag == '1' && termflag == '2'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendYList.do"; }else if(Searchflag == '0' && termflag == '2'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendYtoyList.do"; }else if(Searchflag == '1' && termflag == '3'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendHList.do"; }else if(Searchflag == '0' && termflag == '3'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendHtohList.do"; } // 프로시그바 시작 fn_progressPop(); //월 기간셋팅 if(Searchflag == '1' && termflag == '0'){ var mon1 = $("#mon1 option:selected").val(); $("#monthS").val(mon1); var mon2 = $("#mon2 option:selected").val(); $("#monthE").val(mon2); var one1 = Number(mon1.substring(0,4)); var one2 = Number(mon1.substring(5,7)); $("#one").val(mon1); var gap = one1*12+one2; var two = $("#mon2 option:selected").val(); var two1 = Number(two.substring(0,4)); var two2 = Number(two.substring(5,7)); var Cnt = (two1*12+two2)-(one1*12+one2); $("#Cnt").val(Cnt); if(Cnt > 11){ alert("조회가능한 기간은 최대 12개월 입니다."); fn_progressPopClose(); }else if(Cnt < 0){ alert("선택하신 조회 종료월이 시작월의 이전 시점입니다."); fn_progressPopClose(); }else if(Cnt == 0){ alert("선택하신 입력월이 동일합니다. "); fn_progressPopClose(); } else { var arrid = new Array(); var start =""; for(var i=1; i <=Cnt ; i++ ){ var searstart1 = Math.floor(((gap+i)/12)); var searstart2 = (gap+i)%12; if(searstart2 == 1){ start = "-01"; }else if(searstart2 == 2){ start = "-02"; }else if(searstart2 == 3){ start = "-03"; }else if(searstart2 == 4){ start = "-04"; }else if(searstart2 == 5){ start = "-05"; }else if(searstart2 == 6){ start = "-06"; }else if(searstart2 == 7){ start = "-07"; }else if(searstart2 == 8){ start = "-08"; }else if(searstart2 == 9){ start = "-09"; }else if(searstart2 == 10){ start = "-10"; }else if(searstart2 == 11){ start = "-11"; }else if(searstart2 == 0){ start = "-12"; searstart1 = searstart1-1; } var startyearmon = String(searstart1)+start; arrid.push(startyearmon); } $("#twelve").val(arrid[10]); $("#eleven").val(arrid[9]); $("#ten").val(arrid[8]); $("#nine").val(arrid[7]); $("#eight").val(arrid[6]); $("#seven").val(arrid[5]); $("#six").val(arrid[4]); $("#five").val(arrid[3]); $("#four").val(arrid[2]); $("#three").val(arrid[1]); $("#two").val(arrid[0]); var categories = new Array(); categories.push(mon1); for(var j =0 ; j <= Cnt-1 ; j++){ categories.push(arrid[j]); } $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); } } //월 비교셋팅 else if (Searchflag == '0' && termflag == '0'){ var mon1 = $("#mon1 option:selected").val(); $("#monthS").val(mon1); var mon2 = $("#mon2 option:selected").val(); $("#monthE").val(mon2); if(mon1 != mon2){ $("#one").val(mon1); $("#two").val(mon2); var categories = new Array(); categories.push(mon1); categories.push(mon2); $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); }else{ alert("선택 월이 동일합니다."); fn_progressPopClose(); } } //분기 기간셋팅 else if (Searchflag == '1' && termflag == '1'){ var bon1 = $("#bon1 option:selected").val(); $("#monthS").val(bon1); var bon2 = $("#bon2 option:selected").val(); $("#monthE").val(bon2); $("#one").val(bon1); var one1 = Number(bon1.substring(0,4)); var one2 = Number(bon1.substring(5,6)); var last1 = Number(bon2.substring(0,4)); var last2 = Number(bon2.substring(5,6)); var gap = one1*4+one2; var Cnt = (last1*4+last2)-(one1*4+one2); $("#Cnt").val(Cnt); if(Cnt > 7){ alert("조회가능한 분기는 최대 8분기 입니다."); fn_progressPopClose(); }else if(Cnt < 0){ alert("선택하신 조회 분기가 시작분기 이전 시점입니다."); fn_progressPopClose(); }else if(Cnt == 0){ alert("선택하신 분기가 동일합니다. "); fn_progressPopClose(); } else { var arrid = new Array(); var start =""; for(var i=1; i <=Cnt ; i++ ){ var searstart1 = Math.floor(((gap+i)/4)); var searstart2 = (gap+i)%4; if(searstart2 == 1){ start = "-1"; }else if(searstart2 == 2){ start = "-2"; }else if(searstart2 == 3){ start = "-3"; }else if(searstart2 == 0){ start = "-4"; searstart1 = searstart1-1; } var startyearmon = String(searstart1)+start; arrid.push(startyearmon); } $("#eight").val(arrid[6]); $("#seven").val(arrid[5]); $("#six").val(arrid[4]); $("#five").val(arrid[3]); $("#four").val(arrid[2]); $("#three").val(arrid[1]); $("#two").val(arrid[0]); var categories = new Array(); categories.push(bon1); for(var j =0 ; j <= Cnt-1 ; j++){ categories.push(arrid[j]); } $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); } } //분기 비교셋팅 else if (Searchflag == '0' && termflag == '1'){ var bon1 = $("#bon1 option:selected").val(); $("#monthS").val(bon1); var bon2 = $("#bon2 option:selected").val(); $("#monthE").val(bon2); if(bon1 != bon2){ $("#one").val(bon1); $("#two").val(bon2); var categories = new Array(); categories.push(bon1); categories.push(bon2); $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); }else{ alert("선택한 분기가 동일합니다."); fn_progressPopClose(); } } // 년 비교 셋팅 else if (Searchflag == '0' && termflag == '2'){ var year1 = $("#year1 option:selected").val(); $("#monthS").val(year1); var year2 = $("#year2 option:selected").val(); $("#monthE").val(year2); if(year1 != year2){ var one = $("#year1 option:selected").val(); $("#one").val(one); var two = $("#year2 option:selected").val(); $("#two").val(two); var categories = new Array(); categories.push(one); categories.push(two); $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); }else{ alert("선택한 년도가 동일합니다."); fn_progressPopClose(); } } // 년 기간 셋팅 else if (Searchflag == '1' && termflag == '2'){ var year1 = $("#year1 option:selected").val(); $("#monthS").val(year1); var year2 = $("#year2 option:selected").val(); $("#monthE").val(year2); $("#one").val(year1); var one1 = Number(year1); var one2 = Number(year2); var Cnt = one2-one1; $("#Cnt").val(Cnt); if(Cnt > 3){ alert("조회가능한 년도는 최대 4년도 입니다."); fn_progressPopClose(); }else if(Cnt < 0){ alert("선택하신 조회 년도가 시작년도 이전 시점입니다."); fn_progressPopClose(); }else if(Cnt == 0){ alert("선택하신 년도가 동일합니다. "); fn_progressPopClose(); } else { var arrmon = new Array(); var categories = new Array(); categories.push(year1); for(var i=1 ; i <= Cnt ; i++){ arrmon.push(one1+i); categories.push(one1+i); } var endNum = categories.length; $("#endNum").val(endNum); $("#four").val(arrmon[2]); $("#three").val(arrmon[1]); $("#two").val(arrmon[0]); // alert(categories); $("#categories").val(categories); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); } } //반기 기간셋팅 else if (Searchflag == '1' && termflag == '3'){ var half1 = $("#half1 option:selected").val(); $("#monthS").val(half1); var half2 = $("#half2 option:selected").val(); $("#monthE").val(half2); $("#one").val(half1); var one1 = Number(half1.substring(0,4)); var one2 = Number(half1.substring(5,6)); var last1 = Number(half2.substring(0,4)); var last2 = Number(half2.substring(5,6)); var gap = one1*2+one2; var Cnt = (last1*2+last2)-(one1*2+one2); $("#Cnt").val(Cnt); if(Cnt > 7){ alert("조회가능한 (상/하)반기는 최대 8(상/하)반기 입니다."); fn_progressPopClose(); }else if(Cnt < 0){ alert("선택하신 조회 (상/하)반기가 시작(상/하)반기 이전 시점입니다."); fn_progressPopClose(); }else if(Cnt == 0){ alert("선택하신 (상/하)반기가 동일합니다. "); fn_progressPopClose(); } else { var arrid = new Array(); var start =""; for(var i=1; i <=Cnt ; i++ ){ var searstart1 = Math.floor(((gap+i)/2)); var searstart2 = (gap+i)%2; if(searstart2 == 1){ start = "-1"; }else if(searstart2 == 0){ start = "-2"; searstart1 = searstart1-1; } var startyearmon = String(searstart1)+start; arrid.push(startyearmon); } $("#eight").val(arrid[6]); $("#seven").val(arrid[5]); $("#six").val(arrid[4]); $("#five").val(arrid[3]); $("#four").val(arrid[2]); $("#three").val(arrid[1]); $("#two").val(arrid[0]); var categories = new Array(); categories.push(half1); for(var j =0 ; j <= Cnt-1 ; j++){ categories.push(arrid[j]); } $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); } } //반기 비교셋팅 else if (Searchflag == '0' && termflag == '3'){ var half1 = $("#half1 option:selected").val(); $("#monthS").val(half1); var half2 = $("#half2 option:selected").val(); $("#monthE").val(half2); if(half1 == half2){ alert("선택한 (상/하)반기가 동일합니다."); fn_progressPopClose(); }else{ $("#one").val(half1); $("#two").val(half2); var categories = new Array(); categories.push(half1); categories.push(half2); $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); } } }); // 상품 추가 버튼 $("#img_addCom").click(function(){ $("#selectP option:selected").each(function(i){ var hasEntpId = false; var selVal = $(this).val(); var selText = $(this).text(); //alert("kakakakak"+selVal); if(selVal != "0"){ // 추가된 판매업체중에 같은 상품이 있는지 확인 $("#ul_searchGood li").each(function(k){ //alert($("[id=val]").eq(k).val()); if($("[id=val]").eq(k).val() == selVal){ alert("이미 등록된 상품 입니다."); hasEntpId = true; } }); if( !hasEntpId ){ fn_addRow(selVal, selText); } }else{ alert("상품을 선택해 주세요!"); } }); }); // 상품 삭제버튼 클릭 $("table").delegate(".img_delCom", "click", function(){ fn_delRow( $(".img_delCom").index(this) ); }); $("#btn_excelDownload").click(function(){ // 조회, 엑셀다운 구분자 $("#searchOrExcel").val("excel"); var termflag = $("#term option:selected").val(); $("#termflag").val(termflag); var Searchflag = $("#sear option:selected").val(); $("#Searchflag").val(Searchflag); var url = ""; if(Searchflag == '1' && termflag == '0'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendMList.do"; }else if(Searchflag == '0' && termflag == '0'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendMtomList.do"; }else if(Searchflag == '1' && termflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendBList.do"; }else if(Searchflag == '0' && termflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendBtobList.do"; }else if(Searchflag == '1' && termflag == '2'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendYList.do"; }else if(Searchflag == '0' && termflag == '2'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendYtoyList.do"; }else if(Searchflag == '1' && termflag == '3'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendHList.do"; }else if(Searchflag == '0' && termflag == '3'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getGoodTrendHtohList.do"; } $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); }); }); //상품 추가 function fn_addRow(selVal, selText){ var appendHtml = ""; appendHtml = "