| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <!DOCTYPE html>
- <html lang="ko"
- xmlns:th="http://www.thymeleaf.org">
- <!--
- *******************************************************************************
- * @source : CustomerAgeOrderForm.html
- * @desc : 연령별주문현황 Page
- *============================================================================
- * STYLE24
- * Copyright(C) 2020 TSIT, All rights reserved.
- *============================================================================
- * VER DATE AUTHOR DESCRIPTION
- * === =========== ========== =============================================
- * 1.0 2021.09.28 swkim 최초 작성
- *******************************************************************************
- -->
- <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/customer/age/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="3" id="terms"></td>
- </tr>
- <tr>
- <th>디바이스</th>
- <td colspan="3">
- <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>
- </tr>
- <tr>
- <th>등급</th>
- <td colspan="3">
- <label th:if="${gradeGbList}" th:each="oneData, status : ${gradeGbList}" class="chkBox checked"><input type="checkbox" name="multiGradeGb" th:value="${oneData.cd}" th:text="${oneData.cdNm}" checked="checked"/></label>
- </td>
- </tr>
- <tr>
- <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>
- <th>매출카테고리</th>
- <td>
- <input type="text" class="w100" name="itemkindCdSearchTxt" id="itemkindCdSearchTxt" maxlength="20" />
- <button type="button" class="btn icn" onclick="cfnOpenItemkindListPopup('fnSetItemkindInfo', 'M');"><i class="fa fa-search"></i></button>
- <span id="itemkindCdTxt"></span>
- <input type="hidden" name="itemkindCdList"/>
- </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>
- </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>
- <style>
- .ag-header-group-text{
- margin-left: calc(50% - 25px);
- }
- </style>
- <script th:inline="javascript">
- /*<![CDATA[*/
- let columnDefs = [
- { headerName: "연령", field: "age", width: 100, cellClass: 'text-center' },
- { headerName: "성별", field: "sexGb", width: 100, cellClass: 'text-center' },
- {
- headerName: "주문 현황", field: "", width: 1200, cellClass: 'text-center',
- children: [
- {headerName: "총매출액(A+B)", field: "totOrdAmt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return gagaAgGrid.toAddComma(params.value);
- }
- },
- {headerName: "매출액(A)", field: "ordAmt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return gagaAgGrid.toAddComma(params.value);
- }
- },
- {headerName: "취/반품액(B)", field: "cnclAmt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return gagaAgGrid.toAddComma(params.value);
- }
- },
- {headerName: "주문수", field: "ordCnt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return gagaAgGrid.toAddComma(params.value);
- }
- },
- {headerName: "취/반품갯수", field: "cnclQty", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return gagaAgGrid.toAddComma(params.value);
- }
- },
- {headerName: "기간평균주문수", field: "avgOrdCnt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return gagaAgGrid.toAddComma(params.value);
- }
- },
- {headerName: "평균주문상품개수", field: "avgSellQty", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return gagaAgGrid.toAddComma(params.value);
- }
- },
- {headerName: "객단가", field: "custPrice", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return gagaAgGrid.toAddComma(params.value);
- }
- }
- ]
- }
- ];
- let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
- 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}
- }
- ];
- 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 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 len = 0;
- let totInfo = {};
- totInfo.age = '';
- totInfo.sexGb = 'TOTAL';
- totInfo.totOrdAmt = 0;
- totInfo.ordAmt = 0;
- totInfo.cnclAmt = 0;
- totInfo.ordCnt = 0;
- totInfo.cnclQty = 0;
- totInfo.avgOrdCnt = 0;
- totInfo.avgSellQty = 0;
- totInfo.custPrice = 0;
- gridOptions.api.forEachNode(function(rowNode, index) {
- if (!rowNode.group) {
- if( typeof rowNode.data.totOrdAmt == 'number') { totInfo.totOrdAmt += rowNode.data.totOrdAmt ; }
- if( typeof rowNode.data.ordAmt == 'number') { totInfo.ordAmt += rowNode.data.ordAmt ; }
- if( typeof rowNode.data.cnclAmt == 'number') { totInfo.cnclAmt += rowNode.data.cnclAmt ; }
- if( typeof rowNode.data.ordCnt == 'number') { totInfo.ordCnt += rowNode.data.ordCnt ; if (rowNode.data.ordCnt > 0) len++; }
- if( typeof rowNode.data.cnclQty == 'number') { totInfo.cnclQty += rowNode.data.cnclQty ; }
- if( typeof rowNode.data.avgOrdCnt == 'number') { totInfo.avgOrdCnt += rowNode.data.avgOrdCnt ; }
- if( typeof rowNode.data.avgSellQty == 'number') { totInfo.avgSellQty += rowNode.data.avgSellQty ; }
- if( typeof rowNode.data.custPrice == 'number') { totInfo.custPrice += rowNode.data.custPrice ; }
- }
- });
- totInfo.avgOrdCnt = (Math.round(totInfo.avgOrdCnt / len * 10) / 10);
- totInfo.avgSellQty = (Math.round(totInfo.avgSellQty / len * 10) / 10);
- totInfo.custPrice = Math.floor(totInfo.custPrice / len);
- gagaAgGrid.setPinnedRowData(gridOptions, totInfo, 'top');
- }
- // 초기화 클릭시
- $('#btnInit').on('click', function() {
- $('#searchForm')[0].reset();
- $('#brandCdTxt').html('');
- $('#searchForm input[name=brandCdList]').val('');
- $('#itemkindCdTxt').html('');
- $('#searchForm input[name=itemkindCdList]').val('');
- });
- // 엑셀다운로드
- $('#btnExcel').on('click', function() {
- gagaAgGrid.exportToExcel('일자별주문 목록', gridOptions);
- });
- $(document).ready(function() {
- cfnCreateCalendar('#terms', 'startDt', 'endDt', true, '주문', undefined, ['btnToday']);
- $('.btnYesterday').trigger('click');
- // Create a agGrid
- gagaAgGrid.createGrid('gridList', gridOptions);
- });
- /*]]>*/
- </script>
- </html>
|