Pārlūkot izejas kodu

입점업체정산 추가

gagamel 4 gadi atpakaļ
vecāks
revīzija
eb2aaea0ea

+ 42 - 0
src/main/java/com/style24/persistence/domain/SupplyCompFee.java

@@ -0,0 +1,42 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 입점업체수수료 Domain
+ *
+ * @author gagamel
+ * @since 2021. 7. 26
+ */
+@SuppressWarnings("serial")
+@Data
+public class SupplyCompFee extends TscBaseDomain {
+
+	private String usacYm;				// 정산연월
+	private String supplyVendorCd;		// 공급벤더코드
+	private String supplyCompCd;		// 공급업체코드
+	private String supplyCompNm;		// 공급업체명
+	private int sellQty;				// 판매수량
+	private int realSellAmt;			// 실판매금액(=상품총액)
+	private int sellFeeAmt;				// 수수료(실판매금액 * 판매수수료율)
+	private int cpnDcAmt;				// 쿠폰할인총액
+	private int selfCpnDcAmt;			// 자사쿠폰분담액
+	private int supplyCompCpnDcAmt;		// 입점쿠폰분담액
+	private int tmtbDcAmt;				// 다다익선할인총액
+	private int selfTmtbDcAmt;			// 자사다다익선분담액
+	private int supplyCompTmtbDcAmt;	// 입점다다익선분담액
+	private int billAmt;				// 계산서발행금액
+	private int supplyAmt;				// 공급금액
+	private int taxAmt;					// 세액
+	private int delvFee;				// 배송비
+	private int etcDeductAmt;			// 기타차감
+	private int giveAmt;				// 지급금액
+	private int receivableAmt;			// 미수금
+	private int totGiveAmt;				// 총지급금액
+
+	// 검색조건
+	private String settleYm;			// 정산연월
+
+}

+ 47 - 0
src/main/java/com/style24/persistence/mybatis/shop/TssSettle.xml

@@ -66,5 +66,52 @@
 		GROUP  BY AF_LINK_CD, AF_LINK_NM, OCCUR_DT, ORD_NO, ORD_DTL_STAT
 		ORDER  BY AF_LINK_CD, AF_LINK_NM, OCCUR_DT, ORD_NO, ORD_DTL_STAT
 	</select>
