コード例 #1
0
        /// <summary>
        /// 获取订单信息
        /// </summary>
        /// <param name="stDate"></param>
        /// <param name="edDate"></param>
        /// <returns></returns>
        public static Dictionary <string, decimal> GetOrderInfo(DateTime stDate, DateTime edDate)
        {
            Dictionary <string, decimal> dic = new Dictionary <string, decimal>()
            {
                { "总订单", 0 },
                { "Saas服务", 0 },
                { "短信", 0 },
                { "话费", 0 },
                { "硬件", 0 },
                { "总订单笔数", 0 },
                { "Saas服务笔数", 0 },
                { "短信笔数", 0 },
                { "话费笔数", 0 },
                { "硬件笔数", 0 }
            };

            //获取订单类型
            List <OrderInfoModel> tOrdList = T_OrderInfoBLL.GetOrderInfoByDate(stDate, edDate, 0);
            decimal tSelf     = 0;
            decimal tSms      = 0;
            decimal tMaterial = 0;
            decimal tPhone    = 0;

            foreach (var item in tOrdList)
            {
                OrderItemProp tempModel = T_Order_businessBLL.GetListItemProps(Convert.ToInt32(item.busId), item.accId);
                if (tempModel.SelfMark == "1")
                {
                    tSelf           += Convert.ToDecimal(item.RealPayMoney);
                    dic["Saas服务笔数"] += 1;
                }
                else if (tempModel.PureSms == "1")
                {
                    tSms        += Convert.ToDecimal(item.RealPayMoney);
                    dic["短信笔数"] += 1;
                }
                else
                {
                    tPhone      += Convert.ToDecimal(item.RealPayMoney);
                    dic["话费笔数"] += 1;
                }
            }

            //获取实物商品相关统计(实物商品计入他营产品)
            List <OrderInfoModel> MaterialList = T_OrderInfoBLL.GetOrderInfoByDate(stDate, edDate, 1);

            if (MaterialList != null && MaterialList.Count > 0)
            {
                foreach (var item in MaterialList)
                {
                    tMaterial   += Convert.ToDecimal(item.RealPayMoney);
                    dic["硬件笔数"] += 1;
                }
            }

            dic["Saas服务"] = tSelf;
            dic["短信"]     = tSms;
            dic["话费"]     = tPhone;
            dic["硬件"]     = tMaterial;
            dic["总订单"]    = tSelf + tSms + tPhone + tMaterial;
            dic["总订单笔数"]  = dic["Saas服务笔数"] + dic["短信笔数"] + dic["话费笔数"] + dic["硬件笔数"];

            return(dic);
        }
コード例 #2
0
        public static string GetOrderType(string dataType, DateTime BgTime, DateTime EdTime)
        {
            FusionPieModel model = new FusionPieModel();

            string strJson = "";

            DateTime bgTime = new DateTime();
            DateTime edTime = new DateTime();

            if (dataType == "oth")
            {
                bgTime = BgTime;
                edTime = EdTime.AddHours(23).AddMinutes(59).AddSeconds(59);
            }
            else if (dataType == "month")
            {
                DateTime FirstDay = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                DateTime LastDay  = FirstDay.AddMonths(1).AddDays(-1);

                bgTime = FirstDay;
                edTime = LastDay.AddHours(23).AddMinutes(59).AddSeconds(59);
            }
            else if (dataType == "lastmonth")
            {
                DateTime nowTime  = DateTime.Now.AddMonths(-1);
                DateTime FirstDay = new DateTime(nowTime.Year, nowTime.Month, 1);
                DateTime LastDay  = FirstDay.AddMonths(1).AddDays(-1);

                bgTime = FirstDay;
                edTime = LastDay.AddHours(23).AddMinutes(59).AddSeconds(59);
            }
            else if (dataType == "3month")
            {
                DateTime nowTime  = DateTime.Now.AddMonths(-2);
                DateTime FirstDay = new DateTime(nowTime.Year, nowTime.Month, 1);
                DateTime LastDay  = FirstDay.AddMonths(3).AddDays(-1);

                bgTime = FirstDay;
                edTime = LastDay.AddHours(23).AddMinutes(59).AddSeconds(59);
            }
            else if (dataType == "today")
            {
                bgTime = DateTime.Today.AddHours(0).AddMinutes(0).AddSeconds(0);
                edTime = DateTime.Today.AddHours(23).AddMinutes(59).AddSeconds(59);
            }

            List <OrderInfoModel> list = T_OrderInfoBLL.GetOrderInfoByDate(bgTime, edTime, 0);
            double self      = 0;
            double other     = 0;
            double otherServ = 0;

            //int count = 0;//调试信息

            foreach (var item in list)
            {
                OrderItemProp tempModel = T_Order_businessBLL.GetListItemProps(Convert.ToInt32(item.busId), item.accId);
                if (tempModel.SelfMark == "1")
                {
                    self += Convert.ToDouble(item.RealPayMoney);
                }
                else if (tempModel.PureSms == "1")
                {
                    otherServ += Convert.ToDouble(item.RealPayMoney);
                    //count++;
                }
                else
                {
                    other += Convert.ToDouble(item.RealPayMoney);
                }
            }

            //获取实物商品相关统计(实物商品计入他营产品)
            List <OrderInfoModel> MaterialList = T_OrderInfoBLL.GetOrderInfoByDate(bgTime, edTime, 1);

            if (MaterialList != null && MaterialList.Count > 0)
            {
                foreach (var item in MaterialList)
                {
                    other += Convert.ToDouble(item.RealPayMoney);
                }
            }

            //获取京东订单那相关统计(订单商品计入他营产品)
            List <OrderInfoModel> JdList = T_OrderInfoBLL.GetOrderInfoByDate(bgTime, edTime, 2);

            if (MaterialList != null && MaterialList.Count > 0)
            {
                foreach (var item in MaterialList)
                {
                    other += Convert.ToDouble(item.RealPayMoney);
                }
            }

            //OrderPartition orderMoney = T_OrderInfoBLL.GetOrderType(bgTime, edTime);

            double allMoney = self + other + otherServ;

            model.chart.caption           = "产品类型比例";
            model.chart.baseFontSize      = "12";
            model.chart.showpercentvalues = "1";

            PieData servData = new PieData();

            servData.label    = "第三方服务";
            servData.value    = GetBaiFen(Convert.ToDouble(otherServ), allMoney);
            servData.toolText = "第三方服务," + GetBaiFen(Convert.ToDouble(otherServ), allMoney) + "% (¥" + ControlHelper.formats(otherServ, 2).ToString() + ")";

            model.data.Add(servData);

            PieData selfData = new PieData();

            selfData.label    = "Saas服务";
            selfData.value    = GetBaiFen(Convert.ToDouble(self), allMoney);
            selfData.toolText = "Saas服务," + GetBaiFen(Convert.ToDouble(self), allMoney) + "% (¥" + ControlHelper.formats(self, 2).ToString() + ")";

            model.data.Add(selfData);

            PieData otherData = new PieData();

            otherData.label    = "他营";
            otherData.value    = GetBaiFen(Convert.ToDouble(other), allMoney);
            otherData.toolText = "他营," + GetBaiFen(Convert.ToDouble(other), allMoney) + "% (¥" + ControlHelper.formats(other, 2).ToString() + ")";

            model.data.Add(otherData);

            return(CommonLib.Helper.JsonSerializeObject(model));
        }