소스 검색

2021-09-29 수 1.기획전 주문 통계 추가

skyhopes 4 년 전
부모
커밋
6a6a5490de

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

@@ -139,4 +139,20 @@ public interface TsaStatisticsDao {
 	 */
 	 */
 	Collection<Statistics> getTmtbOrderDetailList(Statistics statistics);
 	Collection<Statistics> getTmtbOrderDetailList(Statistics statistics);
 
 
+	/**
+	 * 사은품 주문 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 28.
+	 */
+	Collection<Statistics> getPlanOrderList(Statistics statistics);
+
+	/**
+	 * 사은품 주문 상세조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 28.
+	 */
+	Collection<Statistics> getPlanOrderDetailList(Statistics statistics);
+
 }
 }

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

@@ -251,4 +251,24 @@ public class TsaStatisticsService {
 		return statisticsDao.getTmtbOrderDetailList(statistics);
 		return statisticsDao.getTmtbOrderDetailList(statistics);
 	}
 	}
 
 
+	/**
+	 * 사은품 주문 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 28.
+	 */
+	public Collection<Statistics> getPlanOrderList(Statistics statistics) {
+		return statisticsDao.getPlanOrderList(statistics);
+	}
+
+	/**
+	 * 사은품 주문 상세조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 28.
+	 */
+	public Collection<Statistics> getPlanOrderDetailList(Statistics statistics) {
+		return statisticsDao.getPlanOrderDetailList(statistics);
+	}
+
 }
 }

+ 47 - 1
src/main/java/com/style24/admin/biz/web/TsaStatisticsController.java

@@ -690,7 +690,7 @@ public class TsaStatisticsController extends TsaBaseController {
 	}
 	}
 
 
 	/**
 	/**
-	 * 다다익선 통계 조
+	 * 다다익선 통계 조
 	 * author: 이명철
 	 * author: 이명철
 	 * return: Collection<Statistics>
 	 * return: Collection<Statistics>
 	 * since: 2021. 9. 28.
 	 * since: 2021. 9. 28.
@@ -706,11 +706,57 @@ public class TsaStatisticsController extends TsaBaseController {
 		return statisticsService.getTmtbOrderList(statistics);
 		return statisticsService.getTmtbOrderList(statistics);
 	}
 	}
 
 
+	/**
+	 * 다다익선 주문 상세조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 28.
+	 */
 	@PostMapping("/tmtb/order/detail/list")
 	@PostMapping("/tmtb/order/detail/list")
 	@ResponseBody
 	@ResponseBody
 	public Collection<Statistics> getTmtbOrderDetailList(@RequestBody Statistics statistics) {
 	public Collection<Statistics> getTmtbOrderDetailList(@RequestBody Statistics statistics) {
 		return statisticsService.getTmtbOrderDetailList(statistics);
 		return statisticsService.getTmtbOrderDetailList(statistics);
 	}
 	}
 
 
+	/**
+	 * 기획전 통게 화면
+	 * author: 이명철
+	 * return: ModelAndView
+	 * since: 2021. 9. 28.
+	 */
+	@GetMapping("/plan/trading/form")
+	public ModelAndView planTradingForm() {
+		ModelAndView mav = new ModelAndView();
+		mav.setViewName("statistics/PlanTradingForm");
+		return mav;
+	}
+
+	/**
+	 * 기획전 통계 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 28.
+	 */
+	@PostMapping("/plan/order/list")
+	@ResponseBody
+	public Collection<Statistics> getPlanOrderList(@RequestBody Statistics statistics) {
+		if (!StringUtils.isBlank(statistics.getPlanSq())) {
+			statistics.setMultiPlanSq(statistics.getPlanSq().split(System.lineSeparator()));
+		}
+		return statisticsService.getPlanOrderList(statistics);
+	}
+
+	/**
+	 * 기획전 주문 상세조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 28.
+	 */
+	@PostMapping("/plan/order/detail/list")
+	@ResponseBody
+	public Collection<Statistics> getPlanOrderDetailList(@RequestBody Statistics statistics) {
+		return statisticsService.getPlanOrderDetailList(statistics);
+	}
+
 
 
 }
 }

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

@@ -196,6 +196,9 @@ public class Statistics extends TscBaseDomain {
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] multiTmtbSq;	//  프로모션번호
 	private String[] multiTmtbSq;	//  프로모션번호
 
 
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] multiPlanSq;	//  기획전번호
+
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] applyGbArr;	//  프로모션유형
 	private String[] applyGbArr;	//  프로모션유형
 
 
@@ -204,9 +207,12 @@ public class Statistics extends TscBaseDomain {
 	private int custCpnCnt;
 	private int custCpnCnt;
 	private int ordRate;
 	private int ordRate;
 
 
+	private String planSq;
+	private String planNm;
 	private String tmtbSq;
 	private String tmtbSq;
 	private String tmtbNm;
 	private String tmtbNm;
 	private String applyGb;
 	private String applyGb;
 	private int dcAmt;
 	private int dcAmt;
 
 
+
 }
 }

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

