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
@@ -53,49 +53,38 @@ namespace FineUIPro.Web.HSSE.CostGoods
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @" SELECT CostManage.CostManageId, "
+ @" CostManage.ProjectId,"
+ @" CodeRecords.Code AS CostManageCode,"
+ @" CostManage.CostManageName,"
+ @" CostManage.UnitId,"
+ @" CostManage.ContractNum,"
+ @" CostManage.CostManageDate,"
+ @" CostManage.Opinion,"
+ @" CostManage.SubHSE,"
+ @" CostManage.SubCN,"
+ @" CostManage.SubProject,"
+ @" CostManage.States,"
+ @" CostManage.CompileMan,"
+ @" CostManage.CompileDate,"
+ @" Unit.UnitName,"
+ @" (CASE WHEN CostManage.States = " + BLL.Const.State_0 + " OR CostManage.States IS NULL THEN '待['+OperateUser.PersonName+']提交' WHEN CostManage.States = " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperateUser.PersonName+']办理' END) AS FlowOperateName"
+ @" FROM CostGoods_CostManage AS CostManage "
+ @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CostManage.CostManageId = CodeRecords.DataId "
+ @" LEFT JOIN Sys_FlowOperate AS FlowOperate ON CostManage.CostManageId = FlowOperate.DataId AND FlowOperate.IsClosed <> 1"
+ @" LEFT JOIN Person_Persons AS OperateUser ON FlowOperate.OperaterId = OperateUser.PersonId"
+ @" LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = CostManage.UnitId"
+ @" LEFT JOIN Person_Persons AS Users ON CostManage.CompileMan = Users.PersonId WHERE 1=1 ";
{
string strSql = @" SELECT CostManage.CostManageId, CostManage.ProjectId,CostManage.UnitId,Unit.UnitName,CostManage.ContractNum,CostManage.CostManageDate,
CostManage.States,(CASE WHEN CostManage.States =1 THEN '审核中' WHEN CostManage.States =2 THEN '已完成' ELSE '待提交' END) AS StatesName,
CostManage.CompileMan,Users.PersonName AS CompileManName,CostManage.CompileDate,CostManage.SumMoney
FROM CostGoods_CostManage AS CostManage
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = CostManage.UnitId
LEFT JOIN Person_Persons AS Users ON CostManage.CompileMan = Users.PersonId WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += " AND CostManage.ProjectId = @ProjectId";
if (!string.IsNullOrEmpty(Request.Params["projectId"])) ///是否文件柜查看页面传项目值
{
listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"]));
strSql += " AND CostManage.States = @States"; ///状态为已完成
listStr.Add(new SqlParameter("@States", BLL.Const.State_2));
}
else
{
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
}
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
{
strSql += " AND CostManage.UnitId = @UnitId"; ///状态为已完成
listStr.Add(new SqlParameter("@UnitId", this.CurrUser.UnitId));
}
if (this.rblState.SelectedValue != "-1")
{
if (this.rblState.SelectedValue == Const.State_0)
{
strSql += " AND (CostManage.States IS NULL OR CostManage.States = @States)"; ///状态为已完成
}
else
{
strSql += " AND CostManage.States = @States"; ///状态为已完成
}
listStr.Add(new SqlParameter("@States", this.rblState.SelectedValue));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
@@ -167,17 +156,21 @@ namespace FineUIPro.Web.HSSE.CostGoods
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string id = Grid1.SelectedRowID;
var costManage = BLL.CostManageService.GetCostManageById(id);
var costManage = CostManageService.GetCostManageById(Grid1.SelectedRowID);
if (costManage != null)
{
if (this.btnMenuEdit.Hidden || costManage.States == BLL.Const.State_2) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
var getNowFlow = CostManageService.getNowCostManageFlowOperateList(costManage.CostManageId);
if (costManage.States == Const.State_1 && getNowFlow != null && getNowFlow.OperaterId == this.CurrUser.PersonId)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CostManageView.aspx?CostManageId={0}", id, "查看 - ")));
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CostManageAudit.aspx?CostManageId={0}", costManage.CostManageId, "编辑 - ")));
}
else
else if ((costManage.States == Const.State_0 || string.IsNullOrEmpty(costManage.States)) && !this.btnMenuEdit.Hidden)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CostManageEdit.aspx?CostManageId={0}", id, "编辑 - ")));
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CostManageEdit.aspx?CostManageId={0}", costManage.CostManageId, "编辑 - ")));
}
else
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CostManageView.aspx?CostManageId={0}", costManage.CostManageId, "查看 - ")));
}
}
}
@@ -255,10 +248,75 @@ namespace FineUIPro.Web.HSSE.CostGoods
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
this.Grid1.PageSize = this.Grid1.RecordCount;
this.BindGrid();
Response.Write(GetGridTableHtml(Grid1));
Response.Write(GetGridTableHtml(this.Grid1));
Response.End();
}
#endregion
#endregion
/// <summary>
/// 查看
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnView_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CostManageView.aspx?CostManageId={0}", Grid1.SelectedRowID, "查看 - ")));
}
/// <summary>
/// 状态事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void rblState_SelectedIndexChanged(object sender, EventArgs e)
{
// 绑定表格
this.BindGrid();
}
#region ID获取审核信息
/// <summary>
/// 根据ID获取审核信息
/// </summary>
/// <param name="costManageId"></param>
/// <returns></returns>
protected string ConvertOperateName(object costManageId)
{
string strValue = "";
if (costManageId != null)
{
var costManage = CostManageService.GetCostManageById(costManageId.ToString());
if (costManage != null && costManage.States != Const.State_2)
{
if (costManage.States == Const.State_1)
{
var getNowFlow = CostManageService.getNowCostManageFlowOperateList(costManage.CostManageId);
if (getNowFlow != null)
{
strValue = "待【" + Person_PersonsService.GetPersonsNameById(getNowFlow.OperaterId) + "】审核";
}
}
else
{
strValue="待【"+Person_PersonsService.GetPersonsNameById(costManage.CompileMan) +"】提交";
}
}
}
return strValue;
}
#endregion
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
// 绑定表格
this.BindGrid();
}
}
}