<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:th="http://www.thymeleaf.org"
	  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	  layout:decorate="~{/web/layout/homeLayout}">
	<th:block layout:fragment="layout_css">
		<link rel="stylesheet" href="/css/web/stock_delivery_warehousing_sub.css?v1.1">
		<link rel="stylesheet" href="/css/web/modal_stock_delivery_warehousing_sub.css?v1.1">
		<link rel="stylesheet" href="/css/web/grid.css?v1.1">
	</th:block>

<th:block layout:fragment="layout_top_script">
<script src="/js/web/jquery.twbsPagination.js" type="text/javascript"></script>
<script>
let menuClass     = "[[${param.menuClass}]]"==""?"":"[[${param.menuClass}]]";

let selectUseYn   = "[[${selectUseYn}]]"==""?"N":"[[${selectUseYn}]]";
let insertUseYn   = "[[${insertUseYn}]]"==""?"N":"[[${insertUseYn}]]";
let updateUseYn   = "[[${updateUseYn}]]"==""?"N":"[[${updateUseYn}]]";
let deleteUseYn   = "[[${deleteUseYn}]]"==""?"N":"[[${deleteUseYn}]]";
let downloadUseYn = "[[${downloadUseYn}]]"==""?"N":"[[${downloadUseYn}]]";

/* 페이징 검색 관련 변수 */
let stockStatusSearchKeywordParam = "[[${param.stockStatusSearchKeywordParam}]]";
let stockStatusSort               = "[[${param.stockStatusSort}]]";
let stockStatusDir                = "[[${param.stockStatusDir}]]";
let stockStatusStart              = "[[${param.stockStatusStart}]]"==""?0:"[[${param.stockStatusStart}]]";
let stockStatusLimit              = "[[${param.stockStatusLimit}]]"==""?100:"[[${param.stockStatusLimit}]]";

let stockStatusSearchStartDate    = "[[${param.stockStatusSearchStartDate}]]";
let stockStatusSearchEndDate      = "[[${param.stockStatusSearchEndDate}]]";
let stockStatusSearchDateType     = "[[${param.stockStatusSearchDateType}]]"==""?"A":"[[${param.stockStatusSearchDateType}]]";


let stockStatusTreatmentId        = "[[${param.stockStatusTreatmentId}]]";
let stockStatusCompanyId          = "[[${param.stockStatusCompanyId}]]";

/* 검색 관련 변수 */
let stockHistorySort               = "[[${param.stockHistorySort}]]";
let stockHistoryDir                = "[[${param.stockHistoryDir}]]";
let stockHistoryStart              = "[[${param.stockHistoryStart}]]"==""?0:"[[${param.stockHistoryStart}]]";
let stockHistoryLimit              = "[[${param.stockHistoryLimit}]]"==""?100:"[[${param.stockHistoryLimit}]]";

let stockHistorySearchStartDate    = "[[${param.stockHistorySearchStartDate}]]";
let stockHistorySearchEndDate      = "[[${param.stockHistorySearchEndDate}]]";
let stockHistorySearchDateType     = "[[${param.stockHistorySearchDateType}]]"==""?"A":"[[${param.stockHistorySearchDateType}]]";
let stockHistorySearchType         = "[[${param.stockHistorySearchType}]]"==""?"":"[[${param.stockHistorySearchType}]]";


let muTreatmentId        = "[[${param.muTreatmentId}]]";
let muProductId          = "[[${param.muProductId}]]";
let muCompanyId          = "[[${param.muCompanyId}]]";


