ChargeTotalController.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.CommonLogic.ChargeManage.ChargeTotal;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using Bowin.Common.Utility;
  11. using Bowin.Common.Data;
  12. using EMIS.Utility;
  13. using System.Data;
  14. using EMIS.ViewModel.ChargeManage.ChargeTotal;
  15. namespace EMIS.Web.Controllers.ChargeManae.ChargeTotal
  16. {
  17. [Authorization]
  18. public class ChargeTotalController : Controller
  19. {
  20. public IChargeTotalServices ChargeTotalServices { get; set; }
  21. /// <summary>
  22. /// 费用汇总页面
  23. /// </summary>
  24. /// <returns></returns>
  25. public ActionResult List()
  26. {
  27. return View();
  28. }
  29. /// <summary>
  30. /// 费用汇总列表查询
  31. /// </summary>
  32. /// <param name="pararms"></param>
  33. /// <returns></returns>
  34. [HttpPost]
  35. public ActionResult List(QueryParamsModel pararms)
  36. {
  37. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  38. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  39. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  40. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  41. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  42. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  43. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  44. var chargeYearID = pararms.getExtraInt("ChargeYearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYearDropDown");
  45. var chargeProjectID = pararms.getExtraGuid("ChargeProjectComboGrid");
  46. //在校状态
  47. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  48. return base.Json(ChargeTotalServices.GetChargeTotadViewGrid(configuretView, collegeID, yearID, standardID, educationID,
  49. learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  50. }
  51. /// <summary>
  52. /// 列表查询统计信息
  53. /// </summary>
  54. /// <param name="pararms"></param>
  55. /// <returns></returns>
  56. public ActionResult ChargeTotalList(QueryParamsModel pararms)
  57. {
  58. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  59. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  60. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  61. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  62. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  63. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  64. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  65. var chargeYearID = pararms.getExtraInt("ChargeYearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYearDropDown");
  66. var chargeProjectID = pararms.getExtraGuid("ChargeProjectComboGrid");
  67. //在校状态
  68. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  69. var chargeTotalSumView = ChargeTotalServices.GetTotalView(configuretView, collegeID, yearID, standardID, educationID,
  70. learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, 1, 1);
  71. return base.Json(new ChargeTotalSumView()
  72. {
  73. ChargeCountSum = chargeTotalSumView.ChargeCountSum,
  74. AmountSum = chargeTotalSumView.AmountSum,
  75. ChargeAmountSum = chargeTotalSumView.ChargeAmountSum,
  76. ActualAmountSum = chargeTotalSumView.ActualAmountSum,
  77. DelayCountSum = chargeTotalSumView.DelayCountSum,
  78. DelayAmountSum = chargeTotalSumView.DelayAmountSum,
  79. PaymenCountSum = chargeTotalSumView.PaymenCountSum,
  80. PaymenAmountSum = chargeTotalSumView.PaymenAmountSum
  81. });
  82. }
  83. /// <summary>
  84. /// Excel导出
  85. /// </summary>
  86. /// <returns></returns>
  87. public ActionResult Excel()
  88. {
  89. NpoiExcelHelper neh = new NpoiExcelHelper();
  90. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  91. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  92. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  93. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  94. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  95. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  96. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  97. var chargeYearID = Request.Form["ChargeYearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ChargeYearDropDown"].ParseStrTo<int>();
  98. var chargeProjectID = Request.Form["ChargeProjectComboGrid"].ParseStrTo<Guid>();
  99. //在校状态
  100. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  101. //统计
  102. var chargeTotalSumView = ChargeTotalServices.GetTotalView(configuretView, collegeID, yearID, standardID, educationID,
  103. learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus, 1, 1);
  104. var dt = ChargeTotalServices.GetChargeTotalViewList(configuretView, collegeID, yearID, standardID, educationID,
  105. learningformID, learnSystem, chargeYearID, chargeProjectID, inSchoolStatus)
  106. .Select(x => new
  107. {
  108. x.ClassNo,
  109. x.ClassName,
  110. x.GradeMajorCode,
  111. x.GradeMajoyStr,
  112. x.Grade,
  113. x.StandardID,
  114. x.StandardCode,
  115. x.StandardName,
  116. x.EducationName,
  117. x.LearningformName,
  118. x.LearnSystem,
  119. x.ChargeYear,
  120. x.ChargeProjectStr,
  121. x.ChargeCount,
  122. x.Amount,
  123. x.ChargeAmount,
  124. x.ActualAmount,
  125. x.DelayCount,
  126. x.DelayAmount,
  127. x.PaymenCount,
  128. x.PaymenAmount,
  129. x.TeacherNo,
  130. x.TeacherName,
  131. x.CollegeCode,
  132. x.CollegeStr
  133. }).ToTable();
  134. //追加统计列
  135. DataRow newRow = dt.NewRow();
  136. newRow[0] = "统计:";
  137. newRow[13] = chargeTotalSumView.ChargeCountSum ?? 0;
  138. newRow[14] = chargeTotalSumView.AmountSum ?? 0;
  139. newRow[15] = chargeTotalSumView.ChargeAmountSum ?? 0;
  140. newRow[16] = chargeTotalSumView.ActualAmountSum ?? 0;
  141. newRow[17] = chargeTotalSumView.DelayCountSum ?? 0;
  142. newRow[18] = chargeTotalSumView.DelayAmountSum ?? 0;
  143. newRow[19] = chargeTotalSumView.PaymenCountSum ?? 0;
  144. newRow[20] = chargeTotalSumView.PaymenAmountSum ?? 0;
  145. dt.Rows.Add(newRow);
  146. string[] liststring = {
  147. "班级编号", "班级名称", "年级专业编号", "年级专业名称", "年级", "专业ID(Value)", "专业代码",
  148. "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "缴费学年", "收费项目",
  149. "应收人数", "应收金额", "调整金额", "实收金额", "缓交人数", "缓交金额", "已收人数", "已收金额",
  150. "班主任编号", "班主任", RSL.Get("CollegeCode"), RSL.Get("CollegeName")
  151. };
  152. neh.Export(dt, liststring, "费用统计信息" + DateTime.Now.ToString("yyyyMMdd"));
  153. return Json(new ReturnMessage()
  154. {
  155. IsSuccess = true,
  156. Message = "导出成功。"
  157. });
  158. }
  159. }
  160. }