using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.ViewModel; using EMIS.CommonLogic.ChargeManage.ChargeTotal; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using Bowin.Common.Utility; using Bowin.Common.Data; using EMIS.Utility; using System.Data; using EMIS.ViewModel.ChargeManage.ChargeTotal; namespace EMIS.Web.Controllers.ChargeManae.ChargeTotal { [Authorization] public class ChargeTotalController : Controller { public IChargeTotalServices ChargeTotalServices { get; set; } /// /// 费用汇总页面 /// /// public ActionResult List() { return View(); } /// /// 费用汇总列表查询 /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown"); var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown"); var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform"); var learnSystem = pararms.getExtraString("DictionaryLearnSystem"); var chargeYearID = pararms.getExtraInt("ChargeYearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYearDropDown"); var chargeProjectID = pararms.getExtraGuid("ChargeProjectComboGrid"); //在校状态 var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); return base.Json(ChargeTotalServices.GetChargeTotadViewGrid(configuretView, collegeID, yearID, standardID, educationID, learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 列表查询统计信息 /// /// /// public ActionResult ChargeTotalList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown"); var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown"); var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform"); var learnSystem = pararms.getExtraString("DictionaryLearnSystem"); var chargeYearID = pararms.getExtraInt("ChargeYearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYearDropDown"); var chargeProjectID = pararms.getExtraGuid("ChargeProjectComboGrid"); //在校状态 var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); var chargeTotalSumView = ChargeTotalServices.GetTotalView(configuretView, collegeID, yearID, standardID, educationID, learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, 1, 1); return base.Json(new ChargeTotalSumView() { ChargeCountSum = chargeTotalSumView.ChargeCountSum, AmountSum = chargeTotalSumView.AmountSum, ChargeAmountSum = chargeTotalSumView.ChargeAmountSum, ActualAmountSum = chargeTotalSumView.ActualAmountSum, DelayCountSum = chargeTotalSumView.DelayCountSum, DelayAmountSum = chargeTotalSumView.DelayAmountSum, PaymenCountSum = chargeTotalSumView.PaymenCountSum, PaymenAmountSum = chargeTotalSumView.PaymenAmountSum }); } /// /// Excel导出 /// /// public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo(); var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo(); var educationID = Request.Form["DictionaryEducation"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo(); var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo(); var learnSystem = Request.Form["DictionaryLearnSystem"].ToString(); var chargeYearID = Request.Form["ChargeYearDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ChargeYearDropDown"].ParseStrTo(); var chargeProjectID = Request.Form["ChargeProjectComboGrid"].ParseStrTo(); //在校状态 var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo(); //统计 var chargeTotalSumView = ChargeTotalServices.GetTotalView(configuretView, collegeID, yearID, standardID, educationID, learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, 1, 1); var dt = ChargeTotalServices.GetChargeTotalViewList(configuretView, collegeID, yearID, standardID, educationID, learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus) .Select(x => new { x.ClassNo, x.ClassName, x.GradeMajorCode, x.GradeMajoyStr, x.Grade, x.StandardID, x.StandardCode, x.StandardName, x.EducationName, x.LearningformName, x.LearnSystem, x.ChargeYear, x.ChargeProjectStr, x.ChargeCount, x.Amount, x.ChargeAmount, x.ActualAmount, x.DelayCount, x.DelayAmount, x.PaymenCount, x.PaymenAmount, x.TeacherNo, x.TeacherName, x.CollegeCode, x.CollegeStr }).ToTable(); //追加统计列 DataRow newRow = dt.NewRow(); newRow[0] = "统计:"; newRow[13] = chargeTotalSumView.ChargeCountSum ?? 0; newRow[14] = chargeTotalSumView.AmountSum ?? 0; newRow[15] = chargeTotalSumView.ChargeAmountSum ?? 0; newRow[16] = chargeTotalSumView.ActualAmountSum ?? 0; newRow[17] = chargeTotalSumView.DelayCountSum ?? 0; newRow[18] = chargeTotalSumView.DelayAmountSum ?? 0; newRow[19] = chargeTotalSumView.PaymenCountSum ?? 0; newRow[20] = chargeTotalSumView.PaymenAmountSum ?? 0; dt.Rows.Add(newRow); string[] liststring = { "班级编号", "班级名称", "年级专业编号", "年级专业名称", "年级", "专业ID(Value)", "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "缴费学年", "收费项目", "应收人数", "应收金额", "调整金额", "实收金额", "缓交人数", "缓交金额", "已收人数", "已收金额", "班主任编号", "班主任", RSL.Get("CollegeCode"), RSL.Get("CollegeName") }; neh.Export(dt, liststring, "费用统计信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }