YNICTE/BO/Controllers/croomController.cs

1255 lines
70 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Web.Mvc;
using NP.Model;
using NP.Base.Popbill;
using Popbill.Taxinvoice;
using System.Collections;
using Spring.Expressions;
namespace NP.BO.Controllers
{
public class croomController : BOBaseController
{
public ActionResult lectreg(NP.Model.VMCM vm)
{
vm.ComCodes = GetComCodes("typeman,typeedu,typegrade,typejob,studyplace");
vm.IsAdmin = SUserInfo.IsAdmin;
vm.IsSiteAdmin = SUserInfo.IsSiteAdmin;
return View(vm);
}
public ActionResult lectcms(VMCM vm)
{
if (!IsPost())
{
vm.stringval5 = null;
vm.stringval6 = null;
}
var ht = SetHash(vm, false);
if (string.IsNullOrEmpty(vm.stringval))
{
vm.stringval = DateTime.Now.Year.ToString();
}
ht.Add("tyear", !string.IsNullOrEmpty(vm.stringval2) ? null : vm.stringval);
ht.Add("tmno", vm.stringval2);
ht.Add("cshape", vm.stringval3);
ht.Add("cnamelike", vm.stringval4);
ht.Add("islect", "1");
ht.Add("sstime", vm.stringval5);
ht.Add("setime", vm.stringval6);
ht.Add("isallday", "1");
vm.CMs = Dao.Get<CM>("lect.cms", ht);
vm.pagetotalcount = GetCount(vm.CMs.FirstOrDefault());
vm.Terms = Dao.Get<Term>("cm.term.ys", new System.Collections.Hashtable() { });
return View(vm);
}
public ActionResult certs(VMCM vm)
{
vm.Exams = InitM<Exam>();
switch (vm.tabidx)
{
case 0:
var ht = SetHash(vm);
ht.Add("status", vm.stringval);
ht.Add("ename", vm.stringval2);
vm.Exams = Dao.Get<Exam>("exam.exams", ht);
vm.pagetotalcount = GetCount(vm.Exams.FirstOrDefault());
break;
case 1:
break;
}
return View(vm);
}
public ActionResult certr(VMCM vm)
{
vm.FileList = new List<File>() { };
if (vm.intval > 0)
{
vm.Exam = Dao.Get<Exam>("exam.exams", new System.Collections.Hashtable() { { "exno", vm.intval } }).First();
var fgnos = "";
if (vm.Exam.fgno != null)
{
fgnos += "," + vm.Exam.fgno;
}
if (fgnos != "")
{
vm.FileList = GetFiles(fgnos.Substring(1));
}
}
else
{
vm.Exam = new Exam() { isopen = 1 };
}
vm.CGs = Dao.Get<CG>("cm.cgs", new System.Collections.Hashtable() { { "isdel", 0 }, { "isuse", 1 } });
ViewBag.TestCode = TestCode;
ViewBag.TestCode2 = TestCode2;
vm.ComCodes = GetComCodes("cert,certgrade");
return View(vm);
}
public ActionResult certreception(VMCM vm)
{
vm.Exam = Dao.Get<Exam>("exam.exams", new System.Collections.Hashtable() { { "exno", vm.intval } }).First();
vm.ExamUsers = Dao.Get<ExamUser>("exam.examusers", new System.Collections.Hashtable() { { "exno", vm.intval }, { "pstatus" + (vm.addstringval == "4" ? "24" : vm.addstringval == "8" ? "89" : ""), vm.addstringval } });
vm.ComCodes = GetComCodes("cert,certgrade");
vm.Assigns = Dao.Get<Assign>("users.assigns", new System.Collections.Hashtable() { { "issite", 1 } });
return View(vm);
}
public ActionResult certresult(VMCM vm)
{
vm.Exam = Dao.Get<Exam>("exam.exams", new System.Collections.Hashtable() { { "exno", vm.intval } }).First();
vm.ExamUsers = Dao.Get<ExamUser>("exam.examusers", new System.Collections.Hashtable() { { "exno", vm.intval }, { "ispass", vm.addstringval2 }, { "resultview", 1 }, { "pstatus", 1 } });
vm.ComCodes = GetComCodes("cert,certgrade");
return View(vm);
}
public ActionResult examdatareg(VMCM vm)
{
vm.Exam = Dao.Get<Exam>("exam.exams", new System.Collections.Hashtable() { { "exno", vm.intval } }).First();
return View(vm);
}
public ActionResult certprint(VMCM vm)
{
vm.Exam = Dao.Get<Exam>("exam.exams", new System.Collections.Hashtable() { { "exno", vm.intval } }).First();
vm.ExamUsers = Dao.Get<ExamUser>("exam.examusers", new System.Collections.Hashtable() { { "exno", vm.intval }, { "usernos", vm.addstringval3 }, { "ispass", 1 } });
vm.ExamUserRenews = Dao.Get<ExamUserRenew>("exam.examuserrenews", new System.Collections.Hashtable() { { "exno", vm.intval }, { "usernos", vm.addstringval3 }, { "isprint", 1 } });
vm.ComCodes = GetComCodes("cert,certgrade");
return View(vm);
}
public ActionResult cddlist(VMCM vm)
{
vm.Exams = Dao.Get<Exam>("exam.exams", new System.Collections.Hashtable() { { "status", 4 } });
vm.pagerowcount = 100;
var ht = SetHash(vm);
ht.Add("certcc", vm.intval2);
ht.Add("certgradecc", vm.intval3);
ht.Add("searchcon", vm.stringval5);
ht.Add("cnamelike", vm.stringval6);
ht.Add("ispass", 1);
ht.Add("pstatus", 1);
ht.Add("certdate", vm.stringval7);
ht.Add("certindate", vm.stringval4);
vm.ExamUsers = Dao.Get<ExamUser>("exam.examusers", ht);
vm.pagetotalcount = GetCount(vm.ExamUsers.FirstOrDefault());
vm.ComCodes = GetComCodes("cert,certgrade");
return View(vm);
}
public ActionResult cmlects(VMCM vm)
{
if (vm.addstringval4 == null)
{
vm.addstringval4 = "2099-12-31";
}
//검색조건
var ht = new System.Collections.Hashtable() { { "cmno", vm.intval} };
ht.Add("isready", 0);
//0:신청중; 2:수강중; 3:수강취소
//0:결제대기; 1:입금대기; 2:결제완료; 3:결제취소; 4:환불신청; 5:부분환불; 6:전액환불
if (vm.addstringval == "8")
{
ht.Add("statusin", "5,8,9");
}else if(vm.addstringval == "3")
{
ht.Add("statusin", "1,2,3,4");
}
else
{
ht.Add("status", vm.addstringval);
}
ht.Add("paystatusnotin", "0,42,52,66");
switch (vm.addstringval2)
{
case "0": ht.Add("paystatus", 21); break;
case "1": ht.Add("paystatus", 22); break;
case "2": ht.Add("paystatus", 1); ht.Add("rstatus", 0); break;
case "3": ht.Add("paystatus", 41); break;
case "4": ht.Add("refundcall", 1); break;
case "5": ht.Add("rstatus", 1); break;
case "6": ht.Add("rstatus", 2); break;
default: break;
}
if (vm.isexceldown == 1)
{
vm.Lects = Dao.Get<Lect>("lect.lects.att",ht);
return ExportExcel(
new String[] { "고객사", "이름","직위", "교육생ID", "이메일", "전화번호", "휴대폰번호", "신청일", "수강상태", "결제상태" , "교육일", "기술인구분","직무분야","교육목적","등급"},
new String[] { "asname", "username", "uduty", "userid", "email", "telno", "mobile", "cdtymd", "statusname", "pstatusname", "estartstring", "typemanname", "typejobname", "typeeduname", "typegradename" },
vm.Lects,
"신청자명단");
}
else
{
if (vm.intval < 1)
{
return Redirect("/croom/lectcms");
}
ViewBag.TestCode = TestCode;
vm.CM = Dao.Get<CM>("cm.cm", new System.Collections.Hashtable() { { "cmno", vm.intval } }).First();
ht.Remove("cmno");
ht.Add("cmno", vm.CM.cmno);
if (vm.addstringval4 != "2099-12-31")
{
ht.Add("scdestart", vm.addstringval4);
}
ht.Add("searchtext", vm.addstringval5);
vm.Lects = Dao.Get<Lect>("lect.lects", ht);
}
vm.ComCodes = GetComCodes("typeman,typeedu,typegrade,typejob");
return View(vm);
}
public ActionResult asrpop(VMCM vm)
{
vm.FileList = new List<File>() { };
vm.Assign = new Assign() { isjoin = 1, status = 1 };
if (vm.intval > 0)
{
vm.Assign = Dao.Get<Assign>("users.assigns2", new System.Collections.Hashtable() { { "asno", vm.intval }, { "excel1", ",a.post" }, { "orderby", "a.asname" } }).First();
LogSet(new ActLog() { logtype = 50, logtarget = 31, logdata = vm.Assign.asname, userno = vm.Assign.asno, uno = SUserInfo.UserNo, uip = GetUserIP() });
var fnos = "";
if ((vm.Assign.fgnobno ?? 0) > 0)
{
fnos += vm.Assign.fgnobno.Value.ToString();
}
if ((vm.Assign.fgnobank ?? 0) > 0)
{
fnos += "," + vm.Assign.fgnobank.Value.ToString();
}
if (fnos != "")
{
vm.FileList = GetFiles(fnos.StartsWith(",") ? fnos.Substring(1) : fnos);
}
}
else
{
vm.Assign.ascode = Dao.Get<int>("users.assign.newascode", 1).First();
}
return View(vm);
}
public ActionResult cmstandbylects(VMCM vm)
{
//대기승인 시점으로부터 48시간이 지났음에도 '결제대기' 상태일 경우 취소처리
Dao.Save("lect.drop2day", new System.Collections.Hashtable() { { "cmno", vm.intval }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } });
vm.CM = Dao.Get<CM>("cm.cm", new System.Collections.Hashtable() { { "cmno", vm.intval } }).First();
vm.pagerowcount = 100;
var ht = SetHash(vm);
ht.Add("cmno", vm.CM.cmno);
ht.Add("isready", 1);
//0:신청중; 2:수강중; 3:수강취소
//0:결제대기; 1:입금대기; 2:결제완료; 3:결제취소; 4:환불신청; 5:부분환불; 6:전액환불
if (vm.addstringval == "4")
{
ht.Add("statusin", "0,2,4");
}
else if (vm.addstringval == "5")
{
ht.Add("statusin", "5,8,9");
}
else if (vm.addstringval == "3")
{
ht.Add("statusin", "6");
}
else
{
ht.Add("status", vm.addstringval);
}
ht.Add("paystatusnotin", "0,42,66");
switch (vm.addstringval2)
{
case "0": ht.Add("paystatus", 21); break;
case "1": ht.Add("paystatus", 22); break;
case "2": ht.Add("paystatus", 1); ht.Add("rstatus", 0); break;
case "3": ht.Add("paystatus", 41); break;
case "4": ht.Add("refundcall", 1); break;
case "5": ht.Add("rstatus", 1); break;
case "6": ht.Add("rstatus", 2); break;
case "7": ht.Add("paystatus", 53); break;
default: break;
}
ht.Remove("searchtext");
ht.Add("searchtext", vm.addstringval5);
vm.Lects = Dao.Get<Lect>("lect.lects", ht);
vm.pagetotalcount = GetCount(vm.Lects.FirstOrDefault());
vm.ComCodes = GetComCodes("typeman,typeedu,typegrade,typejob");
return View(vm);
}
public ActionResult cmlectattprint(VMCM vm)
{
ViewBag.PopupMenuName = "출석부출력";
vm.CM = Dao.Get<CM>("cm.cm", new System.Collections.Hashtable() { { "cmno", vm.intval } }).First();
vm.Lects = Dao.Get<Lect>("lect.lects.att", new System.Collections.Hashtable() { { "status", 1 }, { "cmno", vm.CM.cmno } });
return View(vm);
}
public ActionResult encourages(VMLect vm)
{
vm.stringval = vm.stringval ?? DateTime.Now.Year.ToString();
vm.stringval13 = vm.stringval13 ?? "username";
vm.Lects = new List<Lect>() { };
vm.CMs = new List<CM>() { };
if (IsPost())
{
vm.Lects = Dao.Get<Lect>("grade.lectgrades", new System.Collections.Hashtable(){
{"tmno", vm.stringval2 }, {"cgno", vm.stringval3}, {"cmno", vm.stringval4},
{ "attrateunder", vm.stringval5},
{ "est1not", vm.stringval6}, { "est2not", vm.stringval7},
{ "est11not", vm.stringval8},{ "est12not", vm.stringval9},
{ "est21not", vm.stringval10},
{ "isrebate", vm.stringval11=="1"&&vm.stringval12==null?1:vm.stringval11==null&&vm.stringval12=="p1"?0:(int?)null},
{"cshapes", "0,2" },
{"cname",vm.stringval15},
{vm.stringval13, vm.stringval14}});
vm.pagetotalcount = GetCount(vm.Lects.FirstOrDefault());
vm.CMs = Dao.Get<CM>("cm.cms", new System.Collections.Hashtable() { { "tmno", vm.stringval2 }, { "cgno", vm.stringval3 }, { "cshapes", "0,2" }, { "ismaster", 0 }});
foreach (var d in vm.CMs)
{
d.text = string.Format("{0}({1})", d.text, d.classno);
}
}
vm.Terms = Dao.Get<Term>("cm.term.ys", new System.Collections.Hashtable() { });
vm.CGs = Dao.Get<CG>("cm.cgs", new System.Collections.Hashtable() { { "isdel", 0 }, { "issecond", 1 } });
vm.EmailSend = new EmailSend() { };
return View(vm);
}
public ActionResult encourageset(VMLect vm)
{
vm.SCDLects = Dao.Get<SCDLect>("lect.scdlects", new System.Collections.Hashtable() { });
return View(vm);
}
public ActionResult rss(VMLect vm)
{
var ht = SetHash(vm, false);
ht.Add("tyear", !string.IsNullOrEmpty(vm.stringval2) ? null : vm.stringval);
ht.Add("tmno", vm.stringval2);
ht.Add("cshape", vm.stringval3);
ht.Add("rstype", vm.stringval4);
ht.Add("cnamelike", vm.stringval5);
vm.CMRSs = Dao.Get<CMRS>("lect.cmrss", ht);
vm.pagetotalcount = GetCount(vm.CMRSs.FirstOrDefault());
vm.Terms = Dao.Get<Term>("cm.term.ys", new System.Collections.Hashtable() { });
return View(vm);
}
public ActionResult rsv(VMLect vm)
{
vm.CMRS = Dao.Get<CMRS>("lect.cmrs", vm.intval).First();
if (vm.isexceldown == 1)
{
vm.RSCQs = Dao.Get<RSCQ>("lect.rscq", vm.CMRS.rscno);
vm.LectRSs = Dao.Get<LectRS>("lect.lectrss", vm.CMRS.rsno);
var ccnt = vm.RSCQs.Select(s => s.rscqno).Distinct().Count();
using (System.IO.StringWriter sw = new System.IO.StringWriter())
{
using (System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw))
{
// Create a form to contain the List
System.Web.UI.HtmlControls.HtmlTable table = new System.Web.UI.HtmlControls.HtmlTable();
System.Web.UI.HtmlControls.HtmlTableRow row = new System.Web.UI.HtmlControls.HtmlTableRow();
System.Web.UI.HtmlControls.HtmlTableCell hcell = new System.Web.UI.HtmlControls.HtmlTableCell();
hcell.ColSpan = ccnt + 6;
hcell.InnerText = "● 과정정보 : " + string.Format("{0} | {1} | {2} | {3}반", vm.CMRS.tmname, vm.CMRS.cshapename, vm.CMRS.cname, vm.CMRS.classno);
row.Cells.Add(hcell); table.Rows.Add(row);
row = new System.Web.UI.HtmlControls.HtmlTableRow();
hcell = new System.Web.UI.HtmlControls.HtmlTableCell();
hcell.ColSpan = ccnt + 6;
hcell.InnerText = "● 설문종류/설문지 : " + string.Format("{0} / {1}", vm.CMRS.rstypename, vm.CMRS.rscname);
row.Cells.Add(hcell); table.Rows.Add(row);
row = new System.Web.UI.HtmlControls.HtmlTableRow();
hcell = new System.Web.UI.HtmlControls.HtmlTableCell();
hcell.ColSpan = ccnt + 6;
hcell.InnerText = "● 설문참여/대상 : " + string.Format("{0} / {1} ({2}%)", vm.CMRS.countok, vm.CMRS.countlect, (vm.CMRS.countok / (vm.CMRS.countlect * 1.0)).ToString("#,0.#"));
row.Cells.Add(hcell); table.Rows.Add(row);
row = new System.Web.UI.HtmlControls.HtmlTableRow();
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = "고객사"; hcell.BgColor = "gray"; hcell.Align = "center"; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = "이름"; hcell.BgColor = "gray"; hcell.Align = "center"; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = "ID"; hcell.BgColor = "gray"; hcell.Align = "center"; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = "직급"; hcell.BgColor = "gray"; hcell.Align = "center"; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = "신청구분"; hcell.BgColor = "gray"; hcell.Align = "center"; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = "설문참여일시"; hcell.BgColor = "gray"; hcell.Align = "center"; row.Cells.Add(hcell);
for (var i = 0; i < ccnt; i++)
{
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = (i + 1).ToString(); hcell.BgColor = "gray"; hcell.Align = "center"; row.Cells.Add(hcell);
}
table.Rows.Add(row);
foreach (var lectno in vm.LectRSs.Select(s => s.lectno).Distinct())
{
var u = vm.LectRSs.Where(w => w.lectno == lectno).First();
row = new System.Web.UI.HtmlControls.HtmlTableRow();
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = u.asname; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = u.username; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = u.userid; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = u.ccpositionname; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = u.isrebatename; row.Cells.Add(hcell);
hcell = new System.Web.UI.HtmlControls.HtmlTableCell(); hcell.InnerText = u.cdtymdhm; row.Cells.Add(hcell);
foreach (var rscqno in vm.RSCQs.Select(s => s.rscqno).Distinct())
{
var q = vm.RSCQs.Where(w => w.rscqno == rscqno).First();
hcell = new System.Web.UI.HtmlControls.HtmlTableCell();
if (q.atype == 2 && vm.LectRSs.Where(w=>w.lectno == lectno && w.rscqno == rscqno).Count() > 0)
{
hcell.InnerText = vm.LectRSs.Where(w => w.lectno == lectno && w.rscqno == rscqno).First().atext ?? "";
}
else
{
if(vm.RSCQs.Where(w=>w.rscqno == rscqno).Count() > 0 && vm.LectRSs.Where(w2 => w2.lectno == lectno && w2.rscqno == rscqno).Count() > 0)
{
hcell.InnerHtml = string.Join(",", vm.RSCQs.Where(w => w.rscqno == rscqno && string.Format(",{0},", vm.LectRSs.Where(w2 => w2.lectno == lectno && w2.rscqno == rscqno).First().atext ?? "")
.Contains(string.Format(",{0},", w.qino))).Select(s => s.rno));
}
}
hcell.Align = "left";
row.Cells.Add(hcell);
}
table.Rows.Add(row);
}
table.RenderControl(htw);
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment;filename=Research.xls");
Response.AddHeader("Content-Type", "application/vnd.ms-excel");
Response.Output.Write(sw.ToString());
Response.End();
return null;
}
}
}
else
{
vm.RSCQs = Dao.Get<RSCQ>("lect.cmrscqs", vm.CMRS.rsno);
return View(vm);
}
}
public ActionResult deliveries(VMLect vm)
{
var ht = SetHash(vm, false);
if (!IsPost())
{
vm.stringval = vm.stringval2 = DateTime.Now.ToString("yyyy-MM-dd");
}
ht.Add("payokstime", !string.IsNullOrEmpty(vm.stringval2) && string.IsNullOrEmpty(vm.stringval) ? "1900-01-01" : vm.stringval);
ht.Add("payoketime", !string.IsNullOrEmpty(vm.stringval) && string.IsNullOrEmpty(vm.stringval2) ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : string.IsNullOrEmpty(vm.stringval2) ? null : string.Format("{0} 23:59:59", vm.stringval2));
ht.Add("isdvr", vm.stringval3);
ht.Add("isdvrcode" + vm.stringval4, 1);
vm.stringval5 = vm.stringval5 ?? "all";
ht.Add(vm.stringval5, vm.stringval6);
vm.PayDVRs = Dao.Get<PayDVR>("pay.paydvrs", ht);
vm.pagetotalcount = GetCount(vm.PayDVRs.FirstOrDefault());
vm.stringval20 = DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddDays(-14).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddMonths(-2).ToString("yyyy-MM-dd");
return View(vm);
}
public ActionResult edub2bs(VMLect vm)
{
var ht = SetHash(vm, false);
vm.EduB2Bs = Dao.Get<EduB2B>("lect.edub2bs", ht);
vm.pagetotalcount = GetCount(vm.EduB2Bs.FirstOrDefault());
return View(vm);
}
public ActionResult edub2b(VMLect vm)
{
vm.EduB2B = Dao.Get<EduB2B>("lect.edub2bs", new System.Collections.Hashtable() { { "eduno", vm.intval } }).First();
vm.FileList = new List<File>() { };
if (vm.EduB2B.fgno != null)
{
vm.FileList = GetFiles(vm.EduB2B.fgno.Value);
}
return View(vm);
}
public ActionResult attoffs(VMLect vm)
{
vm.stringval = vm.stringval ?? DateTime.Now.ToString("yyyy-MM-dd");
vm.CMInnings = Dao.Get<CMInning>("lect.attoffs", vm.stringval);
vm.pagetotalcount = GetCount(vm.CMInnings.FirstOrDefault());
return View(vm);
}
public ActionResult attoff(VMLect vm)
{
vm.CMInning = Dao.Get<CMInning>("lect.cminning", vm.longval).First();
vm.LectInnings = Dao.Get<LectInning>("lect.lectinnings.foratt", vm.CMInning.cmino);
vm.pagetotalcount = GetCount(vm.LectInnings.FirstOrDefault());
return View(vm);
}
public ActionResult attscds(VMLect vm)
{
vm.ComCodes = GetComCodes("studyplace");
ViewBag.reporturl = GetConfig("reporturl");
var ht = SetHash(vm);
ht.Add("edate", vm.stringval);
ht.Add("cname", vm.stringval2);
ht.Add("studyplace", vm.stringval3);
vm.Lects = Dao.Get<Lect>("lect.lectinnings.forattscd", ht);
vm.pagetotalcount = GetCount(vm.Lects.FirstOrDefault());
return View(vm);
}
public ActionResult grades(NP.Model.VMCM vm)
{
var ht = SetHash(vm, false);
ht.Add("tyear", !string.IsNullOrEmpty(vm.stringval2) ? null : vm.stringval);
ht.Add("tmno", vm.stringval2);
ht.Add("cshape", vm.stringval3);
if (vm.stringval4 == "0")
{
ht.Add("nocomplete", 1);
}
else if (vm.stringval4 == "1")
{
ht.Add("hascomplete", 1);
}
else if (vm.stringval4 == "3")
{
ht.Add("result", 1);
}
else if (vm.stringval4 == "4")
{
ht.Add("noresult", 1);
}
ht.Add("cnamelike", vm.stringval5);
vm.IsAdmin = SUserInfo.IsAdmin;
if (SUserInfo.IsTeacher)
{
ht.Add("profno", SUserInfo.UserNo);
}
ht.Add("status", 1);
vm.CMs = Dao.Get<CM>("lect.cms", ht);
vm.pagetotalcount = GetCount(vm.CMs.FirstOrDefault());
vm.Terms = Dao.Get<Term>("cm.term.ys", new System.Collections.Hashtable() { });
vm.IsProf = SUserInfo.IsTeacher;
return View(vm);
}
public ActionResult grade(VMLect vm)
{
vm.CM = Dao.Get<CM>("cm.cms", new System.Collections.Hashtable { { "cmno", vm.intval } }).First();
vm.IsAdmin = SUserInfo.IsAdmin;
if (ViewBag.IsSubAdmin97)
{
vm.tabidx = 4;
}
switch (vm.tabidx)
{
case 0:
{
ViewBag.fronturl = GetConfig("fronturl");
ViewBag.reporturl = GetConfig("reporturl");
if (Dao.Get<CMEV>("cm.cmev", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno } }).Count > 0)
{
vm.CMEV = Dao.Get<CMEV>("cm.cmev", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno } }).First();
}
else
{
vm.CMEV = new CMEV() { };
}
vm.Lects = Dao.Get<Lect>("grade.lectgrades", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "ustatus", 1 }, { "isrebate", vm.addstringval },{"iscomplete",vm.addstringval2 },{"cmisno",vm.addstringval3 },{ "ispasss", vm.addstringval4 },{"ispassa",vm.addstringval5 },{"ispassex",vm.addstringval6 },{"usernameid",vm.addstringval7 }, { "orderby", "ua.asname,ua.asno,u.username" } });
vm.CMInnings = new List<CMInning>() { };
vm.CMinningscds = new List<CMinningscd>() { };
if(vm.CMEV.cshape ==2)
{
vm.CMInnings = Dao.Get<CMInning>("cm.cminnings", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "isonline", 0 },{"isscd",1 } });
vm.CMinningscds = Dao.Get<CMinningscd>("cm.cminningscds", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno } });
}
}
break;
case 1:
{
vm.Lects = Dao.Get<Lect>("lect.atts", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "status", 1 }, { "ustatus", 1 }, { "isrebate", vm.addstringval } });
vm.pagetotalcount = GetCount(vm.Lects.FirstOrDefault());
vm.CMInnings = Dao.Get<CMInning>("cm.cminnings", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "isonline", 0 },{"isscd",0 } });
}
break;
case 2:
case 3:
{
vm.CMEXes = Dao.Get<CMEX>("cm.cmexes", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "extype", vm.tabidx == 2 ? 0 : 1 } });
vm.LectEXes = new List<LectEX>() { };
if (vm.CMEXes.Count() > 0)
{
vm.LectEXes = Dao.Get<LectEX>("lect.lectexes", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "exno", !string.IsNullOrEmpty(vm.addstringval) ? GetInt(vm.addstringval) : vm.CMEXes.First().exno }, { "isrebate", vm.addstringval2 }, { "estate", vm.addstringval3 },{"ustatus",1 } });
}
vm.pagetotalcount = GetCount(vm.LectEXes);
}
break;
case 4:
{
vm.CMSDs = Dao.Get<CMSD>("cm.cmsds", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "sdtype", 0 } });
vm.LectSDs = new List<LectSD>() { };
vm.FileList = new List<File>() { };
var fgnos = string.Join(",", vm.CMSDs.Where(w => w.fgno != null).Select(s => s.fgno.Value));
if (!string.IsNullOrEmpty(fgnos))
{
vm.FileList = GetFiles(fgnos);
}
if (vm.CMSDs.Count() > 0)
{
vm.LectSDs = Dao.Get<LectSD>("lect.lectsds", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "sdno", !string.IsNullOrEmpty(vm.addstringval) ? GetInt(vm.addstringval) : vm.CMSDs.First().sdno }, { "isrebate", vm.addstringval2 }, { "sdstate", vm.addstringval3 }, { "isproduct" + (GetConfig("isstaging") == "1" ? "x" : ""), 1 } ,{"ustatus",1 } });
}
vm.pagetotalcount = GetCount(vm.LectSDs);
}
break;
case 5:
{
vm.CMSDs = Dao.Get<CMSD>("cm.cmsds", new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "sdtype", 1 } });
vm.LectSDs = new List<LectSD>() { };
vm.FileList = new List<File>() { };
var fgnos = string.Join(",", vm.CMSDs.Where(w => w.fgno != null).Select(s => s.fgno.Value));
if (!string.IsNullOrEmpty(fgnos))
{
vm.FileList = GetFiles(fgnos);
}
if (vm.CMSDs.Count() > 0)
{
var _ht = new System.Collections.Hashtable() { { "cmno", vm.CM.cmno }, { "sdno", !string.IsNullOrEmpty(vm.addstringval) ? GetInt(vm.addstringval) : vm.CMSDs.First().sdno }, { "isrebate", vm.addstringval2 },{"ustatus",1 } };
if (!string.IsNullOrEmpty(vm.addstringval3))
{
_ht.Add("dcount", "=" + vm.addstringval3);
if (vm.addstringval3 == "3")
{
_ht["dcount"] = "&gt;2";
}
}
vm.LectSDs = Dao.Get<LectSD>("lect.lectdiscusses", _ht);
}
vm.pagetotalcount = GetCount(vm.LectSDs);
}
break;
default: break;
}
return View(vm);
}
public ActionResult gradeall(VMLect vm)
{
vm.IsAdmin = SUserInfo.IsAdmin;
vm.ComCodes = GetComCodes("studyplace");
ViewBag.fronturl = GetConfig("fronturl");
ViewBag.reporturl = GetConfig("reporturl");
if (ViewBag.IsSubAdmin97)
{
vm.tabidx = 4;
}
int pcnt = vm.pagerowcount == 0 ? 100 : vm.pagerowcount;
var ht = SetHash(vm);
ht.Add("edate", vm.stringval);
ht.Add("cshape", vm.stringval2);
ht.Add("cname", vm.stringval3);
ht.Add("cnamestr", vm.stringval3);
ht.Add("iscomplete", vm.stringval4);
ht.Add("studyplace", vm.stringval5);
ht.Add("sdateall", vm.stringval8);
ht.Add("edateall", vm.stringval9);
ht.Add("asname", vm.stringval10);
ht.Add("mobile", vm.stringval11);
if (!string.IsNullOrEmpty(vm.stringval11))
{
var mobile_temp = vm.stringval11.Replace("-", "");
if (mobile_temp.Length == 10)
{
vm.stringval11 = mobile_temp.Substring(0, 3) + "-" + mobile_temp.Substring(3, 3) + "-" + mobile_temp.Substring(6);
}
else if (mobile_temp.Length == 11)
{
vm.stringval11 = mobile_temp.Substring(0, 3) + "-" + mobile_temp.Substring(3, 4) + "-" + mobile_temp.Substring(7);
}
ht["mobile"] = vm.stringval11;
}
ht.Add("ustatus", 1);
if (!string.IsNullOrEmpty(vm.stringval6))
{
ht.Add(vm.stringval6, vm.stringval7);
}
switch (vm.tabidx)
{
case 0:
//ht.Add("ustatus", 1);
ht.Add("orderby", "ua.asname,ua.asno,u.username");
vm.Lects = Dao.Get<Lect>("grade.lectgrades", ht);
if (vm.isexceldown == 1)
{
return ExportExcel(
new String[] { "순번","결제번호", "사용자ID", "이름","주민번호","교육생연락처","교육유형","교육구분"
, "기술인분류", "직무분야","교육목적","등급", "교육시작일", "교육종료일", "과정명","수료번호","교육이수시간"
, "진도율", "평가점수", "과제점수", "총점", "온라인집체교육출석여부", "강의평가"
,"업체명","업체주소","사업자등록번호","고용보험관리번호","업태","종목","대표자","학력","직위","업체담당자","업체담당자 연락처"
,"교육비","환급여부","환급액","환급은행명","환급계좌","환급계좌예금주","계산서이메일","소속협회"
,"교육상위분류","교육하위분류","교육장소","교육연도", "수료여부"},
new String[] { "rno","payno", "userid", "username","userpno", "mobile","cshapename","edukind"
, "typemanname","typejobname","typeeduname","typegradename", "sdatestr", "edatestr", "cname","completeno","studytime"
, "attrate", "ex1point", "sd0point", "tpointstr", "isoffabsstr", "rs0point"
,"asname","addr","brno","eino","btype","bkind","ceoname","slevelName","uduty","mname","mphone"
,"payamt","isrebatename","rbankamt","rbank","rbankaccnum","rbankuser","taxemail","association"
,"pcgname","cgname","studyplacename","tyear", "iscompletename" },
vm.Lects,
"성적처리전체" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day,null,",2,4");
}
vm.pagetotalcount = GetCount(vm.Lects.FirstOrDefault());
break;
case 2:
case 3:
{
ht.Add("extype", vm.tabidx == 2 ? 0 : 1);
ht.Add("estate", vm.addstringval2);
vm.LectEXes = Dao.Get<LectEX>("lect.lectexes.all", ht);
if (vm.isexceldown == 1)
{
return ExportExcel(
new String[] { "No", "운영기수", "구분", "고객사", "교육장", "과정명", "시험명", "교육생", "ID", "핸드폰", "교육시작일", "교육종료일", "응시일자(제출일자)","경과시간", "IP", "응시상태", "총점", "수료여부" },
new String[] { "rno", "sseq", "isrebatename", "asname", "studyplacename", "cname", "exname", "username", "userid", "mobile", "leststr", "leestrExcel", "estarteend", "eseterm", "eip", "estatename", "tpoint", "iscompletename" },
vm.LectEXes,
"성적처리평가" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day);
}
vm.pagetotalcount = GetCount(vm.LectEXes.FirstOrDefault());
}
break;
case 4:
{
ht.Add("sdtype", 0);
vm.LectSDs = new List<LectSD>() { };
ht.Add("sdstate", vm.addstringval2);
ht.Add("isproduct" + (GetConfig("isstaging") == "1" ? "x" : ""), 1);
vm.LectSDs = Dao.Get<LectSD>("lect.lectsds.all", ht);
/*to-do*/
if (vm.isexceldown == 1)
{
return ExportExcel(
new String[] { "No", "운영기수", "교육장", "과정명", "교육생", "ID", "핸드폰", "교육시작일", "교육종료일", "상태", "점수", "첨삭", "모사", "최근제출일(IP)", "최근평가일(IP)","수료여부" },
new String[] { "rno", "sseq", "studyplacename", "cname", "username", "userid", "mobile", "leststr", "leestrExcel", "sdstatename", "cpoint2", "feedbox", "copyratename", "submittimeip_format", "checktimeip_format", "iscompletename" },
vm.LectSDs,
"성적처리과제" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day);
}
vm.pagetotalcount = GetCount(vm.LectSDs.FirstOrDefault());
}
break;
default:break;
}
return View(vm);
}
public ActionResult atts(VMLect vm)
{
vm.Lect = Dao.Get<Lect>("lect.lects", new System.Collections.Hashtable() { { "lectno", vm.longval } }).First();
vm.LectInningPages = Dao.Get<LectInningPage>("lect.lectinningpages", new System.Collections.Hashtable() { { "lectno", vm.Lect.lectno },{"isscd", 0} });
vm.PageLogs = Dao.Get<PageLog>("lect.pagelogs", new System.Collections.Hashtable() { { "start", vm.Lect.sstime }, { "end", vm.Lect.setime.Value.ToString("yyyy-MM-dd 23:59:59") }, { "userno", vm.Lect.userno }, { "logsite", 1 } });
return View(vm);
}
public ActionResult pay(VMCRoom vm)
{
var ht = SetHash(vm, false);
if (!IsPost())
{
vm.pagerowcount = 50;
//vm.stringval = DateTime.Now.ToString("yyyy-MM-01");
//vm.stringval2 = Convert.ToDateTime(vm.stringval).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
}
ht.Add("cdts", vm.stringval);
ht.Add("cdte", string.IsNullOrEmpty(vm.stringval2) ? null : (vm.stringval2 + " 23:59:59"));
//ht.Add("pstatusin", vm.stringval3);
//ht.Add("isrefundcall", string.IsNullOrEmpty(vm.stringval4) ? null : "1");
//ht.Add("rstatusin", vm.stringval5);
String pstatusall = null;
if (vm.stringval3 != null)
{
pstatusall = " and ((p.pstatus in (" +vm.stringval3+") and pr.rstatus is null and p.rstatus = 0)";
}
if (vm.stringval4 != null)
{
pstatusall = pstatusall == null ? "and ((pr.rfdno is not null and pr.rstatus = 0)" : (pstatusall + " or (pr.rfdno is not null and pr.rstatus = 0)");
}
if ((vm.stringval5??"").Contains("1"))
{
pstatusall = pstatusall == null ? "and ((pi.rstatus=1 and p.payamt>p.refundamt)" : (pstatusall + " or (pi.rstatus=1 and p.payamt>p.refundamt)");
}
if ((vm.stringval5 ?? "").Contains("2"))
{
pstatusall = pstatusall == null ? "and ((p.rstatus > 0 and p.payamt=p.refundamt)" : (pstatusall + " or (p.rstatus > 0 and p.payamt=p.refundamt)");
}
pstatusall = pstatusall == null ? pstatusall : pstatusall + ")";
ht.Add("isunpay", vm.stringval18);
ht.Add("pstatusall", pstatusall);
ht.Add("ptypein", vm.stringval7);
ht.Add("isjoin", vm.stringval8);
ht.Add("brno", string.IsNullOrEmpty(vm.stringval10) ? null : vm.stringval10.Replace("-", ""));
ht.Add("piptype", vm.stringval11);
ht.Add("cshape", vm.stringval12);
ht.Add("pcgno", vm.stringval13);
ht.Add("isrebates", vm.stringval14);
ht.Add("certcode", TestCode1);
if (!string.IsNullOrEmpty(vm.stringval16))
{
ht.Add(vm.stringval15 ?? "usernameiditemname", vm.stringval16);
}
ht.Add("isgroup", vm.stringval17);
ht.Add("estart", vm.stringval20);
ht.Add("eend", string.IsNullOrEmpty(vm.stringval21) ? null : (vm.stringval21 + " 23:59:59"));
ht.Add("studyplace", vm.stringval22);
ht.Add("mobile", vm.stringval23);
if (!string.IsNullOrEmpty(vm.stringval23))
{
var mobile_temp = vm.stringval23.Replace("-", "");
if (mobile_temp.Length == 10)
{
vm.stringval23 = mobile_temp.Substring(0, 3) + "-" + mobile_temp.Substring(3, 3) + "-" + mobile_temp.Substring(6);
}
else if (mobile_temp.Length == 11)
{
vm.stringval23 = mobile_temp.Substring(0, 3) + "-" + mobile_temp.Substring(3, 4) + "-" + mobile_temp.Substring(7);
}
ht["mobile"] = vm.stringval23;
}
vm.PayItems = Dao.Get<PayItem>("cr.payitems", ht);
vm.pagetotalcount = GetCount(vm.PayItems.FirstOrDefault());
vm.CGs = Dao.Get<CG>("cm.cgs", new System.Collections.Hashtable() { { "istop", 1 }, { "isdel", 0 }, { "isuse", 1 } });
vm.ComCodes = GetComCodes("typeman,typeedu,typegrade,typejob,studyplace");
vm.stringval19 = DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddDays(-14).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddMonths(-2).ToString("yyyy-MM-dd");
if (vm.isexceldown == 1)
{
foreach (var payItem in vm.PayItems)
{
payItem.studyplacename = vm.ComCodes.Where(w => w.cgroup.ToString() == "studyplace" && w.ccode == payItem.studyplace).FirstOrDefault()?.cname;
payItem.cmistudyplacename = vm.ComCodes.Where(w => w.cgroup.ToString() == "studyplace" && w.ccode == payItem.cmistudyplace).FirstOrDefault()?.cname;
}
return ExportExcel(
new String[] { "결제번호", "신청자이름", "ID","주민번호", "핸드폰", "회사명", "상품유형", "환급여부", "상품명", "결제금액", "결제방법", "입금금액", "환불금액", "신청일","신청일시", "입금일", "결제상태", "환급은행명", "환급계좌번호", "환급예금주", "교육장소", "강좌교육시작일", "강좌교육종료일", "신청교육장소", "교육종료일","기술인분류","교육구분","직무분야","등급","목적","수료여부" },
new String[] { "payno", "username", "userid"," userpno", "mobile", "asname", "cshapename", "isrebatename", "itemname", "payamt", "pptypename", "payamt", "refundamt", "cdtymd","cdtymdhms", "payymd", "pstatusname2", "rbank", "rbankaccnum", "tbankuser", "studyplacename", "sdateymd", "edateymd", "cmistudyplacename", "cmiestartymd","tmname","edukind","tjname","tgname","tename", "completename" },
vm.PayItems,
"ProductSales_" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day);
}
return View(vm);
}
public ActionResult payview(VMPay vm)
{
if (!IsPost())
{
LogSet(new ActLog() { logtype = 60, logtarget = 41, logdata = "결제번호: "+vm.payno, uno = SUserInfo.UserNo, uip = GetUserIP() });
}
if (vm.isexamready == 1)
{
//자격증시험 승인상태의 데이터(수동결제완료처리 용도)
vm.Pay = Dao.Get<Pay>("cr.payforexam1", new System.Collections.Hashtable() { { "userno", vm.userno }, { "exno", vm.payno } }).First();
vm.PayItems = Dao.Get<PayItem>("cr.payforexam2", new System.Collections.Hashtable() { { "userno", vm.userno }, { "exno", vm.payno } });
}
else
{
vm.Pay = Dao.Get<Pay>("cr.pay1", vm.payno).First();
vm.PayItems = Dao.Get<PayItem>("cr.pay2", vm.payno);
vm.ComCodes = GetComCodes("typeman,typeedu,typegrade,typejob,studyplace");
vm.Lect = Dao.Get<Lect>("lect.lects", new System.Collections.Hashtable() { { "payno", vm.payno } }).FirstOrDefault();
vm.Lect.typemanname = vm.ComCodes.Where(w => w.cgroup.ToString() == "typeman" && w.ccode == vm.Lect.typeman).FirstOrDefault()?.cname;
vm.Lect.typeeduname = vm.ComCodes.Where(w => w.cgroup.ToString() == "typeedu" && w.ccode == vm.Lect.typeedu).FirstOrDefault()?.cname;
vm.Lect.typegradename = vm.ComCodes.Where(w => w.cgroup.ToString() == "typegrade" && w.ccode == vm.Lect.typegrade).FirstOrDefault()?.cname;
vm.Lect.typejobname = vm.ComCodes.Where(w => w.cgroup.ToString() == "typejob" && w.ccode == vm.Lect.typejob).FirstOrDefault()?.cname;
if(!string.IsNullOrEmpty(vm.Lect.studyplace)) vm.Lect.studyplacename = vm.ComCodes.Where(w => w.cgroup.ToString() == "studyplace" && w.ccode == int.Parse(vm.Lect.studyplace)).FirstOrDefault()?.cname;
ViewBag.TestCode = TestCode;
vm.CM = Dao.Get<CM>("cm.cm", new System.Collections.Hashtable() { { "cmno", vm.Lect.cmno } }).First();
}
return View(vm);
}
public ActionResult payrefund(VMPay vm)
{
vm.Pay = Dao.Get<Pay>("cr.pay.forrfd", vm.payno).First();
vm.PayItems = Dao.Get<PayItem>("cr.payitem.forrfd", vm.payno);
vm.PayRfds = Dao.Get<PayRfd>("cr.payrfditems", vm.payno);
return View(vm);
}
public ActionResult refundview(VMPay vm)
{
vm.Pay = Dao.Get<Pay>("cr.pay.forrfd", vm.payno).First();
vm.PayItems = Dao.Get<PayItem>("cr.payitem.forrfd", vm.payno);
vm.PayRfds = Dao.Get<PayRfd>("cr.payrfditems2", vm.rfdno);
vm.FileList = new List<File>() { };
vm.FileList2 = new List<File>() { };
if (vm.PayRfds != null && (vm.PayRfds.First().fgnor??0) > 0)
{
vm.FileList = GetFiles(vm.PayRfds.First().fgnor.Value);
}
if (vm.PayRfds != null && (vm.PayRfds.First().fgnob??0) > 0)
{
vm.FileList2 = GetFiles(vm.PayRfds.First().fgnob.Value);
}
return View(vm);
}
public ActionResult refundprint(VMPay vm)
{
vm.Pay = Dao.Get<Pay>("cr.pay.forrfd", vm.payno).First();
vm.PayItems = Dao.Get<PayItem>("cr.payitem.forrfd", vm.payno);
vm.PayRfds = Dao.Get<PayRfd>("cr.payrfditems2", vm.rfdno);
return View(vm);
}
public ActionResult tax(VMCRoom vm)
{
var ht = SetHash(vm, false);
if(vm.isexceldown != 1)
{
vm.stringval11 = null;
}
if (!IsPost())
{
vm.stringval6 = DateTime.Now.ToString("yyyy-MM-01");
vm.stringval7 = Convert.ToDateTime(vm.stringval6).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
}
ht.Add("staxdatereq", vm.stringval6);
ht.Add("etaxdatereq", string.IsNullOrEmpty(vm.stringval7) ? null : (vm.stringval7 + " 23:59:59"));
ht.Add("cdts", vm.stringval);
ht.Add("cdte", string.IsNullOrEmpty(vm.stringval2) ? null : (vm.stringval2 + " 23:59:59"));
ht.Add("staxdate", vm.stringval8);
ht.Add("etaxdate", string.IsNullOrEmpty(vm.stringval9) ? null : (vm.stringval9 + " 23:59:59"));
ht.Add("pstatus", vm.stringval10);
ht.Add("taxnos", vm.stringval11);
ht.Add("ischeck", vm.stringval12);
ht.Add("csdate", vm.stringval13);
ht.Add("cedate", string.IsNullOrEmpty(vm.stringval14) ? null : (vm.stringval14 + " 23:59:59"));
ht.Add("isreceipt", vm.stringval15);
if (!string.IsNullOrEmpty(vm.stringval3))
{
if(vm.stringval3 == "2")
{
ht.Add("iscancel", 1);
}
else
{
ht.Add("iscancel", 0);
ht.Add("tstatus" + (vm.stringval3), 1);
}
}
if (!string.IsNullOrEmpty(vm.stringval5))
{
if (!string.IsNullOrEmpty(vm.stringval4))
{
ht.Add(vm.stringval4, vm.stringval5);
}
else
{
ht.Add("nimp", vm.stringval5);
}
}
vm.PayTaxes = Dao.Get<PayTax>("cr.paytaxes", ht);
if (vm.isexceldown == 1)
{
return ExportExcel(
new String[] {"결제번호","신청일","입금일","결제상태","이름","아이디","전화번호","강좌명","교육종료일","회사명","대표명","주소","사업자번호","업태","종목","담당자명","담당자연락처"
,"계산서수신이메일","청구영수","발행요청금액","발행요청일","실제날짜","발행한날","발행상태"},
new String[] {"payno","cdtymd", "payoktimeymd", "pstatusname2","username", "userid", "mobile", "itemname","eendymd", "asname", "ceoname","asaddr",
"brno", "btype","bkind", "manname", "telno", "email", "isreceiptname", "taxamt", "taxdatereqymd","taxdateymd","realtaxdateymd","status"},
vm.PayTaxes,
"계산서요청"+DateTime.Now.ToString("yy.MM.dd"), null);
}
vm.pagetotalcount = GetCount(vm.PayTaxes.FirstOrDefault());
return View(vm);
}
public ActionResult taxdetail(VMCRoom vm)
{
if (vm.longval < 1 && vm.intval < 0 )
{
return Redirect("/croom/tax");
}
if (vm.intval > 0)
vm.PayTaxes = Dao.Get<PayTax>("cr.paytaxes", new System.Collections.Hashtable() { { "payno", vm.intval } });
else
vm.PayTaxes = Dao.Get<PayTax>("cr.paytaxes", new System.Collections.Hashtable() { { "taxno", vm.longval }});
vm.FileList = new List<File>() { };
if (vm.PayTaxes.First().fgno != null)
{
vm.FileList = GetFiles(vm.PayTaxes.First().fgno.Value);
}
vm.PayTaxes2 = Dao.Get<PayTax>("cr.paytaxes2", vm.PayTaxes.First().payno);
if (vm.intval > 0)
vm.PayTaxItem = Dao.Get<PayItem>("cr.paytaxitem2", new System.Collections.Hashtable() { { "payno", vm.intval } });
else
vm.PayTaxItem = Dao.Get<PayItem>("cr.paytaxitem2", new System.Collections.Hashtable() { { "taxno", vm.longval } });
#region Popbill
var payTax = vm.PayTaxes.First();
if (payTax != null)
{
var result = PopbillService.GetTaxinvoice(payTax);
if (result.IsSuccess)
{
ViewBag.Taxinvoice = result.Data;
ViewBag.TaxinvoiceInfo = PopbillService.GetTaxinvoiceInfo(payTax).Data;
if(ViewBag.TaxinvoiceInfo != null && payTax.statecode == 0)
{
#region
payTax.uno = SUserInfo.UserNo;
payTax.uip = GetUserIP();
payTax.statecode = ViewBag.TaxinvoiceInfo.stateCode;
Dao.Save("cr.paytax.save", payTax);
#endregion
}
}
}
#endregion
return View(vm);
}
public ActionResult taxsmart(VMCRoom vm)
{
vm.Datas = new List<Data>() { };
vm.intval = 0;
vm.intval2 = 0;
var lasttime2 = CookieGet("smartbill2", "");
if (lasttime2 != "")
{
vm.intval2 = Convert.ToInt32((DateTime.Now - Convert.ToDateTime(lasttime2)).TotalSeconds);
if (vm.intval2 < 60)
{
vm.intval2 = 60 - vm.intval2;
}
}
if (IsPost() && vm.addstringval != null)
{
vm.addstringval = vm.addstringval ?? DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd");
vm.addstringval2 = vm.addstringval2 ?? DateTime.Now.ToString("yyyy-MM-dd");
var lasttime = CookieGet("smartbill", "");
if (lasttime != "")
{
vm.intval = Convert.ToInt32((DateTime.Now - Convert.ToDateTime(lasttime)).TotalSeconds);
if (vm.intval < 60)
{
vm.intval = 60 - vm.intval;
return View(vm);
}
}
var request = new SmartRequest()
{
MessageId = "kfcfkfcf" + DateTime.Now.ToString("yyyyMMddHHmmss"),
Signal = "DTI_STATUS_LIST",
RequestTime = DateTime.Now.ToString("yyyyMMddHHmmss"),
SendComRegno = "1048205661",
AuthToken = "d09OaVA0VXBsMzhnTWp3WE5SamZjRm1uQ245L3VYYjc4OWM3VG1WSlRoaz0K",
ServiceCode = "DTI",
SearchFromDate = vm.addstringval,
SearchToDate = vm.addstringval2,
SearchComRegno = vm.addstringval3,
RepoTypeCode = "AR"
};
System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
//client.BaseAddress = new Uri("http://demoapi.smartbill.co.kr/");
client.BaseAddress = new Uri("http://api.smartbill.co.kr/");
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
var response = client.PostAsJsonAsync("sb-api/request/", request).Result;
vm.addstringval10 = null;
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsAsync<SmartResult>().Result;
if ("30000".Equals(result.ResultCode))
{
var totalCount = result.ResultDataSet.Tables[0].Rows.Count;
if (totalCount > 0)
{
for (var i = 0; i < totalCount; i++)
{
vm.Datas.Add(new Data()
{
strval = result.ResultDataSet.Tables[0].Rows[i].ItemArray[0].ToString(),//참조번호
strval2 = result.ResultDataSet.Tables[0].Rows[i].ItemArray[1].ToString(),//세금계산서상태
strval3 = result.ResultDataSet.Tables[0].Rows[i].ItemArray[2].ToString(),//국세청전송상태
strval4 = result.ResultDataSet.Tables[0].Rows[i].ItemArray[3].ToString(),//국세청 전송결과
strval5 = result.ResultDataSet.Tables[0].Rows[i].ItemArray[4].ToString(),//국세청 전송일자
strval6 = result.ResultDataSet.Tables[0].Rows[i].ItemArray[5].ToString()//담당자 이메일
});
}
}
}
else
{
vm.addstringval10 = result.ResultMessage;
}
}
CookieSet("smartbill", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), 1);
vm.intval = 60;
}
vm.addstringval = vm.addstringval ?? DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd");
vm.addstringval2 = vm.addstringval2 ?? DateTime.Now.ToString("yyyy-MM-dd");
return View(vm);
}
public ActionResult Documents(VMCRoom vm)
{
ViewBag.reporturl = GetConfig("reporturl");
var ht = SetHash(vm, false);
if (!IsPost())
{
vm.pagerowcount = 50;
vm.stringval = DateTime.Now.ToString("yyyy-MM-01");
vm.stringval2 = Convert.ToDateTime(vm.stringval).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
}
if (SUserInfo.IsSiteAdmin)
{
ht.Add("asno", SUserInfo.ASNo);
ViewBag.IsSiteAdmin = SUserInfo.IsSiteAdmin;
}
ht.Add("cdts", vm.stringval);
ht.Add("cdte", string.IsNullOrEmpty(vm.stringval2) ? null : (vm.stringval2 + " 23:59:59"));
ht.Add("asname", string.IsNullOrEmpty(vm.stringval3) ? null : vm.stringval3);
ht.Add("isrebates", vm.stringval4);
if (!string.IsNullOrEmpty(vm.stringval6))
{
ht.Add(vm.stringval5 ?? "usernameiditemname", vm.stringval6);
}
vm.stringval20 = DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddDays(-14).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd") + ";" +
DateTime.Now.AddMonths(-2).ToString("yyyy-MM-dd");
vm.Lects = Dao.Get<Lect>("lect.lecture.document", ht);
vm.pagetotalcount = GetCount(vm.Lects.FirstOrDefault());
return View(vm);
}
public ActionResult documentspast(Documents vm)
{
var ht = SetHash(vm);
vm.syears = Dao.Get<textvalue>("cr.documnetspasts.syear", ht).ToList();
vm.cgs = Dao.Get<textvalue>("cr.documnetspasts.cg", ht).ToList();
vm.cshapes = Dao.Get<textvalue>("cr.documnetspasts.cshape", ht).ToList();
vm.typemans = Dao.Get<textvalue>("cr.documnetspasts.typeman", ht).ToList();
vm.edukinds = Dao.Get<textvalue>("cr.documnetspasts.edukind", ht).ToList();
vm.typeedus = Dao.Get<textvalue>("cr.documnetspasts.typeedu", ht).ToList();
vm.typegrades = Dao.Get<textvalue>("cr.documnetspasts.typegrade", ht).ToList();
vm.typejobs = Dao.Get<textvalue>("cr.documnetspasts.typejob", ht).ToList();
vm.kinds = Dao.Get<textvalue>("cr.documnetspasts.kind", ht).ToList();
List<textvalue> words = new List<textvalue>();
words.Add(new textvalue { text = "이름", value = "이름"});
words.Add(new textvalue { text = "주민등록번호", value = "주민등록번호" });
words.Add(new textvalue { text = "수료번호", value = "수료번호" });
words.Add(new textvalue { text = "업체명", value = "업체명" });
words.Add(new textvalue { text = "사업자등록번호", value = "사업자등록번호" });
vm.words = words;
vm.DocumentList = InitM<Document>();
ht.Add("syear", vm.stringval);
ht.Add("cg", vm.stringval2);
ht.Add("cshape", vm.stringval3);
ht.Add("typeman", vm.stringval4);
ht.Add("edukind", vm.stringval5);
ht.Add("typeedu", vm.stringval6);
ht.Add("typegrade", vm.stringval7);
ht.Add("typejob", vm.stringval8);
vm.stringval9 = vm.stringval9 == null ? vm.stringval == null ? "2019-01-01 00:00:00" : vm.stringval + "-01-01 00:00:00" : vm.stringval9;
vm.stringval10 = vm.stringval10 == null ? vm.stringval == null ? "2020-12-31 23:59:59" : vm.stringval + "-12-31 23:59:59" : vm.stringval10;
ht.Add("ssdate", vm.stringval9);
ht.Add("sedate", vm.stringval10);
switch (vm.stringval11)
{
case "이름": ht.Add("word", "username"); break;
case "주민등록번호": ht.Add("word", "userpno"); break;
case "수료번호": ht.Add("word", "completeno"); break;
case "업체명": ht.Add("word", "companyname"); break;
case "사업자등록번호": ht.Add("word", "brno"); break;
}
ht.Add("text", vm.stringval12);
vm.DocumentList = Dao.Get<Document>("cr.documnetspasts", ht);
vm.pagetotalcount = GetCount(vm.DocumentList.FirstOrDefault());
if (vm.isexceldown == 1)
{
vm.DocumentList = Dao.Get<Document>("cr.documnetspasts", ht);
return ExportExcel(
new String[] {"순번","사용자ID","이름","주민번호","교육생연락처","교육유형","교육구분","기술인분류","직무분야","교육목적","등급","교육시작일","교육종료일",
"과정명","수료번호","주문번호","업체명","업체주소","사업자등록번호","고용보험관리번호","업태","종목",
"대표자","학력","직위","업체담당자","업체담당당자 연락처","교육비","환급액","환급은행명","환급계좌" ,"환급계좌예금주","계산서이메일",
"소속협회","교육상위분류","교육하위분류","교육장","교육이수시간","교육연도"},
new String[] {"rno","userid", "username", "userpnostr","phone", "cshape", "edukind", "typeman", "typejob", "typeedu", "typegrade", "ssdateymd2","sedateymd2",
"cgname", "completeno","paynostr", "companyname", "companyaddr", "brno", "eino", "btype", "bkind",
"ceoname","slevel","uduty","mname","mphone","sprice","rprice","rbank","rbankno","rbankuser","taxemail",
"assign","userid","userid","userid","sctime","syear"},
vm.DocumentList,
"증빙서류출력(과거)",null,",0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38");
}
return View(vm);
}
public ActionResult completions(VMCRoom vm)
{
vm.Completions = InitM<Completion>();
vm.CGs = Dao.Get<CG>("cm.cgs", new System.Collections.Hashtable() { { "isuse", 1 }, { "isdel", 0 } });
vm.ComCodes = GetComCodes("typeman,typeedu,typegrade,typejob,studyplace");
var ht = SetHash(vm);
ht.Add("tyear", vm.stringval);
ht.Add("pcgno", vm.stringval2);
ht.Add("cgno", vm.stringval3);
ht.Add("cshape", vm.stringval4);
ht.Add("typeman", vm.stringval5);
ht.Add("studyplace", vm.stringval6);
ht.Add("typejob", vm.stringval7);
ht.Add("scompletetime", vm.stringval8);
ht.Add("ecompletetime", vm.stringval9);
ht.Add("typegrade", vm.stringval10);
ht.Add("typeedu", vm.stringval11);
vm.Completions = Dao.Get<Completion>("cr.completions", ht);
vm.pagetotalcount = GetCount(vm.Completions.FirstOrDefault());
foreach (var completion in vm.Completions)
{
completion.typeeduName = vm.ComCodes.Where(w=> w.ccode == completion.typeedu).FirstOrDefault()?.cname;
completion.typegradeName = vm.ComCodes.Where(w => w.ccode == completion.typegrade).FirstOrDefault()?.cname;
completion.typejobName = vm.ComCodes.Where(w => w.ccode == completion.typejob).FirstOrDefault()?.cname;
completion.typemanName = vm.ComCodes.Where(w => w.ccode == completion.typeman).FirstOrDefault()?.cname;
completion.studyplaceName = vm.ComCodes.Where(w => w.ccode == completion.studyplace).FirstOrDefault()?.cname;
if(completion.cshape == 2)
{
completion.sdate = completion.payoktime;
completion.edate = completion.estart;
}
}
if (vm.isexceldown == 1)
{
vm.Completions = Dao.Get<Completion>("cr.completions", ht);
foreach (var completion in vm.Completions)
{
completion.typeeduName = vm.ComCodes.Where(w => w.ccode == completion.typeedu).FirstOrDefault()?.cname;
completion.typegradeName = vm.ComCodes.Where(w => w.ccode == completion.typegrade).FirstOrDefault()?.cname;
completion.typejobName = vm.ComCodes.Where(w => w.ccode == completion.typejob).FirstOrDefault()?.cname;
completion.typemanName = vm.ComCodes.Where(w => w.ccode == completion.typeman).FirstOrDefault()?.cname;
completion.studyplaceName = vm.ComCodes.Where(w => w.ccode == completion.studyplace).FirstOrDefault()?.cname;
if (completion.cshape == 2)
{
completion.sdate = completion.payoktime;
completion.edate = completion.estart;
}
}
return ExportExcel(
new String[] {"순번" ,"사용자ID","이름","주민번호","교육생연락처","교육유형","교육구분","기술인분류","직무분야","교육목적","등급","교육시작일","교육종료일",
"과정명","수료번호","주문번호","업체명","업체주소","사업자등록번호","고용보험관리번호","업태","종목",
"대표자","학력","직위","업체담당자","업체담당당자 연락처","교육비","환급액","환급은행명","환급계좌" ,"환급계좌예금주","계산서이메일",
"소속협회","교육상위분류","교육하위분류","교육장","교육이수시간","교육연도"},
new String[] {"rno","userid","username", "userpnostr","mobile", "cshapename", "edukind", "typemanName", "typejobName", "typeeduName", "typegradeName", "sdateymd2","edateymd2",
"cname","completeno","payno","asname", "companyaddr", "brno", "eino", "btype", "bkind",
"ceoname","slevelName","uduty","mname","mphone","payamt","rbankamt","rbank","rbankaccnum","rbankuser","taxemail",
"association","pcgname", "cgname", "studyplaceName","studytime","tyear"},
vm.Completions,
"수료관리", null, ",0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38");
}
return View(vm);
}
}
}