Просмотр исходного кода

2021-09-23 목 1. 시간별 주문현황, 2. 카테고리별 주문현황 추가

skyhopes 4 лет назад
Родитель
Сommit
9064755e47

+ 16 - 0
src/main/java/com/style24/admin/biz/dao/TsaStatisticsDao.java

@@ -73,4 +73,20 @@ public interface TsaStatisticsDao {
 	 */
 	Collection<Statistics> getHourlyOrderList(Statistics statistics);
 
+	/**
+	 * 카테고리 주문 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 23.
+	 */
+	Collection<Statistics> getCategoryOrderList(Statistics statistics);
+
+	/**
+	 * 카테고리 주문 상세 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 23.
+	 */
+	Collection<Statistics> getCategoryOrderDetailList(Statistics statistics);
+
 }

+ 20 - 0
src/main/java/com/style24/admin/biz/service/TsaStatisticsService.java

@@ -96,4 +96,24 @@ public class TsaStatisticsService {
 		return statisticsDao.getHourlyOrderList(statistics);
 	}
 
+	/**
+	 * 카테고리 주문 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 23.
+	 */
+	public Collection<Statistics> getCategoryOrderList(Statistics statistics) {
+		return statisticsDao.getCategoryOrderList(statistics);
+	}
+
+	/**
+	 * 카테고리 주문 상세 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 23.
+	 */
+	public Collection<Statistics> getCategoryOrderDetailList(Statistics statistics) {
+		return statisticsDao.getCategoryOrderDetailList(statistics);
+	}
+
 }

+ 71 - 0
src/main/java/com/style24/admin/biz/web/TsaStatisticsController.java

@@ -444,4 +444,75 @@ public class TsaStatisticsController extends TsaBaseController {
 	}
 
 
+	/**
+	 * 카테고리별 매출현황 화면
+	 * author: 이명철
+	 * return: ModelAndView
+	 * since: 2021. 9. 21.
+	 */
+	@GetMapping("/category/trading/form")
+	public ModelAndView categoryTradingForm() {
+		ModelAndView mav = new ModelAndView();
+
+		// 정상이월구분
+		mav.addObject("formalGbList", rendererService.getAvailCommonCodeList("G009"));
+
+		mav.setViewName("statistics/CategoryTradingForm");
+		return mav;
+	}
+
+	/**
+	 * 카테고리별 매출현황 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 21.
+	 */
+	@PostMapping("/category/order/list")
+	@ResponseBody
+	public Collection<Statistics> getCategoryOrderList(@RequestBody Statistics statistics) {
+
+		if (!StringUtils.isBlank(statistics.getExtmallIdList())) {
+			statistics.setMultiExtmallId(statistics.getExtmallIdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getSupplyCompCdList())) {
+			statistics.setMultiSupplyCompCd(statistics.getSupplyCompCdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getAfLinkCdList())) {
+			statistics.setMultiAfLinkCd(statistics.getAfLinkCdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getBrandCdList())) {
+			statistics.setMultiBrandCd(statistics.getBrandCdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getItemkindCdList())) {
+			statistics.setMultiItemkindCd(statistics.getItemkindCdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getGoodsCd())) {
+			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
+		}
+
+		if (!StringUtils.isBlank(statistics.getFormalGb())) {
+			statistics.setMultiFrontGb(statistics.getExtmallIdList().split(","));
+		}
+
+		return statisticsService.getCategoryOrderList(statistics);
+	}
+	
+	/**
+	 * 카테고리 주문 상세 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 23.
+	 */
+	@PostMapping("/category/order/detail/list")
+	@ResponseBody
+	public Collection<Statistics> getCategoryOrderDetailList(@RequestBody Statistics statistics) {
+		return statisticsService.getCategoryOrderDetailList(statistics);
+	}
+
+
 }

+ 4 - 0
src/main/java/com/style24/persistence/domain/Statistics.java

