Files
fod/mypage/refund_month_test.php

323 lines
15 KiB
PHP

<?php $bland_code = "kia"; ?>
<!--
//메타의 각 브랜드 별 코드는 hyundai,genesis 입니다.
//브랜드 별 경로에 따라 해당 코드를 변경해주세요.
-->
<?php $gnbStyleCode = "hskey"; ?>
<!--
페이지 별 붙박이 코드입니다. 해당 변수는 JSP로만 변경해주시고, 값은 그대로 유지만 시켜주시면 됩니다.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>제품상세명 &gt; 제품리스트 &gt; 회사명</title>
<!--
//위에 순서대로 title 이 변경되어야 합니다.
-->
<?php
include($_SERVER['DOCUMENT_ROOT']."/kr/include/meta.php");
?>
<!--상품상세 페이지 css 분리-->
<link rel="stylesheet" charset="UTF-8" href="/kr/assets/css/service.css?v1" type="text/css" />
<?php
include($_SERVER['DOCUMENT_ROOT']."/kr/include/style.php");
?>
<style>
h3 {margin-top: 4rem;}
.caution {margin-top:2rem; font-size:1.4rem; font-weight:600; color:red;}
table {width:100%; margin-top:1rem; border:1px solid #DEDEDE;}
td {padding:1.5rem; border:1px solid #DEDEDE;}
td.title {width:14rem; background-color:#f3f3f3;}
input[type=number] {display:flex; width:100%; align-items:center; padding-left:1.7rem; border:1px solid #DEDEDE; height:5rem; font-size:1.6rem; color:#000000;}
.refund_info {border:1px solid #DEDEDE; margin-top:2rem; padding:0 2rem 2rem 2rem;}
.refund_info .item {margin-top:2rem}
.refund_info .item .title {font-size:2rem; font-weight:600; color:#000000;}
.refund_info .item ul {margin-top:1rem;}
.refund_info .item ul li {position:relative; font-size:1.4rem; line-height:2.2rem; padding:0.5rem 0 0.5rem 1rem;}
.refund_info .item ul li:before {content:""; position: absolute; top:12px; left:0; displaY:block; width:4px; height:4px; background-color:#000000; }
</style>
</head>
<body id="faq">
<div class="csKey">&nbsp;</div>
<!--//header-->
<?php
include($_SERVER['DOCUMENT_ROOT']."/kr/include/header.php");
?>
<!--//header-->
<div class="pageTitle">
<h1>환불 테스트</h1>
</div>
<!--//content-warp-->
<div class="contentWarp">
<div class="csWarp">
<div class="csInner">
<h2>
월 구독상품 환불 테스트
</h2>
<div class="refund_info">
<div class="item">
<div class="title">
구독 상품 정책
</div>
<ul>
<li>
구독 상품은 구독해지 신청이 발생하는 경우 일할 정산으로 환불액이 계산됩니다.
</li>
<li>
모든 일할 정산의 기준 금액은 판매가에서 할인 금액을 뺀 최근 실 구독 결제액으로 산정합니다.
</li>
<li>
일할 정산 금액은 최종 계산까지는 소수점 둘째 자리까지 계산하되, 최종 금액산정은 결과값에서 소수점 이하에서 반올림으로 처리합니다.
</li>
<li>
구독상품 일할 정산 금액의 산정 기준은 365일로 계산합니다.
</li>
<li>
월 구독의 경우 최근 실 구독 비용이 10,000원으로 발생된다면, 1일 기준 비용은 328.77원입니다.<br>(10,000원 X 12개월 / 365일 = 328.77)
</li>
<li>
연 구독의 경우 최근 실 구독 비용이 100,000원으로 발생된다면, 1일 기준 비용은 273.97원입니다.<br>(100,000원 / 365일 = 273.97)
</li>
<li>
환불 액 계산은 잔여일 수 X 일 비용으로 계산합니다.
</li>
<li>
잔여일 수 계산은 (다음 구독 결제일-구독 해지 신청일-1)로 합니다.
</li>
</ul>
</div>
</div>
<!-- <div class="refund_info">
<div class="item">
<div class="title">
구독 상품 환불 공통 정책
</div>
<ul>
<li>
구독 상품인 1년 이용권과 월간 이용권은 최초 구독일(구매일)로부터 7일 이내 청약철회 및 계약해제를 할 수 있다.
</li>
<li>
청약철회가 가능한 7일의 기준은 휴일및 공휴일을 제외한다.
</li>
<li>
구매일 익일부터 1일로 산정하며, 휴일을 제외하고 7일이되는 날짜의 24시까지 청약 철회가 가능하다.
</li>
<li>
구매일로부터 7일내 청약철회가 발생한 경우, 주문 취소 처리 및 전액 환불한다.
</li>
<li>
최초 구독일(구매일)로부터 7일이 지난 경우에는 구매취소는 불가능하나, 구독취소는 가능하다.
</li>
<li>
구독취소가 발생한 경우, 즉시 구독취소(청약철회) 처리되며, 사용일에 따른 일할정산으로 환불처리 한다.
</li>
<li>
모든 일할 정산의 기준 금액은 판매가에서 할인 금액을 뺀 실제 결제액으로 산정한다.<br>(ex: 10,000원의 구독 상품을 최초 구매 시 2,000원 할인의 쿠폰과 1,000원의 포인트를 사용하여 구독 시작하여, 해당월에 구독취소가 발생한 경우, 일할정산에 계산되는 비용은 7,000원이다.)
</li>
<li>
일할정산 금액은 최종 계산까지는 소수점 둘째짜리까지 계산하되, 최종 금액산정은 결과값에서 소수점 이하 사사오입으로 처리한다.
</li>
</ul>
</div>
<div class="item">
<div class="title">
월 구독 상품 환불 정책
</div>
<ul>
<li>
환불계산의 기준 금액은 구독 취소 시점의 최근 실 구독 결제 비용으로 한다. <br>
(쿠폰, 포인트를 제외한 실 결제 금액)
</li>
<li>
월 구독 일할정산 금액의 산정 기준은 365일로 계산한다.<br>최근 실 구독 비용이 10,000원으로 발생된다면, 1일 기준 비용은 328.77원이다.<br>(10,000원 X 12개월 / 365일 = 328.77)
</li>
<li>
환불액 계산은 잔여일 수 X 일 비용으로 계산한다.
</li>
<li>
잔여일 수 계산은 (다음 구독 결제일-구독 해지 신청일-1)로 한다.
</li>
</ul>
</div>
</div> -->
<div class="formBox" style="margin-top:3rem;">
<dl class="important">
<dt>최근 실 구독 비용</dt>
<dd>
<input class="month_fee" type="number" placeholder="금액을 입력해주세요">
</dd>
</dl>
<dl class="important">
<dt>최근 구독 결제일</dt>
<dd>
<input class="datepicker month_pay_date" type="text" placeholder="Select Date.." readonly="readonly">
</dd>
</dl>
<dl class="important">
<dt>구독 취소일</dt>
<dd>
<input class="datepicker month_cancel_date" type="text" placeholder="Select Date.." readonly="readonly">
</dd>
</dl>
<div class="csBtn" style="width:100%;">
<div class="oneButton">
<button class="" onClick="refund_calculation_month();"><p>계산하기</p></button>
</div>
</div>
<h2 style="margin-top:2rem;">
결과
</h2>
<div class="caution">
[주의] 해당 계산 화면은 사전 검토를 위한 사항으로 실 개발 사항이 아님을 참고해주세요.
</div>
<table>
<tr>
<td class="title">기준비용</td>
<td class="month_base_cost"></td>
</tr>
<tr>
<td class="title">잔여일수</td>
<td class="month_remaining_days"></td>
</tr>
<tr>
<td class="title">환불액</td>
<td class="month_refund_amount"></td>
</tr>
<tr>
<td class="title">공급가</td>
<td class="supply_price"></td>
</tr>
<tr>
<td class="title">부가세</td>
<td class="vat"></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<!--//content-warp-->
<script>
$( function() {
$( ".datepicker" ).datepicker({
"dateFormat": "yy-mm-dd",
});
} );
function refund_calculation_month(){
//최근 실 구독 비용
var month_fee = $(".month_fee").val();
//최근 구독 결제일
var month_pay_date = new Date($(".month_pay_date").val()+"T00:00:00");
//구독 취소일
var month_cancel_date = new Date($(".month_cancel_date").val()+"T00:00:00");
//다음 결제일: 자체 계산
var month_pay_one_later = add_month(month_pay_date, 1);
function add_month(date, month) {
var next_month_first_date = new Date(
date.getFullYear(),
date.getMonth()+1,
1
);
var next_month_last_date = new Date(
next_month_first_date.getFullYear(),
next_month_first_date.getMonth() + 1
, 0
);
var result = next_month_first_date;
if(date.getDate() > next_month_last_date.getDate())
{
result.setDate(next_month_last_date.getDate());
}
else
{
result.setDate(date.getDate());
}
return result;
}
if(month_fee == "" || month_fee == "0"){
alert("'최근 실 구독 비용'을 입력해주세요.");
$(".month_fee").focus();
return;
}
if(month_pay_date == "Invalid Date"){
alert("'최근 구독 결제일'을 입력해주세요.");
$(".month_pay_date").focus();
return;
}
if(month_cancel_date == "Invalid Date"){
alert("'구독 취소일'을 입력해주세요.");
$(".month_cancel_date").focus();
return;
}
if(month_pay_date > month_cancel_date){
alert("'최근 구독 결제일'보다 '구독 취소일'이 더 빠를 수 없습니다.");
return;
}
if(month_cancel_date >= month_pay_one_later){
alert("'구독 취소일'이 '다음 결제일' 또는 그 이후가 될 수 없습니다.");
return;
}
//기준 비용
//var month_base_cost = Math.round(((month_fee * 12) / 365) * 100) / 100;
var month_base_cost = (month_fee * 12) / 365;
//잔여일수
var bt_ms = month_pay_one_later.getTime() - month_cancel_date.getTime() ;
var month_remaining_days = (bt_ms / (1000*60*60*24))-1 ;
//환불액
var month_refund_amount = Math.round(month_remaining_days * month_base_cost);
//공급가
var supply_price = Math.round(month_refund_amount/1.1);
//부가세
var vat = month_refund_amount - supply_price;
$('.month_base_cost').html(month_base_cost+" 원");
$('.month_remaining_days').html(month_remaining_days+" 일");
$('.month_refund_amount').html(month_refund_amount+" 원");
$('.supply_price').html(supply_price+" 원");
$('.vat').html(vat+" 원");
}
</script>
<!--//footer-->
<?php
include($_SERVER['DOCUMENT_ROOT']."/kr/include/footer.php");
?>
<!--//footer-->
</body>
</html>