+	
+	<!-- 입점업체정산 목록 -->
+	<select id="getSupplyCompanyFeeList" parameterType="SupplyCompFee" resultType="SupplyCompFee">
+		/* TsaSettle.getSupplyCompanyFeeList */
+		SELECT U.USAC_YM                                                                                                 /*정산연월*/
+		     , U.SUPPLY_COMP_CD                                                                                          /*공급업체코드*/
+		     , SC.SUPPLY_COMP_NM                                                                                         /*공급업체명*/
+		     , U.SELL_QTY                                                                                                /*판매수량*/
+		     , U.REAL_SELL_AMT                                                                                           /*실판매금액(=상품총액)*/
+		     , U.SELL_FEE_AMT                                                                                            /*수수료*/
+		     , U.CPN_DC_AMT                                                                                              /*쿠폰할인금액*/
+		     , U.SELF_CPN_DC_AMT                                                                                         /*자사쿠폰분담액*/
+		     , U.SUPPLY_COMP_CPN_DC_AMT                                                                                  /*입점쿠폰분담액*/
+		     , U.TMTB_DC_AMT                                                                                             /*다다익선할인금액*/
+		     , U.SELF_TMTB_DC_AMT                                                                                        /*자사다다익선분담액*/
+		     , U.SUPPLY_COMP_TMTB_DC_AMT                                                                                 /*입점다다익선분담액*/
+		     , U.BILL_AMT                                                                                                /*계산서발행금액*/
+		     , U.SUPPLY_AMT                                                                                              /*공급금액*/
+		     , U.TAX_AMT                                                                                                 /*세액*/
+		     , U.DELV_FEE                                                                                                /*배송비*/
+		     , IFNULL(UR2.ETC_DEDUCT_AMT,0)                                                            AS ETC_DEDUCT_AMT /*기타차감*/
+		     , (U.REAL_SELL_AMT - U.SELL_FEE_AMT + U.SELF_CPN_DC_AMT + U.SELF_TMTB_DC_AMT)
+		       + U.DELV_FEE - IFNULL(UR2.ETC_DEDUCT_AMT,0)                                             AS GIVE_AMT       /*지급금액*/
+		     , IFNULL(UR1.RECEIVABLE_AMT,0)                                                            AS RECEIVABLE_AMT /*미수금*/
+		     , (U.REAL_SELL_AMT - U.SELL_FEE_AMT + U.SELF_CPN_DC_AMT + U.SELF_TMTB_DC_AMT)
+		       + U.DELV_FEE - IFNULL(UR2.ETC_DEDUCT_AMT,0)
+		       - IFNULL(UR1.RECEIVABLE_AMT,0)                                                          AS TOT_GIVE_AMT   /*총지급금액*/
+		FROM   TB_USAC U
+		INNER JOIN TB_SUPPLY_COMPANY SC ON U.SUPPLY_COMP_CD = SC.SUPPLY_COMP_CD
+		INNER JOIN TB_SUPPLY_VENDOR SV ON SC.SUPPLY_VENDOR_CD = SV.SUPPLY_VENDOR_CD
+		LEFT OUTER JOIN TB_USAC_RECEIVE UR1 ON U.USAC_YM = UR1.USAC_YM
+		                                   AND U.SUPPLY_COMP_CD = UR1.SUPPLY_COMP_CD
+		LEFT OUTER JOIN (
+		                 SELECT OCCUR_YM        AS USAC_YM
+		                      , SUPPLY_COMP_CD
+		                      , SUM(REWARD_AMT) AS ETC_DEDUCT_AMT
+		                 FROM   TB_USAC_DEDUCT
+		                 WHERE  OCCUR_YM = REPLACE(#{settleYm},'-','')
+		                 GROUP  BY OCCUR_YM, SUPPLY_COMP_CD
+		                ) UR2 ON U.USAC_YM = UR2.USAC_YM
+		                     AND U.SUPPLY_COMP_CD = UR2.SUPPLY_COMP_CD
+		WHERE  U.USAC_YM = REPLACE(#{settleYm},'-','')
+		AND    SV.SUPPLY_VENDOR_CD = #{supplyVendorCd}
+		<if test="supplyCompCd != null and supplyCompCd != ''">
+		AND    U.SUPPLY_COMP_CD = #{supplyCompCd}
+		</if>
+	</select>
 
 </mapper>

+ 10 - 0
src/main/java/com/style24/scm/biz/dao/TssSettleDao.java

@@ -4,6 +4,7 @@ import java.util.Collection;
 
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.AflinkFee;
+import com.style24.persistence.domain.SupplyCompFee;
 
 /**
  * 정산 Dao
@@ -23,4 +24,13 @@ public interface TssSettleDao {
 	 */
 	Collection<AflinkFee> getAfLinkFeeList(AflinkFee afLinkFee);
 
+	/**
+	 * 입점업체정산 목록
+	 * @param supplyCompFee - 입점업체정산 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 9. 2
+	 */
+	Collection<SupplyCompFee> getSupplyCompanyFeeList(SupplyCompFee supplyCompFee);
+
 }

+ 12 - 0
src/main/java/com/style24/scm/biz/service/TssSettleService.java

@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.style24.persistence.domain.AflinkFee;
+import com.style24.persistence.domain.SupplyCompFee;
 import com.style24.scm.biz.dao.TssSettleDao;
 
 import lombok.extern.slf4j.Slf4j;
@@ -34,4 +35,15 @@ public class TssSettleService {
 		return settleDao.getAfLinkFeeList(afLinkFee);
 	}
 
+	/**
+	 * 입점업체정산 목록
+	 * @param supplyCompFee - 입점업체정산 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 9. 2
+	 */
+	public Collection<SupplyCompFee> getSupplyCompanyFeeList(SupplyCompFee supplyCompFee) {
+		return settleDao.getSupplyCompanyFeeList(supplyCompFee);
+	}
+
 }

