$(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]); } } if(($("#shopword").val()).length > 0){ var sremake = ($("#shopword").val()).split(","); var sremakename = ($("#shopname").val()).split(","); //alert(remake.length); var cnt = (sremake.length)-1; for(var i = 0 ; i <= cnt ; i++){ sn_addRow(sremake[i],sremakename[i]); } } var term = $("#termflag").val(); var sear = $("#Searchflag").val(); //입력기간 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"); }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"); }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"); }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",""); } // 조건별 그리드 if(sear == '1' && term == '0' ){ $("#exceldn").css("display",""); $("#op1").css("display",""); $("#op4").css("display","none"); }else if(sear == '1' && term == '1'){ $("#exceldn").css("display",""); $("#op1").css("display",""); $("#op4").css("display","none"); }else if(sear == '1' && term == '2'){ $("#exceldn").css("display",""); $("#op1").css("display",""); $("#op4").css("display","none"); }else if(sear == '1' && term == '3'){ $("#exceldn").css("display",""); $("#op1").css("display",""); $("#op4").css("display","none"); }else if(sear == '0' && term == '0'){ $("#exceldn").css("display",""); $("#op1").css("display","none"); $("#op4").css("display",""); }else if(sear == '0' && term == '1'){ $("#exceldn").css("display",""); $("#op1").css("display","none"); $("#op4").css("display",""); }else if(sear == '0' && term == '2'){ $("#exceldn").css("display",""); $("#op1").css("display","none"); $("#op4").css("display",""); }else if(sear == '0' && term == '3'){ $("#exceldn").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_getCode("", "020000000", "larea", $("#lflag").val()); // 업태코드 설정 fn_getCodeStat("BU", "", "shoptype", $("#etflag").val()); // 상품 대분류코드 fn_getCodeStatI("selectD","1","",$("#dflag").val()); // 상품 중분류코드 if($("#dflag").val() != ""){ fn_getCodeStatI("selectJ","2",$("#dflag").val(),$("#jflag").val()); } // 상품 소분류코드 if($("#jflag").val() != ""){ fn_getCodeStatI("selectS","3",$("#jflag").val(),$("#sflag").val()); } // 상품 코드 if($("#sflag").val() != ""){ fn_getCodeTGood($("#sflag").val(), "selectP", ""); } var el = $("#etflag").val(); var al = $("#lflag").val(); if(al != null || al !="" || al !="0" || el != "0" ){ $('#shop').find("option").each(function(){ $(this).remove(); }); $('#shop').append(""); $.ajax({ type:"POST", url: "/tprice/portal/pricetrend/dailynecessitypricetrend/getSelectshop.do", data: "entpAreaCode="+al+"&entpTypeCode="+el, dataType:"json", success:function(data){ var tr = data.json; $.each(tr, function(key){ $('#shop').append(""); }); }, failure:function(data){ } }); } var searchManu = $("#searchManu").val(); if(searchManu == '1'){ $("[name=search1]").hide(); $("#menu1").attr('class','on'); $("#menu2").attr('class',''); }else if (searchManu == '2'){ $("[name=search1]").show(); $("#menu1").attr('class',''); $("#menu2").attr('class','on'); } var viewflag = $("#viewflag").val(); if(viewflag == '3'){ $("#all").attr('class','btn_sort on'); $("#sall").attr('class','btn_sort'); $("#base").attr('class','btn_sort'); 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'); 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'); 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(){ //페이지 UNIT 갯수 수정 $("#pageUnit").change(function() { $("#searchOrExcel").val("search"); var termflag = $("#termflag").val(); var Searchflag = $("#Searchflag").val(); var url = ""; if(termflag == '0' && searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendMList.do"; }else if(termflag == '1'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendBList.do"; }else if(termflag == '2'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendYList.do"; }else if(termflag == '3'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendHList.do"; }else if(termflag == '0'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendMtoMList.do"; }else if(termflag == '1'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendBtoBList.do"; }else if(termflag == '2'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendYtoYList.do"; }else if(termflag == '3'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendHtoHList.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(); $("#ul_searchShop li").remove(); $("[name=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'); $("[name=search1]").show(); $("#search_h").text("선택 업소별 가격동향 검색 조회"); $('#menu1 a').attr('title', $('#menu1 a').text()); $('#menu2 a').attr('title', $('#menu2 a').text() + ' 선택됨'); }); //선택 지역 업태 별 업소SELECT BOX $("#larea,#shoptype").change(function(){ $('#shop').find("option").each(function(){ $(this).remove(); }); $('#shop').append(""); var entpAreaCode = $("#larea option:selected").val(); $("#lflag").val(entpAreaCode); var entpTypeCode = $("#shoptype option:selected").val(); $("#typeflag").val(entpTypeCode); $.ajax({ type:"POST", url: "/tprice/portal/pricetrend/dailynecessitypricetrend/getSelectshop.do", data: "entpAreaCode="+entpAreaCode+"&entpTypeCode="+entpTypeCode, dataType:"json", success:function(data){ var tr = data.json; $.each(tr, function(key){ $('#shop').append(""); }); }, failure:function(data){ } }); }); // 중분류값 $("#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"); }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"); }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"); }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",""); } }); //조회 $("#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 lflag = $("#larea option:selected").val(); $("#lflag").val(lflag); var etflag = $("#shoptype option:selected").val(); $("#etflag").val(etflag); 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 != '3'){ $("#viewflag").val("3"); } //조회상품 LIST 작성 var keyword = new Array(); var keywordname = new Array(); $("#ul_searchGood li").each(function(i){ keyword.push($(this).children("#val").val()); //alert(keyword); keywordname.push($(this).children("#text").val()); }); if(termflag =='1'){ $("#datename").val("분기"); }else if(termflag =='3'){ $("#datename").val("반기"); }else if(termflag =='2'){ $("#datename").val("년"); }else{ $("#datename").val("월"); } //조회업체 LIST 작성 var shopword = new Array(); var shopname = new Array(); $("#ul_searchShop li").each(function(i){ shopword.push($(this).children("#val").val()); //alert(keyword); shopname.push($(this).children("#text").val()); }); $("#keyword").val(keyword); $("#keywordname").val(keywordname); $("#shopword").val(shopword); $("#shopname").val(shopname); var url =""; if(termflag == '0' && searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendMList.do"; }else if(termflag == '1'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendBList.do"; }else if(termflag == '2'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendYList.do"; }else if(termflag == '3'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendHList.do"; }else if(termflag == '0'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendMtoMList.do"; }else if(termflag == '1'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendBtoBList.do"; }else if(termflag == '2'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendYtoYList.do"; }else if(termflag == '3'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendHtoHList.do"; } // 프로시그바 시작 fn_progressPop(); //월 기간셋팅 if(termflag == '0' && searchflag == '1'){ var mon1 = $("#mon1 option:selected").val(); $("#monthS").val(mon1); var mon2 = $("#mon2 option:selected").val(); $("#monthE").val(mon2); $("#one").val(mon1); var one1 = Number(mon1.substring(0,4)); var one2 = Number(mon1.substring(5,7)); var two1 = Number(mon2.substring(0,4)); var two2 = Number(mon2.substring(5,7)); var gap = one1*12+one2; 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(); // alert(gap); for(var i=1; i <=Cnt ; i++ ){ var searstart1 = Math.floor(((gap+i)/12)); var searstart2 = (gap+i)%12; var start =""; 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); //alert(arrid); } $("#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 (termflag == '1' && searchflag == '1'){ var bon1 = $("#bon1 option:selected").val(); $("#monthS").val(bon1); var bon2 = $("#bon2 option:selected").val(); $("#monthE").val(bon2); var one = $("#bon1 option:selected").val(); $("#one").val(one); var last = $("#bon2 option:selected").val(); var one1 = Number(one.substring(0,4)); var one2 = Number(one.substring(5,6)); var last1 = Number(last.substring(0,4)); var last2 = Number(last.substring(5,6)); // var oneb = String(one1)+String(one2); var gap = one1*4+one2; var Cnt = (last1*4+last2)-(one1*4+one2); // alert(Cnt); $("#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(); for(var i=1; i <=Cnt ; i++ ){ var searstart1 = Math.floor(((gap+i)/4)); var searstart2 = (gap+i)%4; var start =""; 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); // alert(arrid); } $("#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 (termflag == '2' && searchflag == '1'){ 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; // alert(Cnt); $("#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); } $("#four").val(arrmon[2]); $("#three").val(arrmon[1]); $("#two").val(arrmon[0]); $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action",url) .attr("onSubmit", "return true") .submit(); } } // 반기 셋팅 else if (termflag == '3' && searchflag == '1'){ var half1 = $("#half1 option:selected").val(); $("#monthS").val(half1); var half2 = $("#half2 option:selected").val(); $("#monthE").val(half2); var one = $("#half1 option:selected").val(); $("#one").val(one); var last = $("#half2 option:selected").val(); var one1 = Number(one.substring(0,4)); var one2 = Number(one.substring(5,6)); var last1 = Number(last.substring(0,4)); var last2 = Number(last.substring(5,6)); // var oneb = String(one1)+String(one2); var gap = one1*2+one2; var Cnt = (last1*2+last2)-(one1*2+one2); // alert(Cnt); $("#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(); for(var i=1; i <=Cnt ; i++ ){ var searstart1 = Math.floor(((gap+i)/2)); var searstart2 = (gap+i)%2; var start =""; if(searstart2 == 1){ start = "-1"; }else if(searstart2 == 0){ start = "-2"; searstart1 = searstart1-1; } var startyearmon = String(searstart1)+start; arrid.push(startyearmon); // alert(arrid); } $("#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 == '0'){ var mon1 = $("#mon1 option:selected").val(); var mon2 = $("#mon2 option:selected").val(); if(mon1 == mon2){ alert("선택 월이 동일합니다."); fn_progressPopClose(); }else{ $("#monthS").val(mon1); $("#monthE").val(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 if (searchflag == '0' &&termflag == '1'){ var bon1 = $("#bon1 option:selected").val(); var bon2 = $("#bon2 option:selected").val(); $("#monthS").val(bon1); $("#monthE").val(bon2); $("#one").val(bon1); $("#two").val(bon2); if(bon1 == bon2){ alert("선택 월이 동일합니다."); fn_progressPopClose(); }else{ 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 if (searchflag == '0' && termflag == '3'){ var shalf1 = $("#half1 option:selected").val(); var shalf2 = $("#half2 option:selected").val(); $("#monthS").val(shalf1); $("#monthE").val(shalf2); $("#one").val(shalf1); $("#two").val(shalf2); if(shalf1 == shalf2){ alert("선택 분기가 동일합니다."); fn_progressPopClose(); }else{ var categories = new Array(); categories.push(shalf1); categories.push(shalf2); $("#categories").val(categories); var endNum = categories.length; $("#endNum").val(endNum); $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); } }else if (searchflag == '0' && termflag == '2'){ var year1 = $("#year1 option:selected").val(); var year2 = $("#year2 option:selected").val(); $("#monthS").val(year1); $("#monthE").val(year2); $("#one").val(year1); $("#two").val(year2); if(year1 == year2){ alert("선택 년도가 동일합니다."); fn_progressPopClose(); }else{ var categories = new Array(); categories.push(year1); categories.push(year2); $("#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(); if(selVal != '0'){ // 추가된 판매업체중에 같은 판매업체가 있는지 확인 $("#ul_searchGood li").each(function(k){ 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) ); }); // 업체 추가 버튼 $("#img_addshop").click(function(){ $("#shop option:selected").each(function(i){ var hasEntpId = false; var selVal = $(this).val(); var selText = $(this).text(); if(selVal != '0'){ // 추가된 판매업체중에 같은 판매업체가 있는지 확인 $("#ul_searchShop li").each(function(k){ if($("[id=val]").eq(k).val() == selVal){ alert("이미 등록된 업체 입니다."); hasEntpId = true; } }); if( !hasEntpId ){ sn_addRow(selVal, selText); } }else{ alert(" 판매업체를 선택하세요."); } }); }); // 업체 삭제버튼 클릭 $("table").delegate(".img_delshop", "click", function(){ sn_delRow( $(".img_delshop").index(this) ); }); // 조회, 엑셀다운 구분자 $("#btn_excelDownload").click(function(){ var checkEx = $("#jflag").val(); var keyword = new Array(); var shopword = new Array(); $("#ul_searchGood li").each(function(i){ keyword.push($(this).children("#val").val()); }); $("#ul_searchShop li").each(function(i){ shopword.push($(this).children("#val").val()); }); var checkkey = keyword.length; var checkshop = shopword.length; if(checkEx != '0'|| checkkey > 0 || checkshop > 0 ){ $("#searchOrExcel").val("excel"); var termflag = $("#term option:selected").val(); $("#termflag").val(termflag); var searchflag = $("#sear option:selected").val(); $("#Searchflag").val(searchflag); var url =""; if(termflag == '0' && searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendMList.do"; }else if(termflag == '1'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendBList.do"; }else if(termflag == '2'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendYList.do"; }else if(termflag == '3'&& searchflag == '1'){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendHList.do"; }else if(termflag == '0'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendMtoMList.do"; }else if(termflag == '1'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendBtoBList.do"; }else if(termflag == '2'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendYtoYList.do"; }else if(termflag == '3'&& searchflag == "0"){ url = "/tprice/portal/pricetrend/dailynecessitypricetrend/getShopTrendHtoHList.do"; } $("#listForm") .attr("action", url) .attr("onSubmit", "return true") .submit(); }else{ alert("판매업소별 가격동향 엑셀파일은 다음과 같이 조회 시 가능합니다. \n\n 1. 중분류 선택 후 조회 \n 2. 판매업소, 개별상품 선택 후 조회 "); } }); }); //상품 추가 function fn_addRow(selVal, selText){ var appendHtml = ""; appendHtml = "