@@ -36,6 +36,10 @@ public class Statistics extends TscBaseDomain {
 	private long exUsacAmt;		// 예상 정산액C*(1-D)
 	private long realOrdAmt;	// 실결제금액
 
+	private String cateNm1;     // 대분류
+	private String cateNm2;     // 중분류
+	private String cateNm3;     // 소분류
+
 	// 검색조건
 	private String dayGb;		// 날짜구분(D:일별, W:주별, M:월별)
 	private String startDt;		// 시작일

+ 61 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaStatistics.xml

@@ -891,4 +891,65 @@
 		ORDER BY A.HOUR
 	</select>
 
+	<!-- 카테고리별 주문 조회 -->
+	<select id="getCategoryOrderList" parameterType="Statistics" resultType="Statistics">
+		/* TsaStatistics.getCategoryOrderList */
+		SELECT A.ITEMKIND_CD
+		    , SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', 1) AS CATE_NM1 /* 대분류 */
+		    , SUBSTRING_INDEX(SUBSTRING(T4.FULL_CATE_NM, INSTR(SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', 2), ' > ') + 3), ' > ', 1) AS CATE_NM2 /* 중분류 */
+		    , SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', -1) AS CATE_NM3 -- 소분류
+		    , SUM(A.SELF_AMT + A.CHANNEL_AMT + A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) AS TOT_AMT /*총매출*/
+		    , SUM(A.SELF_AMT + A.CHANNEL_AMT) AS SELFMALL_AMT /*자사몰매출*/
+		    , SUM(A.EXTMALL_AMT) AS EXTMALL_AMT /*제휴몰매출*/
+		FROM TB_STAT_ORD_DAY A, TB_ITEMKIND_CATE TC, TB_CATE_4SRCH T4
+		WHERE A.ITEMKIND_CD = TC.ITEMKIND_CD
+		    AND TC.CATE_NO = T4.LEAF_CATE_NO
+		    AND (A.SELF_AMT + A.CHANNEL_AMT + A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) > 0
+	        <![CDATA[
+	        /* 직접선택 */
+	        AND A.DAY >= DATE_FORMAT(#{startDt}, '%Y%m%d')
+	        AND A.DAY <  DATE_ADD(DATE_FORMAT(#{endDt}, '%Y%m%d'), INTERVAL 1 DAY)
+	        ]]>
+			<if test="multiFrontGb != null">
+				/* 디바이스 */
+				<foreach collection="multiFrontGb" item="item" index="index"  open="AND A.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiExtmallId != null">
+				/* 제휴몰 */
+				<foreach collection="multiExtmallId" item="item" index="index"  open="AND A.EXTMALL_ID IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiSupplyCompCd != null">
+				/* 공급처 */
+				<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND A.SUPPLY_COMP_CD IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiBrandCd != null">
+				/* 브랜드 */
+				<foreach collection="multiBrandCd" item="item" index="index"  open="AND A.BRAND_CD IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+		GROUP BY A.ITEMKIND_CD, T4.FULL_CATE_NM
+	</select>
+
+	<!-- 카테고리 상세 조회 -->
+	<select id="getCategoryOrderDetailList" parameterType="Statistics" resultType="Statistics">
+		/* TsaStatistics.getCategoryOrderDetailList */
+		SELECT
+		    C.BRAND_ENM
+		    , A.GOODS_CD
+		    , B.GOODS_NM
+		    , SUM(A.SELF_AMT + A.CHANNEL_AMT + A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) AS TOT_AMT /*총매출*/
+		    , SUM(A.SELL_QTY) AS SELL_QTY /*판매수량*/
+		    , SUM(A.ORD_CUST) AS ORD_CUST /*구매자수*/
+		FROM TB_STAT_ORD_DAY A, TB_GOODS B, TB_BRAND C
+		WHERE A.GOODS_CD = B.GOODS_CD
+		    AND A.BRAND_CD = C.BRAND_CD
+		    AND (A.SELF_AMT + A.CHANNEL_AMT + A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) > 0
+		    AND A.ITEMKIND_CD = #{itemkindCd}
+	        <![CDATA[
+	        /* 직접선택 */
+	        AND A.DAY >= DATE_FORMAT(#{startDt}, '%Y%m%d')
+	        AND A.DAY <  DATE_ADD(DATE_FORMAT(#{endDt}, '%Y%m%d'), INTERVAL 1 DAY)
+	        ]]>
+		GROUP BY C.BRAND_ENM, A.GOODS_CD, B.GOODS_NM
+	</select>
+
 </mapper>

+ 465 - 0
src/main/webapp/WEB-INF/views/statistics/CategoryTradingForm.html

@@ -0,0 +1,465 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : CategoryTradingForm.html
+ * @desc    : 카테고리별주문 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021-09-22 수   lmc        최초 작성
+ *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title"></div>
+		<!-- //메인타이틀 영역 -->
+
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc"></div>
+		<!-- //메뉴 설명 -->
+
+		<!-- 검색조건 영역 -->
+		<div class="panelStyle">
+			<form id="searchForm" name="searchForm" action="#" th:action="@{'/statistics/category/order/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
+				<input type="hidden" name="dayGb" value="D"/>
+
+				<table class="frmStyle" aria-describedby="검색조건">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:25%;"/>
+						<col style="width:10%;"/>
+						<col/>
+					</colgroup>
+					<tr>
+						<th>기간<i class="required" title="필수" aria-hidden="true"></i></th>
+						<td colspan="5" id="terms">
+						</td>
+					</tr>
+					<tr>
+						<th>디바이스</th>
+						<td>
+							<label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="P" checked="checked"/>PC웹</label>
+							<label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="M" checked="checked"/>모바일웹</label>
+							<label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="A" checked="checked"/>APP</label>
+						</td>
+						<th>제휴몰</th>
+						<td>
+							<input type="text" class="w100" name="extmallIdSearchTxt" id="extmallIdSearchTxt" maxlength="20"/>
+							<button type="button" class="btn icn" onclick="cfnOpenExtmallListPopup('fnSetExtmallInfo', 'M');"><i class="fa fa-search"></i></button>
+							<span id="extmallIdTxt"></span>
+							<input type="hidden" name="extmallIdList"/>
+						</td>
+					</tr>
+					<tr>
+						<th>공급업체</th>
+						<td>
+							<input type="text" class="w100" name="supplyCompCdSearchTxt" id="supplyCompCdSearchTxt" maxlength="20"/>
+							<button type="button" class="btn icn" onclick="cfnOpenCompanyListPopup('fnSetSupplyCompInfo', 'M');"><i class="fa fa-search"></i></button>
+							<span id="supplyCompCdTxt"></span>
+							<input type="hidden" name="supplyCompCdList"/>
+						</td>
+						<th>브랜드</th>
+						<td>
+							<input type="text" class="w100" name="brandCdSearchTxt" id="brandCdSearchTxt" maxlength="20" />
+							<button type="button" class="btn icn" onclick="cfnOpenBrandListPopup('fnSetBrandInfo', 'M');"><i class="fa fa-search"></i></button>
+							<span id="brandCdTxt"></span>
+							<input type="hidden" name="brandCdList"/>
+						</td>
+					</tr>
+				</table>
+				<ul class="panelBar">
+					<li class="center">
+						<button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
+						<button type="button" class="btn btn-gray btn-lg" id="btnInit">초기화</button>
+					</li>
+				</ul>
+			</form>
+			<form id="detailSearchForm" action="/statistics/category/order/detail/list" style="display:none;">
+				<input name="itemkindCd">
+				<input name="startDt">
+				<input name="endDt">
+			</form>
+		</div>
+		<!-- 검색조건 영역 -->
+
+		<!-- 리스트 영역 -->
+		<div class="panelStyle">
+			<ul class="panelBar">
+				<li>
+					<button type="button" class="btn btn-default btn-lg" onclick="fnExcelDownLoad();">엑셀다운로드</button>
+				</li>
+			</ul>
+			<div id="gridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
+		</div>
+		<div class="panelStyle">
+			<ul class="panelBar">
+				<li>
+					<button type="button" class="btn btn-default btn-lg" onclick="fnDetailExcelDownLoad();">엑셀다운로드</button>
+				</li>
+			</ul>
+			<div id="detailGridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
+		</div>
+		<!-- //리스트 영역 -->
+	</div>
+
+<style>
+.ag-header-group-text{
+	margin-left: calc(50% - 25px);
+}
+</style>
+<script th:inline="javascript">
+/*<![CDATA[*/
+	let columnDefs = [
+		{ headerName: "대분류", field: "cateNm1", width: 150, cellClass: 'text-center' },
+		{ headerName: "중분류", field: "cateNm2", width: 150, cellClass: 'text-center' },
+		{ headerName: "소분류", field: "cateNm3", width: 150, cellClass: 'text-center' },
+		{ headerName: "매출 현황", field: "", width: 100, cellClass: 'text-center',
+			children: [
+				{headerName: "총 매출액(A+B)", field: "totAmt", width: 120, cellClass: 'text-right',
+					cellRenderer: function(params) {
+						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+					}
+				},
+				{headerName: "자사몰(A)", field: "selfmallAmt", width: 120, cellClass: 'text-right',
+					cellRenderer: function(params) {
+						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+					}
+				},
+				{headerName: "제휴몰(B)", field: "extmallAmt", width: 120, cellClass: 'text-right',
+					cellRenderer: function(params) {
+						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+					}
+				},
+			]
+		},
+		{ headerName: "판매현황보기", field: "sellStatus", width: 100, cellClass: 'text-center',
+			cellRenderer: function (params) {
+				return '<a href="javascript:void(0);">판매현황보기</a>';
+			}
+		},
+	];
+
+	let detailColumnDefs = [
+		{ headerName: "브랜드", field: "brandEnm", width: 150, cellClass: 'text-center' },
+		{ headerName: "상품번호", field: "goodsCd", width: 150, cellClass: 'text-center',
+			cellRenderer: function (params) {
+				return '<a href="javascript:void(0);">'+params.value+'</a>';
+			}
+		},
+		{ headerName: "상품명", field: "goodsNm", width: 300, cellClass: 'text-left',
+			cellRenderer: function (params) {
+				return '<a href="javascript:void(0);">'+params.value+'</a>';
+			}
+		},
+		{ headerName: "상품매출액", field: "totAmt", width: 150, cellClass: 'text-right',
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+			}
+		},
+		{ headerName: "판매수량", field: "sellQty", width: 150, cellClass: 'text-right',
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+			}
+		},
+		{ headerName: "구매자수", field: "ordCust", width: 150, cellClass: 'text-right',
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+			}
+		},
+	];
+
+	let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+	let detailGridOptions = gagaAgGrid.getGridOptions(detailColumnDefs);
+
+	// Row Click
+	gridOptions.onCellClicked = function(event) {
+		var params = event.data;
+		if (event.colDef.field == "goodsCd"){
+			cfnOpenGoodsDetailPopup('U', params.goodsCd);
+		}
+		else if (event.colDef.field == "goodsNm"){
+			cfnOpenGoodsDetailPopup('U', params.goodsCd);
+		}
+		else if (event.colDef.field == "sellStatus"){
+			$("#detailSearchForm input[name=itemkindCd]").val(params.itemkindCd);
+			$("#detailSearchForm input[name=startDt]").val($("#searchForm input[name=startDt]").val());
+			$("#detailSearchForm input[name=endDt]").val($("#searchForm input[name=endDt]").val());
+			gagaAgGrid.fetch($('#detailSearchForm').prop('action'), detailGridOptions, '#detailSearchForm', fnDetailCreateTotal);
+		}
+	}
+
+	// Row Click
+	detailGridOptions.onCellClicked = function(event) {
+		var params = event.data;
+		if (event.colDef.field == "goodsCd"){
+			cfnOpenGoodsDetailPopup('U',goodsCd);
+		}
+		else if (event.colDef.field == "goodsNm"){
+			cfnOpenGoodsDetailPopup('U',goodsCd);
+		}
+	}
+
+    gridOptions.excelStyles = [
+        {
+            id: 'text-center',
+            dataType: 'string',
+			font: {size : 10, bold: false}
+        },
+        {
+            id: 'text-left',
+            dataType: 'string',
+			font: {size : 10, bold: false}
+        },
+        {
+            id: 'text-right',
+            dataType: 'number',
+			font: {size : 10, bold: false}
+        }
+    ];
+
+    detailGridOptions.excelStyles = gridOptions.excelStyles;
+
+    var fnExcelDownLoad = function(){
+
+    	var totalRows = gridOptions.api.getDisplayedRowCount();
+		if(totalRows==0){
+			mcxDialog.alert('조회된 내역이 없습니다.');
+			return;
+		}
+
+    	var date = new Date().format("YYYYMMDDHHmmss");
+		var params = {
+						fileName : "카테고리별 주문목록_"+ date,
+						sheetName: "DATA"
+					 };
+		gridOptions.api.exportDataAsExcel(params);
+    }
+    var fnDetailExcelDownLoad = function(){
+
+    	var totalRows = detailGridOptions.api.getDisplayedRowCount();
+		if(totalRows==0){
+			mcxDialog.alert('조회된 내역이 없습니다.');
+			return;
+		}
+
+    	var date = new Date().format("YYYYMMDDHHmmss");
+		var params = {
+						fileName : "카테고리별 주문상세목록_"+ date,
+						sheetName: "DATA"
+					 };
+		detailGridOptions.api.exportDataAsExcel(params);
+    }
+
+	// 제휴몰 조회 팝업에서 호출
+	var fnSetExtmallInfo = function(result) {
+		var arrExtmallId = [];
+		var extmallIdTxt = "";
+		var sIndex = 0;
+		$('#extmallIdTxt').html('');
+		$('#searchForm input[name=extmallIdSearchTxt]').val('');
+
+		result.forEach(function(extmall) {
+			sIndex++;
+			arrExtmallId.push(extmall.extmallId);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (sIndex == 1) {
+			$('#searchForm input[name=extmallIdSearchTxt]').val(arrExtmallId[0]);
+		} else {
+			extmallIdTxt = sIndex + " 개";
+			$('#extmallIdTxt').html(extmallIdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrExtmallId);
+		$("#searchForm input[name=extmallIdList]").val(arrExtmallId.join(','));
+	}
+
+	// 업체 조회 팝업에서 호출
+	var fnSetSupplyCompInfo = function(result) {
+		var arrSupplyCompCd = [];
+		var supplyCompCdTxt = "";
+		var sIndex = 0;
+		$('#supplyCompCdTxt').html('');
+		$('#searchForm input[name=supplyCompCdSearchTxt]').val('');
+
+		result.forEach(function(supplyComp) {
+			sIndex++;
+			arrSupplyCompCd.push(supplyComp.supplyCompCd);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (sIndex == 1) {
+			$('#searchForm input[name=supplyCompCdSearchTxt]').val(arrSupplyCompCd[0]);
+		} else {
+			supplyCompCdTxt = sIndex + " 개";
+			$('#supplyCompCdTxt').html(supplyCompCdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrSupplyCompCd);
+		$("#searchForm input[name=supplyCompCdList]").val(arrSupplyCompCd.join(','));
+	}
+
+	// 제휴채널 조회 팝업에서 호출
+	var fnSetAfLinkInfo = function(result) {
+		var arrAfLinkCd = [];
+		var afLinkCdTxt = "";
+		var sIndex = 0;
+		$('#afLinkCdTxt').html('');
+		$('#searchForm input[name=afLinkCdSearchTxt]').val('');
+
+		result.forEach(function(afLink) {
+			sIndex++;
+			arrAfLinkCd.push(afLink.afLinkCd);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (sIndex == 1) {
+			$('#searchForm input[name=afLinkCdSearchTxt]').val(arrAfLinkCd[0]);
+		} else {
+			afLinkCdTxt = sIndex + " 개";
+			$('#afLinkCdTxt').html(afLinkCdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrAfLinkCd);
+		$("#searchForm input[name=afLinkCdList]").val(arrAfLinkCd.join(","));
+	}
+
+	// 브랜드 조회 팝업에서 호출
+	var fnSetBrandInfo = function(result) {
+		var arrBrandCd = [];
+		var brandCdTxt = "";
+		var bIndex = 0;
+		$('#brandCdTxt').html('');
+		$('#searchForm input[name=brandCdSearchTxt]').val('');
+
+		result.forEach(function(brand){
+			bIndex++;
+			arrBrandCd.push(brand.brandCd);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (bIndex == 1) {
+			$('#searchForm input[name=brandCdSearchTxt]').val(arrBrandCd[0]);
+		} else {
+			brandCdTxt = bIndex + " 개";
+			$('#brandCdTxt').html(brandCdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrBrandCd);
+		$("#searchForm input[name=brandCdList]").val(arrBrandCd.join(","));
+	}
+
+	// 품목 조회 팝업에서 호출
+	var fnSetItemkindInfo = function(result) {
+		var arrItemkindCd = [];
+		var itemkindCdTxt = "";
+		var bIndex = 0;
+		$('#itemkindCdTxt').html('');
+		$('#searchForm input[name=itemkindCdSearchTxt]').val('');
+
+		result.forEach(function(itemkind){
+			bIndex++;
+			arrItemkindCd.push(itemkind.itemkindCd);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (bIndex == 1) {
+			$('#searchForm input[name=itemkindCdSearchTxt]').val(arrItemkindCd[0]);
+		} else {
+			itemkindCdTxt = bIndex + " 개";
+			$('#itemkindCdTxt').html(itemkindCdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrItemkindCd);
+		$("#searchForm input[name=itemkindCdList]").val(arrItemkindCd.join(','));
+	}
+
+	// 검색
+	$('#btnSearch').on('click', function() {
+		// 입력 값 체크
+		if (!gagajf.validation($('#searchForm')))
+			return false;
+
+		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm', fnCreateTotal);
+	});
+
+	// 합계 생성
+	let fnCreateTotal = function() {
+
+		let totInfo = {};
+		totInfo.itemkindCd  = "TOTAL";
+		totInfo.totAmt      = 0;
+		totInfo.selfmallAmt = 0;
+		totInfo.extmallAmt  = 0;
+
+		gridOptions.api.forEachNode(function(rowNode, index) {
+			if (!rowNode.group) {
+				if( typeof rowNode.data.totAmt         == 'number') { totInfo.totAmt          += rowNode.data.totAmt         ; }
+				if( typeof rowNode.data.selfmallAmt    == 'number') { totInfo.selfmallAmt     += rowNode.data.selfmallAmt    ; }
+				if( typeof rowNode.data.extmallAmt     == 'number') { totInfo.extmallAmt      += rowNode.data.extmallAmt     ; }
+			}
+		});
+
+		gagaAgGrid.setPinnedRowData(gridOptions, totInfo, 'top');
+	}
+
+	// 합계 생성
+	let fnDetailCreateTotal = function() {
+
+		let totInfo = {};
+		totInfo.brandEnm= 'TOTAL';
+		totInfo.goodsCd = '';
+		totInfo.goodsNm	= '';
+		totInfo.totAmt  = 0;
+		totInfo.sellQty = 0;
+		totInfo.ordCust = 0;
+
+		detailGridOptions.api.forEachNode(function(rowNode, index) {
+			if (!rowNode.group) {
+				if( typeof rowNode.data.totAmt     == 'number') { totInfo.totAmt      += rowNode.data.totAmt     ; }
+				if( typeof rowNode.data.sellQty    == 'number') { totInfo.sellQty     += rowNode.data.sellQty    ; }
+				if( typeof rowNode.data.ordCust    == 'number') { totInfo.ordCust     += rowNode.data.ordCust    ; }
+			}
+		});
+
+		gagaAgGrid.setPinnedRowData(detailGridOptions, totInfo, 'top');
+	}
+
+	// 초기화 클릭시
+	$('#btnInit').on('click', function() {
+		$('#searchForm')[0].reset();
+
+		$('#extmallIdTxt').html('');
+		$('#searchForm input[name=extmallIdList]').val('');
+		$('#supplyCompCdTxt').html('');
+		$('#searchForm input[name=supplyCompCdList]').val('');
+		$('#afLinkCdTxt').html('');
+		$('#searchForm input[name=afLinkCdList]').val('');
+		$('#brandCdTxt').html('');
+		$('#searchForm input[name=brandCdList]').val('');
+		$('#itemkindCdTxt').html('');
+		$('#searchForm input[name=itemkindCdList]').val('');
+	});
+
+	$(document).ready(function() {
+		cfnCreateCalendar('#terms', 'startDt', 'endDt', true, '주문', undefined, ['btnToday']);
+		$('.btnYesterday').trigger('click');
+
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+		// Create a agGrid
+		gagaAgGrid.createGrid('detailGridList', detailGridOptions);
+
+		//조회
+		$('#btnSearch').click();
+	});
+/*]]>*/
+</script>
+
+</html>