316 lines
18 KiB
Plaintext
316 lines
18 KiB
Plaintext
|
|
@model NP.Model.VMCM
|
||
|
|
<form id="mform" method="post" enctype="multipart/form-data" class="form-horizontal">
|
||
|
|
<section class="panel panel-default" style="border-top: 1px solid #ddd; margin-top: 5px;">
|
||
|
|
<header class="panel-heading"><strong><i class="fa fa-bars"></i> 개별등록<span class=""></span></strong></header>
|
||
|
|
<div class="panel-body">
|
||
|
|
<div class="form-group">
|
||
|
|
<label class="col-sm-4 col-md-2 control-label">강좌/패키지ID</label>
|
||
|
|
<div class="col-sm-8 col-md-10">
|
||
|
|
<a href="#" class="btn btn-info btn-xs data-find data-find-float" onclick="findcmshow(0)"><i class="fa fa-search"></i></a>
|
||
|
|
<input type="text" class="form-control disp-init text-center" id="cmno" disabled /><br />
|
||
|
|
<ul>
|
||
|
|
<li id="cmname"></li>
|
||
|
|
<li id="ssseterm"></li>
|
||
|
|
<li id="fee"></li>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
||
|
|
<label class="col-sm-4 col-md-2 control-label">신규회원등록여부</label>
|
||
|
|
<div class="col-sm-8 col-md-10">@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "1:예;0:아니오" }, { "checked", 0 }, { "name", "ismember" } })</div>
|
||
|
|
</div>
|
||
|
|
<div id="newuser" style="display: none;">
|
||
|
|
<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
||
|
|
<label class="col-sm-4 col-md-2 control-label">신청자정보</label>
|
||
|
|
<div class="col-sm-8 col-md-10">
|
||
|
|
<span style="text-align:right; display: inline-block; width: 50px;">이름</span>: <input type="text" class="form-control disp-init" maxlength="25" id="username" /><br />
|
||
|
|
<span style="text-align:right; display: inline-block; width: 50px;">이메일</span>: <input type="text" class="form-control disp-init" maxlength="40" id="email" /> ※ 추후 사이트 접속 시 ID로 사용됩니다.<br />
|
||
|
|
<span style="text-align:right; display: inline-block; width: 50px;">휴대폰</span>: <input type="text" class="form-control disp-init" maxlength="11" id="mobile" /> ※ '-'제외 입력, 추후 사이트 접속 시 비밀번호로 사용됩니다.
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div id="olduser">
|
||
|
|
<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
||
|
|
<label class="col-sm-4 col-md-2 control-label">신청자ID</label>
|
||
|
|
<div class="col-sm-8 col-md-10">
|
||
|
|
<input type="hidden" id="userno" />
|
||
|
|
<a href="#" class="btn btn-default btn-xs" style="margin-left: 20px;" onclick="userboxabsasno = 0, userboxftype = 2; findusershow()" id="btnuser">신청자 선택</a>
|
||
|
|
<input type="text" class="form-control disp-init text-center" id="userid" disabled /><br />
|
||
|
|
<p class="form-control-static" id="userinfo"></p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
||
|
|
<label class="col-sm-4 col-md-2 control-label">결제방법</label>
|
||
|
|
@if (Model.IsAdmin)
|
||
|
|
{
|
||
|
|
<div class="col-sm-8 col-md-10">@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "1:신용카드;2:계좌이체;3:가상계좌;4:현금;5:현금+카드;6:무료;9:위탁계약" }, { "checked", 1 }, { "name", "ptype" } })</div>
|
||
|
|
}
|
||
|
|
else if (Model.IsSiteAdmin)
|
||
|
|
{
|
||
|
|
<div class="col-sm-8 col-md-10">@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "9:위탁계약" }, { "checked", 9 }, { "name", "ptype" } })</div>
|
||
|
|
}
|
||
|
|
</div>
|
||
|
|
<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
||
|
|
<label class="col-sm-4 col-md-2 control-label">결제금액</label>
|
||
|
|
<div class="col-sm-8 col-md-10">
|
||
|
|
<table class="databox" id="layertable" style="width: auto;">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th class="cm hide">강좌</th>
|
||
|
|
<th class="payamt">결제금액</th>
|
||
|
|
<th class="payamtcash hide">현금</th>
|
||
|
|
<th class="payamtcard hide">카드</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<tr data-cmno="">
|
||
|
|
<th class="cm hide text-left"></th>
|
||
|
|
<td class="payamt"><input type="text" class="form-control text-right int" id="payamt" value="0" /></td>
|
||
|
|
<td class="payamtcash hide"><input type="text" class="form-control text-right int" id="payamtcash" value="0" /></td>
|
||
|
|
<td class="payamtcard hide"><input type="text" class="form-control text-right int" id="payamtcard" value="0" /></td>
|
||
|
|
</tr>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
<div class="text-center">
|
||
|
|
<a href="#" class="btn btn-primary" onclick="save();">교육생등록</a>
|
||
|
|
</div>
|
||
|
|
<br /><br />
|
||
|
|
<section class="panel panel-default" style="border-top: 1px solid #ddd; margin-top: 5px;">
|
||
|
|
<header class="panel-heading"><strong><i class="fa fa-bars"></i> 일괄등록 (시스템에 등록된 회원만 추가 가능합니다)<span class=""></span></strong></header>
|
||
|
|
<div class="panel-body">
|
||
|
|
<div class="form-group">
|
||
|
|
<label class="col-sm-4 col-md-2 control-label">교육생 일괄등록</label>
|
||
|
|
<div class="col-sm-8 col-md-10">
|
||
|
|
<input id="uploadfile" type="file" /><br />
|
||
|
|
<a href="~/Content/file/LECT@(Model.IsAdmin?"":"SITE").xlsx" class="btn btn-info">양식다운로드</a>
|
||
|
|
<a href="#" class="btn btn-primary" onclick="checkfile();">파일검증</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="text-right">
|
||
|
|
<a href="#" class="btn btn-danger" onclick="delall();">불량DATA 일괄삭제</a>
|
||
|
|
<a href="#" class="btn btn-primary" onclick="save2();">등록</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="table-responsive" id="excel2">
|
||
|
|
<table class="table table-striped b-t b-light">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th width="20">No</th>
|
||
|
|
<th>패키지ID</th>
|
||
|
|
<th>패키지명</th>
|
||
|
|
<th>강좌ID</th>
|
||
|
|
<th>강좌명</th>
|
||
|
|
<th>ID</th>
|
||
|
|
<th>이름</th>
|
||
|
|
<th>결제방식</th>
|
||
|
|
<th>결제금액</th>
|
||
|
|
<th>현금</th>
|
||
|
|
<th>카드</th>
|
||
|
|
<th>검증결과</th>
|
||
|
|
<th>삭제</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody class="data" id="tbody2"></tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
</form>
|
||
|
|
@Html.Partial("./Partial/CMBox2", "bindCM;강좌/패키지 선택;91;;1;1")
|
||
|
|
@Html.Partial("./Partial/UserBox", "bindUser;신청자 선택;1;1", new ViewDataDictionary { { "assigns", Model.Assigns } })
|
||
|
|
@section scriptsHeader{
|
||
|
|
<style type="text/css">
|
||
|
|
#layertable td{padding: 2px 4px;}
|
||
|
|
tbody th.cm{padding: 0 10px;}
|
||
|
|
tr.error{color: red;}
|
||
|
|
</style>
|
||
|
|
}
|
||
|
|
@section scripts{
|
||
|
|
<script>
|
||
|
|
var cmboxtmno = 0;
|
||
|
|
var cmboxnotcmno = "";
|
||
|
|
$(document).ready(function () {
|
||
|
|
$("input[name='ptype']").on("change", function () {
|
||
|
|
$("th.payamtcash,th.payamtcard,td.payamtcash,td.payamtcard").addClass("hide");
|
||
|
|
if ($(this).val() == "5") {
|
||
|
|
$("th.payamtcash,th.payamtcard,td.payamtcash,td.payamtcard").removeClass("hide");
|
||
|
|
}
|
||
|
|
});
|
||
|
|
$("input[name='ismember']").on("change", function () {
|
||
|
|
$("#userno,#userid,#username,#email,#mobile").val("");
|
||
|
|
$("#userinfo").text("");
|
||
|
|
$("#newuser").hide();
|
||
|
|
$("#olduser").show();
|
||
|
|
if ($(this).val() == "1") {
|
||
|
|
$("#newuser").show();
|
||
|
|
$("#username").focus();
|
||
|
|
$("#olduser").hide();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
$("#uploadfile").on("change", function () {
|
||
|
|
if ($(this).val() != "") {
|
||
|
|
$("#tbody2 tr").remove();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
$("body").on("click", "#tbody2 tr td a.btn-danger", function () {
|
||
|
|
if (confirm("삭제하시겠습니까?")) {
|
||
|
|
$(this).closest("tr").remove();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
var _ismaster = 0;
|
||
|
|
function bindCM(vs) {
|
||
|
|
var v = vs.split(':');
|
||
|
|
setv("cmno", v[0]);
|
||
|
|
$("#cmname").text(v[2] + " | " + v[8] + " | " + v[1]);
|
||
|
|
$("#ssseterm").text("교육일 : " + v[9] + "일");
|
||
|
|
$("#fee").text("교육비 : 회원 " + bindComma3(v[5]) + "원 | 비회원 " + bindComma3(v[6]) + "원");
|
||
|
|
$("#layertable tbody tr:gt(0)").remove();
|
||
|
|
_ismaster = 0;
|
||
|
|
if (v[7] == "2") {
|
||
|
|
_ismaster = 2;
|
||
|
|
capp("/acommon/cmpcget", { pcno: v[0] }, "cbcmpcget");
|
||
|
|
} else {
|
||
|
|
$("#layertable tbody tr").first().attr("data-cmno", v[0]);
|
||
|
|
$("th.cm,th.payamtcash,th.payamtcard,td.payamtcash,td.payamtcard").addClass("hide");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function cbcmpcget() {
|
||
|
|
$.each(capResult.obj, function (i, d) {
|
||
|
|
if (i > 0) {
|
||
|
|
$("#layertable tbody tr").first().clone().appendTo("#layertable tbody");
|
||
|
|
}
|
||
|
|
$("#layertable tbody tr").last().attr("data-cmno", d.cmno);
|
||
|
|
$("#layertable tbody tr").last().find("th.cm").html(d.tmname + " | " + d.cnameclassno + "<br/>회원가: " + bindComma3(d.infee) + ", 비회원가: " + bindComma3(d.outfee));
|
||
|
|
$("#layertable tbody tr").last().find("td.payamt input,td.payamtcash input,td.payamtcard input").val(0);
|
||
|
|
});
|
||
|
|
$("th.cm").removeClass("hide");
|
||
|
|
}
|
||
|
|
function bindUser(vs) {
|
||
|
|
var v = vs.split(':');
|
||
|
|
setv("userid", v[7]);
|
||
|
|
setv("userno", v[0]);
|
||
|
|
$("#userinfo").text("[" + v[5] + "]" + v[6] + " | " + v[2] + "(" + v[3] + ")");
|
||
|
|
}
|
||
|
|
function checkfile() {
|
||
|
|
if ($("#uploadfile").val() == "") {
|
||
|
|
msg2("파일을 선택해주세요.");
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
var thumbext = $("#uploadfile").val();
|
||
|
|
thumbext = thumbext.slice(thumbext.indexOf(".") + 1).toLowerCase();
|
||
|
|
if ("xls,xlsx".indexOf(thumbext) < 0) {
|
||
|
|
msg("xls,xlsx 확장자만 가능합니다.", 0, true);
|
||
|
|
}
|
||
|
|
$("#tbody2 tr").remove();
|
||
|
|
//else if (confirm("파일을 검증하시겠습니까?")) {
|
||
|
|
var formData = new FormData();
|
||
|
|
formData.append("uploadfile", $("#uploadfile")[0].files[0]);
|
||
|
|
formData.append("uploadjob", "lectbatch");
|
||
|
|
capfile("/acommon/uploadexcel", formData, "cbcheckfile", true, false, true, true);
|
||
|
|
//}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function cbcheckfile() {
|
||
|
|
if (capResult.code != 1000) {
|
||
|
|
msg2(capResult.msg);
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
$.each(capResult.obj, function (i, d) {
|
||
|
|
$("#tbody2").append("<tr data-val=\"" + getdb(d.pcno) + ":" + d.cmno + ":" + d.userno + ":" + d.ptype + ":" + d.payamt + ":" + d.payamtcash + ":" + d.payamtcard + "\" class=\"" + (d.value == "정상" ? "data" : "error") + "\">" +
|
||
|
|
"<td>" + d.rnorvt + "</td>" +
|
||
|
|
"<td>" + getdb(d.pcno) + "</td>" +
|
||
|
|
"<td class=\"text-left\">" + getdb(d.pcname) + "</td>" +
|
||
|
|
"<td>" + zerotonull(d.cmno) + "</td>" +
|
||
|
|
"<td class=\"text-left\">" + getdb(d.cname) + "</td>" +
|
||
|
|
"<td>" + getdb(d.userid) + "</td>" +
|
||
|
|
"<td>" + getdb(d.username) + "</td>" +
|
||
|
|
"<td>" + d.ptypename + "</td>" +
|
||
|
|
"<td>" + bindComma3(d.payamt) + "</td>" +
|
||
|
|
"<td>" + bindComma3(d.payamtcash) + "</td>" +
|
||
|
|
"<td>" + bindComma3(d.payamtcard) + "</td>" +
|
||
|
|
"<td>" + getdb(d.value) + "</td><td class=\"link text-center\"><a href=\"#\" class=\"btn-xxs btn btn-danger\">X</a></td></tr>");
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function zerotonull(v) {
|
||
|
|
return v == 0 ? "" : v;
|
||
|
|
}
|
||
|
|
function delall() {
|
||
|
|
if (confirm("불량DATA를 일괄삭제하시겠습니까?")) {
|
||
|
|
$("#tbody2 tr.error").remove();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function save2() {
|
||
|
|
if ($("#tbody2 tr.error").length > 0) {
|
||
|
|
msg("불량DATA가 있어 등록할 수 없습니다.");
|
||
|
|
}
|
||
|
|
else if ($("#tbody2 tr.data").length < 1) {
|
||
|
|
msg("등록할 데이터가 없습니다.");
|
||
|
|
}
|
||
|
|
else if (confirm("교육생을 일괄 등록하시겠습니까?")) {
|
||
|
|
var d = "";
|
||
|
|
$.each($("#tbody2 tr.data"), function (i, r) {
|
||
|
|
d += ";" + $(r).attr("data-val");
|
||
|
|
});
|
||
|
|
capp("/acommon/lectbatch", { datas: d.substr(1) }, "cbsave2");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function cbsave2() {
|
||
|
|
if (capResult.code == 1000) {
|
||
|
|
msg("일괄 등록되었습니다.", null, null, null, true);
|
||
|
|
submit("mform", 500);
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
msgdev(true);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function save() {
|
||
|
|
var ta = 0;
|
||
|
|
var tcash = 0;
|
||
|
|
var tcard = 0;
|
||
|
|
var sd = "";
|
||
|
|
$.each($("#layertable tbody tr"), function (i, r) {
|
||
|
|
ta += getint($(r).find("td.payamt input").val());
|
||
|
|
tcash += getint($(r).find("td.payamtcash input").val());
|
||
|
|
tcard += getint($(r).find("td.payamtcard input").val());
|
||
|
|
sd += ";" + $(r).attr("data-cmno") + ":" + getint($(r).find("td.payamt input").val()) + ":" + getint($(r).find("td.payamtcash input").val()) + ":" + getint($(r).find("td.payamtcard input").val());
|
||
|
|
});
|
||
|
|
sd = sd.substr(1);
|
||
|
|
if (check("cmno", null, "강좌/패키지를 선택해주세요.")) { }
|
||
|
|
else if ($("#ismember0").prop("checked") && $("#userno").val() == "") { msg("신청자ID를 등록해주세요."); }
|
||
|
|
else if ($("#ismember1").prop("checked") && $("#username").val() == "") { focus("username"); msg("신청자이름을 입력해주세요."); }
|
||
|
|
else if ($("#ismember1").prop("checked") && !isemail($("#email").val())) { focus("username"); msg("이메일을 확인해주세요."); }
|
||
|
|
else if ($("#ismember1").prop("checked") && !ismobile($("#mobile").val())) { focus("username"); msg("핸드폰번호를을 확인해주세요."); }
|
||
|
|
else if (getrv("ptype") != "6" && getrv("ptype") != "9" && ta < 1) { msg("결제금액을 입력해주세요."); }
|
||
|
|
else if (getrv("ptype") == "5" && ta != tcash + tcard) { msg("결제금액을 확인해주세요."); }
|
||
|
|
else if (confirm("교육생을 등록하시겠습니까?")) {
|
||
|
|
if (_ismaster == 0) {
|
||
|
|
capp("/acommon/lectreg", { pis: sd, isnewmember: $("#ismember1").prop("checked"), userno: val("userno")==""?0:val("userno"), username: val("username"), email: val("email"), mobile: val("mobile"), ptype: getrv("ptype") }, "cbsave");
|
||
|
|
} else {
|
||
|
|
capp("/acommon/lectreg", { pcno: val("cmno"), pis: sd, isnewmember: $("#ismember1").prop("checked"), userno: val("userno") == "" ? 0 : val("userno"), username: val("username"), email: val("email"), mobile: val("mobile"), ptype: getrv("ptype") }, "cbsave");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function cbsave() {
|
||
|
|
if (capResult.obj == -1) {
|
||
|
|
msg("이미 등록된 이메일입니다(ID)");
|
||
|
|
} else if (capResult.obj == -2) {
|
||
|
|
msg("이미 등록된 이메일입니다(Email)");
|
||
|
|
} else if (capResult.obj == -3) {
|
||
|
|
msg("회원등록이 실패하였습니다.");
|
||
|
|
} else if (capResult.obj == -4) {
|
||
|
|
msg("강좌에 해당 회원이 이미 수강중입니다.");
|
||
|
|
}else if (capResult.code == 1000) {
|
||
|
|
msg2("저장되었습니다.", 10, null, null, true);
|
||
|
|
submit("mform", 500);
|
||
|
|
} else {
|
||
|
|
msgdev();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
}
|