public ActionResult BaoCao() { if (this.CheckNoAccessIntoNhaXe(_workContext, _permissionService, StandardPermissionProvider.CVBaoCao)) { return(AccessDeniedView()); } var model = new ChiPhiXeListModel(); var hangmucs = _chiphixeService.GetAllHangMucChiPhi(_workContext.NhaXeId); model.hangmucs = hangmucs.Select(c => new SelectListItem { Value = c.Id.ToString(), Text = c.Ten }).ToList(); model.hangmucs.Insert(0, new SelectListItem { Value = "0", Text = "----Chọn hạng mục----" }); model.AllXeInfo = _xeinfoService.GetAllXeInfoByNhaXeId(_workContext.NhaXeId).Select(c => { return(new XeXuatBenItemModel.XeVanChuyenInfo(c.Id, c.BienSo)); }).ToList(); model.TuNgay = DateTime.Now.AddMonths(-1); model.DenNgay = DateTime.Now; return(View(model)); }
public ActionResult ListChiPhiBaoCao(DataSourceRequest command, ChiPhiXeListModel model) { var items = _chiphixeService.GetAllChiPhiXes(_workContext.NhaXeId, model.XeVanChuyenListId, model.HangMucChiPhiListId, model.TuNgay, model.DenNgay); var xeids = items.Select(c => c.XeVanChuyenId).ToArray(); var xeinfos = _xeinfoService.GetAllXeInfoByNhaXeId(_workContext.NhaXeId).Where(c => xeids.Contains(c.Id)).ToList(); var models = new List <ChiPhiXeModel>(); foreach (var xe in xeinfos) { var m = new ChiPhiXeModel(); m.BienSo = xe.BienSo; m.TenLaiXe = xe.laixe != null ? xe.laixe.HoVaTen : ""; var chiphis = items.Where(c => c.XeVanChuyenId == xe.Id).ToList(); if (chiphis.Count > 0) { m.TenHangMuc = chiphis[0].hangmuc.Ten; m.ChiPhi = chiphis.Sum(c => c.ChiPhi); } models.Add(m); } var gridModel = new DataSourceResult { Data = models, Total = models.Count }; return(Json(gridModel)); }
public ActionResult ListChiPhi(DataSourceRequest command, ChiPhiXeListModel model) { var items = _chiphixeService.GetAllChiPhiXes(_workContext.NhaXeId, model.XeVanChuyenListId, model.HangMucChiPhiListId, model.TuNgay, model.DenNgay); var gridModel = new DataSourceResult { Data = items.Select(x => { var modelcp = toModel(x); return(modelcp); }), Total = items.Count }; return(Json(gridModel)); }