<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html lang="ko">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>견적서</title>

    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="/publish/css/reset.css">
    <link rel="stylesheet" href="/publish/css/common.css">
    <link rel="stylesheet" href="/publish/css/estimate.css">
    <link rel="stylesheet" href="/publish/css/font.css">
    <link rel="stylesheet" href="/publish/css/button.css">
    
    <script src="/publish/js/jquery-3.5.0.js"></script>
    <script src="/publish/js/jquery.mCustomScrollbar.concat.min.js"></script>
    <script src="/publish/js/common.js"></script>
    <script src="/publish/js/content.js"></script>
    <script src="/publish/js/calendar.js"></script>
	<script src="/publish/js/popupLayer.js"></script>
    
<script>

$(document).ready(function () {
	// 인쇄하기 Click Event
	$("#btnPayEstimatePrint").click(function(){
		// 인쇄하기
		winPrint();
	});		

});

// 인쇄하기
function winPrint() {
	$("#btnPayEstimatePrint").hide();
	
	window.print();	
	
	$("#btnPayEstimatePrint").show();
}

</script>

</head>
<body style="overflow-x:hidden;">

    <!-- 견적서 -->
    <div class="estimate_wrap">
        <div class="estimate">
            <div class="est_head clearfix">
                <img src="/publish/images/CI.png" alt="문자온 CI">
                <div class="clearfix">
                    <p>(12248) 경기도 남양주시 다산순환로 20, A동 735호(다산동, 현대프리미어캠퍼스)</p>
                    <p>TEL  1551-8011</p>
                </div>
            </div>
            <div class="est_body">
                <h2>${title}</h2>
                <div class="cont1">
                    <div>
                        <p>수신자</p>
                        <table class="est_table">
                            <caption>수신자 정보</caption>
                            <colgroup>
                                <col style="width: 50px;">
                                <col style="width: auto;">
                            </colgroup>
                            <tbody>
                                <tr>
                                    <th>기&nbsp;&nbsp;업&nbsp;&nbsp;명</th>
                                    <td>${recipientName}</td>
                                </tr>
                                <tr>
                                    <th>담&nbsp;&nbsp;당&nbsp;&nbsp;자</th>
                                    <td>${managerName} (${mobile})</td>
                                </tr>
                                <tr>
                                    <th>견적일자</th>
                                    <td>${publishDate}</td>
                                </tr>
                                <tr>
                                    <th>유효기간</th>
                                    <td>결제일로부터 30일</td>
                                </tr>
                                <tr>
                                    <th>결제조건</th>
                                    <td></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div>
                        <p>공급자</p>
                        <img src="/publish/images/content/stamp.png" alt="도장" class="stamp">
                        <table class="est_table">
                            <caption>공급자 정보</caption>
                            <colgroup>
                                <col style="width: 82px;">
                                <col style="width: auto;">
                            </colgroup>
                            <tbody>
                                <tr>
                                    <th>회&nbsp;&nbsp;사&nbsp;&nbsp;명</th>
                                    <td>주식회사 아이티앤</td>
                                </tr>
                                <tr>
                                    <th>사업자등록번호</th>
                                    <td>653-87-00858</td>
                                </tr>
                                <tr>
                                    <th>대&nbsp;&nbsp;표&nbsp;&nbsp;자</th>
                                    <td>유인식</td>
                                </tr>
                                <tr>
                                    <th>전&nbsp;&nbsp;&nbsp;&nbsp;화</th>
                                    <td>1551-8011</td>
                                </tr>
                                <tr>
                                    <th>이&nbsp;&nbsp;메&nbsp;&nbsp;일</th>
                                    <td>help@iten.co.kr</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="cont2 clearfix">
                    <p>합계</p>
                    <p><span>${totSumPrice}</span> 원(${isVatStr})</p>
                </div>
                <div class="cont3">
                    <p>(단위:원, 건)</p>
                    <table class="est_table2">
                        <caption>견적서 품목, 단가, 수량, 공급가액, 부가세, 금액 정보를 제공하는 표</caption>
                        <colgroup>
                            <col style="width: 140px;">
                            <col style="width: 65px;">
                            <col style="width: auto;">
                            <col style="width: 130px;">
                            <col style="width: 130px;">
                            <col style="width: 130px;">
                        </colgroup>
                        <thead>
                            <tr>
                                <th scope="col">품목</th>
                                <th scope="col">단가</th>
                                <th scope="col">수량</th>
                                <th scope="col">공급가액</th>
                                <th scope="col">세액(부가세)</th>
                                <th scope="col">금액</th>
                            </tr>
                        </thead>
                        <tbody>
						<c:forEach var="sList" items="${smsList}">
                            <tr>
                                <th><c:out value="${sList.smsItemName}"/></th>
                                <td>                                
									<c:choose>
										<c:when test="${isVat eq '1'}">
											<fmt:formatNumber value="${sList.unitPricePlusVat}" pattern=""/>
										</c:when>
										<c:otherwise>
											<fmt:formatNumber value="${sList.unitPrice}" pattern=""/>
										</c:otherwise>
									</c:choose>
                                </td>
                                <td>
									<c:choose>
										<c:when test="${sList.smsItemName eq '팩스'}">
											<fmt:formatNumber value="${sList.caseNumber * sList.casePage}" pattern=""/> 
										</c:when>
										<c:otherwise>
											<fmt:formatNumber value="${sList.caseNumber}" pattern=""/>
										</c:otherwise>
									</c:choose>                                
                                </td>
                                <td><c:out value="${sList.supplyPrice}"/></td>
                                <td><c:out value="${sList.vatPrice}"/></td>
                                <td><c:out value="${sList.totPrice}"/></td>
                            </tr>					
						</c:forEach>
                        </tbody>
                    </table>
                </div>
                <div class="cont4">
                    <table class="est_table">
                        <caption>공급가액, 부가세, 총 결제금액에 대한 표</caption>
                        <colgroup>
                            <col style="width: 120px;">
                            <col style="width: auto;">
                        </colgroup>
                        <tbody>
                            <tr>
                                <th>공급가액</th>
                                <td><span>${supplySumPrice}</span> 원</td>
                            </tr>
                            <tr>
                                <th>세액(부가세)</th>
                                <td><span>${vatSumPrice}</span> 원</td>
                            </tr>
                            <tr>
                                <th>총 결제금액</th>
                                <td><span>${totSumPrice}</span> 원</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="est_footer">
                <span>특이사항</span>
                <div>
                    <p>- 본 견적서는 기본 견적서로 결제방식, 옵션 등에 따라 차이가 발생할 수 있습니다.</p>
                    <p>- 결제금액에 2% 포인트 적립(단가할인 고객의 경우 적립 제외)</p>
                    <p>- 포인트 10,000원 이상부터 현금으로 전환 가능</p>
                    <p>- 100만원 이상 충전을 원하시는 고객께서는 1551-8011로 별도 문의 바랍니다.</p>
                    <p>- 인터넷 익스플로러를 사용하시는 고객께서는 <span>[옵션도구>옵션>고급>인쇄>배경색 및 이미지 인쇄]</span>를 체크해주시기 바랍니다.</p>

                </div>
            </div>
			<div class="est_btn_wrap" id="est_btn_wrap">
				<button type="button" class="btnType" id="btnPayEstimatePrint"><i class="print_img"></i>인쇄하기</button>                  
			</div>
        </div>
    </div><!--// 견적서 -->
</body>
</html>
