public List <DepositInfo> FetchDepositBundles(DateTime depositdt) { var q = from b in DbUtil.Db.BundleHeaders where b.DepositDate == depositdt orderby b.BundleHeaderId select new DepositInfo { BundleId = b.BundleHeaderId.ToString(), Cash = b.TotalCash ?? 0, Checks = b.TotalChecks ?? 0, Coins = b.TotalEnvelopes ?? 0, Total = (b.TotalCash ?? 0) + (b.TotalChecks ?? 0) + (b.TotalEnvelopes ?? 0), }; var list = q.ToList(); var t = new DepositInfo { BundleId = "TOTALS", Cash = list.Sum(b => b.Cash), Checks = list.Sum(b => b.Checks), Coins = list.Sum(b => b.Coins), Total = list.Sum(b => b.Cash + b.Checks + b.Coins), }; list.Add(t); return(list); }
public List<DepositInfo> FetchDepositBundles(DateTime depositdt) { var q = from b in DbUtil.Db.BundleHeaders where b.DepositDate == depositdt orderby b.BundleHeaderId select new DepositInfo { BundleId = b.BundleHeaderId.ToString(), Cash = b.TotalCash ?? 0, Checks = b.TotalChecks ?? 0, Coins = b.TotalEnvelopes ?? 0, Total = (b.TotalCash ?? 0) + (b.TotalChecks ?? 0) + (b.TotalEnvelopes ?? 0), }; var list = q.ToList(); var t = new DepositInfo { BundleId = "TOTALS", Cash = list.Sum(b => b.Cash), Checks = list.Sum(b => b.Checks), Coins = list.Sum(b => b.Coins), Total = list.Sum(b => b.Cash + b.Checks + b.Coins), }; list.Add(t); return list; }