using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.CommonLogic.PaymentManage;
using EMIS.ViewModel;
using EMIS.Web.Controls;
using Bowin.Common.Data;
using Bowin.Web.Controls.Mvc;
using Bowin.Common.Utility;
using EMIS.Utility;
namespace EMIS.Web.Controllers.PaymentManage
{
[Authorization]
public class PaymentController : Controller
{
public IPaymentServices PaymentServices { get; set; }
public ActionResult List()
{
return View();
}
public ActionResult CollegeTeacherReport()
{
return View();
}
public ActionResult CollegeTeacherMonthReport()
{
return View();
}
public ActionResult MonthlyReport()
{
return View();
}
public ActionResult GradeyearReport()
{
return View();
}
public ActionResult WorktimeTotalReport()
{
return View();
}
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
var collegeID = pararms.getExtraGuid("cbgCollege");
var titleID = pararms.getExtraInt("ddlTitle") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlTitle");
var list = PaymentServices.GetPaymentDetailViewList(configuretView, schoolyearID, collegeID, titleID, pararms.page.Value, pararms.rows.Value);
return Json(list);
}
///
/// 导出Excel
///
///
[HttpPost]
public ActionResult Excel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo();
var collegeID = Request.Form["cbgCollege"].ParseStrTo();
var titleID = Request.Form["ddlTitle"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlTitle"].ParseStrTo();
var dt = PaymentServices.GetPaymentDetailViewList(configuretView, schoolyearID, collegeID, titleID).Select(x => new
{
x.SchoolyearCode,
x.CollegeName,
x.UserName,
x.TeacherTypeDesc,
x.TitleDesc,
PaymentStandard = string.Format("{0:#0.00}", x.PaymentStandard),
x.EducationDesc,
x.LearningformDesc,
x.LearningformRate,
StudentCount = (x.StudentCount ?? 0).ToString(),
ExemptionCount = (x.ExemptionCount ?? 0).ToString(),
ActualStudentCount = (x.ActualStudentCount ?? 0).ToString(),
StudentCountRate = (x.StudentCountRate ?? 0).ToString(),
RetakeStudentCount = (x.RetakeStudentCount ?? 0).ToString(),
ScheduleDayCount = (x.ScheduleDayCount ?? 0).ToString(),
ActualScheduleHours = (x.ActualScheduleHours ?? 0).ToString(),
HoursPayment = string.Format("{0:#0.00}", x.HoursPayment),
PracticeHours = (x.PracticeHours ?? 0).ToString(),
PracticeRate = string.Format("{0:#0.00}", x.PracticeRate),
PracticePayment = string.Format("{0:#0.00}", x.PracticePayment),
TotalPayment = string.Format("{0:#0.00}", x.TotalPayment),
x.ClasamajorName,
x.CoursematerialName,
PlanTotalHours = (x.PlanTotalHours ?? 0).ToString(),
x.TimeSegmentDesc,
x.ExaminationModeDesc
}).ToTable();
string[] liststring = { "学年学期", RSL.Get("College"), "任课老师", "教师类型", "职称", "标准课酬", RSL.Get("EducationID"), "学习形式", "形式系数", "班级人数",
"免考人数", "实际人数", "人数系数", "重修人数", "排课天数", "实际学时", "课时课酬", "实践学时", "实践系数", "实践课酬",
"总课酬", "班级名称", "课程名称", "计划学时", "课时类别", "考核方式" };
neh.Export(dt, liststring, "教师课酬列表");
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功!",
url = Url.Action("List").AddMenuParameter()
});
}
///
/// 导出Excel
///
///
[HttpPost]
public ActionResult ExcelTotal()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo();
var collegeID = Request.Form["cbgCollege"].ParseStrTo();
var titleID = Request.Form["ddlTitle"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlTitle"].ParseStrTo();
var dt = PaymentServices.GetPaymentTotalViewList(configuretView, schoolyearID, collegeID, titleID).Select(x => new
{
x.CollegeName,
x.UserName,
x.Account,
TotalPayment = string.Format("{0:#0.00}", x.TotalPayment ?? 0)
}).ToTable();
string[] liststring = { RSL.Get("College"), "任课老师", "工商银行账号", "总课酬(元)" };
neh.Export(dt, liststring, "教师课酬汇总表");
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功!",
url = Url.Action("List").AddMenuParameter()
});
}
}
}