<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page import="itn.com.cmm.LoginVO" %>
<!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">
    
</head>
<script type="text/javascript">

function f_print(){
	document.getElementById('est_btn_wrap').style.display = 'none';
    var initBody = document.body.innerHTML;
    window.onbeforeprint = function(){
        // print_area는 인쇄하고자 하는 영역의 ID를 말합니다.( 필수 )
//         document.body.innerHTML = document.getElementById("print_area").innerHTML;
    }
    window.onafterprint = function(){
        document.body.innerHTML = initBody;
    }
    window.print();
    document.getElementById('est_btn_wrap').style.display = '';
}

</script>
<style type="text/css">
.blank {margin:0 12px;}
.est_table2_wrap {overflow:hidden;}
.est_table2 {border:0 none;}
.est_table2 tbody td:first-child {border-left:0 none;}
.est_table2 tbody tr:last-child th, .est_table2 tbody tr:last-child td {border-bottom:0 none;}
</style>
<body>
    <!-- 견적서 -->
    <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>사용내역서</h2>
                <div class="cont1 tb_ver2">
                    <div>
                        <p>수신자</p>
                        <table class="est_table">
                            <caption>수신자 정보</caption>
                            <colgroup>
                                <col style="width: 50px;">
                                <col style="width: auto;">
                            </colgroup>
                            <tbody>
                                <tr>
                                    <th>등록번호</th>
                                    <td>
                                    	<c:choose>
                                    		<c:when test="${mberManageVO.dept eq'c'}">
                                    			<c:out value="${mberManageVO.bizNo}"/>
                                    		</c:when>
                                    		<c:otherwise>
                                    			-
                                    		</c:otherwise>
                                    	</c:choose>
                                    </td>
                                </tr>
                                <tr>
                                    <th>상<span class="blank"></span>호</th>
                                    <td>
                                    	<c:choose>
                                    		<c:when test="${mberManageVO.dept eq'c'}">
                                    			<c:out value="${mberManageVO.mberNm}"/>
                                    		</c:when>
                                    		<c:otherwise>
                                    			-
                                    		</c:otherwise>
                                    	</c:choose>
                                    </td>
                                </tr>
                                <tr>
                                    <th>성<span class="blank"></span>명</th>
                                    <td>
                                    	<c:choose>
                                    		<c:when test="${mberManageVO.dept eq'c'}">
                                    			<c:out value="${mberManageVO.managerNm}"/>
                                    		</c:when>
                                    		<c:otherwise>
                                    			<c:out value="${mberManageVO.mberNm}"/>
                                    		</c:otherwise>
                                    	</c:choose>
                                    </td>
                                </tr>
                                <tr>
                                    <th>전화번호</th>
                                    <td><c:out value="${mberManageVO.moblphonNo}"/></td>
                                </tr>
                                <tr>
                                    <th style="letter-spacing:-0.85px;">이&ensp;메&ensp;일</th>
                                    <td><c:out value="${mberManageVO.mberEmailAdres}"/></td>
                                </tr>
                                <tr>
   	                    			<td colspan="2" style="text-align:center;"><span><c:out value="${mberManageVO.mberNm}"/></span>님의 사용내역(<c:out value="${startDate}"/>~<c:out value="${endDate}"/>)을 아래와 같이 확인합니다.</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <%-- <div class="cont2 clearfix">
                    <p>총 사용금액</p>
                    <c:choose>
	                	<c:when test="${searchVO.addVatType eq 'N'}">
	                		<p><span>${totalSumPrice}</span> 원(VAT 별도)</p>
	                	</c:when>
	                	<c:otherwise>
	                		<p><span>${addTaxSumPrice}</span> 원(VAT 포함)</p>
	                	</c:otherwise>
	                </c:choose>
                </div> --%>
                <div class="cont3">
                    <p>(단위 : 원,  건)</p>
                    <div class="est_table2_wrap">
                        <table class="est_table2">
                            <caption>품목, 발송건수, 공급가액, 부가세, 금액 정보를 제공하는 표</caption>
                            <colgroup>
                                <col style="width:30%;">
                                <col style="width:30%;">
                                <col style="width:auto;">
                            </colgroup>
                            <thead>
                                <tr>
                                    <th scope="col">문자유형</th>
                                    <th scope="col">발송건수</th>
                                    <th scope="col">사용금액</th>
                                </tr>
                            </thead>
                            <tbody>
								<c:if test="${pageType != 'fax'}">
									<c:forEach var="result" items="${resultList}" varStatus="status">
		                            	<tr>
		                            		<td>${result.msgTypeName}</td>
		                            		<td>
		                            			<c:choose>
		                            				<c:when test="${result.msgTypeName eq '단문'}">
		                            					<fmt:formatNumber type="number" maxFractionDigits="3" value="${result.shtSendCount}" var="shtSendCount" />
														<c:out value="${shtSendCount}"/>
		                            				</c:when>
		                            				<c:when test="${result.msgTypeName eq '장문'}">
		                            					<fmt:formatNumber type="number" maxFractionDigits="3" value="${result.longSendCount}" var="longSendCount" />
														<c:out value="${longSendCount}"/>
		                            				</c:when>
		                            				<c:when test="${result.msgTypeName eq '그림'}">
		                            					<fmt:formatNumber type="number" maxFractionDigits="3" value="${result.pictSendCount}" var="pictSendCount" />
														<c:out value="${pictSendCount}"/>
		                            				</c:when>
		                            				<c:when test="${result.msgTypeName eq '알림톡'}">
		                            					<fmt:formatNumber type="number" maxFractionDigits="3" value="${result.atSendCount}" var="atSendCount" />
														<c:out value="${atSendCount}"/>
		                            				</c:when>
		                            				<c:otherwise>
		                            					<fmt:formatNumber type="number" maxFractionDigits="3" value="${result.ftSendCount}" var="ftSendCount" />
														<c:out value="${ftSendCount}"/>
		                            				</c:otherwise>
		                            			</c:choose>
		                            			<%-- <fmt:formatNumber type="number" maxFractionDigits="3" value="${result.sendCount}" var="sendCount" />
												<c:out value="${sendCount}"/> --%>
		                            		</td>
		                            		<td>
		                            			<fmt:formatNumber type="number" maxFractionDigits="3" value="${result.totalPrice}" var="totalPrice" />
												<c:out value="${totalPrice}"/>
	                            			</td>
		                            	</tr>			
									</c:forEach>
								</c:if>
								<c:if test="${empty pageType || pageType == 'fax'}">
									<c:forEach var="resultFax" items="${payUserSumFaxList}" varStatus="status">
										<c:if test="${resultFax.ftSendCount > 0}">
											<tr>
			                            		<td>${resultFax.msgTypeName}</td>
			                            		<td>
	                            					<fmt:formatNumber type="number" maxFractionDigits="3" value="${resultFax.ftSendCount}" var="ftSendCount" />
													<c:out value="${ftSendCount}"/>
			                            		</td>
			                            		<td>
			                            			<fmt:formatNumber type="number" maxFractionDigits="3" value="${resultFax.totalPrice}" var="totalPrice" />
													<c:out value="${totalPrice}"/>
		                            			</td>
			                            	</tr>		
		                            	</c:if>
		                            </c:forEach>
								</c:if>
								<c:if test="${ empty resultList && empty payUserSumFaxList}">
									<tr>
										<td colspan="4">
											사용내역이 없습니다.
										</td>
									</tr>
								</c:if>
							</tbody>
						</table>
					</div>
				</div>
							
                <div class="cont2 clearfix">
                    <p>총 사용금액 <span>(VAT 별도)</span></p>
                    <p><span>
                    	<c:out value="${totalSumPrice}"/>
                    </span>원</p>
                </div>
                
                <div class="cont5">
                    <p><span>${year} 년&nbsp;&nbsp;<span>${month}</span> 월&nbsp;&nbsp;<span>${day}</span> 일</p>
                    <div>
                        <span>주식회사 아이티앤 대표이사</span>
                        <span>유&nbsp;인&nbsp;식</span>
                        <span class="big_stamp"><img src="/publish/images/content/big_stamp.png"></span>
                    </div>
                </div>
            </div>
            <div class="est_btn_wrap" id="est_btn_wrap">
                    <button type="button" class="btnType" onclick="javascript:f_print(); return false;"><i class="print_img"></i>인쇄하기</button>                  
            </div>
        </div>
    </div><!--// 견적서 -->
</body></html>
