2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HSSE.CostGoods
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class Expense : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2023-05-29 09:09:30 +08:00
|
|
|
|
/// 项目id
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string ProjectId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["ProjectId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["ProjectId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-05-29 09:09:30 +08:00
|
|
|
|
|
|
|
|
|
|
#region Page_Init
|
|
|
|
|
|
|
|
|
|
|
|
// 注意:动态创建的代码需要放置于Page_Init(不是Page_Load),这样每次构造页面时都会执行
|
|
|
|
|
|
protected void Page_Init(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
InitYearGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-05-31 10:18:16 +08:00
|
|
|
|
protected static int sDate = 0;
|
|
|
|
|
|
protected static int eDate = 0;
|
2023-05-29 09:09:30 +08:00
|
|
|
|
#region 按年份
|
|
|
|
|
|
private void InitYearGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
FineUIPro.BoundField bf;
|
|
|
|
|
|
|
|
|
|
|
|
bf = new FineUIPro.BoundField();
|
|
|
|
|
|
bf.DataField = "Id";
|
|
|
|
|
|
bf.DataFormatString = "{0}";
|
|
|
|
|
|
bf.HeaderText = "编号";
|
|
|
|
|
|
bf.Width = 60;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
bf.Hidden = true;
|
2023-05-29 09:09:30 +08:00
|
|
|
|
Grid1.Columns.Add(bf);
|
|
|
|
|
|
|
|
|
|
|
|
bf = new FineUIPro.BoundField();
|
|
|
|
|
|
bf.DataField = "SupCostTypeName";
|
|
|
|
|
|
bf.DataFormatString = "{0}";
|
|
|
|
|
|
bf.HeaderText = "类别名称";
|
2023-06-06 17:01:34 +08:00
|
|
|
|
bf.ColumnID = "GroupB";
|
2023-05-29 09:09:30 +08:00
|
|
|
|
bf.Width = 90;
|
|
|
|
|
|
bf.HeaderTextAlign = TextAlign.Center;
|
|
|
|
|
|
Grid1.Columns.Add(bf);
|
|
|
|
|
|
|
|
|
|
|
|
bf = new FineUIPro.BoundField();
|
|
|
|
|
|
bf.DataField = "CostTypeName";
|
|
|
|
|
|
bf.DataFormatString = "{0}";
|
|
|
|
|
|
bf.HeaderText = "分项名称";
|
|
|
|
|
|
bf.Width = 120;
|
|
|
|
|
|
bf.HeaderTextAlign = TextAlign.Center;
|
|
|
|
|
|
Grid1.Columns.Add(bf);
|
|
|
|
|
|
|
|
|
|
|
|
this.ProjectId = this.ProjectId ?? this.CurrUser.LoginProjectId;
|
|
|
|
|
|
var getProject = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == this.ProjectId);
|
|
|
|
|
|
if (getProject != null)
|
|
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
sDate = getProject.StartDate.HasValue ? getProject.StartDate.Value.Year : DateTime.Now.Year;
|
|
|
|
|
|
eDate = getProject.EndDate.HasValue ? getProject.EndDate.Value.Year : DateTime.Now.Year;
|
2023-05-31 10:18:16 +08:00
|
|
|
|
var getCostEx = Funs.DB.CostGoods_Expense.Where(x => x.ProjectId == this.ProjectId);
|
|
|
|
|
|
if (getCostEx.Count() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var getMaxYear = getCostEx.Max(x => x.Year);
|
|
|
|
|
|
if (getMaxYear.HasValue && getMaxYear > eDate)
|
|
|
|
|
|
{
|
|
|
|
|
|
eDate = getMaxYear.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
var getMinYear = getCostEx.Min(x => x.Year);
|
|
|
|
|
|
if (getMinYear.HasValue && getMinYear < sDate)
|
|
|
|
|
|
{
|
|
|
|
|
|
sDate = getMinYear.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; sDate + i <= eDate; i++)
|
2023-05-29 09:09:30 +08:00
|
|
|
|
{
|
|
|
|
|
|
bf = new FineUIPro.BoundField();
|
2023-05-31 10:18:16 +08:00
|
|
|
|
bf.DataField = (sDate + i).ToString();
|
2023-05-29 09:09:30 +08:00
|
|
|
|
bf.DataFormatString = "{0}";
|
2023-06-06 17:01:34 +08:00
|
|
|
|
bf.HeaderText = (sDate + i).ToString() + "年(元)";
|
2023-05-29 09:09:30 +08:00
|
|
|
|
bf.Width = 200;
|
|
|
|
|
|
bf.HeaderTextAlign = TextAlign.Center;
|
|
|
|
|
|
Grid1.Columns.Add(bf);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bf = new FineUIPro.BoundField();
|
|
|
|
|
|
bf.DataField = "SumC";
|
|
|
|
|
|
bf.DataFormatString = "{0}";
|
2023-06-06 17:01:34 +08:00
|
|
|
|
bf.HeaderText = "合计(元)";
|
2023-05-29 09:09:30 +08:00
|
|
|
|
bf.Width = 90;
|
|
|
|
|
|
bf.HeaderTextAlign = TextAlign.Center;
|
|
|
|
|
|
Grid1.Columns.Add(bf);
|
|
|
|
|
|
|
|
|
|
|
|
Grid1.DataKeyNames = new string[] { "Id", "CostTypeName" };
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
2023-05-29 09:09:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
2023-05-29 09:09:30 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.ProjectId)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
|
|
|
|
|
this.ProjectId = Request.Params["projectId"];
|
|
|
|
|
|
}
|
2023-05-29 09:09:30 +08:00
|
|
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
|
|
|
|
////权限按钮方法
|
|
|
|
|
|
this.GetButtonPower();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
this.btnNew.OnClientClick = Window1.GetShowReference("ExpenseEdit.aspx") + "return false;";
|
2023-05-29 09:09:30 +08:00
|
|
|
|
this.btnUnit.OnClientClick = Window2.GetShowReference("ExpenseUnit.aspx") + "return false;";
|
|
|
|
|
|
UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, false);
|
|
|
|
|
|
Funs.FineUIPleaseSelect(drpUnit, "请选择单位");
|
|
|
|
|
|
LoadData();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-05-29 09:09:30 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
2023-05-29 09:09:30 +08:00
|
|
|
|
/// 获取数据
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
2023-05-29 09:09:30 +08:00
|
|
|
|
private void LoadData()
|
|
|
|
|
|
{
|
|
|
|
|
|
DataTable tb = GetDataTable(); //this.LINQToDataTable(getData.ToList());
|
|
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取模拟树表格
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public DataTable GetDataTable()
|
|
|
|
|
|
{
|
|
|
|
|
|
DataTable table = new DataTable();
|
|
|
|
|
|
table.Columns.Add(new DataColumn("Id", typeof(string)));
|
|
|
|
|
|
table.Columns.Add(new DataColumn("SupCostTypeName", typeof(string)));
|
2025-10-10 14:33:21 +08:00
|
|
|
|
table.Columns.Add(new DataColumn("CostTypeName", typeof(string)));
|
2023-05-31 10:18:16 +08:00
|
|
|
|
for (int i = 0; sDate + i <= eDate; i++)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-05-31 10:18:16 +08:00
|
|
|
|
table.Columns.Add(new DataColumn((sDate + i).ToString(), typeof(string)));
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2023-05-29 09:09:30 +08:00
|
|
|
|
|
|
|
|
|
|
table.Columns.Add(new DataColumn("SumC", typeof(String)));
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != Const._Null)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
SetTable(table, this.drpUnit.SelectedText);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2023-05-29 09:09:30 +08:00
|
|
|
|
else
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
SetTable(table, null);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return table;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-10 14:33:21 +08:00
|
|
|
|
private void SetTable(DataTable table, string unitId)
|
2023-06-06 17:01:34 +08:00
|
|
|
|
{
|
|
|
|
|
|
var getDetail = from x in Funs.DB.CostGoods_ExpenseDetail
|
|
|
|
|
|
join y in Funs.DB.CostGoods_Expense on x.ExpenseId equals y.ExpenseId
|
2025-10-10 14:33:21 +08:00
|
|
|
|
where y.ProjectId == this.ProjectId && (unitId == null || y.UnitId == this.drpUnit.SelectedValue)
|
2023-06-06 17:01:34 +08:00
|
|
|
|
orderby y.Year, x.SupSortIndex, x.SortIndex
|
|
|
|
|
|
select new { x.ExpenseDetailId, x.ExpenseId, y.Year, x.SupCostTypeId, x.SupCostTypeName, x.SupSortIndex, x.CostType, x.CostTypeName, x.SortIndex, x.CostMoney };
|
|
|
|
|
|
var getType = (from x in getDetail select new { x.SupSortIndex, x.SortIndex, x.CostType }).Distinct();
|
2023-10-08 10:59:38 +08:00
|
|
|
|
int j = 1;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
foreach (var item in getType)
|
|
|
|
|
|
{
|
|
|
|
|
|
var getD = getDetail.FirstOrDefault(x => x.CostType == item.CostType);
|
|
|
|
|
|
if (getD != null)
|
2023-05-29 09:09:30 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
DataRow row = table.NewRow();
|
|
|
|
|
|
row[0] = getD.ExpenseDetailId + "#" + getD.ExpenseId;
|
|
|
|
|
|
row[1] = getD.SupCostTypeName;
|
|
|
|
|
|
row[2] = getD.CostTypeName;
|
|
|
|
|
|
int r = 3;
|
|
|
|
|
|
for (int i = 0; sDate + i <= eDate; i++)
|
2023-05-29 09:09:30 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
var getV = getDetail.Where(x => x.Year == sDate + i && x.CostType == item.CostType);
|
|
|
|
|
|
if (getV.Count() > 0)
|
2023-05-29 09:09:30 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
row[r] = getV.Sum(x => x.CostMoney ?? 0);
|
2023-05-29 09:09:30 +08:00
|
|
|
|
}
|
2023-06-06 17:01:34 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
row[r] = 0.00;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
r = r + 1;
|
2023-05-29 09:09:30 +08:00
|
|
|
|
}
|
2023-06-06 17:01:34 +08:00
|
|
|
|
row[r] = getDetail.Where(x => x.CostType == item.CostType).Sum(x => x.CostMoney ?? 0);
|
|
|
|
|
|
table.Rows.Add(row);
|
2023-10-08 10:59:38 +08:00
|
|
|
|
j = r + 1;
|
2023-05-29 09:09:30 +08:00
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2023-10-08 10:59:38 +08:00
|
|
|
|
|
|
|
|
|
|
DataRow rowSum = table.NewRow();
|
|
|
|
|
|
rowSum[0] = SQLHelper.GetNewID();
|
|
|
|
|
|
rowSum[1] = "";
|
|
|
|
|
|
rowSum[2] = "合计";
|
|
|
|
|
|
int rSum = 3;
|
|
|
|
|
|
for (int i = 0; sDate + i <= eDate; i++)
|
|
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
var getV = getDetail.Where(x => x.Year == sDate + i);
|
2023-10-08 10:59:38 +08:00
|
|
|
|
if (getV.Count() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
rowSum[rSum] = getV.Sum(x => x.CostMoney ?? 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
rowSum[rSum] = 0.00;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rSum = rSum + 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
table.Rows.Add(rowSum);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-05-29 09:09:30 +08:00
|
|
|
|
|
|
|
|
|
|
#region 导出按钮
|
|
|
|
|
|
/// 导出按钮
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2023-05-29 09:09:30 +08:00
|
|
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-05-29 09:09:30 +08:00
|
|
|
|
Response.ClearContent();
|
|
|
|
|
|
string filename = Funs.GetNewFileName();
|
|
|
|
|
|
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("费用计划" + filename, System.Text.Encoding.UTF8) + ".xls");
|
|
|
|
|
|
Response.ContentType = "application/excel";
|
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
|
|
|
|
this.Grid1.PageSize = this.Grid1.RecordCount;
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
2023-05-31 10:18:16 +08:00
|
|
|
|
Response.Write(GetGridTableHtml(this.Grid1));
|
2023-05-29 09:09:30 +08:00
|
|
|
|
Response.End();
|
2025-10-10 14:33:21 +08:00
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 分页 排序
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 改变索引事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
|
{
|
2023-05-29 09:09:30 +08:00
|
|
|
|
LoadData();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页下拉选择事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
2023-05-29 09:09:30 +08:00
|
|
|
|
LoadData();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-05-29 09:09:30 +08:00
|
|
|
|
///
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2023-05-29 09:09:30 +08:00
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-05-29 09:09:30 +08:00
|
|
|
|
LoadData();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2023-05-29 09:09:30 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-05-29 09:09:30 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查看
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnView_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.EditData("view");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 双击事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.EditData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 右键编辑事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.EditData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-05-29 09:09:30 +08:00
|
|
|
|
/// 编辑数据
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
2023-05-29 09:09:30 +08:00
|
|
|
|
private void EditData(string type = null)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2023-05-29 09:09:30 +08:00
|
|
|
|
string id = Grid1.SelectedRow.Values[0].ToString();
|
|
|
|
|
|
var getID = Funs.GetStrListByStr(id, '#');
|
|
|
|
|
|
if (getID != null && getID.Count > 1)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-05-29 09:09:30 +08:00
|
|
|
|
var getEx = ExpenseService.GetExpenseById(getID[1]);
|
|
|
|
|
|
if (getEx != null && !string.IsNullOrEmpty(getEx.UnitId))
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-05-29 09:09:30 +08:00
|
|
|
|
if (this.btnMenuEdit.Hidden || type == "view") ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
|
|
|
|
|
{
|
2023-05-31 10:18:16 +08:00
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ExpenseView.aspx?ExpenseId={0}", getEx.ExpenseId, "查看 - ")));
|
2023-05-29 09:09:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2023-05-31 10:18:16 +08:00
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ExpenseEdit.aspx?ExpenseId={0}", getEx.ExpenseId, "编辑 - ")));
|
2023-05-29 09:09:30 +08:00
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 删除
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 右键删除事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
|
|
|
|
{
|
|
|
|
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
2023-05-29 09:09:30 +08:00
|
|
|
|
var getEx = ExpenseService.GetExpenseById(rowID);
|
|
|
|
|
|
if (getEx != null && !string.IsNullOrEmpty(getEx.UnitId))
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, getEx.ExpenseCode, getEx.ExpenseId, BLL.Const.ProjectExpenseMenuId, BLL.Const.BtnDelete);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
BLL.ExpenseService.DeleteExpenseById(rowID);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-05-29 09:09:30 +08:00
|
|
|
|
this.LoadData();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-05-29 09:09:30 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 单位查询事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
this.LoadData();
|
2023-05-29 09:09:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Request.Params["value"] == "0")
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ProjectExpenseMenuId);
|
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnNew.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnMenuEdit.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnMenuDelete.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2023-05-31 10:18:16 +08:00
|
|
|
|
|
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
LoadData();
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|