|
- using Learun.Util;
- using System.Data;
- using Learun.Application.TwoDevelopment.ReceiveSendFeeManagement;
- using System.Web.Mvc;
- using System.Collections.Generic;
- using System.Linq;
- using Learun.Application.WorkFlow;
-
- namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
- /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- /// 创 建:超级管理员
- /// 日 期:2021-05-28 14:18
- /// 描 述:支出预算管理
- /// </summary>
- public class FD_PayManageController : MvcControllerBase
- {
- private FD_PayManageIBLL fD_PayManageIBLL = new FD_PayManageBLL();
- private FD_IncomeManageIBLL fD_IncomeManageIBLL = new FD_IncomeManageBLL();
- private NWFTaskIBLL nWFTaskIBLL = new NWFTaskBLL();
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- return View();
- }
- /// <summary>
- /// 打印
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult PrintSpecial()
- {
- return View();
- }
- /// <summary>
- /// 打印
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult PrintPublic()
- {
- return View();
- }
-
- /// <summary>
- /// 表单(基本承包经费支出)
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FormPublic()
- {
- ViewBag.Amount = 0;
- ViewBag.Name = "";
- var incomlist = fD_IncomeManageIBLL.GetIncomeList("0", "1");
- if (incomlist.Count() > 0)
- {
- var model = incomlist.FirstOrDefault();
- ViewBag.Name = model.IName;
- ViewBag.Amount = model.ISurplusAmount;
- }
- return View();
- }
- #endregion
-
- #region 获取数据
- /// <summary>
- /// 获取表单数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPTypeTree(string keyValue)
- {
- var data = fD_PayManageIBLL.GetTree();
-
- return Success(data);
- }
-
- /// <summary>
- /// 获取页面显示列表数据
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = fD_PayManageIBLL.GetPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormData(string keyValue)
- {
- var FD_PayManageData = fD_PayManageIBLL.GetFD_PayManageEntity(keyValue);
- var jsonData = new
- {
- FD_PayManage = FD_PayManageData,
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPrintData(string keyValue, string processId)
- {
- var FD_PayManageData = fD_PayManageIBLL.GetFD_PayManageEntity(keyValue);
- var TaskLogList = (List<NWFTaskLogEntity>)nWFTaskIBLL.GetLogList(processId);
- var jsonData = new
- {
- FD_PayManage = FD_PayManageData,
- TaskLogList = TaskLogList
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// </summary>
- /// <param name="processId">流程Id</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormDataByProcessId(string processId)
- {
- var FD_PayManageData = fD_PayManageIBLL.GetFormDataByProcessId(processId);
- var jsonData = new
- {
- FD_PayManage = FD_PayManageData,
- };
- return Success(jsonData);
- }
-
- /// <summary>
- /// 获取收入预算下拉框列表
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetIncomeList(string budgetType, string financeBudgetType)
- {
- var fD_IncomeManageData = fD_IncomeManageIBLL.GetIncomeList(budgetType, financeBudgetType);
- var list = new List<object>();
- foreach (var item in fD_IncomeManageData)
- {
- list.Add(new
- {
- text = item.IName + "(剩余金额:" + item.ISurplusAmount + ")",
- value = item.IId,
- });
- }
- return Success(list);
- }
-
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- fD_PayManageIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="strEntity">实体</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- FD_PayManageEntity entity = strEntity.ToObject<FD_PayManageEntity>();
- //判断资金支出来源对应的收入预算是否存在
- var ITopType = "";
- var ISecondType = "";
- if ((entity.PTopSource == "1" || entity.PTopSource == "2") || entity.PType == "2")
- {
- //学校经费 部门专项经费对应公用经费
- ITopType = "0";
- ISecondType = "1";
- }
- else if (entity.PTopSource == "3")
- {
- //财政专项经费
- ITopType = "0";
- ISecondType = "2";
- }
- else if (entity.PTopSource == "4")
- {
- //培训收入
- ITopType = "2";
- }
-
- var incomlist = fD_IncomeManageIBLL.GetIncomeList(ITopType, ISecondType);
- if (incomlist.Count() <= 0)
- return Fail("请先添加对应的收入预算!");
-
- if (entity.PTopSource == "3" && string.IsNullOrEmpty(entity.PIncomeId))
- {
- //财政专项经费
- return Fail("请选择财政专项名称!");
- }
- else
- {
- entity.PIncomeId = incomlist.Select(x => x.IId).FirstOrDefault();
- }
- fD_PayManageIBLL.SaveEntity(keyValue, entity);
- if (string.IsNullOrEmpty(keyValue))
- {
- }
- return Success("保存成功!");
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="keyValue"></param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult ChangeStatusById(string keyValue, string processId)
- {
- fD_PayManageIBLL.ChangeStatusById(keyValue, 1, processId);
- return Success("操作成功!");
- }
- #endregion
-
- }
- }
|