public ModelLineItem CustomerAwards(int agencyid, decimal start, decimal end) { var query = from c in FDIDB.ReceiveHistories where c.AgencyId == agencyid && c.Date >= start && c.Date < end select new ValueAnalysisItem { Value = c.Price, Date = c.Date, }; var query1 = from c in FDIDB.RewardHistories where c.Date >= start && c.Date < end select new ValueAnalysisItem { Value = c.Price, Date = c.Date, }; var obj = new LineItem { Line = "Rút lũy", ListLine = query }; var obj1 = new LineItem { Line = "Tích lũy", ListLine = query1 }; IEnumerable <LineItem> arr = new[] { obj1, obj }; var model = new ModelLineItem { ListItem = arr }; return(model); }
public ModelLineItem Revenue(int agencyid, decimal start, decimal end) { var query = from c in FDIDB.PaymentVouchers where c.AgencyId == agencyid && c.DateCreated >= start && c.DateCreated < end select new ValueAnalysisItem { Value = c.Price, Date = c.DateCreated, }; var query1 = from c in FDIDB.ReceiptVouchers where c.AgencyId == agencyid && c.DateCreated >= start && c.DateCreated < end select new ValueAnalysisItem { Value = c.Price, Date = c.DateCreated, }; var query2 = from c in FDIDB.Shop_Orders where c.AgencyId == agencyid && c.Status < 4 && c.DateCreated >= start && c.DateCreated < end select new ValueAnalysisItem { Value = c.TotalPrice, Date = c.DateCreated, }; var obj = new LineItem { Line = "Thu", ListLine = query }; var obj1 = new LineItem { Line = "Chi", ListLine = query1 }; var obj2 = new LineItem { Line = "Đơn hàng", ListLine = query2 }; IEnumerable <LineItem> arr = new[] { obj1, obj, obj2 }; var model = new ModelLineItem { ListItem = arr }; return(model); }