+ 33 - 0
src/main/java/com/style24/scm/biz/web/TssSettleController.java

@@ -13,6 +13,7 @@ import org.springframework.web.servlet.ModelAndView;
 
 import com.style24.persistence.domain.AflinkFee;
 import com.style24.persistence.domain.CommonCode;
+import com.style24.persistence.domain.SupplyCompFee;
 import com.style24.scm.biz.service.TssRendererService;
 import com.style24.scm.biz.service.TssSettleService;
 import com.style24.scm.support.controller.TssBaseController;
@@ -75,4 +76,36 @@ public class TssSettleController extends TssBaseController {
 		return settleService.getAfLinkFeeList(aflinkFee);
 	}
 
+	/**
+	 * 입점업체정산 화면
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 9. 2
+	 */
+	@GetMapping("/supply/company/fee/form")
+	public ModelAndView supplyCompanFeeForm() {
+		ModelAndView mav = new ModelAndView("settle/SupplyCompanyFeeForm");
+
+		// 입점업체 목록
+		mav.addObject("supplyCompList", rendererService.getEntrSupplyCompanyList(TssSession.getInfo().getSupplyVendorCd()));
+
+		return mav;
+	}
+
+	/**
+	 * 입점업체정산 목록
+	 * @param supplyCompFee - 입점업체정산 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 1. 20
+	 */
+	@PostMapping("/supply/company/fee/list")
+	@ResponseBody
+	public Collection<SupplyCompFee> getSupplyCompanyFeeList(@RequestBody SupplyCompFee supplyCompFee) {
+		// 파라미터로 다른 값을 입력해 조회할 수 있으므로 세션값으로 다시 설정
+		supplyCompFee.setSupplyVendorCd(TssSession.getInfo().getSupplyVendorCd());
+
+		return settleService.getSupplyCompanyFeeList(supplyCompFee);
+	}
+
 }

+ 223 - 0
src/main/webapp/WEB-INF/views/settle/SupplyCompanyFeeForm.html

