Пример #1
0
        /// <summary>
        /// 根据预算phid判断是否可以引用
        /// </summary>
        /// <returns></returns>
        public string JudgeIfAllowRefence()
        {
            long id = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["id"]);  //预算表主键
            var  ys = BudgetMstService.Find(id).Data;

            if (ys.FIfPerformanceAppraisal == EnumYesNo.Yes)
            {
                //若需要绩效评价判断是否存在已上报的自评单据
                var dicWhere = new Dictionary <string, object>();
                new CreateCriteria(dicWhere).Add(ORMRestrictions <Int64> .Eq("YSMstPhId", id))
                .Add(ORMRestrictions <string> .Eq("FAuditStatus", "2"));
                var result = PerformanceMstService.Find(dicWhere).Data;
                if (result.Count == 0)
                {
                    return("false");
                }
            }
            return("true");
        }
Пример #2
0
        /// <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));
            }
        }