コード例 #1
0
        //信息完成处理
        public ActionResult WinChuLi(T_WinBak Twbak)
        {
            //  var WinMoney = Request["WinMoney"]==null?0:Request["WinMoney"].ToString().Trim().Length<=0?0:Convert.ToDecimal(Request["WinMoney"]);

            var Baojia            = YXB_BaojiaService.LoadEntities(x => x.BaoJiaTop_id == Twbak.BaoJiaTOPID).DefaultIfEmpty();
            List <YXB_Baojia> ybj = new List <YXB_Baojia>();

            foreach (var it in Baojia)
            {
                it.WinMoney  = Convert.ToDecimal(Request["EidtMoney" + it.id]);
                it.WinYunFei = Convert.ToDecimal(Request["EidtYunFei" + it.id]);
                it.WIN       = 1;
                //修改完成报价信息
                ybj.Add(it);
            }

            Twbak.AddPerson = LoginUser.ID;
            Twbak.AddTime   = MvcApplication.GetT_time();
            if (T_WinBakService.UpHeTongWinADD(ybj, Twbak))
            {
                return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { ret = "no" }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        //查询月总汇
        public ActionResult GetMonthSumData()
        {
            var          Utime    = Convert.ToDateTime(Request["Utime"]);
            var          Dtime    = Convert.ToDateTime(Request["Dtime"]);
            List <Month> retMonth = new List <Month>();
            var          oldtemp  = T_BaoJiaToPService.LoadEntities(x => x.AddTime < Utime);

            if (T_BaoJiaToPService.LoadEntities(x => x.AddTime < Utime).FirstOrDefault() == null)
            {
                retMonth.Add(new Month {
                    ID = 0, WinCount = 0, LostCount = 0, DaiDingCount = 0, SumCount = 0, WinDML = 0, lostDML = 0, DdDml = 0, SumDMLCount = 0
                });
            }
            else
            {
                retMonth.Add(GetMonthVar(oldtemp, 0, 0));
            }
            //获取成功失败原因列表
            var yyItem = T_YSItemsService.LoadEntities(x => x.Items == 1 && x.ID != 1);

            List <Items>[] Rlis = new List <Items> [2];
            Rlis[0] = AddList(yyItem, oldtemp);
            oldtemp = T_BaoJiaToPService.LoadEntities(x => x.AddTime >= Utime && x.AddTime <= Dtime).DefaultIfEmpty();



            Rlis[1] = AddList(yyItem, oldtemp);

            retMonth.Add(GetMonthVar(oldtemp, retMonth[0].DaiDingCount, retMonth[0].DdDml));

            oldtemp = T_BaoJiaToPService.LoadEntities(x => x.AddTime <= Dtime);
            retMonth.Add(GetMonthVar(oldtemp, 0, 0));

            #region 成功失败待定金额百分比
            var LostYuanyinItem = T_WinBakService.LoadEntities(x => x.AddTime < Utime).DefaultIfEmpty();
            //获取报价人员
            var Uload = UserInfoService.LoadEntities(x => x.BuMenID == 1).DefaultIfEmpty();
            //获取成功或失败的信息
            var DMYuanyinItem = T_WinBakService.LoadEntities(x => x.AddTime >= Utime && x.AddTime <= Dtime).DefaultIfEmpty();
            //获取待定信息
            var DaiDingData = T_BaoJiaToPService.LoadEntities(x => x.AddTime >= Utime && x.AddTime <= Dtime).Where(x => x.T_WinBak.Count() == 0).DefaultIfEmpty();

            //.Sum(a => a.YXB_Baojia.Sum(m => m.CPShuLiang * (m.BaoJiaMoney + m.BaoJiaYunFei)));
            var DMyyItem = from a in DMYuanyinItem
                           select new {
                PerName      = a.T_BaoJiaToP.YXB_Kh_list.UserInfo.PerSonName,
                WinMoney     = a.YuanYin == 1 ? a.T_BaoJiaToP.YXB_Baojia.Sum(m => m.CPShuLiang * (m.WinMoney + m.WinYunFei)):0,
                LostMoney    = a.YuanYin != 1 ? a.T_BaoJiaToP.YXB_Baojia.Sum(m => m.CPShuLiang * (m.WinMoney + m.WinYunFei)) : 0,
                DaiDingMoney = a.T_BaoJiaToP.YXB_Baojia.Where(m => m.WIN == 0).Sum(m => m.CPShuLiang * (m.BaoJiaMoney + m.BaoJiaYunFei)),
            };
            List <Items> WinLostMoney = new List <Items>();

            foreach (var f in Uload)
            {
                Items its = new Items();
                its.PName  = f.PerSonName;
                its.Wmoney = DMyyItem.Where(x => x.PerName == its.PName).Sum(x => x.WinMoney) == null ? 0 : DMyyItem.Where(x => x.PerName == its.PName).Sum(x => x.WinMoney);
                its.Lmoney = DMyyItem.Where(x => x.PerName == its.PName).Sum(x => x.LostMoney) == null ? 0 : DMyyItem.Where(x => x.PerName == its.PName).Sum(x => x.LostMoney);
                var itm = DaiDingData.Where(x => x.YXB_Kh_list.UserInfo.PerSonName == f.PerSonName).DefaultIfEmpty().Sum(x => x.YXB_Baojia.Sum(y => (y.BaoJiaMoney + y.BaoJiaYunFei) * y.CPShuLiang));
                its.Dmoney   = itm == null ? 0 : itm;
                its.WPercent = Rounds((its.Wmoney / DMyyItem.Sum(x => x.WinMoney) * 100) == null ? 0 : its.Wmoney / DMyyItem.Sum(x => x.WinMoney) * 100);
                its.LPercent = Rounds((its.Lmoney / DMyyItem.Sum(x => x.LostMoney) * 100) == null ? 0 :its.Lmoney / DMyyItem.Sum(x => x.LostMoney) * 100);
                var Summoneydd = DaiDingData.Sum(x => x.YXB_Baojia.Sum(y => (y.BaoJiaMoney + y.BaoJiaYunFei) * y.CPShuLiang));
                its.DPercent = Rounds(Summoneydd == null ? 0 : its.Dmoney / Summoneydd * 100);
                WinLostMoney.Add(its);
            }
            //添加总数
            Items ims = new Items();
            ims.PName    = "合计";
            ims.Wmoney   = WinLostMoney.Sum(x => x.Wmoney);
            ims.Lmoney   = WinLostMoney.Sum(x => x.Lmoney);
            ims.Dmoney   = WinLostMoney.Sum(x => x.Dmoney);
            ims.WPercent = Convert.ToInt32(WinLostMoney.Sum(x => x.WPercent));
            ims.LPercent = Convert.ToInt32(WinLostMoney.Sum(x => x.LPercent));
            ims.DPercent = Convert.ToInt32(WinLostMoney.Sum(x => x.DPercent));
            WinLostMoney.Add(ims);
            #endregion


            return(Json(new { ret = "ok", temp = retMonth, LostItem = Rlis, XiangXi = WinLostMoney }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        private List <SlcClass> GeteSS(out int intcount)
        {
            bool OutBool   = Request["outexe"] == null ? false : Convert.ToBoolean(Request["outexe"]);
            int  pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 25;

            pageSize = OutBool ? pageSize : pageSize;
            int           win = Request["win"] == null ? 0 : int.Parse(Request["win"]);
            UserInfoParam uim = new UserInfoParam();

            uim.Uptime     = Convert.ToDateTime(Request["UpTime"]);
            uim.Dwtime     = Convert.ToDateTime(Request["DwTime"]);
            uim.zt         = Request["YyZt"] == null ? 0 : Request["YyZt"].Length <= 0 ? 0 : int.Parse(Request["YyZt"]);
            uim.addess     = Request["addess"];
            uim.Person     = Request["Person"] == null ? 0 : Request["Person"].Length <= 0 ? 0 : int.Parse(Request["Person"]);
            uim.KHname     = Request["KHname"] == null ? 0 : Request["KHname"].Length <= 0 ? 0 : int.Parse(Request["KHname"]);
            uim.CPname     = Request["CPname"] == null ? 0 : Request["CPname"].Length <= 0 ? 0 : int.Parse(Request["CPname"]);
            uim.CPxh       = Request["CPxh"] == null ? 0 : Request["CPxh"].Length <= 0 ? 0 : int.Parse(Request["CPxh"]);
            uim.PageIndex  = pageIndex;
            uim.PageSize   = pageSize;
            uim.TotalCount = 0;
            var temp1 = T_WinBakService.LoadSearchEntities(uim);
            var temp  = from a in temp1
                        select new SlcClass
            {
                ID             = a.ID,
                TopId          = a.T_BaoJiaToP.id,
                BaoJiaPerson   = a.T_BaoJiaToP.YXB_Baojia.FirstOrDefault().BaoJiaPerson,
                JiShuYaoQiu    = a.T_BaoJiaToP.JiShuYaoQiu,
                Addess         = a.T_BaoJiaToP.Addess,
                DaiBanYunShu   = a.T_BaoJiaToP.DaiBanYunShu,
                JieShuanFanShi = a.T_BaoJiaToP.JieShuanFanShi,
                HeTongQianDing = a.T_BaoJiaToP.HeTongQianDing,
                KHname         = a.T_BaoJiaToP.YXB_Kh_list.KHname,
                KHComname      = a.T_BaoJiaToP.KHComname,
                KHperson       = a.T_BaoJiaToP.YXB_Kh_list.KHperson,
                KHfaren        = a.T_BaoJiaToP.YXB_Kh_list.KHfaren,
                KHzhiwu        = a.T_BaoJiaToP.YXB_Kh_list.KHzhiwu,
                KHphoto        = a.T_BaoJiaToP.YXB_Kh_list.KHphoto,
                UName          = a.T_BaoJiaToP.YXB_Kh_list.UserInfo.UName,
                WinMoney       = a.T_BaoJiaToP.YXB_Baojia.DefaultIfEmpty().Sum(s => s.CPShuLiang * (s.WinMoney + s.WinYunFei)),
                AddTime        = a.T_BaoJiaToP.YXB_Baojia.FirstOrDefault().AddTime,
                TOPaddtime     = a.T_BaoJiaToP.AddTime,
                BaoJiaTime     = a.T_BaoJiaToP.YXB_Baojia.FirstOrDefault().BaoJiaTime,
                GhTime         = a.T_BaoJiaToP.GhTime,
                NewTime        = a.T_BaoJiaToP.YXB_Kh_list.NewTime,
                WinStr         = a.T_BaoJiaToP.T_WinBak.FirstOrDefault() == null ? null : a.T_BaoJiaToP.T_WinBak.FirstOrDefault().T_YSItems.MyText,
                Winbak         = a.T_BaoJiaToP.T_WinBak.FirstOrDefault() == null ? null : a.T_BaoJiaToP.T_WinBak.FirstOrDefault().Bak,
            };
            var templist = temp.ToList();

            for (int i = 0; i < templist.Count; i++)
            {
                templist[i].Addess = ArrF(templist[i].Addess);
                long tid   = templist[i].TopId;
                var  topbj = YXB_BaojiaService.LoadEntities(x => x.BaoJiaTop_id == tid).DefaultIfEmpty();
                templist[i].FahuoMoney = topbj.Sum(x => x.T_WinBakFaHuo.Sum(m => m.FahuoInt) * (x.WinMoney + x.WinYunFei));
            }
            intcount = uim.TotalCount;
            return(templist);
        }