You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

275 lines
8.5 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.ReceiveSendFeeManagement;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using Learun.Application.WorkFlow;
  8. namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2021-05-28 14:18
  15. /// 描 述:支出预算管理
  16. /// </summary>
  17. public class FD_PayManageController : MvcControllerBase
  18. {
  19. private FD_PayManageIBLL fD_PayManageIBLL = new FD_PayManageBLL();
  20. private FD_IncomeManageIBLL fD_IncomeManageIBLL = new FD_IncomeManageBLL();
  21. private NWFTaskIBLL nWFTaskIBLL = new NWFTaskBLL();
  22. #region 视图功能
  23. /// <summary>
  24. /// 主页面
  25. /// <summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. public ActionResult Index()
  29. {
  30. return View();
  31. }
  32. /// <summary>
  33. /// 表单页
  34. /// <summary>
  35. /// <returns></returns>
  36. [HttpGet]
  37. public ActionResult Form()
  38. {
  39. return View();
  40. }
  41. /// <summary>
  42. /// 打印
  43. /// </summary>
  44. /// <returns></returns>
  45. [HttpGet]
  46. public ActionResult PrintSpecial()
  47. {
  48. return View();
  49. }
  50. /// <summary>
  51. /// 打印
  52. /// </summary>
  53. /// <returns></returns>
  54. [HttpGet]
  55. public ActionResult PrintPublic()
  56. {
  57. return View();
  58. }
  59. /// <summary>
  60. /// 表单(基本承包经费支出)
  61. /// </summary>
  62. /// <returns></returns>
  63. [HttpGet]
  64. public ActionResult FormPublic()
  65. {
  66. ViewBag.Amount = 0;
  67. ViewBag.Name = "";
  68. var incomlist = fD_IncomeManageIBLL.GetIncomeList("0", "1");
  69. if (incomlist.Count() > 0)
  70. {
  71. var model = incomlist.FirstOrDefault();
  72. ViewBag.Name = model.IName;
  73. ViewBag.Amount = model.ISurplusAmount;
  74. }
  75. return View();
  76. }
  77. #endregion
  78. #region 获取数据
  79. /// <summary>
  80. /// 获取表单数据
  81. /// </summary>
  82. /// <param name="keyValue">主键</param>
  83. /// <returns></returns>
  84. [HttpGet]
  85. [AjaxOnly]
  86. public ActionResult GetPTypeTree(string keyValue)
  87. {
  88. var data = fD_PayManageIBLL.GetTree();
  89. return Success(data);
  90. }
  91. /// <summary>
  92. /// 获取页面显示列表数据
  93. /// </summary>
  94. /// <param name="pagination">分页参数</param>
  95. /// <param name="queryJson">查询参数</param>
  96. /// <returns></returns>
  97. [HttpGet]
  98. [AjaxOnly]
  99. public ActionResult GetPageList(string pagination, string queryJson)
  100. {
  101. Pagination paginationobj = pagination.ToObject<Pagination>();
  102. var data = fD_PayManageIBLL.GetPageList(paginationobj, queryJson);
  103. var jsonData = new
  104. {
  105. rows = data,
  106. total = paginationobj.total,
  107. page = paginationobj.page,
  108. records = paginationobj.records
  109. };
  110. return Success(jsonData);
  111. }
  112. /// <summary>
  113. /// 获取表单数据
  114. /// </summary>
  115. /// <param name="keyValue">主键</param>
  116. /// <returns></returns>
  117. [HttpGet]
  118. [AjaxOnly]
  119. public ActionResult GetFormData(string keyValue)
  120. {
  121. var FD_PayManageData = fD_PayManageIBLL.GetFD_PayManageEntity(keyValue);
  122. var jsonData = new
  123. {
  124. FD_PayManage = FD_PayManageData,
  125. };
  126. return Success(jsonData);
  127. }
  128. /// <summary>
  129. /// 获取表单数据
  130. /// </summary>
  131. /// <param name="keyValue">主键</param>
  132. /// <returns></returns>
  133. [HttpGet]
  134. [AjaxOnly]
  135. public ActionResult GetPrintData(string keyValue, string processId)
  136. {
  137. var FD_PayManageData = fD_PayManageIBLL.GetFD_PayManageEntity(keyValue);
  138. var TaskLogList = (List<NWFTaskLogEntity>)nWFTaskIBLL.GetLogList(processId);
  139. var jsonData = new
  140. {
  141. FD_PayManage = FD_PayManageData,
  142. TaskLogList = TaskLogList
  143. };
  144. return Success(jsonData);
  145. }
  146. /// <summary>
  147. /// 获取表单数据
  148. /// </summary>
  149. /// <param name="processId">流程Id</param>
  150. /// <returns></returns>
  151. [HttpGet]
  152. [AjaxOnly]
  153. public ActionResult GetFormDataByProcessId(string processId)
  154. {
  155. var FD_PayManageData = fD_PayManageIBLL.GetFormDataByProcessId(processId);
  156. var jsonData = new
  157. {
  158. FD_PayManage = FD_PayManageData,
  159. };
  160. return Success(jsonData);
  161. }
  162. /// <summary>
  163. /// 获取收入预算下拉框列表
  164. /// </summary>
  165. /// <param name=""></param>
  166. /// <returns></returns>
  167. [HttpGet]
  168. [AjaxOnly]
  169. public ActionResult GetIncomeList(string budgetType, string financeBudgetType)
  170. {
  171. var fD_IncomeManageData = fD_IncomeManageIBLL.GetIncomeList(budgetType, financeBudgetType);
  172. var list = new List<object>();
  173. foreach (var item in fD_IncomeManageData)
  174. {
  175. list.Add(new
  176. {
  177. text = item.IName + "(剩余金额:" + item.ISurplusAmount + ")",
  178. value = item.IId,
  179. });
  180. }
  181. return Success(list);
  182. }
  183. #endregion
  184. #region 提交数据
  185. /// <summary>
  186. /// 删除实体数据
  187. /// </summary>
  188. /// <param name="keyValue">主键</param>
  189. /// <returns></returns>
  190. [HttpPost]
  191. [AjaxOnly]
  192. public ActionResult DeleteForm(string keyValue)
  193. {
  194. fD_PayManageIBLL.DeleteEntity(keyValue);
  195. return Success("删除成功!");
  196. }
  197. /// <summary>
  198. /// 保存实体数据(新增、修改)
  199. /// </summary>
  200. /// <param name="keyValue">主键</param>
  201. /// <param name="strEntity">实体</param>
  202. /// <returns></returns>
  203. [HttpPost]
  204. [ValidateAntiForgeryToken]
  205. [AjaxOnly]
  206. public ActionResult SaveForm(string keyValue, string strEntity)
  207. {
  208. FD_PayManageEntity entity = strEntity.ToObject<FD_PayManageEntity>();
  209. //判断资金支出来源对应的收入预算是否存在
  210. var ITopType = "";
  211. var ISecondType = "";
  212. if ((entity.PTopSource == "1" || entity.PTopSource == "2") || entity.PType == "2")
  213. {
  214. //学校经费 部门专项经费对应公用经费
  215. ITopType = "0";
  216. ISecondType = "1";
  217. }
  218. else if (entity.PTopSource == "3")
  219. {
  220. //财政专项经费
  221. ITopType = "0";
  222. ISecondType = "2";
  223. }
  224. else if (entity.PTopSource == "4")
  225. {
  226. //培训收入
  227. ITopType = "2";
  228. }
  229. var incomlist = fD_IncomeManageIBLL.GetIncomeList(ITopType, ISecondType);
  230. if (incomlist.Count() <= 0)
  231. return Fail("请先添加对应的收入预算!");
  232. if (entity.PTopSource == "3" && string.IsNullOrEmpty(entity.PIncomeId))
  233. {
  234. //财政专项经费
  235. return Fail("请选择财政专项名称!");
  236. }
  237. else
  238. {
  239. entity.PIncomeId = incomlist.Select(x => x.IId).FirstOrDefault();
  240. }
  241. fD_PayManageIBLL.SaveEntity(keyValue, entity);
  242. if (string.IsNullOrEmpty(keyValue))
  243. {
  244. }
  245. return Success("保存成功!");
  246. }
  247. /// <summary>
  248. /// 提交
  249. /// </summary>
  250. /// <param name="keyValue"></param>
  251. /// <returns></returns>
  252. [HttpPost]
  253. [AjaxOnly]
  254. public ActionResult ChangeStatusById(string keyValue, string processId)
  255. {
  256. fD_PayManageIBLL.ChangeStatusById(keyValue, 1, processId);
  257. return Success("操作成功!");
  258. }
  259. #endregion
  260. }
  261. }