@@ -0,0 +1,223 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : SupplyCompanyFeeForm.html
+ * @desc    : 입점업체정산 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.09.02   gagamel     최초 작성
+ *******************************************************************************
+ -->
+	<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="@{'/settle/supply/company/fee/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
+				<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>
+							<input type="text" class="schMonth w60" name="settleYm" id="settleYm" maxlength="7" required="required"/>
+							<button type="button" class="btn icn schBtn" data-id="settleYm"><i class="fa fa-calendar" aria-hidden="true"></i></button>
+						</td>
+						<th>공급업체</th>
+						<td>
+							<select name="supplyCompCd">
+								<option value="">[전체]</option>
+								<option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</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" onclick="$('#searchForm')[0].reset();">초기화</button>
+					</li>
+				</ul>
+			</form>
+		</div>
+		<!-- 검색조건 영역 -->
+
+		<!-- 리스트 영역 -->
+		<div class="panelStyle">
+			<!-- 버튼 배치 영역 -->
+			<ul class="panelBar">
+				<li class="left">
+					<span class="infoTxt cBlue">* 항목 설명</span>
+					<!-- 아이콘 툴팁 -->
+					<div class="iconTooltip marL10">
+						<i class="fa fa-info" aria-hidden="true"></i>
+						<span class="left" style="width: 600px;">
+							<strong>1.계산서발행금액</strong>: ROUND(수수료 - (자사쿠폰분담액 + 자사다다익선분담액), 0) (< 0 인 경우 0으로 표기)<br/>
+							<strong>2.공급가액</strong>: INT(계산서발행금액 / 1.1)<br/>
+							<strong>3.세액</strong>: 계산서발행금액 - 공급가액<br/>
+							<strong>4.지급금액</strong>: (상품총액 – 수수료 + 자사쿠폰분담액 + 자사다다익선분담액) + 배송비 - 기타차감<br/>
+							<strong>5.총지급금액</strong>: 지급금액 - 미수금<br/>
+							<strong>6.상태</strong>: 전자계약여부 = 'N' then [보류] else 지급금액 < 0 then [미수금] else [정상]
+						</span>
+					</div>
+					<!-- //아이콘 툴팁 -->
+				</li>
+				<li class="right">
+					<button type="button" class="btn btn-warning btn-lg" id="btnDownloadTaxBillExcel">세금계산서용 엑셀다운로드</button>
+					<a href="javascript:void(0);" id="taxBillExcel" style="display: none;">세금계산서엑셀</a>
+					<button type="button" class="btn btn-default btn-lg" id="btnExcel">엑셀다운로드</button>
+				</li>
+			</ul>
+			<!-- //버튼 배치 영역 -->
+			
+			<div id="gridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
+		</div>
+		<!-- //리스트 영역 -->
+	</div>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	let columnDefs = [
+		{ headerName: "정산연월", field: "usacYm", width: 80, cellClass: 'text-center', hide: true },
+		{ headerName: "공급업체코드", field: "supplyCompCd", width: 100, cellClass: 'text-center', hide: true },
+		{ headerName: "공급업체", field: "supplyCompNm", width: 200 },
+		{
+			headerName: "판매수량", field: "sellQty", width: 100, cellClass: 'text-center',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "상품총액", field: "realSellAmt", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "수수료", field: "sellFeeAmt", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "공급가액", field: "supplyAmt", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "세액", field: "taxAmt", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "쿠폰할인총액", field: "cpnDcAmt", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "자사쿠폰분담액", field: "selfCpnDcAmt", width: 120, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "입점쿠폰분담액", field: "supplyCompCpnDcAmt", width: 120, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "다다익선할인총액", field: "tmtbDcAmt", width: 120, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "자사다다익선분담액", field: "selfTmtbDcAmt", width: 150, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "입점다다익선분담액", field: "supplyCompTmtbDcAmt", width: 150, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "계산서발행금액", field: "billAmt", width: 120, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "배송비", field: "delvFee", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "기타차감", field: "etcDeductAmt", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle: { color: '#B50808', 'background-color': '#FF9AA2' }
+		},
+		{
+			headerName: "지급금액", field: "giveAmt", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		},
+		{
+			headerName: "미수금", field: "receivableAmt", width: 100, cellClass: 'text-right',
+			editable: true, cellEditor: 'numericCellEditor', cellEditorParams: { maxlength: 12, validType: 'integer', required: true },
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(Number(params.value)); },
+			cellStyle: { color: '#fffff', 'background-color': '#aaaaff' }
+		},
+		{
+			headerName: "총지급금액", field: "totGiveAmt", width: 100, cellClass: 'text-right',
+			cellRenderer: function (params) { return gagaAgGrid.toAddComma(params.value); },
+			cellStyle : function(params) { if (Number(params.value) < 0) return { 'color' : 'red' } }
+		}
+	];
+
+	let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+	gridOptions.stopEditingWhenGridLosesFocus = true;
+	
+	// 검색
+	$('#btnSearch').on('click', function() {
+		// 입력 값 체크
+		if (!gagajf.validation('#searchForm'))
+			return false;
+		
+		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm');
+	});
+	
+	// 엑셀다운로드
+	$('#btnExcel').on('click', function() {
+		if (gridOptions.api.getDisplayedRowCount() <= 0) {
+			mcxDialog.alert("조회된 데이터가 없습니다. 조회 후 다운로드 하세요.");
+			return false;
+		}
+		
+		gagaAgGrid.exportToExcel('입점업체정산 목록', gridOptions);
+	});
+	
+	$(document).ready(function() {
+		$('#settleYm').val((new Date()).before(0, 1, 0).format("YYYY-MM"));
+		
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+	});
+/*]]>*/
+</script>
+
+</html>