YNICTE/BO/Views/croom/payrefund.cshtml

258 lines
17 KiB
Plaintext
Raw Normal View History

2020-10-12 14:39:23 +09:00
@model NP.Model.VMPay
@{
Layout = "~/Views/Shared/_PopupLayout.cshtml";
}
<ul class="pagination pagination-md" id="thistabul">
<li class=""><a href="#" onclick="gotab()" data-toggle="tab">기본정보</a></li>
<li class="active"><a href="#" data-toggle="tab">환불관리</a></li>
</ul>
<section class="panel panel-default">
<header class="panel-heading"><strong><i class="fa fa-bars"></i> 환불요청이력<span class=""></span></strong></header>
<table class="regtable" style="margin-top: 0;">
2020-12-01 15:50:16 +09:00
<thead><tr><th>요청일</th><th>상품</th><th>환불사유</th><th>접수상태</th><th>상세보기</th>@*<th>요청서</th>*@</tr></thead>
2020-10-12 14:39:23 +09:00
<tbody>
@foreach (var rfdno in Model.PayRfds.Select(s => s.rfdno).Distinct())
{
var r = Model.PayRfds.Where(w => w.rfdno == rfdno).First();
<tr>
<td class="text-center">@r.cdtymd</td>
<td class="left">
@if (r.isgroup == 1)
{
@r.itemname<br />
@:@string.Join(", ", Model.PayRfds.Where(w => w.rfdno == rfdno).Select(s => string.Format("{0}({1})", s.username, s.userid)))
}
else
{
@:@string.Join(", ", Model.PayRfds.Where(w => w.rfdno == rfdno).Select(s => s.itemname))
}
</td>
<td class="left">@r.rtext</td>
<td class="text-center">@r.rstatusname</td>
<td class="link text-center"><a href="#" class="btn btn-xxs btn-default" onclick="viewrfd(0, @r.rfdno)">조회</a></td>
2020-12-01 15:50:16 +09:00
@*<td class="link text-center"><a href="#" class="btn btn-xxs btn-default" onclick="viewrfd(1, @r.rfdno)">인쇄</a></td>*@
2020-10-12 14:39:23 +09:00
</tr>
}
</tbody>
</table>
</section>
<div style="color: red; font-size: 14px; font-weight: bold; margin-bottom: 10px; text-align: right;">@(Model.Pay.ispg == 0 ? "PG연동 환불 대상이 아닌 결제데이터입니다." : Model.Pay.ptype == 3 ? "가상계좌결제건은 PG연동 환불되지 않습니다." : "")</div>
<section class="panel panel-default">
<header class="panel-heading"><strong><i class="fa fa-bars"></i> 신청과정 및 신청자 현황<span class=""></span></strong></header>
<table class="regtable" style="margin-top: 0;">
<colgroup>
<col style="width:80px" />
<col />
<col />
<col />
<col />
<col />
<col />
<col style="width: 120px" />
</colgroup>
<thead><tr><th>상품유형</th><th>상품명</th><th>교육생(ID)</th><th>입금액</th><th>환불금액</th><th>환불일자</th><th>메모</th><th>수강상태</th></tr></thead>
<tbody id="tbody1">
@foreach (var d in Model.PayItems.Where(w => "014".Contains(w.ptype.ToString())))
{
<tr class="refund@(d.rstatus)" data-rstatus="@d.rstatus" data-pino="@d.pino" data-ptype="@d.ptype" data-payamt="@d.payamt">
<td>@d.pcgname.Replace("교육", "")</td>
<td class="left">@d.itemname</td>
<td>@string.Format("{0}({1})", d.username, d.userid)</td>
<td class="right" style="min-width: 140px;">@d.payamt.ToString("#,0")</td>
2021-12-03 08:44:52 +09:00
<td><input data-org="@d.refundamt" style="min-width: 100px;" type="text" class="form-control dev int refundamt text-right" @(d.rstatus > 0 ? "disabled" : "") value="@(d.refundamt == 0 ? d.payamt : d.refundamt)" /></td>
<td><input data-org="@d.refundtime" type="text" data-date-format="yyyy-mm-dd" class="form-control dev refundtime input-sm input-s datepicker-input form-control dev " @(d.rstatus > 0 ? "disabled" : "") value="@(d.refundtime == null ? DateTime.Now.ToString("yyyy-MM-dd") : d.refundtime.Value.ToString("yyyy-MM-dd"))" style="width: 100px;" /></td>
2020-10-12 14:39:23 +09:00
<td><input data-org="@d.refundinfo" type="text" class="form-control dev refundinfo" @(d.rstatus > 0 ? "disabled" : "") value="@d.refundinfo" /></td>
<td>@Html.Partial("./Partial/Select", null, new ViewDataDictionary { { "valuetext", "0:수강유지;1:수강취소" }, { "name", "refundstatus" + d.pino }@*, { "disabled" + (d.rstatus > 0 ? "" : "x"), 1 }*@, { "class", "refundstatus" }, { "selected", d.rstatus == 0 ? "0" : d.refundstatus.ToString() } })</td>
</tr>
}
</tbody>
</table>
@if (Model.PayItems.Where(w => "014".Contains(w.ptype.ToString())).Count() > 0)
{
<div style="padding: 5px 10px; text-align: right;">
<label><input type="checkbox" id="iscanceled" @(Model.Pay.rstatus > 0 ? "disabled":"") /> 수동취소완료</label>
<a href="#" class="btn btn-primary" onclick="save();">신청과정 환불상태 저장</a><br />
2020-12-01 15:50:16 +09:00
<p style="color:red;">※ LG유플러스 상점에서 직접 취소한 경우에 수동취소완료를 체크해주세요.</p>
2020-10-12 14:39:23 +09:00
</div>
}
</section>
2020-12-01 15:50:16 +09:00
<section class="panel panel-default" style="display: none;">
2020-10-12 14:39:23 +09:00
<header class="panel-heading"><strong><i class="fa fa-bars"></i> 교재 및 기타<span class=""></span></strong></header>
<table class="regtable" style="margin-top: 0;">
<colgroup>
<col />
<col />
<col />
<col />
<col />
<col />
<col />
<col style="width: 120px" />
</colgroup>
<thead><tr><th>상품유형</th><th>상품명</th><th>수량</th><th>입금액</th><th>환불금액</th><th>환불일자</th><th>메모</th><th>상태변경</th></tr></thead>
<tbody id="tbody2">
@foreach (var d in Model.PayItems.Where(w => "23".Contains(w.ptype.ToString())))
{
<tr class="refund@(d.rstatus)" data-rstatus="@d.rstatus" data-pino="@d.pino" data-ptype="@d.ptype" data-payamt="@d.payamt">
<td>@(d.ptype == 2 ? "교재" : "시험")</td>
<td class="left">@d.itemname</td>
<td>@d.pcnt</td>
<td class="right">@d.payamt.ToString("#,0")</td>
<td><input data-org="@d.refundamt" type="text" class="form-control dev int refundamt text-right" @((d.ptype == 2 && !string.IsNullOrEmpty(Model.Pay.dvrcode)) || d.rstatus > 0 ? "disabled" : "") value="@d.refundamt" /></td>
<td><input data-org="@d.refundtime" type="text" data-date-format="yyyy-mm-dd" class="form-control dev refundtime input-sm input-s datepicker-input form-control dev " @((d.ptype == 2 && !string.IsNullOrEmpty(Model.Pay.dvrcode)) || d.rstatus > 0 ? "disabled" : "") value="@(d.refundtime==null?"":d.refundtime.Value.ToString("yyyy-MM-dd"))" /></td>
<td><input data-org="@d.refundinfo" type="text" class="form-control dev refundinfo" @(d.rstatus > 0 ? "disabled" : "") value="@d.refundinfo" /></td>
<td>@Html.Partial("./Partial/Select", null, new ViewDataDictionary { { "valuetext", "0:시험유지;1:시험취소" }, { "name", "refundstatus" + d.pino }, { "disabled" + (d.rstatus > 0 ? "" : "x"), 1 },{ "class","refundstatus" + (d.ptype == 2 ? " hidden":"") },{ "selected", d.rstatus==0 ?"0":d.refundstatus.ToString() } })</td>
</tr>
}
</tbody>
</table>
</section>
<div style="@(Model.Pay.isdvr == 1 ? "" : "display:none;")">
<label><input type="checkbox" id="chkcanceldvr" @(Model.Pay.isrefunddvr==1 || !string.IsNullOrEmpty(Model.Pay.dvrcode)? "disabled":"") @(Model.Pay.isrefunddvr==1? "style=\"display:none\"":"") /> 택배비(@(Model.Pay.deliamt.ToString("#,0"))원) 환불처리 @(Model.Pay.isrefunddvr == 1?"완료":"") @(Model.Pay.isdvr2 == 0 ? "[직접수령]":"")</label>
<div style="color: red;">※ 교재의 경우 택배배송시 송장번호가 입력되었거나 직접수령정보가 있을 경우 환불이 불가능합니다.</div>
</div>
@if (Model.PayItems.Where(w => "23".Contains(w.ptype.ToString())).Count() > 0)
{
<div style="padding: 5px 10px; text-align: right;"><a href="#" class="btn btn-primary" onclick="save2();">교재 및 기타 환불상태 저장</a></div>
}
<br /><br /><br />
@section styles{
<style type="text/css">
.regtable tr td{background-color: #fff; text-align: center;}
.regtable tr td.left{text-align: left;}
.regtable tr td.right{text-align: right;}
</style>
}
@section scriptsHeader{
@Html.Partial("./Partial/ScriptDate")
}
@section scripts{
<script>
$(document).ready(function () {
if ('@(Model.Pay.iscanceled)' == '1') {
$("input:checkbox[id='iscanceled']").prop("checked", true);
} else {
$("input:checkbox[id='iscanceled']").prop("checked", false);
}
});
function gotab() {
bglayer();
location.href = '/croom/payview?payno=@Model.Pay.payno';
}
function viewrfd(isprint, rfdno) {
if (isprint == 1) {
winopen("/croom/refundprint?payno=@Model.Pay.payno&rfdno=" + rfdno, 'rfdview', 800, screen.height - 200);
} else {
winopen("/croom/refundview?payno=@Model.Pay.payno&rfdno=" + rfdno, 'rfdview', 900, screen.height - 200);
}
}
function thisrefresh() {
opener.thisrefresh();
rfs(0);
}
function save() {
var sd = "";
var isvalid = true;
$.each($("#tbody1 tr.refund0"), function (i, r) {
if ((getint($(r).find("input.refundamt").val()) > 0 && $(r).find("input.refundtime").val() == "") || (getint($(r).find("input.refundamt").val()) == 0 && getint($(r).attr("data-payamt")) == 0 && $(r).find("input.refundtime").val() == "")) {
isvalid = false; $(r).find("input.refundtime").focus(); msg("환불일자를 입력해주세요."); return false;
} else if ($(r).find("input.refundtime").val() != "" && getint($(r).find("input.refundamt").val()) < 1 && getint($(r).attr("data-payamt")) > 0) {
isvalid = false; $(r).find("input.refundamt").focus(); msg("환불금액을 입력해주세요."); return false;
} else if (getint($(r).find("input.refundamt").val()) > getint($(r).attr("data-payamt"))) {
isvalid = false; $(r).find("input.refundamt").focus(); msg("환불금액이 입금액을 초과할 수 없습니다."); return false;
} else if (getint($(r).find("input.refundamt").val()) > 0 && $(r).attr("data-ptype") != "2" && $(r).find("select.refundstatus").val() == "") {
isvalid = false; $(r).find("select.refundstatus").focus(); msg("수강상태를 선택해주세요."); return false;
} else if (getint($(r).find("input.refundamt").val()) >= 0 && $(r).find("input.refundtime").val() != "") {
sd += ";" + $(r).attr("data-pino") + ":" +
getint($(r).find("input.refundamt").val()) + ":" +
$(r).find("input.refundtime").val() + ":" +
$(r).find("input.refundinfo").val().replace(/;/gi, 'phdpkpkphd').replace(/:/gi, 'jhpkpkjh') + ":" +
($(r).attr("data-ptype") != "2" ? $(r).find("select.refundstatus").val() : "0") + ":"+
($(r).attr("data-rstatus"));
}
});
$.each($("#tbody1 tr.refund1"), function (i, r){
if (getint($(r).find("input.refundamt").val()) > 0 && $(r).attr("data-ptype") != "2" && $(r).find("select.refundstatus").val() == "") {
isvalid = false; $(r).find("select.refundstatus").focus(); msg("수강상태를 선택해주세요."); return false;
} else if (getint($(r).find("input.refundamt").val()) >= 0 && $(r).find("input.refundtime").val() != "") {
sd += ";" + $(r).attr("data-pino") + ":" +
0 + ":" +
$(r).find("input.refundtime").val() + ":" +
$(r).find("input.refundinfo").val().replace(/;/gi, 'phdpkpkphd').replace(/:/gi, 'jhpkpkjh') + ":" +
($(r).attr("data-ptype") != "2" ? $(r).find("select.refundstatus").val() : "0") + ":"+
($(r).attr("data-rstatus"));
}
});
if (isvalid && sd == "" && sd2 == "") {
msg("환불처리할 상품이 없습니다.");
}
else if (isvalid) {
//if (@Model.Pay.rstatus > 0)
//{
// capp("/acommon/payrefund", { payno: @Model.Pay.payno, sd: sd.substr(1), isrefunddvr: 0, iscancel: $("#iscanceled").is(":checked"), prstatus : @Model.Pay.rstatus }, "cbsave");
//}
//else
//{
if (@Model.Pay.ispg == 0) {
if (confirm("PG연동환불대상이 아닌 결제건으로 환불정보만 저장합니다.\n환불정보를 등록하면 해당상품의 환불정보 수정이 불가합니다.\n환불정보를 저장하시겠습니까?")) {
capp("/acommon/payrefund", { payno: @Model.Pay.payno, sd: sd.substr(1), isrefunddvr: 0, iscancel: $("#iscanceled").is(":checked") }, "cbsave");
}
}
else
{
if (confirm("PG연동환불대상 결제건으로 PG연동환불을 진행합니다.\n환불정보를 등록하면 해당상품의 환불정보 수정이 불가합니다.\n환불처리를 진행하시겠습니까?")) {
capp("/acommon/payrefund", { payno: @Model.Pay.payno, sd: sd.substr(1), isrefunddvr: 0, iscancel: $("#iscanceled").is(":checked") }, "cbsave");
}
}
//}
}
}
function save2() {
var sd = "";
var isvalid = true;
$.each($("#tbody2 tr.refund0"), function (i, r) {
if (getint($(r).find("input.refundamt").val()) > 0 && $(r).find("input.refundtime").val() == "") {
isvalid = false; $(r).find("input.refundtime").focus(); msg("환불일자를 입력해주세요."); return false;
} else if ($(r).find("input.refundtime").val() != "" && (getint($(r).find("input.refundamt").val()) < 1 && getint($(r).attr("data-payamt")) != 0)) {
isvalid = false; $(r).find("input.refundamt").focus(); msg("환불금액을 입력해주세요."); return false;
} else if (getint($(r).find("input.refundamt").val()) > getint($(r).attr("data-payamt"))) {
isvalid = false; $(r).find("input.refundamt").focus(); msg("환불금액이 입금액을 초과할 수 없습니다."); return false;
} else if (getint($(r).find("input.refundamt").val()) > 0 && $(r).attr("data-ptype") != "2" && $(r).find("select.refundstatus").val() == "") {
isvalid = false; $(r).find("select.refundstatus").focus(); msg("시험상태를 선택해주세요."); return false;
} else if (getint($(r).find("input.refundamt").val()) > 0 && $(r).find("input.refundtime").val() != "") {
sd += ";" + $(r).attr("data-pino") + ":" +
getint($(r).find("input.refundamt").val()) + ":" +
$(r).find("input.refundtime").val() + ":" +
$(r).find("input.refundinfo").val().replace(/;/gi, 'phdpkpkphd').replace(/:/gi, 'jhpkpkjh') + ":" +
($(r).attr("data-ptype") != "2" ? $(r).find("select.refundstatus").val() : "0")+ ":"+
($(r).attr("data-rstatus"));
}
});
if (isvalid && sd == "") {
msg("환불처리할 상품이 없습니다.");
}
else if (isvalid) {
if (@Model.Pay.ispg == 0) {
if (confirm("PG연동환불대상이 아닌 결제건으로 환불정보만 저장합니다.\n환불정보를 등록하면 해당상품의 환불정보 수정이 불가합니다.\n환불정보를 저장하시겠습니까?")) {
capp("/acommon/payrefund", { payno: @Model.Pay.payno, sd: sd.substr(1), isrefunddvr: $("#chkcanceldvr").prop("checked") ? 1 : 0 , iscancel: false }, "cbsave");
}
} else {
if (confirm("PG연동환불대상 결제건으로 PG연동환불을 진행합니다.\n환불정보를 등록하면 해당상품의 환불정보 수정이 불가합니다.\n환불처리를 진행하시겠습니까?")) {
capp("/acommon/payrefund", { payno: @Model.Pay.payno, sd: sd.substr(1), isrefunddvr: $("#chkcanceldvr").prop("checked") ? 1 : 0 , iscancel: false}, "cbsave");
}
}
}
}
function cbsave() {
if (capResult.code == 1000) {
msg("환불상태가 변경되었습니다.", null, null, null, null, "thisrefresh()");
}
else {
msg("환불처리가 불가능한 데이터입니다.<br/> 강제 취소를 원하실 경우 수동취소 완료를 체크해주세요. (PG사 연동 안됨)");
}
}
</script>
}