BrandTradingForm.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <!--
  5. *******************************************************************************
  6. * @source : BrandTradingForm.html
  7. * @desc : 브랜드별주문 Page
  8. *============================================================================
  9. * STYLE24
  10. * Copyright(C) 2020 TSIT, All rights reserved.
  11. *============================================================================
  12. * VER DATE AUTHOR DESCRIPTION
  13. * === =========== ========== =============================================
  14. * 1.0 2021-09-16 목 lmc 최초 작성
  15. *******************************************************************************
  16. -->
  17. <div id="main">
  18. <!-- 메인타이틀 영역 -->
  19. <div class="main-title"></div>
  20. <!-- //메인타이틀 영역 -->
  21. <!-- 메뉴 설명 -->
  22. <div class="infoBox menu-desc"></div>
  23. <!-- //메뉴 설명 -->
  24. <!-- 검색조건 영역 -->
  25. <div class="panelStyle">
  26. <form id="searchForm" name="searchForm" action="#" th:action="@{'/statistics/brand/order/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
  27. <input type="hidden" name="dayGb" value="D"/>
  28. <table class="frmStyle" aria-describedby="검색조건">
  29. <colgroup>
  30. <col style="width:10%;"/>
  31. <col style="width:25%;"/>
  32. <col style="width:10%;"/>
  33. <col/>
  34. </colgroup>
  35. <tr>
  36. <th>기간<i class="required" title="필수" aria-hidden="true"></i></th>
  37. <td colspan="3" id="terms"></td>
  38. </tr>
  39. <tr>
  40. <th>디바이스</th>
  41. <td>
  42. <label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="P" checked="checked"/>PC웹</label>
  43. <label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="M" checked="checked"/>모바일웹</label>
  44. <label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="A" checked="checked"/>APP</label>
  45. </td>
  46. <th>제휴몰</th>
  47. <td>
  48. <input type="text" class="w100" name="extmallIdSearchTxt" id="extmallIdSearchTxt" maxlength="20"/>
  49. <button type="button" class="btn icn" onclick="cfnOpenExtmallListPopup('fnSetExtmallInfo', 'M');"><i class="fa fa-search"></i></button>
  50. <span id="extmallIdTxt"></span>
  51. <input type="hidden" name="extmallIdList"/>
  52. </td>
  53. </tr>
  54. <tr>
  55. <th>물류구분</th>
  56. <td colspan="3">
  57. <label class="chkBox checked"><input type="checkbox" name="multiDistributionGb" value="SCM" checked="checked"/>입점</label>
  58. <label class="chkBox checked"><input type="checkbox" name="multiDistributionGb" value="WMS" checked="checked"/>위탁</label>
  59. </td>
  60. </tr>
  61. <tr>
  62. <th>공급업체</th>
  63. <td>
  64. <input type="text" class="w100" name="supplyCompCdSearchTxt" id="supplyCompCdSearchTxt" maxlength="20"/>
  65. <button type="button" class="btn icn" onclick="cfnOpenCompanyListPopup('fnSetSupplyCompInfo', 'M');"><i class="fa fa-search"></i></button>
  66. <span id="supplyCompCdTxt"></span>
  67. <input type="hidden" name="supplyCompCdList"/>
  68. </td>
  69. <th>제휴채널</th>
  70. <td>
  71. <input type="text" class="w100" name="afLinkCdSearchTxt" id="afLinkCdSearchTxt" maxlength="20" />
  72. <button type="button" class="btn icn" onclick="cfnOpenAfLinkListPopup('fnSetAfLinkInfo', 'M');"><i class="fa fa-search"></i></button>
  73. <span id="afLinkCdTxt"></span>
  74. <input type="hidden" name="afLinkCdList"/>
  75. </td>
  76. </tr>
  77. <tr>
  78. <th>브랜드</th>
  79. <td>
  80. <input type="text" class="w100" name="brandCdSearchTxt" id="brandCdSearchTxt" maxlength="20" />
  81. <button type="button" class="btn icn" onclick="cfnOpenBrandListPopup('fnSetBrandInfo', 'M');"><i class="fa fa-search"></i></button>
  82. <span id="brandCdTxt"></span>
  83. <input type="hidden" name="brandCdList"/>
  84. </td>
  85. <th>품목</th>
  86. <td>
  87. <input type="text" class="w100" name="itemkindCdSearchTxt" id="itemkindCdSearchTxt" maxlength="20" />
  88. <button type="button" class="btn icn" onclick="cfnOpenItemkindListPopup('fnSetItemkindInfo', 'M');"><i class="fa fa-search"></i></button>
  89. <span id="itemkindCdTxt"></span>
  90. <input type="hidden" name="itemkindCdList"/>
  91. </td>
  92. </tr>
  93. </table>
  94. <ul class="panelBar">
  95. <li class="center">
  96. <button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
  97. <button type="button" class="btn btn-gray btn-lg" id="btnInit">초기화</button>
  98. </li>
  99. </ul>
  100. </form>
  101. </div>
  102. <!-- 검색조건 영역 -->
  103. <!-- 리스트 영역 -->
  104. <div class="panelStyle">
  105. <ul class="panelBar">
  106. <li>
  107. <button type="button" class="btn btn-default btn-lg" onclick="fnExcelDownLoad();">엑셀다운로드</button>
  108. </li>
  109. </ul>
  110. <div id="gridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
  111. </div>
  112. <!-- //리스트 영역 -->
  113. </div>
  114. <style>
  115. .ag-header-group-text{
  116. margin-left: calc(50% - 25px);
  117. }
  118. </style>
  119. <script th:inline="javascript">
  120. /*<![CDATA[*/
  121. let columnDefs = [
  122. { headerName: "브랜드번호", field: "brandCd", width: 100, cellClass: 'text-center' },
  123. { headerName: "브랜드명", field: "brandEnm", width: 180, cellClass: 'text-center'},
  124. { headerName: "브랜드 매출액", field: "", width: 120, cellClass: 'text-right',
  125. children: [
  126. {headerName: "총매출액(A+B+C)", field: "totAmt", width: 120, cellClass: 'text-center',
  127. cellRenderer: function(params) {
  128. return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
  129. }
  130. },
  131. {headerName: "판매 개수", field: "sellQty", width: 120, cellClass: 'text-right',
  132. cellRenderer: function(params) {
  133. return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
  134. }
  135. },
  136. {headerName: "YOY(%)", field: "yoyRate", width: 100, cellClass: 'text-right',
  137. cellRenderer: function(params) {
  138. return params.value +'%';
  139. }
  140. },
  141. ]
  142. },
  143. { headerName: "매출 현황", field: "", width: 100, cellClass: 'text-center',
  144. children: [
  145. {headerName: "자사몰 매출액(A)", field: "selfmallAmt", width: 120, cellClass: 'text-right',
  146. cellRenderer: function (params) {
  147. return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
  148. }
  149. },
  150. {headerName: "제휴몰 매출액(B)", field: "extmallAmt", width: 150, cellClass: 'text-right',
  151. cellRenderer: function (params) {
  152. return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
  153. }
  154. },
  155. {headerName: "취/반품액(C)", field: "cnclAmt", width: 150, cellClass: 'text-right',
  156. cellRenderer: function (params) {
  157. return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
  158. }
  159. },
  160. ]
  161. },
  162. { headerName: "정상이월 결제비중", field: "", width: 100, cellClass: 'text-center',
  163. children: [
  164. {headerName: "정상", field: "totAmt10", width: 150, cellClass: 'text-right',
  165. cellRenderer: function (params) {
  166. return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
  167. }
  168. },
  169. {headerName: "이월", field: "totAmt20", width: 120, cellClass: 'text-right',
  170. cellRenderer: function (params) {
  171. return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
  172. }
  173. },
  174. {headerName: "정상비", field: "amtRate10", width: 100, cellClass: 'text-right',
  175. cellRenderer: function(params) {
  176. return params.value +'%';
  177. }
  178. }
  179. ]
  180. },
  181. ];
  182. let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
  183. // Row Click
  184. gridOptions.onCellClicked = function(event) {
  185. var goodsCd = event.data.goodsCd;
  186. if (event.colDef.field == "goodsCd"){
  187. cfnOpenGoodsDetailPopup('U',goodsCd);
  188. }
  189. if (event.colDef.field == "goodsNm"){
  190. cfnOpenGoodsDetailPopup('U',goodsCd);
  191. }
  192. }
  193. gridOptions.excelStyles = [
  194. {
  195. id: 'text-center',
  196. dataType: 'string',
  197. font: {size : 10, bold: false}
  198. },
  199. {
  200. id: 'text-left',
  201. dataType: 'string',
  202. font: {size : 10, bold: false}
  203. },
  204. {
  205. id: 'text-right',
  206. dataType: 'number',
  207. font: {size : 10, bold: false}
  208. }
  209. ];
  210. var fnExcelDownLoad = function(){
  211. var totalRows = gridOptions.api.getDisplayedRowCount();
  212. if(totalRows==0){
  213. mcxDialog.alert('조회된 내역이 없습니다.');
  214. return;
  215. }
  216. var date = new Date().format("YYYYMMDDHHmmss");
  217. var params = {
  218. fileName : "브랜드별 주문목록_"+ date,
  219. sheetName: "DATA"
  220. };
  221. gridOptions.api.exportDataAsExcel(params);
  222. }
  223. // 제휴몰 조회 팝업에서 호출
  224. var fnSetExtmallInfo = function(result) {
  225. var arrExtmallId = [];
  226. var extmallIdTxt = "";
  227. var sIndex = 0;
  228. $('#extmallIdTxt').html('');
  229. $('#searchForm input[name=extmallIdSearchTxt]').val('');
  230. result.forEach(function(extmall) {
  231. sIndex++;
  232. arrExtmallId.push(extmall.extmallId);
  233. });
  234. // 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
  235. if (sIndex == 1) {
  236. $('#searchForm input[name=extmallIdSearchTxt]').val(arrExtmallId[0]);
  237. } else {
  238. extmallIdTxt = sIndex + " 개";
  239. $('#extmallIdTxt').html(extmallIdTxt);
  240. }
  241. var jsonData = JSON.stringify(arrExtmallId);
  242. $("#searchForm input[name=extmallIdList]").val(arrExtmallId.join(','));
  243. }
  244. // 업체 조회 팝업에서 호출
  245. var fnSetSupplyCompInfo = function(result) {
  246. var arrSupplyCompCd = [];
  247. var supplyCompCdTxt = "";
  248. var sIndex = 0;
  249. $('#supplyCompCdTxt').html('');
  250. $('#searchForm input[name=supplyCompCdSearchTxt]').val('');
  251. result.forEach(function(supplyComp) {
  252. sIndex++;
  253. arrSupplyCompCd.push(supplyComp.supplyCompCd);
  254. });
  255. // 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
  256. if (sIndex == 1) {
  257. $('#searchForm input[name=supplyCompCdSearchTxt]').val(arrSupplyCompCd[0]);
  258. } else {
  259. supplyCompCdTxt = sIndex + " 개";
  260. $('#supplyCompCdTxt').html(supplyCompCdTxt);
  261. }
  262. var jsonData = JSON.stringify(arrSupplyCompCd);
  263. $("#searchForm input[name=supplyCompCdList]").val(arrSupplyCompCd.join(','));
  264. }
  265. // 제휴채널 조회 팝업에서 호출
  266. var fnSetAfLinkInfo = function(result) {
  267. var arrAfLinkCd = [];
  268. var afLinkCdTxt = "";
  269. var sIndex = 0;
  270. $('#afLinkCdTxt').html('');
  271. $('#searchForm input[name=afLinkCdSearchTxt]').val('');
  272. result.forEach(function(afLink) {
  273. sIndex++;
  274. arrAfLinkCd.push(afLink.afLinkCd);
  275. });
  276. // 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
  277. if (sIndex == 1) {
  278. $('#searchForm input[name=afLinkCdSearchTxt]').val(arrAfLinkCd[0]);
  279. } else {
  280. afLinkCdTxt = sIndex + " 개";
  281. $('#afLinkCdTxt').html(afLinkCdTxt);
  282. }
  283. var jsonData = JSON.stringify(arrAfLinkCd);
  284. $("#searchForm input[name=afLinkCdList]").val(arrAfLinkCd.join(","));
  285. }
  286. // 브랜드 조회 팝업에서 호출
  287. var fnSetBrandInfo = function(result) {
  288. var arrBrandCd = [];
  289. var brandCdTxt = "";
  290. var bIndex = 0;
  291. $('#brandCdTxt').html('');
  292. $('#searchForm input[name=brandCdSearchTxt]').val('');
  293. result.forEach(function(brand){
  294. bIndex++;
  295. arrBrandCd.push(brand.brandCd);
  296. });
  297. // 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
  298. if (bIndex == 1) {
  299. $('#searchForm input[name=brandCdSearchTxt]').val(arrBrandCd[0]);
  300. } else {
  301. brandCdTxt = bIndex + " 개";
  302. $('#brandCdTxt').html(brandCdTxt);
  303. }
  304. var jsonData = JSON.stringify(arrBrandCd);
  305. $("#searchForm input[name=brandCdList]").val(arrBrandCd.join(","));
  306. }
  307. // 품목 조회 팝업에서 호출
  308. var fnSetItemkindInfo = function(result) {
  309. var arrItemkindCd = [];
  310. var itemkindCdTxt = "";
  311. var bIndex = 0;
  312. $('#itemkindCdTxt').html('');
  313. $('#searchForm input[name=itemkindCdSearchTxt]').val('');
  314. result.forEach(function(itemkind){
  315. bIndex++;
  316. arrItemkindCd.push(itemkind.itemkindCd);
  317. });
  318. // 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
  319. if (bIndex == 1) {
  320. $('#searchForm input[name=itemkindCdSearchTxt]').val(arrItemkindCd[0]);
  321. } else {
  322. itemkindCdTxt = bIndex + " 개";
  323. $('#itemkindCdTxt').html(itemkindCdTxt);
  324. }
  325. var jsonData = JSON.stringify(arrItemkindCd);
  326. $("#searchForm input[name=itemkindCdList]").val(arrItemkindCd.join(','));
  327. }
  328. // 검색
  329. $('#btnSearch').on('click', function() {
  330. // 입력 값 체크
  331. if (!gagajf.validation($('#searchForm')))
  332. return false;
  333. gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm', fnCreateTotal);
  334. });
  335. // 합계 생성
  336. let fnCreateTotal = function() {
  337. let totInfo = {};
  338. totInfo.brandCd = 'TOTAL';
  339. totInfo.totAmt = 0;
  340. totInfo.sellQty = 0;
  341. totInfo.selfmallAmt = 0;
  342. totInfo.extmallAmt = 0;
  343. totInfo.cnclAmt = 0;
  344. totInfo.totAmt10 = 0;
  345. totInfo.totAmt20 = 0;
  346. totInfo.yoyRate = 0;
  347. totInfo.yoyTotOrdAmt= 0;
  348. gridOptions.api.forEachNode(function(rowNode, index) {
  349. if (!rowNode.group) {
  350. if( typeof rowNode.data.totAmt == 'number') { totInfo.totAmt += rowNode.data.totAmt ; }
  351. if( typeof rowNode.data.sellQty == 'number') { totInfo.sellQty += rowNode.data.sellQty ; }
  352. if( typeof rowNode.data.selfmallAmt == 'number') { totInfo.selfmallAmt += rowNode.data.selfmallAmt ; }
  353. if( typeof rowNode.data.extmallAmt == 'number') { totInfo.extmallAmt += rowNode.data.extmallAmt ; }
  354. if( typeof rowNode.data.cnclAmt == 'number') { totInfo.cnclAmt += rowNode.data.cnclAmt ; }
  355. if( typeof rowNode.data.totAmt10 == 'number') { totInfo.totAmt10 += rowNode.data.totAmt10 ; }
  356. if( typeof rowNode.data.totAmt20 == 'number') { totInfo.totAmt20 += rowNode.data.totAmt20 ; }
  357. if( typeof rowNode.data.yoyTotOrdAmt== 'number') { totInfo.yoyTotOrdAmt += rowNode.data.yoyTotOrdAmt; }
  358. }
  359. });
  360. /*if(totInfo.totAmt > 0 && totInfo.yoyTotOrdAmt > 0){
  361. totInfo.yoyRate = (totInfo.totAmt / totInfo.yoyTotOrdAmt * 100 - 100).toFixed(1);
  362. }else{
  363. totInfo.yoyRate = 0;
  364. }*/
  365. var mod = 1;
  366. if(totInfo.yoyTotOrdAmt > 0) mod = totInfo.yoyTotOrdAmt;
  367. totInfo.yoyRate = Math.floor(totInfo.totAmt / mod * 100 * 100) / 100;
  368. mod = 1;
  369. if(totInfo.totAmt > 0) mod = totInfo.totAmt;
  370. totInfo.amtRate10 = Math.floor(totInfo.totAmt10 / mod * 100 * 100) / 100;
  371. gagaAgGrid.setPinnedRowData(gridOptions, totInfo, 'top');
  372. }
  373. // 초기화 클릭시
  374. $('#btnInit').on('click', function() {
  375. $('#searchForm')[0].reset();
  376. $('#extmallIdTxt').html('');
  377. $('#searchForm input[name=extmallIdList]').val('');
  378. $('#supplyCompCdTxt').html('');
  379. $('#searchForm input[name=supplyCompCdList]').val('');
  380. $('#afLinkCdTxt').html('');
  381. $('#searchForm input[name=afLinkCdList]').val('');
  382. $('#brandCdTxt').html('');
  383. $('#searchForm input[name=brandCdList]').val('');
  384. $('#itemkindCdTxt').html('');
  385. $('#searchForm input[name=itemkindCdList]').val('');
  386. });
  387. // 엑셀다운로드
  388. $('#btnExcel').on('click', function() {
  389. gagaAgGrid.exportToExcel('일자별주문 목록', gridOptions);
  390. });
  391. $(document).ready(function() {
  392. cfnCreateCalendar('#terms', 'startDt', 'endDt', true, '주문', undefined, ['btnToday']);
  393. $('.btnYesterday').trigger('click');
  394. // Create a agGrid
  395. gagaAgGrid.createGrid('gridList', gridOptions);
  396. });
  397. /*]]>*/
  398. </script>
  399. </html>