<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<script src="IDC/js/setToken.js"></script>
<script>
function goServiceDetail(client_code){	
	window.location = "serviceDetail.sev?client_code="+client_code;
}

var tableToExcel = (function(){
	var uri = 'data:application/vnd.ms-excel;base64,'
	    , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>'
	    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
	    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
	  return function(table, name) {
	    if (!table.nodeType) table = document.getElementById(table)
	    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
	    window.location.href = uri + base64(format(template, ctx))
	  }
})();


</script>
<script type="text/javascript">
$(function()
{
	//수정 버튼 눌렀을 때	
	$(document).on("click", ".submit_btn", function(){
		
		var td1 = $(this).parent().parent().parent().children();
		var td2 = td1.next();
		var td3 = td2.next();
		var td4 = td3.next();
		var td5 = td4.next();
		var td6 = td5.next();
		var td7 = td6.next();
		var td8 = td7.next();
		var td9 = td8.next();
		
		var deposit_date = td4.children().val();		
		var deposit_amount = td5.children().val();		
		var deposit_bank = td6.children().val();
		var deposit_name = td7.children().val();
		var deposit_note = td8.children().val();
		
		if(deposit_date == null || deposit_date == ""){
			alert("입금 날짜를 입력해주세요.");
			return false;
		}
		
		if(deposit_amount == null || deposit_amount == ""){
			alert("입금액을 입력해주세요.");
			return false;
		}
		
		if(deposit_bank == null || deposit_bank == ""){
			alert("입금 은행을 입력해주세요.");
			return false;
		}
		
		if(deposit_name == null || deposit_name == ""){
			alert("입금자를 입력해주세요.");
			return false;
		}

		$(".deposit_date").val(deposit_date);
		$(".deposit_amount").val(deposit_amount);
		$(".deposit_bank").val(deposit_bank);
		$(".deposit_name").val(deposit_name);
		$(".deposit_note").val(deposit_note);
		
		return true;
	});
});
</script>
<!-- 여기가 본 페이지이다 -->
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h4><i class="fa fa-desktop fa-fw"></i> 입금 리스트</h4>
				
			</div>
			<div class="panel-body">
				<div class="row">
					<!-- 윗줄 ㅇㅇ -->
					<form action="IdcDepositList.dep" method="post">
						<div class="col-lg-6 col-md-7 col-sm-8 col-xs-12">
							<div class="input-group">
								<input class="form-control" type="text" name="searchContent" placeholder="고객명" value="${searchContent }">
								<div class="input-group-btn">
									<input type="submit" class="btn btn-info btn-outline" value="검색">
									<a class="btn btn-outline btn-default"  href="IdcDepositListExcel.dep">엑셀</a>
								</div>
							</div>
						</div>
					</form>
				</div>
				<!-- row -->
				
<style>

