Ejemplo n.º 1
0
 public ActionResult Index()
 {
     //用户名列表
     ViewBag.user = UserInfoService.LoadEntities(x => x.DelFlag != 1 && x.BuMenID == 1).ToList();
     //状态列表
     ViewBag.items = T_YSItemsService.LoadEntities(x => x.Items == 1).ToList();
     //客户名称 与 项目名称列表
     ViewBag.KeHuName = YXB_Kh_listService.LoadEntities(x => x.DelFlag == 0).ToList();
     return(View());
 }
Ejemplo n.º 2
0
        //获取产品单据列表(修改报价用)
        public ActionResult GetChanPinDJ()
        {
            var temp = T_YSItemsService.LoadEntities(x => x.Items == 2).DefaultIfEmpty();
            var tem  = from a in temp
                       select new
            {
                ID     = a.ID,
                MyText = a.MyText
            };

            return(Json(tem, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        //获取含税列表
        public ActionResult GetHashui()
        {
            var temp  = T_BoolItemService.LoadEntities(x => x.ItemsID == 0).DefaultIfEmpty();
            var temp2 = T_YSItemsService.LoadEntities(x => x.Items == 2).DefaultIfEmpty();
            var tem   = from a in temp
                        select new
            {
                ID      = a.ID,
                MyTexts = a.str
            };
            var tem2 = from a in temp2
                       select new {
                ID      = a.ID,
                MyTexts = a.MyText
            };

            return(Json(new { tem = tem, tem2 = tem2 }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
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));
        }