/// <summary> /// 保存数据 /// </summary> /// <returns>返回Json串</returns> public string Save() { string performancemstformData = System.Web.HttpContext.Current.Request.Form["performancemstformData"]; //string performancedtlevalgridData = System.Web.HttpContext.Current.Request.Form["performancedtlevalgridData"]; string performancedtltextcontformData = System.Web.HttpContext.Current.Request.Form["performancedtltextcontformData"]; string performancedtlbudtlgridData = System.Web.HttpContext.Current.Request.Form["performancedtlbudtlgridData"]; string performancedtltarimplgridData = System.Web.HttpContext.Current.Request.Form["performancedtltarimplgridData"]; long id = Convert.ToInt64(System.Web.HttpContext.Current.Request.Form["id"]); var performancemstforminfo = DataConverterHelper.JsonToEntity <PerformanceMstModel>(performancemstformData); //var performancedtlevalgridinfo = DataConverterHelper.JsonToEntity<PerformanceDtlEvalModel>(performancedtlevalgridData); var performancedtltextcontforminfo = DataConverterHelper.JsonToEntity <PerformanceDtlTextContModel>(performancedtltextcontformData); var performancedtlbudtlgridinfo = DataConverterHelper.JsonToEntity <PerformanceDtlBuDtlModel>(performancedtlbudtlgridData); var performancedtltarimplgridinfo = DataConverterHelper.JsonToEntity <PerformanceDtlTarImplModel>(performancedtltarimplgridData); var results = BudgetMstService.FindBudgetDtlPerformTargetByForeignKey(id); List <PerformanceDtlTarImplModel> performanceDtlTarImplModels = PerformanceMstService.ConvertSaveData(results.Data, performancedtltarimplgridinfo.AllRow); SavedResult <Int64> savedresult = new SavedResult <Int64>(); try { savedresult = PerformanceMstService.SavePerformanceMst(performancemstforminfo.AllRow[0], performancedtltextcontforminfo.AllRow, performancedtlbudtlgridinfo.AllRow, performancedtltarimplgridinfo.AllRow); } catch (Exception ex) { savedresult.Status = ResponseStatus.Error; savedresult.Msg = ex.Message.ToString(); } return(DataConverterHelper.SerializeObject(savedresult)); }
/// <summary> /// 根据主键 预算数据数据 /// </summary> /// <returns>返回Json串</returns> public string GetBudgetMstInfo() { long id = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["id"]); //主表主键 string tabtype = System.Web.HttpContext.Current.Request.Params["tabtype"]; //Tab类型 switch (tabtype) { case "budgetmst": var findedresultmst = BudgetMstService.Find(id); FindedResult <PerformanceMstModel> resultmst = new FindedResult <PerformanceMstModel>(); PerformanceMstModel modelmst = new PerformanceMstModel(); if (findedresultmst.Data != null) { modelmst.YSMstPhId = findedresultmst.Data.PhId; modelmst.FProjCode = findedresultmst.Data.FProjCode; modelmst.FProjName = findedresultmst.Data.FProjName; modelmst.FDeclarationUnit = findedresultmst.Data.FDeclarationUnit; modelmst.FDeclarationUnit_EXName = findedresultmst.Data.FDeclarationUnit_EXName; modelmst.FDeclarationDept = findedresultmst.Data.FDeclarationDept; modelmst.FBudgetDept = findedresultmst.Data.FBudgetDept; modelmst.FBudgetDept_EXName = findedresultmst.Data.FBudgetDept_EXName; modelmst.FProjAttr = findedresultmst.Data.FProjAttr; modelmst.FDuration = findedresultmst.Data.FDuration; modelmst.FStartDate = findedresultmst.Data.FStartDate; modelmst.FEndDate = findedresultmst.Data.FEndDate; modelmst.FProjAmount = findedresultmst.Data.FBudgetAmount; modelmst.FIfPerformanceAppraisal = (int)findedresultmst.Data.FIfPerformanceAppraisal; modelmst.FIfKeyEvaluation = (int)findedresultmst.Data.FIfKeyEvaluation; modelmst.FMeetingTime = findedresultmst.Data.FMeetingTime; modelmst.FMeetiingSummaryNo = findedresultmst.Data.FMeetiingSummaryNo; modelmst.FExpenseCategory = findedresultmst.Data.FExpenseCategory; modelmst.FPerformType = findedresultmst.Data.FPerformType; } ; if (string.IsNullOrEmpty(findedresultmst.Data.FAccount)) { modelmst.FActualAmount = decimal.Round(0, 2);; } else { modelmst.FActualAmount = decimal.Round(decimal.Parse(BudgetMstService.GetSJFSSbyXMCode(findedresultmst.Data.FAccount, modelmst.FProjCode)), 2); } //modelmst.FActualAmount = decimal.Round(decimal.Parse(BudgetMstService.GetSJFSSbyXMCode(findedresultmst.Data.FAccount, modelmst.FProjCode)),2); modelmst.FBalanceAmount = decimal.Round(modelmst.FProjAmount - modelmst.FActualAmount, 2); modelmst.FImplRate = decimal.Round(modelmst.FActualAmount * 100 / modelmst.FProjAmount, 2); resultmst.Data = modelmst; resultmst.Status = findedresultmst.Status; resultmst.Msg = findedresultmst.Msg; return(DataConverterHelper.ResponseResultToJson(resultmst)); case "budgetdtlbudgetdtl": var mst = BudgetMstService.Find(id); var findedresultbudgetdtlbudgetdtl = BudgetMstService.FindBudgetDtlBudgetDtlByForeignKey(id); var listDtl = findedresultbudgetdtlbudgetdtl.Data; //组装model List <PerformanceDtlBuDtlModel> dtlList = new List <PerformanceDtlBuDtlModel>(); if (findedresultbudgetdtlbudgetdtl.Data.Count > 0) { foreach (var item in listDtl) { var index = dtlList.FindIndex(t => t.FDtlCode == item.FDtlCode); if (index != -1) { dtlList[index].FBudgetAmount += item.FAmount; } else { decimal FActualAmount = 0; if (string.IsNullOrEmpty(mst.Data.FAccount)) { FActualAmount = decimal.Round(0, 2);; } else { FActualAmount = decimal.Round(decimal.Parse(BudgetMstService.GetSJFSSbyMXCode(mst.Data.FAccount, item.FDtlCode)), 2); } //var FActualAmount = decimal.Round(decimal.Parse(BudgetMstService.GetSJFSSbyMXCode(mst.Data.FAccount, item.FDtlCode)),2); //((parseFloat(upDate.FActualAmount) / parseFloat(upDate.FBudgetAmount)) * 100).toFixed(2) var FImplRate = decimal.Round(FActualAmount * 100 / item.FBudgetAmount, 2); PerformanceDtlBuDtlModel model = new PerformanceDtlBuDtlModel() { DelPhid = item.PhId, FDtlCode = item.FDtlCode, FName = item.FName, FSourceOfFunds = item.FSourceOfFunds, FSourceOfFunds_EXName = item.FSourceOfFunds_EXName, FExpensesChannel_EXName = item.FExpensesChannel_EXName, FBudgetAmount = item.FBudgetAmount, FActualAmount = FActualAmount, FBalanceAmount = decimal.Round(item.FBudgetAmount - FActualAmount, 2), FImplRate = FImplRate }; dtlList.Add(model); } } } return(DataConverterHelper.EntityListToJson((IList <PerformanceDtlBuDtlModel>)dtlList, dtlList.Count)); case "performancedtltarimpl": var results = BudgetMstService.FindBudgetDtlPerformTargetByForeignKey(id); IList <PerformanceDtlTarImplModel> tarImplList = PerformanceMstService.ConvertData(results.Data); return(DataConverterHelper.EntityListToJson(tarImplList, tarImplList.Count)); default: FindedResult findedresultother = new FindedResult(); return(DataConverterHelper.ResponseResultToJson(findedresultother)); } }