.table-responsive input[type="date"],
.table-responsive input[type="time"],
.table-responsive input[type="datetime-local"],
.table-responsive input[type="month"] {
  line-height: 12px;
  line-height: 1.42857143 \0;
}
.table-responsive input[type="date"].input-sm,
.table-responsive input[type="time"].input-sm,
.table-responsive input[type="datetime-local"].input-sm,
.table-responsive input[type="month"].input-sm {
  line-height: 12px;
  line-height: 1.5 \0;
}
.table-responsive input[type="date"].input-lg,
.table-responsive input[type="time"].input-lg,
.table-responsive input[type="datetime-local"].input-lg,
.table-responsive input[type="month"].input-lg {
  line-height: 12px;
  line-height: 1.33 \0;
}
_:-ms-fullscreen,
:root input[type="date"],
_:-ms-fullscreen,
:root input[type="time"],
_:-ms-fullscreen,
:root input[type="datetime-local"],
_:-ms-fullscreen,
:root input[type="month"] {
  line-height: 1.42857143;
}
_:-ms-fullscreen.input-sm,
:root input[type="date"].input-sm,
_:-ms-fullscreen.input-sm,
:root input[type="time"].input-sm,
_:-ms-fullscreen.input-sm,
:root input[type="datetime-local"].input-sm,
_:-ms-fullscreen.input-sm,
:root input[type="month"].input-sm {
  line-height: 1.5;
}
_:-ms-fullscreen.input-lg,
:root input[type="date"].input-lg,
_:-ms-fullscreen.input-lg,
:root input[type="time"].input-lg,
_:-ms-fullscreen.input-lg,
:root input[type="datetime-local"].input-lg,
_:-ms-fullscreen.input-lg,
:root input[type="month"].input-lg {
  line-height: 1.33;
}
</style>


				
				<input type="hidden" id="token">
	   			<div class="table-responsive" id="table">
					<table class="table table-bordered table-hover table-striped" style="text-align:center;width:100%;">
						<thead>
							<tr>
								<th style="text-align:center;width:45px;">번호</th>
								<th style="text-align:center;width:45px;">코드</th>
								<th style="text-align:center;width:140px;">업체명</th>
								<th style="text-align:center;width:130px;">일자</th>
								<th style="text-align:center;width:150px;">금액</th>
								<th style="text-align:center;width:120px;">은행</th>
								<th style="text-align:center;width:160px;">입금자</th>
								<th style="text-align:center;">비고</th>
								<th style="text-align:center;width:50px;">납부</th>
								<th style="text-align:center;width:40px;">수정</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${IdcDepositList }" varStatus="i" var="temp">
								<tr>
									<td style="text-align:center;">${temp.num }</td>
									<td style="text-align:center;"><a href="/serviceDetail.sev?client_code=${temp.client_code }">${temp.client_code }</a></td>
									<td style="text-align:center;"><a href="/serviceList.sev?filter=mk_all&searchContextService=${temp.client_name }">${temp.client_name }</a></td>
									<td style="text-align:center;"><input type="date" class="depData" value="${temp.deposit_date }"></td>
									<td style="text-align:center;"><input type="text" class="depData" value="${temp.deposit_amount2 }"></td>
									<td style="text-align:center;"><!-- <input type="text" class="depData" value="${temp.deposit_bank }"> -->
										<select class="depData">
											<option value="==선택==" disabled>==선택==</option>
											<option value=${temp.deposit_bank } selected>${temp.deposit_bank }</option>
											<option value="==변경==" disabled>==변경==</option>
											<option value="농협">농협</option>
											<option value="국민">국민</option>
											<option value="우리">우리</option>
											<option value="하나">하나</option>
  										<option value="신한">신한</option>
  										<option value="==기타==" disabled>==기타==</option>
  										<option value="PRIMEIDC">PRIMEIDC</option>
  										<option value="ITSOLUTION">ITSOLUTION</option>
  										<option value="GDIDC">GDIDC</option>
										</select>
									</td>
									<td style="text-align:center;"><input type="text" class="depData" value="${temp.deposit_name }"></td>
									<td><input type="text" class="depData"  value="${temp.deposit_note }" style="width:100%;">
									</td>
									<td><a href="/serviceAccounting.sev?client_code=${temp.client_code }#mkservice">납부</a>  <!--  <input type="button" value="보기" class="btn btn-outline btn-default btn-xs " onclick="goServiceDetail('${temp.client_code }')">--></td>
									<td style="text-align:center;">										
										<form name="frm" action="IdcDepositModify.dep?num=${temp.deposit_num}" method="post" onsubmit="return validateTest();">
											<input type="hidden" name="deposit_date" class="deposit_date"/>
											<input type="hidden" name="deposit_amount" class="deposit_amount"/>
											<input type="hidden" name="deposit_bank"  class="deposit_bank"/>
											<input type="hidden" name="deposit_name" class="deposit_name" />
											<input type="hidden" name="deposit_note" class="deposit_note"/>																																		
											<input type="submit" class="btn btn-outline btn-default btn-xs submit_btn" value="수정" />
										</form>
									</td>
								</tr>
							</c:forEach>
						</tbody>
						<tfoot>
						</tfoot>
					</table>
				</div>
				<!-- table-responsive 
					<div class="btn-group">
						<a class="btn btn-outline btn-default" href="IdcClientDBList.cli">클라이언트DB로</a>
						<a class="btn btn-outline btn-default" href="serviceList.sev?client_code=${client_code}">서비스리스트로</a>
					</div>-->
				<div>
					<ul class="pagination" style="margin:0px;">
						<li>
							<a class="btn btn-outline btn-default" href="IdcDepositList.dep?searchContent=${searchContent }">
								<i class="fa fa-angle-double-left "></i>
							</a>
						</li>
						<li>
							<c:if test="${curPage!=1 }">
								<a class="btn btn-outline_btn-default" href="IdcDepositList.dep?searchOption=${searchOption }&curPage=${curPage-1 }&searchContent=${searchContent}">
									<i class="fa fa-angle-left"></i>
								</a>
							</c:if>
							<c:if test="${curPage==1 }">
								<a class="btn btn-outline_btn-default" href="IdcDepositList.dep?searchOption=${searchOption }&curPage=1&searchContent=${searchContent}">
									<i class="fa fa-angle-left"></i>
								</a>
							</c:if>
						</li>
						<c:forEach var="i" begin="${firstPage }" end="${endPage }">
							<li>
								<a class="btn btn-outline btn-defualt" href="IdcDepositList.dep?curPage=${i}&searchContent=${searchContent }">${i}</a>	
							</li>
						</c:forEach>
						<li>
							<c:if test="${curPage!=pageCnt }">
								<a class="btn btn-outline_btn-default" href="IdcDepositList.dep?searchOption=${searchOption }&curPage=${curPage+1 }&searchContent=${searchContent}">
									<i class="fa fa-angle-right"></i>
								</a>
							</c:if>
							<c:if test="${curPage==pageCnt }">
								<a class="btn btn-outline_btn-default" href="IdcDepositList.dep?searchOption=${searchOption }&curPage=${pageCnt }&searchContent=${searchContent}">
									<i class="fa fa-angle-right"></i>
								</a>
							</c:if>
						</li>
						<li>
							<a class="btn btn-outline btn-default" href="IdcDepositList.dep?curPage=${pageCnt}&searchContent=${searchContent }">
								<i class="fa fa-angle-double-right "></i>
							</a>
						</li>
					</ul>
					<!-- ul -->
				</div>
				<!-- UL DIV -->
			</div>
			<!-- panel-body -->
		</div>
		<!-- panel panel-default -->
	</div>
	<!-- col-lg-12 -->
</div>
<!-- row -->
<!-- /#page-wrapper -->
