Exemple #1
0
        public override JsonResult GetTree()
        {
            var dt     = EnumBaseHelper.GetEnumTable(typeof(CBSType));
            var result = new DataTable();

            result.Columns.Add("Name");
            result.Columns.Add("ParentID");
            result.Columns.Add("Type");
            result.Columns.Add("ID");
            var root = result.NewRow();

            root["Name"]     = "费用科目维护";
            root["ID"]       = "Root";
            root["Type"]     = "Root";
            root["ParentID"] = "";
            result.Rows.Add(root);
            foreach (DataRow row in dt.Rows)
            {
                var child = result.NewRow();
                child["Name"]     = row["text"];
                child["ID"]       = row["value"];
                child["Type"]     = "Child";
                child["ParentID"] = "Root";
                result.Rows.Add(child);
            }
            return(Json(result));
        }
        public JsonResult GetWBSNodes()
        {
            var dt   = EnumBaseHelper.GetEnumTable(typeof(Project.Logic.WBSNodeType));
            var data = new GridData(dt);

            return(Json(data));
        }
        private DataTable CreateTable()
        {
            var dt     = EnumBaseHelper.GetEnumTable("EPC.SaleWorkContent");
            var result = new DataTable();

            result.Columns.Add("UserID");
            result.Columns.Add("UserName");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var fieldName = dt.Rows[i]["value"].ToString() + "_Count";
                result.Columns.Add(fieldName, typeof(decimal));
            }
            result.Columns.Add("TotalValue", typeof(decimal));
            var user = EnumBaseHelper.GetEnumTable("EPC.Sales");

            foreach (DataRow item in user.Rows)
            {
                var row = result.NewRow();
                row["UserID"]   = item["value"];
                row["UserName"] = item["text"];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var fieldName = dt.Rows[i]["value"].ToString() + "_Count";
                    row[fieldName] = 0;
                }
                result.Rows.Add(row);
            }
            return(result);
        }