@@ -1515,4 +1515,134 @@
 		GROUP BY A.BRAND_CD, B.BRAND_ENM, A.GOODS_CD
 		GROUP BY A.BRAND_CD, B.BRAND_ENM, A.GOODS_CD
 	</select>
 	</select>
 
 
+	<!-- 사은품 주문조회 -->
+	<select id="getPlanOrderList" parameterType="Statistics" resultType="Statistics">
+	    /* TsaStatistics.getPlanOrderList */
+		SELECT
+		    CASE WHEN DISTRIBUTION_GB = 'G065_20' THEN '입점' ELSE '위탁' END AS DISTRIBUTION_GB
+		    , BRAND_ENM
+		    , PLAN_SQ
+		    , (SELECT PLAN_NM FROM TB_PLAN P WHERE P.PLAN_SQ = X.PLAN_SQ) AS PLAN_NM
+		    , SUM(ORD_AMT) AS ORD_AMT
+		    , SUM(ORD_CNT) AS ORD_CNT
+		FROM (
+		    SELECT C.DISTRIBUTION_GB
+		         , F.BRAND_ENM
+		         , E.PLAN_SQ
+		         , SUM((B.CURR_PRICE + (SELECT SUM(OPT_ADD_PRICE * ITEM_QTY) FROM TB_ORDER_DETAIL_ITEM X WHERE X.ORD_DTL_NO = B.ORD_DTL_NO)) * (B.ORD_QTY - B.CNCL_RTN_QTY)) AS ORD_AMT
+		         , COUNT(1) AS ORD_CNT
+		    FROM TB_ORDER A,
+		         TB_ORDER_DETAIL B,
+		         TB_GOODS C,
+		         TB_CUSTOMER D,
+		         TB_PLAN_DETAIL E,
+		         TB_BRAND F
+		    WHERE A.ORD_NO = B.ORD_NO
+		      AND B.GOODS_CD = C.GOODS_CD
+		      AND A.CUST_NO = D.CUST_NO
+		      AND B.PLAN_DTL_SQ = E.PLAN_DTL_SQ
+		      AND F.BRAND_CD = C.BRAND_CD
+		      <![CDATA[
+		      AND A.PAY_DT >= DATE_FORMAT(#{startDt}, '%Y-%m-%d')                         -- 시작일변수
+		      AND A.PAY_DT <= DATE_FORMAT(CONCAT(#{endDt}, ' 23:59:59'), '%Y-%m-%d %H:%i:%s') -- 종료일변수
+		      ]]>
+		      AND B.ORD_DTL_STAT NOT IN ('G013_00', 'G013_10', 'G013_98')               -- 주문접수,입금대기,입금전취소 제외
+		      AND B.ORD_QTY > B.CNCL_RTN_QTY
+	          <if test="multiDistributionGb != null">
+	              /* 물류구분 */
+	              <foreach collection="multiDistributionGb" item="item" index="index">
+	                  <if test="item == 'SCM'">
+	                      AND C.DISTRIBUTION_GB = 'G065_20' -- 입점
+	                  </if>
+	                  <if test="item == 'WMS'">
+		                  AND C.DISTRIBUTION_GB IN ('G065_10', 'G065_11', 'G065_12') -- 위탁
+	                  </if>
+	              </foreach>
+	          </if>
+		      <if test="multiTmtbSq != null">
+		          /* 기획전번호  */
+		          <foreach collection="multiPlanSq" item="item" index="index"  open="AND E.PLAN_SQ IN (" close=")" separator=",">#{item}</foreach>
+		      </if>
+		    GROUP BY C.DISTRIBUTION_GB, F.BRAND_ENM, E.PLAN_SQ, A.ORD_NO
+		) X
+		GROUP BY DISTRIBUTION_GB, BRAND_ENM, PLAN_SQ
+	</select>
+
+	<!-- 사은품 주문상세 조회 -->
+	<select id="getPlanOrderDetailList" parameterType="Statistics" resultType="Statistics">
+	    /* TsaStatistics.getPlanOrderDetailList */
+		WITH TAB AS (
+		    SELECT SUM(CUST_CNT) AS TOT_CUST_CNT
+		    FROM (
+		        SELECT COUNT(1) AS CUST_CNT
+		        FROM TB_ORDER A,
+		             TB_ORDER_DETAIL B,
+		             TB_GOODS C,
+		             TB_CUSTOMER D,
+		             TB_PLAN_DETAIL E,
+		             TB_BRAND F
+		        WHERE A.ORD_NO = B.ORD_NO
+		          AND B.GOODS_CD = C.GOODS_CD
+		          AND A.CUST_NO = D.CUST_NO
+		          AND B.PLAN_DTL_SQ = E.PLAN_DTL_SQ
+		          AND F.BRAND_CD = C.BRAND_CD
+		          <![CDATA[
+		          AND A.PAY_DT >= DATE_FORMAT(#{startDt}, '%Y-%m-%d')                         -- 시작일변수
+		          AND A.PAY_DT <= DATE_FORMAT(CONCAT(#{endDt}, ' 23:59:59'), '%Y-%m-%d %H:%i:%s') -- 종료일변수
+		          ]]>
+		          AND B.ORD_DTL_STAT NOT IN ('G013_00', 'G013_10', 'G013_98')               -- 주문접수,입금대기,입금전취소 제외
+		          AND B.ORD_QTY > B.CNCL_RTN_QTY
+		          AND E.PLAN_SQ = #{planSq}
+		        GROUP BY A.CUST_NO
+		    ) Z
+		)
+		SELECT
+		    CASE WHEN DISTRIBUTION_GB = 'G065_20' THEN '입점' ELSE '위탁' END AS DISTRIBUTION_GB
+		    , GOODS_CD
+		    , GOODS_NM
+		    , SUM(ORD_AMT) AS ORD_AMT
+		    , SUM(ORD_QTY) AS ORD_QTY
+		    , SUM(CUST_CNT) AS CUST_CNT
+		    , FLOOR((SUM(CUST_CNT) / (SELECT TOT_CUST_CNT FROM TAB) * 100) / 10) * 10 AS ORD_RATE
+		FROM (
+		     SELECT C.DISTRIBUTION_GB
+		         , C.GOODS_CD
+		         , C.GOODS_NM
+		         , SUM((B.CURR_PRICE + (SELECT SUM(OPT_ADD_PRICE * ITEM_QTY) FROM TB_ORDER_DETAIL_ITEM X WHERE X.ORD_DTL_NO = B.ORD_DTL_NO)) * (B.ORD_QTY - B.CNCL_RTN_QTY)) AS ORD_AMT
+		         , SUM(B.ORD_QTY - B.CNCL_RTN_QTY) AS ORD_QTY
+		         , COUNT(1) OVER(PARTITION BY C.DISTRIBUTION_GB, C.GOODS_CD, A.CUST_NO) AS CUST_CNT
+		    FROM TB_ORDER A,
+		         TB_ORDER_DETAIL B,
+		         TB_GOODS C,
+		         TB_CUSTOMER D,
+		         TB_PLAN_DETAIL E,
+		         TB_BRAND F
+		    WHERE A.ORD_NO = B.ORD_NO
+		      AND B.GOODS_CD = C.GOODS_CD
+		      AND A.CUST_NO = D.CUST_NO
+		      AND B.PLAN_DTL_SQ = E.PLAN_DTL_SQ
+		      AND F.BRAND_CD = C.BRAND_CD
+		      <![CDATA[
+		      AND A.PAY_DT >= DATE_FORMAT(#{startDt}, '%Y-%m-%d')                         -- 시작일변수
+		      AND A.PAY_DT <= DATE_FORMAT(CONCAT(#{endDt}, ' 23:59:59'), '%Y-%m-%d %H:%i:%s') -- 종료일변수
+		      ]]>
+		      AND B.ORD_DTL_STAT NOT IN ('G013_00', 'G013_10', 'G013_98')               -- 주문접수,입금대기,입금전취소 제외
+		      AND B.ORD_QTY > B.CNCL_RTN_QTY
+              <if test="multiDistributionGb != null">
+                  /* 물류구분 */
+                  <foreach collection="multiDistributionGb" item="item" index="index">
+                      <if test="item == 'SCM'">
+                          AND C.DISTRIBUTION_GB = 'G065_20' -- 입점
+                      </if>
+                      <if test="item == 'WMS'">
+                          AND C.DISTRIBUTION_GB IN ('G065_10', 'G065_11', 'G065_12') -- 위탁
+                      </if>
+                  </foreach>
+              </if>
+		      AND E.PLAN_SQ = #{planSq}
+		    GROUP BY C.DISTRIBUTION_GB, C.GOODS_CD, C.GOODS_NM, A.CUST_NO
+		) X
+		GROUP BY DISTRIBUTION_GB, GOODS_CD, GOODS_NM
+	</select>
+
 </mapper>
 </mapper>

+ 314 - 0
src/main/webapp/WEB-INF/views/statistics/PlanTradingForm.html

@@ -0,0 +1,314 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : PlanTradingForm.html
+ * @desc    : 기획전 주문 통계 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021-09-28 화   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/plan/order/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
+				<table class="frmStyle" aria-describedby="검색조건">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:10%;"/>
+						<col style="width:60%;"/>
+						<col style="width:20%;"/>
+					</colgroup>
+					<tr>
+						<th>기간<i class="required" title="필수" aria-hidden="true"></i></th>
+						<td colspan="2" id="terms"></td>
+						<td rowspan="2">
+						  <textarea class="textareaR3 w70p" name="planSq" placeholder="기획전 번호를 입력하세요."></textarea>
+						</td>
+					</tr>
+					<tr>
+					   <th>물류구분</th>
+					   <td colspan="2">
+                            <label class="chkBox checked"><input type="checkbox" name="multiDistributionGb" value="SCM" checked="checked"/>입점</label>
+                            <label class="chkBox checked"><input type="checkbox" name="multiDistributionGb" value="WMS" checked="checked"/>위탁</label>
+					   </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/plan/order/detail/list" style="display:none;">
+				<input name="startDt">
+				<input name="endDt">
+				<input name="planSq">
+			</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: "distributionGb", width: 100, cellClass: 'text-center' },
+		{ headerName: "브랜드", field: "brandEnm", width: 100, cellClass: 'text-center' },
+		{ headerName: "기획전번호", field: "planSq", width: 250, cellClass: 'text-center' },
+		{ headerName: "기획전명", field: "planNm", width: 250, cellClass: 'text-left' },
+		{ headerName: "결제수", field: "ordCnt", width: 150, cellClass: 'text-right',
+            cellRenderer: function(params) {
+                return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+            }
+		},
+		{ headerName: "결제액", field: "ordAmt", width: 150, cellClass: 'text-right',
+            cellRenderer: function(params) {
+                return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+            }
+		},
+		{ headerName: "상세보기", field: "detail", width: 100, cellClass: 'text-center',
+			cellRenderer: function (params) {
+				return '<a href="javascript:void(0);">상세현황보기</a>';
+			}
+		},
+	];
+
+	let detailColumnDefs = [
+		{ headerName: "구분", field: "distributionGb", 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: "ordAmt", width: 150, cellClass: 'text-right',
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+			}
+		},
+		{ headerName: "판매수량", field: "ordQty", width: 150, cellClass: 'text-right',
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+			}
+		},
+		{ headerName: "구매자수", field: "custCnt", width: 150, cellClass: 'text-right',
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+			}
+		},
+		{ headerName: "구매율", field: "custCnt", 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 == "detail"){
+			$("#detailSearchForm input[name=startDt]").val($("#searchForm input[name=startDt]").val());
+			$("#detailSearchForm input[name=endDt]").val($("#searchForm input[name=endDt]").val());
+			$("#detailSearchForm input[name=planSq]").val(params.planSq);
+			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);
+    }
+
+
+	// 검색
+	$('#btnSearch').on('click', function() {
+		// 입력 값 체크
+		if (!gagajf.validation($('#searchForm')))
+			return false;
+
+		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm', fnCreateTotal);
+	});
+
+	// 합계 생성
+	let fnCreateTotal = function() {
+
+		let totInfo = {};
+		totInfo.distributionGb   = "TOTAL";
+		totInfo.brandEnm         = "";
+		totInfo.planSq           = "";
+		totInfo.planNm           = "";
+		totInfo.ordAmt           = 0;
+		totInfo.ordCnt		     = 0;
+
+		gridOptions.api.forEachNode(function(rowNode, index) {
+			if (!rowNode.group) {
+				if( typeof rowNode.data.ordAmt == 'number') { totInfo.ordAmt   += rowNode.data.ordAmt ; }
+				if( typeof rowNode.data.ordCnt == 'number') { totInfo.ordCnt   += rowNode.data.ordCnt ; }
+			}
+		});
+
+		gagaAgGrid.setPinnedRowData(gridOptions, totInfo, 'top');
+	}
+
+	// 합계 생성
+	let fnDetailCreateTotal = function() {
+
+		let totInfo = {};
+		totInfo.brandCd  = "";
+		totInfo.brandEnm = "TOTAL";
+		totInfo.goodsCd  = "";
+		totInfo.goodsNm  = "";
+		totInfo.ordAmt   = 0;
+		totInfo.ordQty   = 0;
+		totInfo.custCnt  = 0;
+
+		detailGridOptions.api.forEachNode(function(rowNode, index) {
+			if (!rowNode.group) {
+				if( typeof rowNode.data.ordAmt        == 'number') { totInfo.ordAmt         += rowNode.data.ordAmt        ; }
+				if( typeof rowNode.data.ordQty        == 'number') { totInfo.ordQty         += rowNode.data.ordQty        ; }
+				if( typeof rowNode.data.custCnt       == 'number') { totInfo.custCnt        += rowNode.data.custCnt       ; }
+			}
+		});
+
+		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);
+
+	});
+/*]]>*/
+</script>
+
+</html>