20230606新增费用申请页面、项目列表按活跃度排序

This commit is contained in:
2023-06-06 17:01:34 +08:00
parent 5984687629
commit e4871bc690
105 changed files with 63242 additions and 2216 deletions
@@ -2,6 +2,7 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
namespace FineUIPro.Web.HSSE.CostGoods
{
@@ -22,11 +23,6 @@ namespace FineUIPro.Web.HSSE.CostGoods
ViewState["CostManageId"] = value;
}
}
/// <summary>
/// 定义集合
/// </summary>
private static List<Model.CostGoods_CostManageItem> costManageItems = new List<Model.CostGoods_CostManageItem>();
#endregion
#region
@@ -39,111 +35,47 @@ namespace FineUIPro.Web.HSSE.CostGoods
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.CostManageId = Request.Params["CostManageId"];
if (!string.IsNullOrEmpty(this.CostManageId))
this.btnClose.OnClientClick = ActiveWindow.GetHideRefreshReference();
string strProjectId = this.CurrUser.LoginProjectId;
this.CostManageId = Request.Params["CostManageId"] ?? SQLHelper.GetNewID();
var costManage = BLL.CostManageService.GetCostManageById(this.CostManageId);
if (costManage != null)
{
Model.CostGoods_CostManage costManage = BLL.CostManageService.GetCostManageById(this.CostManageId);
if (costManage != null)
{
this.txtCostManageCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CostManageId);
this.txtCostManageName.Text = costManage.CostManageName;
if (!string.IsNullOrEmpty(costManage.UnitId))
{
var unit = BLL.UnitService.GetUnitByUnitId(costManage.UnitId);
if (unit != null)
{
this.txtUnitName.Text = unit.UnitName;
}
}
this.txtContractNum.Text = costManage.ContractNum;
if (costManage.CostManageDate != null)
{
this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", costManage.CostManageDate);
}
this.txtOpinion.Text = costManage.Opinion;
this.txtSubHSE.Text = costManage.SubHSE;
this.txtSubCN.Text = costManage.SubCN;
this.txtSubProject.Text = costManage.SubProject;
}
strProjectId = costManage.ProjectId;
this.drpUnit.Text=UnitService.GetUnitNameByUnitId(costManage.UnitId);
this.txtContractNum.Text = costManage.ContractNum;
this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", costManage.CostManageDate);
this.txtProjectName.Text = ProjectService.GetProjectNameByProjectId(strProjectId);
this.txtHseCost.Text = ProjectUnitService.GetSumHSECost(strProjectId, costManage.UnitId).ToString();
this.txtGetCost.Text = CostManageService.GetSumHSECost(strProjectId, costManage.UnitId, this.CostManageId).ToString();
BindGrid();
BindGrid2();
}
///初始化审核菜单
this.ctlAuditFlow.MenuId = BLL.Const.ProjectCostManageMenuId;
this.ctlAuditFlow.DataId = this.CostManageId;
}
}
#region
/// <summary>
/// 计算合计
/// </summary>
private void OutputSummaryData()
{
Grid1.CommitChanges();
decimal sumTotalMoney = 0, sumAuditTotalMoney = 0, totalMoney = 0, auditTotalMoney = 0, priceMoney = 0, auditPriceMoney = 0;
int counts = 0, auditCounts = 0;
for (int i = 0; i < Grid1.Rows.Count; i++)
{
counts = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[3].ToString());
priceMoney = Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[4].ToString());
totalMoney = counts * priceMoney;
sumTotalMoney += totalMoney;
this.Grid1.Rows[i].Values[5] = totalMoney.ToString();
auditCounts = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[6].ToString());
auditPriceMoney = Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[7].ToString());
auditTotalMoney = auditCounts * auditPriceMoney;
sumAuditTotalMoney += auditTotalMoney;
this.Grid1.Rows[i].Values[8] = auditTotalMoney.ToString();
}
if (this.Grid1.Rows.Count > 0)
{
JObject summary = new JObject();
summary.Add("PriceMoney", "总计");
summary.Add("TotalMoney", sumTotalMoney);
summary.Add("AuditTotalMoney", sumAuditTotalMoney);
Grid1.SummaryData = summary;
}
else
{
Grid1.SummaryData = null;
}
}
#endregion
#region Grid
/// <summary>
/// 绑定Grid
/// </summary>
private void BindGrid()
{
costManageItems = BLL.CostManageItemService.GetCostManageItemByCostManageId(this.CostManageId);
var costManageItems = BLL.CostManageItemService.GetCostManageItemByCostManageId(this.CostManageId);
this.Grid1.DataSource = costManageItems;
this.Grid1.PageIndex = 0;
this.Grid1.DataBind();
OutputSummaryData();
OutputSummaryData(costManageItems);
}
/// <summary>
/// 改变索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
private void OutputSummaryData(List<Model.CostGoods_CostManageItem> getItem)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
/// <summary>
/// 分页下拉选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
JObject summary = new JObject();
summary.Add("InvestCostProject", "本次申请合计金额(元)");
summary.Add("PriceMoney", getItem.Sum(x => x.PriceMoney ?? 0));
Grid1.SummaryData = summary;
}
/// <summary>
@@ -157,6 +89,39 @@ namespace FineUIPro.Web.HSSE.CostGoods
}
#endregion
#region BindGrid2
/// <summary>
/// 绑定Grid
/// </summary>
private void BindGrid2()
{
var FlowOperates = from x in Funs.DB.CostGoods_CostManageFlowOperate
where x.CostManageId == this.CostManageId
select new
{
x.FlowOperateId,
x.CostManageId,
x.AuditFlowName,
x.SortIndex,
x.UnitId,
UnitName = Funs.DB.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
x.OperaterId,
OperaterName = Funs.DB.Person_Persons.First(u => u.PersonId == x.OperaterId).PersonName,
x.OperaterTime,
x.IsAgree,
x.Opinion,
x.IsClosed
};
this.Grid2.DataSource = FlowOperates.OrderByDescending(x=> x.SortIndex);
this.Grid2.DataBind();
if (FlowOperates.FirstOrDefault(x => x.OperaterId != null) != null)
{
this.Grid2.Hidden = false;
}
}
#endregion
#region
/// <summary>
/// 上传附件
@@ -167,52 +132,9 @@ namespace FineUIPro.Web.HSSE.CostGoods
{
if (!string.IsNullOrEmpty(this.CostManageId))
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CostManageAttachUrl&menuId={1}", this.CostManageId, BLL.Const.ProjectCostManageMenuId)));
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CostManageAttachUrl&menuId={1}&type=-1", this.CostManageId, BLL.Const.ProjectCostManageMenuId)));
}
}
#endregion
#region
/// <summary>
/// 获取总价
/// </summary>
/// <param name="costManageId"></param>
/// <returns></returns>
protected string GetTotalMoney(object costManageItemId)
{
string total = string.Empty;
if (costManageItemId != null)
{
var costManageItem = BLL.CostManageItemService.GetCostManageItemById(costManageItemId.ToString());
if (costManageItem != null)
{
decimal? price = costManageItem.PriceMoney;
int? count = costManageItem.Counts;
total = Convert.ToString(price * count);
}
}
return total;
}
/// <summary>
/// 获取审核总价
/// </summary>
/// <param name="costManageId"></param>
/// <returns></returns>
protected string GetAuditTotalMoney(object costManageItemId)
{
string total = string.Empty;
if (costManageItemId != null)
{
var costManageItem = BLL.CostManageItemService.GetCostManageItemById(costManageItemId.ToString());
if (costManageItem != null)
{
decimal? auditPrice = costManageItem.AuditPriceMoney;
int? auditCount = costManageItem.AuditCounts;
total = Convert.ToString(auditPrice * auditCount);
}
}
return total;
}
#endregion
}