20230606新增费用申请页面、项目列表按活跃度排序
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.CostGoods
|
||||
{
|
||||
@@ -36,10 +38,6 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 定义集合
|
||||
/// </summary>
|
||||
private static List<Model.CostGoods_CostManageItem> costManageItems = new List<Model.CostGoods_CostManageItem>();
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
@@ -52,151 +50,78 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideRefreshReference();
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
this.InitDropDownList();
|
||||
this.CostManageId = Request.Params["CostManageId"];
|
||||
this.drpInvestCostProject.DataTextField = "Text";
|
||||
this.drpInvestCostProject.DataValueField = "Value";
|
||||
this.drpInvestCostProject.DataSource = BLL.CostManageItemService.GetInvestCostProjectList();
|
||||
this.drpInvestCostProject.DataBind();
|
||||
if (!BLL.CommonService.IsMainUnitOrAdmin(this.CurrUser.PersonId)) //分包单位用户,隐藏审核列
|
||||
|
||||
BLL.UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, false);
|
||||
this.CostManageId = Request.Params["CostManageId"] ?? SQLHelper.GetNewID();
|
||||
var costManage = BLL.CostManageService.GetCostManageById(this.CostManageId);
|
||||
if (costManage != null)
|
||||
{
|
||||
this.Grid1.Columns[7].Hidden = true;
|
||||
this.Grid1.Columns[8].Hidden = true;
|
||||
this.Grid1.Columns[9].Hidden = true;
|
||||
}
|
||||
this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now);
|
||||
if (!string.IsNullOrEmpty(this.CostManageId))
|
||||
{
|
||||
Model.CostGoods_CostManage costManage = BLL.CostManageService.GetCostManageById(this.CostManageId);
|
||||
if (costManage != null)
|
||||
this.ProjectId = costManage.ProjectId;
|
||||
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.ProjectId = costManage.ProjectId;
|
||||
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.InitDropDownList();
|
||||
}
|
||||
this.txtCostManageCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CostManageId);
|
||||
this.txtCostManageName.Text = costManage.CostManageName;
|
||||
if (!string.IsNullOrEmpty(costManage.UnitId))
|
||||
{
|
||||
this.drpUnitId.SelectedValue = costManage.UnitId;
|
||||
}
|
||||
this.txtContractNum.Text = costManage.ContractNum;
|
||||
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;
|
||||
BLL.UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, false);
|
||||
}
|
||||
BindGrid();
|
||||
|
||||
if (!string.IsNullOrEmpty(costManage.UnitId))
|
||||
{
|
||||
this.drpUnit.SelectedValue = costManage.UnitId;
|
||||
}
|
||||
this.txtContractNum.Text = costManage.ContractNum;
|
||||
this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", costManage.CostManageDate);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtCostManageCode.Text = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectCostManageMenuId, this.ProjectId, this.CurrUser.PersonId);
|
||||
this.txtCostManageName.Text = "分包商HSE措施费申请表";
|
||||
this.drpUnit.SelectedValue = this.CurrUser.UnitId ?? Const.UnitId_SEDIN;
|
||||
this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now);
|
||||
}
|
||||
///初始化审核菜单
|
||||
this.ctlAuditFlow.MenuId = BLL.Const.ProjectCostManageMenuId;
|
||||
this.ctlAuditFlow.DataId = this.CostManageId;
|
||||
this.ctlAuditFlow.ProjectId = this.ProjectId;
|
||||
this.ctlAuditFlow.UnitId = this.CurrUser.UnitId;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetRequestEventArgument() == "UPDATE_SUMMARY")
|
||||
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
|
||||
{
|
||||
jerqueSaveMonthPlanList();
|
||||
this.Grid1.DataSource = costManageItems;
|
||||
this.Grid1.DataBind();
|
||||
// 页面要求重新计算合计行的值
|
||||
OutputSummaryData();
|
||||
this.drpUnit.Readonly = true;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
this.txtProjectName.Text = ProjectService.GetProjectNameByProjectId(this.ProjectId);
|
||||
this.txtHseCost.Text = ProjectUnitService.GetSumHSECost(this.ProjectId, this.drpUnit.SelectedValue).ToString();
|
||||
this.txtGetCost.Text = CostManageService.GetSumHSECost(this.ProjectId, this.drpUnit.SelectedValue, this.CostManageId).ToString();
|
||||
|
||||
Person_PersonsService.InitFlowOperateControlUserDropDownList(this.drpNextMan, this.ProjectId, this.drpUnit.SelectedValue, true);
|
||||
if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.drpUnit.SelectedValue))
|
||||
{
|
||||
this.drpNextMan.Label = "分包单位项目经理审批";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drpNextMan.Label = "安全经理审核";
|
||||
}
|
||||
BindGrid2();
|
||||
}
|
||||
}
|
||||
|
||||
#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[4].ToString());
|
||||
priceMoney = Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[5].ToString());
|
||||
totalMoney = counts * priceMoney;
|
||||
sumTotalMoney += totalMoney;
|
||||
this.Grid1.Rows[i].Values[6] = totalMoney.ToString();
|
||||
auditCounts = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[7].ToString());
|
||||
auditPriceMoney = Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[8].ToString());
|
||||
auditTotalMoney = auditCounts * auditPriceMoney;
|
||||
sumAuditTotalMoney += auditTotalMoney;
|
||||
this.Grid1.Rows[i].Values[9] = auditTotalMoney.ToString();
|
||||
}
|
||||
if (this.Grid1.Rows.Count > 0)
|
||||
{
|
||||
JObject summary = new JObject
|
||||
{
|
||||
{ "PriceMoney", "总计" },
|
||||
{ "TotalMoney", sumTotalMoney },
|
||||
{ "AuditTotalMoney", sumAuditTotalMoney }
|
||||
};
|
||||
Grid1.SummaryData = summary;
|
||||
}
|
||||
else
|
||||
{
|
||||
Grid1.SummaryData = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 初始化下拉框
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.ProjectId, true);
|
||||
}
|
||||
|
||||
#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>
|
||||
@@ -207,6 +132,130 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 新增费用申请情况
|
||||
/// <summary>
|
||||
/// 新增费用申请情况
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpUnit.SelectedValue == BLL.Const._Null && !string.IsNullOrEmpty(this.drpUnit.SelectedValue))
|
||||
{
|
||||
Alert.ShowInTop("请选择分包商!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var getCost = CostManageService.GetCostManageById(this.CostManageId);
|
||||
if (getCost == null)
|
||||
{
|
||||
SaveData(Const.BtnSave);
|
||||
}
|
||||
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CostManageItemEdit.aspx?CostManageId={0}", this.CostManageId, "编辑 - ")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
this.Edit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Edit();
|
||||
}
|
||||
|
||||
private void Edit()
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string id = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CostManageItemEdit.aspx?CostManageItemId={0}", id, "编辑 - ")));
|
||||
}
|
||||
|
||||
/// <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();
|
||||
Delete(rowID);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void gvMonthPlan_RowCommand(object sender, GridCommandEventArgs e)
|
||||
{
|
||||
string rowID = this.Grid1.DataKeys[e.RowIndex][0].ToString();
|
||||
if (e.CommandName == "Delete")
|
||||
{
|
||||
Delete(rowID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="rowId"></param>
|
||||
private void Delete(string rowId)
|
||||
{
|
||||
BLL.CostManageItemService.DeleteCostManageItemById(rowId);
|
||||
this.BindGrid();
|
||||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
#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();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -218,11 +267,6 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择分包商!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
this.SaveData(BLL.Const.BtnSave);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
@@ -233,15 +277,10 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
if (this.drpNextMan.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择分包商!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (this.ctlAuditFlow.NextStep == BLL.Const.State_1 && this.ctlAuditFlow.NextPerson == BLL.Const._Null)
|
||||
{
|
||||
ShowNotify("请选择下一步办理人!", MessageBoxIcon.Warning);
|
||||
Alert.ShowInTop("请选择" + this.drpNextMan.Label + "!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
this.SaveData(BLL.Const.BtnSubmit);
|
||||
@@ -254,57 +293,52 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
/// <param name="type"></param>
|
||||
private void SaveData(string type)
|
||||
{
|
||||
if (!BLL.CommonService.IsMainUnitOrAdmin(this.CurrUser.PersonId) && type == BLL.Const.BtnSubmit && this.ctlAuditFlow.NextStep == BLL.Const.State_2)
|
||||
if (this.drpUnit.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInParent("分包商不能关闭审核流程", MessageBoxIcon.Warning);
|
||||
Alert.ShowInTop("请选择单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.CostGoods_CostManage costManage = new Model.CostGoods_CostManage
|
||||
{
|
||||
ProjectId = this.ProjectId,
|
||||
CostManageCode = this.txtCostManageCode.Text.Trim(),
|
||||
CostManageName = this.txtCostManageName.Text.Trim()
|
||||
UnitId = this.drpUnit.SelectedValue == Const._Null ? null : this.drpUnit.SelectedValue,
|
||||
ContractNum = this.txtContractNum.Text.Trim(),
|
||||
CostManageDate = Funs.GetNewDateTime(this.txtCostManageDate.Text.Trim()),
|
||||
States = BLL.Const.State_0,
|
||||
CompileMan = this.CurrUser.PersonId,
|
||||
CompileDate = DateTime.Now,
|
||||
};
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
costManage.UnitId = this.drpUnitId.SelectedValue;
|
||||
}
|
||||
costManage.ContractNum = this.txtContractNum.Text.Trim();
|
||||
costManage.CostManageDate = Funs.GetNewDateTime(this.txtCostManageDate.Text.Trim());
|
||||
costManage.Opinion = this.txtOpinion.Text.Trim();
|
||||
costManage.SubHSE = this.txtSubHSE.Text.Trim();
|
||||
costManage.SubCN = this.txtSubCN.Text.Trim();
|
||||
costManage.SubProject = this.txtSubProject.Text.Trim();
|
||||
costManage.CompileMan = this.CurrUser.PersonId;
|
||||
costManage.CompileDate = DateTime.Now;
|
||||
costManage.States = BLL.Const.State_0;
|
||||
if (type == BLL.Const.BtnSubmit)
|
||||
{
|
||||
costManage.States = this.ctlAuditFlow.NextStep;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.CostManageId))
|
||||
|
||||
if (type == Const.BtnSubmit)
|
||||
{
|
||||
costManage.States = BLL.Const.State_1;
|
||||
}
|
||||
|
||||
var getCost= CostManageService.GetCostManageById(this.CostManageId);
|
||||
if (getCost != null)
|
||||
{
|
||||
costManage.CostManageId = this.CostManageId;
|
||||
BLL.CostManageService.UpdateCostManage(costManage);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, costManage.CostManageCode, costManage.CostManageId, BLL.Const.ProjectCostManageMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CostManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_CostManage));
|
||||
costManage.CostManageCode = Funs.GetNewFileName();
|
||||
costManage.CostManageId = this.CostManageId;
|
||||
BLL.CostManageService.AddCostManage(costManage);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, costManage.CostManageCode, costManage.CostManageId, BLL.Const.ProjectCostManageMenuId, BLL.Const.BtnAdd);
|
||||
}
|
||||
jerqueSaveMonthPlanList();
|
||||
BLL.CostManageItemService.DeleteCostManageItemByCostManageId(this.CostManageId);
|
||||
foreach (var costManageItem in costManageItems)
|
||||
|
||||
if (type == Const.BtnSubmit)
|
||||
{
|
||||
costManageItem.CostManageId = this.CostManageId;
|
||||
BLL.CostManageItemService.AddCostManageItem(costManageItem);
|
||||
var getNext=CostManageService.getNextCostManageFlowOperateList(this.CostManageId, this.CurrUser.PersonId);
|
||||
if(getNext != null)
|
||||
{
|
||||
getNext.OperaterId = this.drpNextMan.SelectedValue ;
|
||||
CostManageService.updateCostManageFlowOperate(getNext);
|
||||
}
|
||||
}
|
||||
////保存流程审核数据
|
||||
this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectCostManageMenuId, this.CostManageId, (type == BLL.Const.BtnSubmit ? true : false), costManage.CostManageName, "../CostGoods/CostManageView.aspx?CostManageId={0}");
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -323,120 +357,5 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CostManageAttachUrl&menuId={1}", this.CostManageId, BLL.Const.ProjectCostManageMenuId)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 新增费用申请情况
|
||||
/// <summary>
|
||||
/// 新增费用申请情况
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
//if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
||||
//{
|
||||
// Alert.ShowInTop("请选择分包商!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
//}
|
||||
jerqueSaveMonthPlanList();
|
||||
Model.CostGoods_CostManageItem costManageItem = new Model.CostGoods_CostManageItem
|
||||
{
|
||||
CostManageItemId = SQLHelper.GetNewID(typeof(Model.CostGoods_CostManageItem))
|
||||
};
|
||||
costManageItems.Add(costManageItem);
|
||||
this.Grid1.DataSource = costManageItems;
|
||||
this.Grid1.DataBind();
|
||||
OutputSummaryData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查并保存其他HSE管理活动集合
|
||||
/// </summary>
|
||||
private void jerqueSaveMonthPlanList()
|
||||
{
|
||||
costManageItems.Clear();
|
||||
JArray mergedData = Grid1.GetMergedData();
|
||||
foreach (JObject mergedRow in mergedData)
|
||||
{
|
||||
string status = mergedRow.Value<string>("status");
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
Model.CostGoods_CostManageItem costManageItem = new Model.CostGoods_CostManageItem
|
||||
{
|
||||
CostManageItemId = this.Grid1.Rows[i].DataKeys[0].ToString(),
|
||||
InvestCostProject = values.Value<string>("InvestCostProject").ToString(),
|
||||
UseReason = values.Value<string>("UseReason").ToString(),
|
||||
Counts = Funs.GetNewIntOrZero(values.Value<string>("Counts").ToString()),
|
||||
PriceMoney = Funs.GetNewDecimalOrZero(values.Value<string>("PriceMoney").ToString()),
|
||||
AuditCounts = !string.IsNullOrEmpty(values.Value<string>("AuditCounts").ToString()) ? Funs.GetNewInt(values.Value<string>("AuditCounts").ToString()) : null,
|
||||
AuditPriceMoney = !string.IsNullOrEmpty(values.Value<string>("AuditPriceMoney").ToString()) ? Funs.GetNewDecimal(values.Value<string>("AuditPriceMoney").ToString()) : null
|
||||
};
|
||||
costManageItems.Add(costManageItem);
|
||||
}
|
||||
}
|
||||
|
||||
protected void gvMonthPlan_RowCommand(object sender, GridCommandEventArgs e)
|
||||
{
|
||||
jerqueSaveMonthPlanList();
|
||||
string rowID = this.Grid1.DataKeys[e.RowIndex][0].ToString();
|
||||
if (e.CommandName == "Delete")
|
||||
{
|
||||
foreach (var item in costManageItems)
|
||||
{
|
||||
if (item.CostManageItemId == rowID)
|
||||
{
|
||||
costManageItems.Remove(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Grid1.DataSource = costManageItems;
|
||||
Grid1.DataBind();
|
||||
OutputSummaryData();
|
||||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
#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? price = costManageItem.AuditPriceMoney;
|
||||
int? count = costManageItem.AuditCounts;
|
||||
total = Convert.ToString(price * count);
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user