Exemple #4
0
        public ActionResult MajorList()
        {
            var tab           = new Tab();
            var majorCategory = CategoryFactory.GetCategory("Project.Major", "专业", "EngageMajor", true);
            var majorTable    = EnumBaseHelper.GetEnumTable("Project.Major");

            if (majorTable.Rows.Count > 0)
            {
                majorCategory.SetDefaultItem(majorTable.Rows[0]["value"].ToString());
            }
            majorCategory.Multi = true;
            tab.Categories.Add(majorCategory);

            var businessTypeCategory = CategoryFactory.GetCategory("Market.BusinessType", "业务类型", "ProjectClass", true);
            var businessTypeTable    = EnumBaseHelper.GetEnumTable("Market.BusinessType");

            if (businessTypeTable.Rows.Count > 0)
            {
                businessTypeCategory.SetDefaultItem(businessTypeTable.Rows[0]["value"].ToString());
            }
            businessTypeCategory.Multi = true;
            tab.Categories.Add(businessTypeCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            var aputitudeTable = EnumBaseHelper.GetEnumTable("HR.UserAptitude");

            ViewBag.ColumnTable = aputitudeTable;
            return(View());
        }
Exemple #5
0
        public JsonResult AddProjectUser(string UserInfo, string ProjectClass)
        {
            var list           = JsonHelper.ToList(UserInfo);
            var aputitudeTable = EnumBaseHelper.GetEnumTable("HR.UserProjectAptitude");

            foreach (var item in list)
            {
                var userID      = item.GetValue("ID");
                var userName    = item.GetValue("Name");
                var userService = FormulaHelper.GetService <IUserService>();
                var userInfo    = userService.GetUserInfoByID(userID);
                foreach (DataRow row in aputitudeTable.Rows)
                {
                    var position = row["value"].ToString();
                    var entity   = this.entities.Set <S_D_UserAptitude>().FirstOrDefault(d => d.ProjectClass == ProjectClass &&
                                                                                         d.Major == "Project" && d.UserID == userID && d.Position == position);
                    if (entity == null)
                    {
                        entity               = this.entities.Set <S_D_UserAptitude>().Create();
                        entity.ID            = FormulaHelper.CreateGuid();
                        entity.UserID        = userID;
                        entity.UserName      = userName;
                        entity.DeptID        = userInfo.UserOrgID;
                        entity.DeptName      = userInfo.UserOrgName;
                        entity.Position      = position;
                        entity.ProjectClass  = ProjectClass;
                        entity.Major         = "Project";
                        entity.AptitudeLevel = 10;
                        this.entities.Set <S_D_UserAptitude>().Add(entity);
                    }
                }
            }
            this.entities.SaveChanges();
            return(Json(""));
        }
        public ActionResult ProjectCostAnylise()
        {
            //绘制数据过滤标签
            var tab = new Tab();
            //项目费用科目
            var dt = EnumBaseHelper.GetEnumTable(typeof(CBSType));
            var cbsTypeCategory = CategoryFactory.GetCategory(typeof(CBSType), "费用科目", "CBSType", true);

            cbsTypeCategory.SetDefaultItem();
            cbsTypeCategory.Multi = false;
            tab.Categories.Add(cbsTypeCategory);
            //年份
            var yearCategory = CategoryFactory.GetYearCategory("BelongYear");

            yearCategory.SetDefaultItem();
            yearCategory.Multi = false;
            tab.Categories.Add(yearCategory);
            //月份
            var monthCategory = CategoryFactory.GetMonthCategory("BelongMonth");

            yearCategory.SetDefaultItem();
            monthCategory.Multi = false;
            tab.Categories.Add(monthCategory);
            //季度
            var quarterCategory = CategoryFactory.GetQuarterCategory("BelongQuarter");

            yearCategory.SetDefaultItem();
            quarterCategory.Multi = false;
            tab.Categories.Add(quarterCategory);
            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
        public ActionResult ListTab()
        {
            string projectInfoID = this.Request["ProjectInfoID"];
            var    projectInfo   = this.GetEntityByID <S_I_ProjectInfo>(projectInfoID);

            if (projectInfo == null)
            {
                throw new Formula.Exceptions.BusinessException("未能找到指定的项目信息");
            }
            var phaseValue  = projectInfo.PhaseValue.Split(',');
            var phaseEnumDt = EnumBaseHelper.GetEnumTable("Project.Phase");
            var phaseInfo   = new List <Dictionary <string, object> >();

            foreach (var item in phaseValue)
            {
                var rows = phaseEnumDt.Select("value='" + item + "'");
                if (rows.Length == 0)
                {
                    continue;
                }
                var di = new Dictionary <string, object>();
                di.SetValue("PhaseValue", item);
                di.SetValue("PhaseName", rows[0]["text"].ToString());
                phaseInfo.Add(di);
            }
            ViewBag.Phase         = phaseInfo;
            ViewBag.ProjectInfoID = projectInfoID;
            ViewBag.SpaceCode     = this.Request["SpaceCode"];
            ViewBag.AuthType      = this.Request["AuthType"];
            return(View());
        }
Exemple #8
0
        public override ActionResult List()
        {
            var level = EnumBaseHelper.GetEnumDef(typeof(Project.Logic.MileStoneType)).EnumItem.ToList();

            ViewBag.MileStoneLevel = level;

            var enumDt = EnumBaseHelper.GetEnumTable("Project.Major");

            ViewBag.Major = JsonHelper.ToJson(enumDt);
            var row = enumDt.NewRow();

            row["value"] = "All";
            row["text"]  = "所有";
            enumDt.Rows.InsertAt(row, 0);
            ViewBag.MajorWithAll = JsonHelper.ToJson(enumDt);

            var tab          = new Tab();
            var deptCategory = CategoryFactory.GetCategory("Project.Phase", "阶段", "PhaseValue");

            deptCategory.Multi = false;
            deptCategory.SetDefaultItem();
            tab.Categories.Add(deptCategory);

            var projectClassCategory = CategoryFactory.GetCategory("Base.ProjectClass", "业务类型", "ProjectClass");

            projectClassCategory.Multi = false;
            projectClassCategory.SetDefaultItem();
            tab.Categories.Add(projectClassCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;

            return(View());
        }
Exemple #9
0
        public ActionResult MajorView()
        {
            var tab = new Tab();

            var aptitudeLevelCategory = CategoryFactory.GetCategory("System.AptitudeLevel", "项目规模", "AptitudeLevel", true);

            aptitudeLevelCategory.SetDefaultItem();
            aptitudeLevelCategory.Multi = true;
            tab.Categories.Add(aptitudeLevelCategory);

            var businessTypeCategory = CategoryFactory.GetCategory("Market.BusinessType", "业务类型", "ProjectClass", true);

            businessTypeCategory.SetDefaultItem();
            businessTypeCategory.Multi = true;
            tab.Categories.Add(businessTypeCategory);

            var majorCategory = CategoryFactory.GetCategory("Project.Major", "专业", "EngageMajor", true);

            majorCategory.SetDefaultItem();
            majorCategory.Multi = true;
            tab.Categories.Add(majorCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            var aputitudeTable = EnumBaseHelper.GetEnumTable("HR.UserAptitude");

            ViewBag.ColumnTable = aputitudeTable;
            return(View());
        }
        private DataTable CreateTable()
        {
            var dt = EnumBaseHelper.GetEnumTable("Base.ProjectClass");

            dt.Columns.Add("BidCount", typeof(decimal));
            dt.Columns.Add("InBidCount", typeof(decimal));
            dt.Columns.Add("Scale", typeof(decimal));
            return(dt);
        }
        public JsonResult GetFlowList(string id)
        {
            var phaseEnumDt = EnumBaseHelper.GetEnumTable("OA.IncomingFlow");
            var phases      = new Dictionary <string, double>();

            foreach (DataRow item in phaseEnumDt.Rows)
            {
                phases.Add(item["text"].ToString(), (double)item["SortIndex"]);
            }
            string sql = string.Format(@"select 
S_WF_InsTaskExec.CreateTime CreateTime
,TaskUserID
,TaskUserName
,ExecUserID
,ExecUserName
,ExecTime
,S_WF_InsDefStep.Phase PhaseName
from S_WF_InsTaskExec
right join S_WF_InsTask on InsTaskID=S_WF_InsTask.ID
join S_WF_InsFlow on S_WF_InsTask.InsFlowId=S_WF_InsFlow.ID
join S_WF_InsDefStep on InsDefStepID=S_WF_InsDefStep.ID
where FormInstanceID='{0}' and (WaitingRoutings is null or WaitingRoutings='') and (WaitingSteps is null or WaitingSteps='') and S_WF_InsDefStep.Phase in ('{1}')
order by isnull(S_WF_InsTaskExec.CreateTime,S_WF_InsTask.CreateTime)", id, string.Join("','", phases.Keys));

            SQLHelper sqlHelper = SQLHelper.CreateSqlHelper("Workflow");
            DataTable dt        = sqlHelper.ExecuteDataTable(sql);

            dt.Columns.Add("UseTime");
            dt.Columns.Add("SortIndex");
            foreach (DataRow row in dt.Rows)
            {
                string CreateTime = row["CreateTime"].ToString();
                string ExecTime   = row["ExecTime"].ToString();
                if (!string.IsNullOrEmpty(ExecTime))
                {
                    var span = DateTime.Parse(ExecTime) - DateTime.Parse(CreateTime);
                    row["UseTime"] = string.Format("{0}天{1}小时{2}分", span.Days, span.Hours, span.Minutes);
                }
                row["SortIndex"] = phases[row["PhaseName"].ToString()];
            }
            foreach (DataRow item in phaseEnumDt.Rows)
            {
                var text = item["text"].ToString();
                if (dt.Select("PhaseName = '" + text + "'").Count() == 0)
                {
                    var row = dt.NewRow();
                    row["PhaseName"] = text;
                    row["SortIndex"] = (double)item["SortIndex"];
                    dt.Rows.Add(row);
                }
            }

            dt.DefaultView.Sort = "SortIndex,CreateTime ASC";
            dt = dt.DefaultView.ToTable();
            return(Json(dt, JsonRequestBehavior.AllowGet));
        }
Exemple #12
0
    public static MvcHtmlString GetEnum(this HtmlHelper html, Type type, string enumName = "")
    {
        DataTable dt = EnumBaseHelper.GetEnumTable(type);

        if (string.IsNullOrEmpty(enumName))
        {
            enumName = type.Name;
        }

        string result = string.Format("var {0} = {1};", enumName, JsonHelper.ToJson(dt));

        return(MvcHtmlString.Create(result));
    }
Exemple #13
0
        /// <summary>
        /// 拼凑统计信息添加到列表内
        /// </summary>
        /// <param name="enumCode">枚举编号</param>
        /// <param name="enumName">枚举名称</param>
        /// <param name="list">最终列表</param>
        /// <param name="index">排序索引</param>
        /// <param name="totalCount">总人数</param>
        /// <param name="employeeDt">员工数据源</param>
        /// <param name="fieldName">员工信息中使用该枚举的字段</param>
        private void EnumCategoryDataToList(string enumCode, string enumName, List <EmployeeResourceModel> list, ref int index, int totalCount, DataTable employeeDt, string fieldName)
        {
            DataTable dt = EnumBaseHelper.GetEnumTable(enumCode);

            foreach (DataRow row in dt.Rows)
            {
                DataRow[] dr = employeeDt.Select(string.Format("{0}='{1}'", fieldName, row["value"]));
                list.Add(new EmployeeResourceModel()
                {
                    Category = enumName, Item = row["text"].ToString(), PersonCount = dr.Count(), Ratio = ((decimal)dr.Count() / (decimal)totalCount * 100).ToString("#0.00") + "%", Index = index++
                });
            }
        }
Exemple #14
0
        public JsonResult GetCooperationRoleList(QueryBuilder qb)
        {
            var dt   = EnumBaseHelper.GetEnumTable(typeof(EPC.Logic.CoopertationRoleType));
            var list = new List <Dictionary <string, object> >();

            foreach (DataRow item in dt.Rows)
            {
                var dic = new Dictionary <string, object>();
                dic.SetValue("RoleCode", item["value"]);
                dic.SetValue("RoleName", item["text"]);
                list.Add(dic);
            }
            return(Json(list));
        }
        public override ActionResult List()
        {
            ViewBag.RoleType = JsonHelper.ToJson(EnumBaseHelper.GetEnumTable(typeof(enumGroupUserType)));
            var documentInfoId = GetQueryString("DocumentInfoID");

            if (!String.IsNullOrWhiteSpace(documentInfoId))
            {
                var entity = entities.Set <S_F_DocumentInfo>().FirstOrDefault(i => i.ID == documentInfoId);
                if (entity != null)
                {
                    ViewBag.IsInherit = entity.IsInherit;
                }
            }
            return(base.List());
        }
        public ActionResult WorkSelector()
        {
            var dataTable = EnumBaseHelper.GetEnumTable(typeof(Expenses.Logic.CBSDefineType));

            ViewBag.DefineCBSDefineType = "";
            var dicList = FormulaHelper.DataTableToListDic(dataTable);
            var resList = dicList.Where(a => !new string[] { CBSDefineType.Company.ToString(), CBSDefineType.Org.ToString() }.Contains(a.GetValue("value")));

            if (resList.Count() > 0)
            {
                ViewBag.DefaultCBSDefineType = resList.FirstOrDefault().GetValue("value");
                ViewBag.CBSDefineType        = JsonHelper.ToJson(resList);
            }

            return(View());
        }
Exemple #17
0
        public JsonResult GetDeptMonthReceiptList()
        {
            var dt = EnumBaseHelper.GetEnumTable("System.ManDept");

            for (int i = 1; i <= 12; i++)
            {
                var field = i + "_Month";
                dt.Columns.Add(field, typeof(decimal));
            }
            dt.Columns.Add("TotalValue", typeof(decimal));
            var belongYear = String.IsNullOrEmpty(this.GetQueryString("BelongYear")) ? DateTime.Now.Year : Convert.ToInt32(this.GetQueryString("BelongYear"));
            var sql        = @"SELECT  ISNULL(SUM(ReceiptInfo.ReceiptValue), 0) AS Value ,
                                BelongMonth,BelongYear,ProductionDept
                        FROM    ( SELECT    ReceiptValue,
					                        YEAR(ReceiptDate) AS BelongYear,
					                        MONTH(ReceiptDate) AS BelongMonth,
                                            ProductionDept
                                  FROM      S_M_Receipt 
                                            LEFT JOIN S_M_ContractInfo ON ContractInfo = S_M_ContractInfo.ID
		                          WHERE YEAR(ReceiptDate)='{0}'
                                ) ReceiptInfo
                        WHERE   1 = 1
                        GROUP BY ProductionDept,BelongMonth,BelongYear; ";
            var receiptDt  = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            foreach (DataRow row in dt.Rows)
            {
                var sumValue = 0m;
                for (int i = 1; i <= 12; i++)
                {
                    if (belongYear == DateTime.Now.Year && i > DateTime.Now.Month)
                    {
                        row[i + "_Month"] = DBNull.Value; continue;
                    }
                    var monthData = receiptDt.Select(" ProductionDept='" + row["value"] + "' and BelongMonth = '" + i + "'").FirstOrDefault();
                    if (monthData == null)
                    {
                        row[i + "_Month"] = 0;
                        continue;
                    }
                    row[i + "_Month"] = monthData["ReceiptValue"];
                    sumValue         += Convert.ToDecimal(monthData["ReceiptValue"]);
                }
                row["TotalValue"] = sumValue;
            }
            return(Json(dt));
        }
        protected override void AfterGetData(DataTable dt, bool isNew, string upperVersionID)
        {
            var row   = dt.Rows[0];
            var wbsID = GetQueryString("WBSID");

            if (!isNew)
            {
                wbsID = row["WBSID"].ToString();
                var id = row["ID"].ToString();
                ViewBag.AuditID   = id;
                ViewBag.IsNew     = false.ToString();
                ViewBag.FlowPhase = row["FlowPhase"].ToString();
            }
            else
            {
                ViewBag.AuditID   = "";
                ViewBag.BatchID   = this.GetQueryString("BatchID");
                ViewBag.IsNew     = true.ToString();
                ViewBag.FlowPhase = row["FlowPhase"].ToString();
            }
            var wbs = this.GetEntityByID <S_W_WBS>(wbsID);

            if (wbs == null)
            {
                throw new Formula.Exceptions.BusinessException("未能找到ID为【" + wbsID + "】的WBS对象");
            }
            var phaseCode = wbs.PhaseCode;

            if (phaseCode.Split('&').Length == 3)
            {
                phaseCode = phaseCode.Split('&')[2];
            }
            if (String.IsNullOrEmpty(phaseCode))
            {
                phaseCode = wbs.S_I_ProjectInfo.PhaseValue;
            }
            var PhaseRows = EnumBaseHelper.GetEnumTable("Project.Phase").Select(" value in ('" + phaseCode.Replace(",", "','") + "')");
            var phaseEnum = new List <Dictionary <string, object> >();

            foreach (DataRow item in PhaseRows)
            {
                phaseEnum.Add(FormulaHelper.DataRowToDic(item));
            }
            ViewBag.Phase = JsonHelper.ToJson(phaseEnum);
        }
        public override ActionResult Edit()
        {
            ViewBag.RoleType = JsonHelper.ToJson(EnumBaseHelper.GetEnumTable(typeof(enumGroupUserType)));
            var documentInfoId = GetQueryString("DocumentInfoID");

            if (!String.IsNullOrWhiteSpace(documentInfoId))
            {
                ViewBag.DocumentInfoID = documentInfoId;
            }
            var level = GetQueryString("Level");

            if (!String.IsNullOrWhiteSpace(level))
            {
                ViewBag.Level = level;
            }

            return(base.Edit());
        }
Exemple #20
0
        public JsonResult SaveProjectAptitude(string ListData, string ProjectClass)
        {
            var list           = JsonHelper.ToList(ListData);
            var aputitudeTable = EnumBaseHelper.GetEnumTable("HR.UserProjectAptitude");

            foreach (var item in list)
            {
                var userID = item.GetValue("UserID");
                foreach (DataRow row in aputitudeTable.Rows)
                {
                    var position = row["value"].ToString();
                    var entity   = this.entities.Set <S_D_UserAptitude>().FirstOrDefault(d => d.UserID == userID && d.ProjectClass == ProjectClass && d.Major == "Project" &&
                                                                                         d.Position == position);
                    var AptitudeLevel = item.GetValue(position);
                    if (String.IsNullOrEmpty(AptitudeLevel))
                    {
                        if (entity != null)
                        {
                            this.entities.Set <S_D_UserAptitude>().Remove(entity);
                        }
                    }
                    else
                    {
                        if (entity == null)
                        {
                            entity              = this.entities.Set <S_D_UserAptitude>().Create();
                            entity.ID           = FormulaHelper.CreateGuid();
                            entity.UserID       = userID;
                            entity.UserName     = item.GetValue("UserName");
                            entity.Position     = position;
                            entity.Major        = "Project";
                            entity.ProjectClass = ProjectClass;
                            entity.DeptID       = item.GetValue("DeptID");
                            entity.DeptName     = item.GetValue("DeptName");
                        }
                        entity.AptitudeLevel = Convert.ToInt32(AptitudeLevel);;
                    }
                }
            }
            this.entities.SaveChanges();
            return(Json(""));
        }
Exemple #21
0
        public JsonResult GetDeptMonthContractList()
        {
            var dt = EnumBaseHelper.GetEnumTable("System.ManDept");

            for (int i = 1; i <= 12; i++)
            {
                var field = i + "_Month";
                dt.Columns.Add(field, typeof(decimal));
            }
            dt.Columns.Add("TotalValue", typeof(decimal));
            var belongYear = String.IsNullOrEmpty(this.GetQueryString("BelongYear")) ? DateTime.Now.Year : Convert.ToInt32(this.GetQueryString("BelongYear"));
            var sql        = @"select isnull(Sum(ContractRMBValue),0) as ContractValue,BelongMonth,BelongYear
                         FROM (
                        SELECT ContractRMBValue,MONTH(SignDate) AS BelongMonth,YEAR(SignDate) AS BelongYear,ProductionDept 
                        FROM dbo.S_M_ContractInfo
                        where YEAR(SignDate)='{0}' and ContractState='Sign' )resulttable
                        group by ProductionDept,BelongMonth,BelongYear ";
            var receiptDt  = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            foreach (DataRow row in dt.Rows)
            {
                var sumValue = 0m;
                for (int i = 1; i <= 12; i++)
                {
                    if (belongYear == DateTime.Now.Year && i > DateTime.Now.Month)
                    {
                        row[i + "_Month"] = DBNull.Value; continue;
                    }
                    var monthData = receiptDt.Select(" ProductionDept='" + row["value"] + "' and BelongMonth = '" + i + "'").FirstOrDefault();
                    if (monthData == null)
                    {
                        row[i + "_Month"] = 0;
                        continue;
                    }
                    row[i + "_Month"] = monthData["ContractValue"];
                    sumValue         += Convert.ToDecimal(monthData["ContractValue"]);
                }
                row["TotalValue"] = sumValue;
            }
            return(Json(dt));
        }
Exemple #22
0
        public ActionResult WBSAddWithAttrDefine()
        {
            string childType = this.Request["Type"];

            ViewBag.NameTitle = EnumBaseHelper.GetEnumDescription(typeof(WBSNodeType), childType);
            if (String.IsNullOrEmpty(childType))
            {
                throw new Formula.Exceptions.BusinessException("未指定需要增加的WBS节点类型,无法增加节点");
            }

            //项目策划-专业、阶段根据策划及业务类型过滤
            string projectInfoID = this.GetQueryString("ProjectInfoID");
            var    project       = this.entities.Set <S_I_ProjectInfo>().Find(projectInfoID);
            var    prjClass      = string.Empty;

            if (project != null)
            {
                prjClass = project.ProjectClass;
            }
            var list = BaseConfigFO.GetWBSEnum(childType, prjClass);

            ViewBag.DefineAttr = JsonHelper.ToJson(list);
            var allDefineAttr = BaseConfigFO.GetWBSEnum(childType, "");

            ViewBag.AllDefineAttr = JsonHelper.ToJson(allDefineAttr);
            var prjClassDt       = EnumBaseHelper.GetEnumTable("Base.ProjectClass");
            var projectClassRows = prjClassDt.Select("value='" + prjClass + "'");

            if (projectClassRows != null && projectClassRows.Count() > 0)
            {
                ViewBag.ProjectClassName = projectClassRows[0]["text"].ToString();
            }
            else
            {
                ViewBag.ProjectClassName = "";
            }
            ViewBag.WBSType = childType;


            return(this.View());
        }
Exemple #23
0
        public ActionResult DeptList()
        {
            var QueryStartDate = GetQueryString("QueryStartDate");
            var QueryEndDate   = GetQueryString("QueryEndDate");

            if (string.IsNullOrEmpty(QueryStartDate))
            {
                QueryStartDate = DateTime.Now.Date.ToString("yyyy-MM") + "-01";
            }
            if (string.IsNullOrEmpty(QueryEndDate))
            {
                QueryEndDate = DateTime.Now.Date.ToString("yyyy-MM-dd");
            }
            ViewBag.QueryStartDate = QueryStartDate;
            ViewBag.QueryEndDate   = QueryEndDate;
            var dt = EnumBaseHelper.GetEnumTable("Comprehensive.WorkHourState");

            ViewBag.WorkHourState = dt.Select("value <>'Create'", "sortindex asc");
            ViewBag.WorkHourType  = (workHourType == WorkHourSaveType.Day.ToString() ? "天" : "小时");
            return(View());
        }
Exemple #24
0
        public ActionResult DeptList()
        {
            var QueryStartDate = GetQueryString("QueryStartDate");
            var QueryEndDate   = GetQueryString("QueryEndDate");

            if (string.IsNullOrEmpty(QueryStartDate))
            {
                QueryStartDate = DateTime.Now.Date.ToString("yyyy-MM") + "-01";
            }
            if (string.IsNullOrEmpty(QueryEndDate))
            {
                QueryEndDate = DateTime.Now.Date.ToString("yyyy-MM-dd");
            }
            ViewBag.QueryStartDate = QueryStartDate;
            ViewBag.QueryEndDate   = QueryEndDate;
            var dt = EnumBaseHelper.GetEnumTable("HR.WorkHourState");

            ViewBag.WorkHourState  = dt.Select("value <>'Create'", "sortindex asc");
            ViewBag.WorkHourType   = (workHourType == WorkHourSaveType.Day.ToString() ? "天" : "小时");
            ViewBag.NeedAdditional = String.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["NeedAdditional"]) ? true :
                                     Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["NeedAdditional"]);
            return(View());
        }
        public JsonResult GetDeptMonthReceiptList()
        {
            var dt = EnumBaseHelper.GetEnumTable("System.ManDept");

            for (int i = 1; i <= 12; i++)
            {
                var field = i + "_Month";
                dt.Columns.Add(field, typeof(decimal));
            }
            dt.Columns.Add("TotalValue", typeof(decimal));
            var belongYear = String.IsNullOrEmpty(this.GetQueryString("BelongYear")) ? DateTime.Now.Year : Convert.ToInt32(this.GetQueryString("BelongYear"));
            var sql        = @"select isnull(Sum(Amount),0) as ReceiptValue,BelongMonth,BelongYear,ProductUnit from S_C_Receipt
where BelongYear='{0}'  group by ProductUnit,BelongMonth,BelongYear ";
            var receiptDt  = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            foreach (DataRow row in dt.Rows)
            {
                var sumValue = 0m;
                for (int i = 1; i <= 12; i++)
                {
                    if (belongYear == DateTime.Now.Year && i > DateTime.Now.Month)
                    {
                        row[i + "_Month"] = DBNull.Value; continue;
                    }
                    var monthData = receiptDt.Select(" ProductUnit='" + row["value"] + "' and BelongMonth = '" + i + "'").FirstOrDefault();
                    if (monthData == null)
                    {
                        row[i + "_Month"] = 0;
                        continue;
                    }
                    row[i + "_Month"] = monthData["ReceiptValue"];
                    sumValue         += Convert.ToDecimal(monthData["ReceiptValue"]);
                }
                row["TotalValue"] = sumValue;
            }
            return(Json(dt));
        }
Exemple #26
0
        public JsonResult GetDeptContractList()
        {
            var dt = EnumBaseHelper.GetEnumTable("System.ManDept");

            dt.Columns.Add("ContractKPI", typeof(decimal));
            dt.Columns.Add("ContractValue", typeof(decimal));
            dt.Columns.Add("ContractComplateRate", typeof(decimal));
            dt.Columns.Add("UnContractValue", typeof(decimal));
            dt.Columns.Add("ContractKPIRemain", typeof(decimal));
            dt.Columns.Add("TimeRate", typeof(decimal));

            var belongYear  = String.IsNullOrEmpty(GetQueryString("BelongYear")) ? DateTime.Now.Year : Convert.ToInt32(GetQueryString("BelongYear"));
            var sql         = "select * from S_KPI_IndicatorOrg where IndicatorType = 'YearIndicator' and BelongYear= '{0}'";
            var indicatorDt = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            sql = @"select isnull(Sum(ContractRMBValue),0) as DataValue,ChargeDeptID,ChargeDeptName,BelongYear,BelongMonth,BelongQuarter
                    FROM(
                    SELECT ContractRMBValue,ProductionDept as ChargeDeptID,ProductionDeptName as ChargeDeptName,
                    YEAR(SignDate) AS BelongYear,MONTH(SignDate) AS BelongMonth,DATEPART(QUARTER,SignDate) AS BelongQuarter
                    FROM dbo.S_M_ContractInfo
                    WHERE ContractState='Sign'  AND YEAR(SignDate)='{0}'
                    )resulttable
                    GROUP BY ChargeDeptID,ChargeDeptName,BelongYear,BelongMonth,BelongQuarter ";
            var contractDt = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            sql = @"select isnull(Sum(ContractRMBValue),0) as DataValue,ChargeDeptID,ChargeDeptName,BelongYear,BelongMonth,BelongQuarter
                    FROM(
                    SELECT ContractRMBValue,ProductionDept as ChargeDeptID,ProductionDeptName as ChargeDeptName,
                    YEAR(SignDate) AS BelongYear,MONTH(SignDate) AS BelongMonth,DATEPART(QUARTER,SignDate) AS BelongQuarter
                    FROM dbo.S_M_ContractInfo
                    WHERE ContractState!='Sign' OR ContractState IS NULL
                    )resulttable
                    GROUP BY ChargeDeptID,ChargeDeptName,BelongYear,BelongMonth,BelongQuarter";
            var UncCntractDt = this.SqlHelper.ExecuteDataTable(sql);

            var sumKpi = 0m; var sumValue = 0m;

            foreach (DataRow row in dt.Rows)
            {
                var obj = indicatorDt.Compute("Sum(ContractValue)", "OrgID='" + row["value"] + "'");
                var kpi = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ContractKPI"] = kpi;
                sumKpi            += kpi;
                obj = contractDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                var value = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ContractValue"]        = value;
                sumValue                   += value;
                row["ContractComplateRate"] = kpi == 0 ? 100 : Math.Round(value / kpi * 100, 2);

                obj = UncCntractDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                row["UnContractValue"]   = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ContractKPIRemain"] = kpi - value;
                row["TimeRate"]          = Math.Round(Convert.ToDecimal(DateTime.Now.DayOfYear) / 365 * 100);
            }
            var result = new Dictionary <string, object>();

            result.SetValue("data", dt);
            var sumData = new Dictionary <string, object>();

            sumData.SetValue("ContractComplateRate", sumKpi == 0 ? 100 : Math.Round(sumValue / sumKpi * 100, 2));
            result.SetValue("sumData", sumData);

            var yAxies = new List <yAxis>();
            var y1     = new yAxis {
                MiniValue = 0, TitleInfo = new Dictionary <string, object>(), Lable = new Dictionary <string, object>()
            };

            y1.TitleInfo.SetValue("text", "合同金额");
            y1.Lable.SetValue("format", "{value}元");
            var y2 = new yAxis {
                MiniValue = 0, TitleInfo = new Dictionary <string, object>(), Lable = new Dictionary <string, object>()
            };

            y2.TitleInfo.SetValue("text", "完成率");
            y2.Lable.SetValue("format", "{value}%"); y2.opposite = true;
            yAxies.Add(y1);
            yAxies.Add(y2);

            var serDefines    = new List <Series>();
            var ReceiptKPISer = new Series {
                Name = "合同目标", Field = "ContractKPI", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
            };

            ReceiptKPISer.Tooltip.SetValue("valueSuffix", "元");
            serDefines.Add(ReceiptKPISer);

            var ReceiptValueSer = new Series {
                Name = "已签订金额", Field = "ContractValue", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
            };

            ReceiptValueSer.Tooltip.SetValue("valueSuffix", "元");
            serDefines.Add(ReceiptValueSer);

            var CanReceiptValueSer = new Series {
                Name = "待签约金额", Field = "UnContractValue", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
            };

            CanReceiptValueSer.Tooltip.SetValue("valueSuffix", "元");
            serDefines.Add(CanReceiptValueSer);

            var RecepitComplateRateSer = new Series {
                Name = "完成率", Field = "ContractComplateRate", Type = "spline", yAxis = 1, Tooltip = new Dictionary <string, object>()
            };

            RecepitComplateRateSer.Tooltip.SetValue("valueSuffix", "%");
            serDefines.Add(RecepitComplateRateSer);

            //var TimeRateSer = new Series { Name = "时间", Field = "TimeRate", Type = "spline", yAxis = 1, Tooltip = new Dictionary<string, object>() };
            //TimeRateSer.Tooltip.SetValue("valueSuffix", "%");
            //serDefines.Add(TimeRateSer);

            var chart = HighChartHelper.CreateColumnXYChart(belongYear + "年各部门合同情况", "", dt, "text", yAxies, serDefines, null);

            result.SetValue("chart", chart);
            return(Json(result));
        }
Exemple #27
0
        public JsonResult GetDeptReceiptList()
        {
            var dt = EnumBaseHelper.GetEnumTable("System.ManDept");

            dt.Columns.Add("ReceiptKPI", typeof(decimal));
            dt.Columns.Add("ReceiptValue", typeof(decimal));
            dt.Columns.Add("RecepitComplateRate", typeof(decimal));
            dt.Columns.Add("CanReceiptValue", typeof(decimal));
            dt.Columns.Add("RemaintContractValue", typeof(decimal));
            dt.Columns.Add("ReceiptKPIRemain", typeof(decimal));
            dt.Columns.Add("TimeRate", typeof(decimal));

            var belongYear  = String.IsNullOrEmpty(GetQueryString("BelongYear")) ? DateTime.Now.Year : Convert.ToInt32(GetQueryString("BelongYear"));
            var sql         = "select * from S_KPI_IndicatorOrg where IndicatorType = 'YearIndicator' and BelongYear= '{0}'";
            var indicatorDt = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            sql = @"SELECT  ISNULL(SUM(ReceiptInfo.ReceiptValue), 0) AS Value ,
                            ProductionDept,ProductionDeptName
                    FROM    ( SELECT    S_M_Receipt.* ,
					                    YEAR(ReceiptDate) AS BelongYear,
                                        ProductionDept ,
                                        ProductionDeptName
                              FROM      S_M_Receipt 
                                        LEFT JOIN S_M_ContractInfo ON ContractInfo = S_M_ContractInfo.ID
		                      WHERE YEAR(ReceiptDate)='{0}'
                            ) ReceiptInfo
                    WHERE   1 = 1
                    GROUP BY ProductionDept,ProductionDeptName;";
            var receiptDt = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            sql = @" select isnull(Sum(isnull(ReceiptValue,0)-isnull(FactReceiptValue,0)),0)  as DataValue,
ProductionDept as ChargeDeptID,ProductionDeptName as ChargeDeptName 
from dbo.S_M_ContractInfo_ReceiptObj left join dbo.S_M_ContractInfo 
on S_M_ContractInfo_ReceiptObj.S_M_ContractInfoID=S_M_ContractInfo.ID
  group by ProductionDept,ProductionDeptName";
            var canReceiptDt = this.SqlHelper.ExecuteDataTable(sql);

            sql = @"select Sum(isnull(ContractRMBValue,0)-isnull(SumReceiptValue,0)) as DataValue,ProductionDept as ChargeDeptID,ProductionDeptName as ChargeDeptName 
 from S_M_ContractInfo where ContractState='Sign' group by ProductionDept,ProductionDeptName";
            var remainContractDt = this.SqlHelper.ExecuteDataTable(sql);
            var sumKpi = 0m; var sumReceiptValue = 0m;

            foreach (DataRow row in dt.Rows)
            {
                var obj = indicatorDt.Compute("Sum(ReceiptValue)", "OrgID='" + row["value"] + "'");
                var kpi = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ReceiptKPI"] = kpi;
                sumKpi           += kpi;
                obj = receiptDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                var recepitValue = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ReceiptValue"]        = recepitValue;
                sumReceiptValue           += recepitValue;
                row["RecepitComplateRate"] = kpi == 0 ? 100 : Math.Round(recepitValue / kpi * 100, 2);

                obj = canReceiptDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                row["CanReceiptValue"]      = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["RemaintContractValue"] = remainContractDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                row["ReceiptKPIRemain"]     = kpi - recepitValue;
                row["TimeRate"]             = Math.Round(Convert.ToDecimal(DateTime.Now.DayOfYear) / 365 * 100);
            }
            var result = new Dictionary <string, object>();

            result.SetValue("data", dt);
            var sumData = new Dictionary <string, object>();

            sumData.SetValue("RecepitComplateRate", sumKpi == 0 ? 100 : Math.Round(sumReceiptValue / sumKpi * 100, 2));
            result.SetValue("sumData", sumData);

            var yAxies = new List <yAxis>();
            var y1     = new yAxis {
                MiniValue = 0, TitleInfo = new Dictionary <string, object>(), Lable = new Dictionary <string, object>()
            };

            y1.TitleInfo.SetValue("text", "收款金额");
            y1.Lable.SetValue("format", "{value}元");
            var y2 = new yAxis {
                MiniValue = 0, TitleInfo = new Dictionary <string, object>(), Lable = new Dictionary <string, object>()
            };

            y2.TitleInfo.SetValue("text", "完成率");
            y2.Lable.SetValue("format", "{value}%"); y2.opposite = true;
            yAxies.Add(y1);
            yAxies.Add(y2);

            var serDefines    = new List <Series>();
            var ReceiptKPISer = new Series {
                Name = "收款目标", Field = "ReceiptKPI", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
            };

            ReceiptKPISer.Tooltip.SetValue("valueSuffix", "元");
            serDefines.Add(ReceiptKPISer);

            var ReceiptValueSer = new Series {
                Name = "已收款", Field = "ReceiptValue", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
            };

            ReceiptValueSer.Tooltip.SetValue("valueSuffix", "元");
            serDefines.Add(ReceiptValueSer);

            var CanReceiptValueSer = new Series {
                Name = "经营应收款", Field = "CanReceiptValue", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
            };

            CanReceiptValueSer.Tooltip.SetValue("valueSuffix", "元");
            serDefines.Add(CanReceiptValueSer);

            var RecepitComplateRateSer = new Series {
                Name = "完成率", Field = "RecepitComplateRate", Type = "spline", yAxis = 1, Tooltip = new Dictionary <string, object>()
            };

            RecepitComplateRateSer.Tooltip.SetValue("valueSuffix", "%");
            serDefines.Add(RecepitComplateRateSer);

            var chart = HighChartHelper.CreateColumnXYChart(belongYear + "年各部门收款情况", "", dt, "text", yAxies, serDefines, null);

            result.SetValue("chart", chart);
            return(Json(result));
        }
Exemple #28
0
        public JsonResult GetDeptIndicatorList(string anlysisValue = "ReceiptValue")
        {
            var dt = EnumBaseHelper.GetEnumTable("System.ManDept");

            dt.Columns.Add("ContractKPI", typeof(decimal));
            dt.Columns.Add("ContractValue", typeof(decimal));
            dt.Columns.Add("ContractComplateRate", typeof(decimal));
            dt.Columns.Add("UnContractValue", typeof(decimal));
            dt.Columns.Add("ContractKPIRemain", typeof(decimal));
            dt.Columns.Add("ReceiptKPI", typeof(decimal));
            dt.Columns.Add("ReceiptValue", typeof(decimal));
            dt.Columns.Add("RecepitComplateRate", typeof(decimal));
            dt.Columns.Add("CanReceiptValue", typeof(decimal));
            dt.Columns.Add("RemaintContractValue", typeof(decimal));
            dt.Columns.Add("ReceiptKPIRemain", typeof(decimal));
            dt.Columns.Add("TimeRate", typeof(decimal));

            var belongYear  = String.IsNullOrEmpty(GetQueryString("BelongYear")) ? DateTime.Now.Year : Convert.ToInt32(GetQueryString("BelongYear"));
            var sql         = "select * from S_KPI_IndicatorOrg where IndicatorType = 'YearIndicator' and BelongYear= '{0}'";
            var indicatorDt = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            sql = @"SELECT  ISNULL(SUM(ReceiptInfo.ReceiptValue), 0) AS Value ,
                            ProductionDept,ProductionDeptName
                    FROM    ( SELECT    ReceiptValue,
                                        ProductionDept,ProductionDeptName
                              FROM      S_M_Receipt 
                                        LEFT JOIN S_M_ContractInfo ON ContractInfo = S_M_ContractInfo.ID
		                      WHERE YEAR(ReceiptDate)='{0}'
                            ) ReceiptInfo
                    WHERE   1 = 1
                    GROUP BY ProductionDept,ProductionDeptName; ";
            var receiptDt = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            sql = @"  select isnull(Sum(isnull(ReceiptValue,0)-isnull(FactReceiptValue,0)),0)  as DataValue,ProductionDept as ChargeDeptID,ProductionDeptName as ChargeDeptName 
                      FROM S_M_ContractInfo_ReceiptObj
                      left join S_M_ContractInfo on S_M_ContractInfo_ReceiptObj.S_M_ContractInfoID=S_M_ContractInfo.ID
                      group by ProductionDept,ProductionDeptName";
            var canReceiptDt = this.SqlHelper.ExecuteDataTable(sql);

            sql = @" select Sum(isnull(ContractRMBValue,0)-isnull(SumReceiptValue,0)) as DataValue,ProductionDept as ChargeDeptID,
                     ProductionDeptName as ChargeDeptName 
                     from S_M_ContractInfo where ContractState='Sign' group by ProductionDept,ProductionDeptName";
            var remainContractDt = this.SqlHelper.ExecuteDataTable(sql);

            sql = @" SELECT isnull(Sum(ContractRMBValue),0) as DataValue,ChargeDeptID,ChargeDeptName,BelongYear,BelongMonth,BelongQuarter
                     FROM
                    (select ContractRMBValue,ProductionDept as ChargeDeptID,ProductionDeptName as ChargeDeptName,
                    YEAR(SignDate) AS BelongYear,MONTH(SignDate) AS BelongMonth,DATEPART(QUARTER,SignDate) AS BelongQuarter
                    from S_M_ContractInfo 
                    WHERE ContractState='Sign' and YEAR(SignDate)='{0}')result
                    GROUP by BelongYear,BelongQuarter,BelongMonth,ChargeDeptID,ChargeDeptName ";
            var contractDt = this.SqlHelper.ExecuteDataTable(String.Format(sql, belongYear));

            sql = @"select isnull(Sum(ContractRMBValue),0) as DataValue,ChargeDeptID,ChargeDeptName,BelongYear,BelongMonth,BelongQuarter
                    FROM(
                    SELECT ContractRMBValue,ProductionDept as ChargeDeptID,ProductionDeptName as ChargeDeptName,
                    YEAR(SignDate) AS BelongYear,MONTH(SignDate) AS BelongMonth,DATEPART(QUARTER,SignDate) AS BelongQuarter
                    FROM dbo.S_M_ContractInfo
                    WHERE ContractState!='Sign' OR ContractState IS NULL
                    )resulttable
                    GROUP BY ChargeDeptID,ChargeDeptName,BelongYear,BelongMonth,BelongQuarter";
            var UncCntractDt = this.SqlHelper.ExecuteDataTable(sql);

            var sumReceptKpi = 0m; var sumReceiptValue = 0m; var sumContractKpi = 0m; var sumContractValue = 0m;

            foreach (DataRow row in dt.Rows)
            {
                var obj       = indicatorDt.Compute("Sum(ReceiptValue)", "OrgID='" + row["value"] + "'");
                var receptkpi = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ReceiptKPI"] = receptkpi;
                sumReceptKpi     += receptkpi;
                obj = receiptDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                var recepitValue = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ReceiptValue"]        = recepitValue;
                sumReceiptValue           += recepitValue;
                row["RecepitComplateRate"] = receptkpi == 0 ? 100 : Math.Round(recepitValue / receptkpi * 100, 2);

                obj = canReceiptDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                row["CanReceiptValue"]      = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["RemaintContractValue"] = remainContractDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                row["ReceiptKPIRemain"]     = receptkpi - recepitValue;
                //row["TimeRate"] = Math.Round(Convert.ToDecimal(DateTime.Now.DayOfYear) / 365 * 100);

                obj = indicatorDt.Compute("Sum(ContractValue)", "OrgID='" + row["value"] + "'");
                var contractKpi = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ContractKPI"] = contractKpi;
                sumContractKpi    += contractKpi;

                obj = contractDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                var value = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ContractValue"]        = value;
                sumContractValue           += value;
                row["ContractComplateRate"] = contractKpi == 0 ? 100 : Math.Round(value / contractKpi * 100, 2);

                obj = UncCntractDt.Compute("Sum(DataValue)", "ChargeDeptID='" + row["value"] + "'");
                row["UnContractValue"]   = obj == null || obj == DBNull.Value ? 0 : Convert.ToDecimal(obj);
                row["ContractKPIRemain"] = contractKpi - value;
            }
            var result = new Dictionary <string, object>();

            result.SetValue("data", dt);
            var sumData = new Dictionary <string, object>();

            sumData.SetValue("RecepitComplateRate", sumReceptKpi == 0 ? 100 : Math.Round(sumReceiptValue / sumReceptKpi * 100, 2));
            sumData.SetValue("ContractComplateRate", sumContractKpi == 0 ? 100 : Math.Round(sumReceiptValue / sumContractKpi * 100, 2));
            result.SetValue("sumData", sumData);

            #region 生成图表
            var yAxies = new List <yAxis>();
            var y1     = new yAxis {
                MiniValue = 0, TitleInfo = new Dictionary <string, object>(), Lable = new Dictionary <string, object>()
            };
            y1.TitleInfo.SetValue("text", "金额");
            y1.Lable.SetValue("format", "{value}元");
            var y2 = new yAxis {
                MiniValue = 0, TitleInfo = new Dictionary <string, object>(), Lable = new Dictionary <string, object>()
            };
            y2.TitleInfo.SetValue("text", "完成率");
            y2.Lable.SetValue("format", "{value}%"); y2.opposite = true;
            yAxies.Add(y1);
            yAxies.Add(y2);

            var serDefines = new List <Series>();
            if (anlysisValue == AnlysisValue.ReceiptValue.ToString())
            {
                var ReceiptKPISer = new Series {
                    Name = "收款目标", Field = "ReceiptKPI", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
                };
                ReceiptKPISer.Tooltip.SetValue("valueSuffix", "元");
                serDefines.Add(ReceiptKPISer);

                var ReceiptValueSer = new Series {
                    Name = "已收款", Field = "ReceiptValue", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
                };
                ReceiptValueSer.Tooltip.SetValue("valueSuffix", "元");
                serDefines.Add(ReceiptValueSer);

                var CanReceiptValueSer = new Series {
                    Name = "经营应收款", Field = "CanReceiptValue", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
                };
                CanReceiptValueSer.Tooltip.SetValue("valueSuffix", "元");
                serDefines.Add(CanReceiptValueSer);

                var RecepitComplateRateSer = new Series {
                    Name = "收款完成率", Field = "RecepitComplateRate", Type = "spline", yAxis = 1, Tooltip = new Dictionary <string, object>()
                };
                RecepitComplateRateSer.Tooltip.SetValue("valueSuffix", "%");
                serDefines.Add(RecepitComplateRateSer);
            }
            else
            {
                var contractKPISer = new Series {
                    Name = "合同目标", Field = "ContractKPI", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
                };
                contractKPISer.Tooltip.SetValue("valueSuffix", "元");
                serDefines.Add(contractKPISer);

                var contractValueSer = new Series {
                    Name = "已签订金额", Field = "ContractValue", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
                };
                contractValueSer.Tooltip.SetValue("valueSuffix", "元");
                serDefines.Add(contractValueSer);

                var unContractValueSer = new Series {
                    Name = "待签约金额", Field = "UnContractValue", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
                };
                unContractValueSer.Tooltip.SetValue("valueSuffix", "元");
                serDefines.Add(unContractValueSer);

                var contractComplateRateSer = new Series {
                    Name = "合同完成率", Field = "ContractComplateRate", Type = "spline", yAxis = 1, Tooltip = new Dictionary <string, object>()
                };
                contractComplateRateSer.Tooltip.SetValue("valueSuffix", "%");
                serDefines.Add(contractComplateRateSer);
            }

            //var TimeRateSer = new Series { Name = "时间", Field = "TimeRate", Type = "spline", yAxis = 1, Tooltip = new Dictionary<string, object>() };
            //TimeRateSer.Tooltip.SetValue("valueSuffix", "%");
            //serDefines.Add(TimeRateSer);
            string title = belongYear + "年各部门收款完成情况";
            if (anlysisValue == AnlysisValue.ContractValue.ToString())
            {
                title = belongYear + "年各部门合同完成情况";
            }
            var chart = HighChartHelper.CreateColumnXYChart(title, "", dt, "text", yAxies, serDefines, null);
            result.SetValue("chart", chart);
            #endregion

            return(Json(result));
        }
Exemple #29
0
        public ActionResult TreeList()
        {
            string id = GetQueryString("ID");
            S_F_CapitalPlanTemplate planTemplate = entities.Set <S_F_CapitalPlanTemplate>().Find(id);

            if (planTemplate == null)
            {
                throw new Exception("未找到id为【" + id + "】的S_F_CapitalPlanTemplate");
            }

            //如果没有任何节点,插入CapitalPlanType枚举值对应的节点
            if (entities.Set <S_F_CapitalPlanTemplate_Detail>().Count(a => a.S_F_CapitalPlanTemplateID == id) == 0)
            {
                //初始
                {
                    S_F_CapitalPlanTemplate_Detail template = new S_F_CapitalPlanTemplate_Detail();
                    template.ID     = FormulaHelper.CreateGuid();
                    template.FullID = template.ID;
                    template.S_F_CapitalPlanTemplateID = id;
                    template.ParentID        = "";
                    template.Name            = "初期合计";
                    template.IsReadOnly      = true;
                    template.CapitalPlanType = CapitalPlanType.Initial.ToString();
                    template.CreateDate      = DateTime.Now;
                    template.CreateUserID    = CurrentUserInfo.UserID;
                    template.CreateUserName  = CurrentUserInfo.UserName;
                    template.SortIndex       = 0;
                    entities.Set <S_F_CapitalPlanTemplate_Detail>().Add(template);
                }
                //流入
                {
                    S_F_CapitalPlanTemplate_Detail template = new S_F_CapitalPlanTemplate_Detail();
                    template.ID     = FormulaHelper.CreateGuid();
                    template.FullID = template.ID;
                    template.S_F_CapitalPlanTemplateID = id;
                    template.ParentID        = "";
                    template.Name            = "经营现金流入";
                    template.IsReadOnly      = true;
                    template.CapitalPlanType = CapitalPlanType.In.ToString();
                    template.CreateDate      = DateTime.Now;
                    template.CreateUserID    = CurrentUserInfo.UserID;
                    template.CreateUserName  = CurrentUserInfo.UserName;
                    template.SortIndex       = 1;
                    entities.Set <S_F_CapitalPlanTemplate_Detail>().Add(template);
                }
                //支出
                {
                    S_F_CapitalPlanTemplate_Detail template = new S_F_CapitalPlanTemplate_Detail();
                    template.ID     = FormulaHelper.CreateGuid();
                    template.FullID = template.ID;
                    template.S_F_CapitalPlanTemplateID = id;
                    template.ParentID        = "";
                    template.Name            = "经营性现金支出";
                    template.IsReadOnly      = true;
                    template.CapitalPlanType = CapitalPlanType.Out.ToString();
                    template.CreateDate      = DateTime.Now;
                    template.CreateUserID    = CurrentUserInfo.UserID;
                    template.CreateUserName  = CurrentUserInfo.UserName;
                    template.SortIndex       = 2;
                    entities.Set <S_F_CapitalPlanTemplate_Detail>().Add(template);
                }
                //总计
                {
                    S_F_CapitalPlanTemplate_Detail template = new S_F_CapitalPlanTemplate_Detail();
                    template.ID     = FormulaHelper.CreateGuid();
                    template.FullID = template.ID;
                    template.S_F_CapitalPlanTemplateID = id;
                    template.ParentID        = "";
                    template.Name            = "现金余缺";
                    template.IsReadOnly      = true;
                    template.CapitalPlanType = CapitalPlanType.Total.ToString();
                    template.CreateDate      = DateTime.Now;
                    template.CreateUserID    = CurrentUserInfo.UserID;
                    template.CreateUserName  = CurrentUserInfo.UserName;
                    template.SortIndex       = 3;
                    entities.Set <S_F_CapitalPlanTemplate_Detail>().Add(template);
                }


                entities.SaveChanges();
            }

            //供选择的不包含CapitalPlanType.Total
            var dt = EnumBaseHelper.GetEnumTable(typeof(CapitalPlanType));

            //DataRow dr = dt.Select("value='" + CapitalPlanType.Total.ToString() + "'")[0];
            //dt.Rows.Remove(dr);
            ViewBag.CapitalPlanType = JsonHelper.ToJson(dt);;
            return(View());
        }
Exemple #30
0
        public string GetAllPortal()
        {
            var enumTable = EnumBaseHelper.GetEnumTable(typeof(Base.Logic.DefaultPortal));

            return(JsonHelper.ToJson(enumTable));
        }