// GET: Admin/PhieuPhatHanhs/Create public ActionResult Create(int loaiVeSoId, System.DateTime ngayPhat) { ViewBag.LoaiVeSo = db.LoaiVeSoes.Where(m => m.LoaiVeSoId == loaiVeSoId).Select(m => m.TenTinh).SingleOrDefault(); ViewBag.NgayPhatHanh = ngayPhat; DotPhatHanh dotPhatHanh = new DotPhatHanh(); dotPhatHanh.NgayPhat = ngayPhat; dotPhatHanh.LoaiVeSoId = loaiVeSoId; List <PhieuPhatHanhVM> listPhieuPhatHanh = new List <PhieuPhatHanhVM>(); var listDaiLyId = db.DaiLies.Select(m => m.DaiLyId).ToList(); foreach (var item in listDaiLyId) { PhieuPhatHanhVM phieuPhatHanhVM = new PhieuPhatHanhVM(); phieuPhatHanhVM.DaiLyId = item; DaiLyBus daiLyBus = new DaiLyBus(); phieuPhatHanhVM.SLPhat = daiLyBus.TinhToanSLPhatTheoDaiLy(loaiVeSoId, item, ngayPhat); phieuPhatHanhVM.TenDaiLy = db.DaiLies.Where(m => m.DaiLyId == item).Select(m => m.TenDaiLy).SingleOrDefault(); listPhieuPhatHanh.Add(phieuPhatHanhVM); } dotPhatHanh.ListPhieuPhatHanh = listPhieuPhatHanh; return(View(dotPhatHanh)); }
// GET: Admin/QuanLyCongNo public ActionResult Index(System.DateTime?ngayCanTim) { ViewBag.DateNow = System.DateTime.Now.ToString("yyyy-MM-dd"); System.DateTime ngayCanTimGan = ngayCanTim.GetValueOrDefault(System.DateTime.Now); DaiLyBus daiLyBus = new DaiLyBus(); List <PhieuCongNo> listPhieuCongNo = new List <PhieuCongNo>(); foreach (var item in db.DaiLies) { PhieuCongNo phieuCongNo = new PhieuCongNo(); phieuCongNo.DaiLyId = item.DaiLyId; phieuCongNo.TenDaiLy = item.TenDaiLy; phieuCongNo.TaiKhoan = daiLyBus.TinhToanCongNoTheoDaiLy(item.DaiLyId, ngayCanTimGan); listPhieuCongNo.Add(phieuCongNo); } return(View(listPhieuCongNo)); }