</script>
</th:block>
<th:block layout:fragment="layout_content">
<!-- 센터쪽 -->
<div class="center_box">
	<p class="page_title">입출고 내역</p>

	<div class="total_list_box">
		<ul class="total_list product_list">
			<li>
				<label>제품명<span>(단위)</span></label>
				<p id="productName"><span id="volumeUnitName"></span></p>
			</li>
			<li>
				<div>
					<label>거래처</label>
					<p id="companyName"></p>
				</div>
				<div>
					<label>사업자 등록번호</label>
					<p id="businessNumber"></p>
				</div>
			</li>
			<li>
				<div>
					<label>담담자</label>
					<p id="userName"></p>
				</div>
				<div>
					<label>연락처</label>
					<p id="phoneNumber"></p>
				</div>
				<div>
					<label>이메일</label>
					<p id="email"></p>
				</div>
			</li>
		</ul>
		<ul class="total_list enwnf_list">
			<li>
                <label>입고</label>
                <p class="number alignRight" id="inTotalQuantity"></p>
                <p class="number alignRight" id="inTotalAmount"></p>
			</li>
			<li>
                <label>사용</label>
                <p class="number alignRight" id="uOutTotalQuantity"></p>
                <p class="number alignRight" id="uOutTotalAmount"></p>
			</li>
			<li>
                <label>판매 수량</label>
                <p class="number alignRight" id="sOutTotalQuantity"></p>
                <p class="number alignRight" id="sOutTotalAmount"></p>
			</li>
			<li>
					<label>반품 수량</label>
					<p class="number alignRight" id="rOutTotalQuantity"></p>
					<p class="number alignRight" id="rOutTotalAmount"></p>
			</li>
			<li>
                <label>폐기 수량</label>
                <p class="number alignRight" id="dOutTotalQuantity"></p>
                <p class="number alignRight" id="dOutTotalAmount"></p>
			</li>
			<li>
                <label>기타 수량</label>
                <p class="number alignRight" id="eOutTotalQuantity"></p>
                <p class="number alignRight" id="eOutTotalAmount"></p>
			</li>
			<li>
                <label>재고조정 - 추가</label>
                <p class="number alignRight" id="aaInTotalQuantity"></p>
                <p class="number alignRight" id="aaInTotalAmount"></p>
			</li>
			<li>
                <label>재고조정 - 감소</label>
                <p class="number alignRight" id="adOutTotalQuantity"></p>
                <p class="number alignRight" id="adOutTotalAmount"></p>
			</li>
		</ul>
	</div>

	<div class="filter_box">
		<div class="form_box">
			<div class="select_box first dropdown">
				<button class="label" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">기간</button>
				<input type="hidden" id="stockHistorySearchDateType"></input>

				<ul class="select_option_list dropdown-menu">
					<li id="li_A" class="option_list_item first" >오늘</li>
					<li id="li_B" class="option_list_item">최근30일</li>
					<li id="li_C" class="option_list_item">최근90일</li>
					<li id="li_D" class="option_list_item">이번주</li>
					<li id="li_E" class="option_list_item">이번달</li>
					<li id="li_F" class="option_list_item">올해</li>
					<li id="li_G" class="option_list_item">지난주</li>
					<li id="li_H" class="option_list_item">지난달</li>
				</ul>
			</div>
			<div class="calendar_box">
				<div class="date_box date" id="divStockHistorySearchStartDate">
					<img src="/image/web/calendar.svg" alt="calendar"/>
					<input type="date" class="date_picker" id="stockHistorySearchStartDate">
				</div>

				<span class="slash">-</span>

				<div class="date_box last date" id="divStockHistorySearchEndDate">
					<img src="/image/web/calendar.svg" alt="calendar"/>
					<input type="date" class="date_picker" id="stockHistorySearchEndDate">
				</div>
			</div>
			
			<div class="select_box last dropdown">
				<button class="label" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">구분</button>
				<input type="hidden" id="stockHistorySearchType" />
				<ul class="select_option_list dropdown-menu">
					<li id="li_All" class="option_list_item">구분 전체</li>
					<li id="li_I" class="option_list_item">입고</li>
					<li id="li_U" class="option_list_item">사용</li>
					<li id="li_S" class="option_list_item">판매</li>
					<li id="li_R" class="option_list_item">반품</li>
					<li id="li_D" class="option_list_item">폐기</li>
					<li id="li_E" class="option_list_item">기타</li>
					<li id="li_AA" class="option_list_item">재고조정-추가</li>
					<li id="li_AD" class="option_list_item">재고조정-감소</li>
				</ul>
			</div>

			<!-- 검색input -->
			<div class="search_list">
				<button id="btnSearchStockHistory" class="search_btn" style="transition: all 0.2s ease-in-out 0s;">조회</button>
			</div>
		</div>


		<div class="right_btn_box">
			<button id="btnInStockHistory" style="transition: all 0.2s ease-in-out 0s;" class="store_btn"><img src='/image/web/ic_add.svg'/>입고</button>
			<button id="btnOutStockHistory" style="transition: all 0.2s ease-in-out 0s;" class="release_btn"><img src='/image/web/minus.svg'/>출고</button>
			<button id="btnDownloadStockHistory" class="download_btn">
				<img src="/image/web/download.svg" alt="내려받기"/>
				<p>내려받기</p>
			</button>
		</div>
	</div>


	<div id="stockHistoryGrid" class="table_box ag-theme-balham"></div>


	<!-- 페이지게이션 -->
	<div class="page_box">
		<nav ria-label="Page navigation" class="navigation">
			<ul class="pagination" id="stockHistoryPagination"></ul>
		</nav>
	</div>
</div>


<form id="stockHistorySelectListForm" method="POST" target="_blank"></form>
</th:block>
<th:block layout:fragment="layout_popup">
</th:block>
<th:block layout:fragment="layout_script">
<script src="/js/web/ag-grid-community-29.3.5.min.js"></script>
<script src="/js/web/stockhistory/stockHistorySelectList.js"></script>
<script src="/js/web/stockhistory/popup/stockHistoryInInsertPop.js"></script>
<script src="/js/web/stockhistory/popup/stockHistoryOutInsertPop.js"></script>

</th:block>
</html>
