username@email.com
2022-01-05 a77fbf7eeb18b5caf3f0e77fa01791a5a8ae094e
zhengcaioa/Services/CooperatecustomCustomerService.cs
@@ -98,6 +98,7 @@
                    updateproject.Shifoutianjiaweixin = cooperatecustomCustomer.Shifoutianjiaweixin;
                    updateproject.Weixintime = cooperatecustomCustomer.Weixintime;
                    updateproject.Weixiner = cooperatecustomCustomer.Weixiner;
                    updateproject.Shouxinedu = cooperatecustomCustomer.Shouxinedu;
                }
                _context.SaveChanges();
@@ -168,7 +169,7 @@
                DateTime.TryParse(Createtimes[1], out Createtimeend);
                Createtimeend = Createtimeend.AddDays(1);
            }
            var query = (from a in _context.CooperatecustomCustomers
                         join b in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khly")
@@ -193,12 +194,12 @@
                         from abi in esss.DefaultIfEmpty()
                         join i in _context.CooperOrders.Where(x => x.RecStatus == "A" &&  x.ChedanStatus !="A" ).GroupBy(q => new { q.Khdw }).Select(q => new
                         join i in _context.CooperOrders.Where(x => x.RecStatus == "A" && x.ChedanStatus != "A").GroupBy(q => new { q.Khdw }).Select(q => new
                         {
                             Khdw = q.Key.Khdw,
                             Moneycount = q.Sum(i => i.Money),
                             Ordercount = q.Count(),
                         }
                         }
                         )
                         on a.Id equals i.Khdw
                         into isss
@@ -232,7 +233,7 @@
                              && (string.IsNullOrWhiteSpace(searchEntity.Sheng) || a.Sheng == searchEntity.Sheng.Trim())
                               && (string.IsNullOrWhiteSpace(searchEntity.City) || a.City == searchEntity.City.Trim())
                                && (string.IsNullOrWhiteSpace(searchEntity.AreaId) || a.AreaId == searchEntity.AreaId.Trim())
                                 && (string.IsNullOrWhiteSpace(searchEntity.Shifouweixin) ||  a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim())
                                 && (string.IsNullOrWhiteSpace(searchEntity.Shifouweixin) || a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim())
                                 && (string.IsNullOrWhiteSpace(searchEntity.HuiyuanId) || a.HuiyuanId == searchEntity.HuiyuanId.Trim())
                         select new CooperatecustomCustomerDTO
@@ -245,7 +246,7 @@
                             Hyfl = a.Hyfl,
                             Khlx = a.Khlx,
                             Ywjl = a.Ywjl,
                             ShengName = fff.Name + "-" + ggg.Name+ "-" + hhh.Name,
                             ShengName = fff.Name + "-" + ggg.Name + "-" + hhh.Name,
                             CityName = ggg.Name,
                             AreaIdName = hhh.Name,
                             KhlyName = bbb.Comments,
@@ -259,6 +260,7 @@
                             Tel = a.Tel,
                             Ordercount = iii.Ordercount.ToString(),
                             Moneycount = iii.Moneycount.ToString(),
                             Moneycountde = iii.Moneycount,
                             Phone = a.Phone,
                             Qq = a.Qq,
                             Email = a.Email,
@@ -286,6 +288,12 @@
                             HuiyuanId = a.HuiyuanId,
                             Weixiner = a.Weixiner,
                             Weixintime = a.Weixintime,
                             Yufukuan = a.Yufukuan ?? 0,
                             Shouxinedu = a.Shouxinedu ?? 0,
                             Shenyushouxin = a.Shenyushouxin ?? 0,
                             YufukuanName = a.Yufukuan.HasValue ? a.Yufukuan.Value.ToString("f2") : "",
                             ShouxineduName = a.Shouxinedu.HasValue ? a.Shouxinedu.Value.ToString("f2") : "",
                             ShenyushouxinName = a.Shenyushouxin.HasValue ? a.Shenyushouxin.Value.ToString("f2") : "",
                         }
                        ).OrderByDescending(x => x.Modifytime).ToList();
@@ -293,7 +301,15 @@
            //if (searchEntity.totalrows == 0)
                searchEntity.totalrows = query.Count();
            data.Heji1 = Math.Round(query.Sum(x => x.Yufukuan) ?? 0, 2);
            data.Heji2 = Math.Round(query.Sum(x => x.Shouxinedu) ?? 0, 2);
            data.Heji3 = Math.Round(query.Sum(x => x.Shenyushouxin) ?? 0, 2);
            data.Heji4 = Math.Round(query.Sum(x => x.Moneycountde) ?? 0, 2);
            var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
            data.DangyeHeji1 = Math.Round(lianlist.Sum(x => x.Yufukuan) ?? 0, 2);
            data.DangyeHeji2 = Math.Round(lianlist.Sum(x => x.Shouxinedu) ?? 0, 2);
            data.DangyeHeji3 = Math.Round(lianlist.Sum(x => x.Shenyushouxin) ?? 0, 2);
            data.DangyeHeji4 = Math.Round(lianlist.Sum(x => x.Moneycountde) ?? 0, 2);
            data.LoadData(searchEntity, lianlist);
            return data;
        }