// GET: Sach/Edit/5 public ActionResult Edit(int?id) { if (id == null) { putErrorMessage("Đường dẫn không chính xác"); return(RedirectToAction("Index")); } var model = SachManager.find((int)id); if (model == null || model.TrangThai == 0) { putErrorMessage("Không tìm thấy"); return(RedirectToAction("Index")); } //Combobox Nhà xuất bản ViewBag.DMNXB = new SelectList(NhaXuatBanManager.getAllAlive(), nameof(NhaXuatBanManager.Properties.MaSoNXB), nameof(NhaXuatBanManager.Properties.TenNXB), ""); //Combobox lĩnh vực ViewBag.DMLinhVuc = new SelectList(LinhVucManager.getAllALive(), nameof(LinhVucManager.Properties.MaSoLinhVuc), nameof(LinhVucManager.Properties.TenLinhVuc), ""); if (model.HinhAnh != null) { ViewBag.imgSrc = ImagesHelper.ImageToDataBase64String(model.HinhAnhTypeImage); } setAlertMessage(); return(View(model)); }
// GET: PhieuNhap/Create public ActionResult Create(int?masonxb) { if (masonxb != null) { var nxb = NhaXuatBanManager.find((int)masonxb); if (nxb == null || nxb.TrangThai == 0) { putErrorMessage("Không tìm thấy Nhà xuát bản"); return(RedirectToAction("Create")); } ViewBag.cultureInfo = CultureInfo; ViewBag.currentNXB = nxb; ViewBag.DMSach = new SelectList(nxb.Sach, nameof(SachManager.Properties.MaSoSach), nameof(SachManager.Properties.TenSach), ""); if (_phieu == null) { _phieu = new PhieuNhap(); } _phieu.MaSoNXB = nxb.MaSoNXB; _phieu.NXB = nxb; _phieu.NgayLap = DateTime.Now; setAlertMessage(); return(View(_phieu)); } else { ViewBag.DMNXB = new SelectList(NhaXuatBanManager.getAllAlive(), nameof(NhaXuatBanManager.Properties.MaSoNXB), nameof(NhaXuatBanManager.Properties.TenNXB), ""); _phieu = new PhieuNhap(); setAlertMessage(); return(View()); } }
public void loadNXB() { _DMNXB = NhaXuatBanManager.getAllAlive() .Where(nxb => nxb.tongTienNoThang(_startMonth, _startYear, _endMonth, _endYear) > 0 && nxb.tinhTongSoLuongNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0 && nxb.tongTienNhapThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList(); gdvDMNXB.DataSource = _DMNXB; _tongTienNo = _DMNXB.Sum(nxb => nxb.TongTienNoThang); _tongTienNhap = _DMNXB.Sum(nxb => nxb.TongTienNhapTheoThang); lbTongConNo.Text = String.Format(_cultureInfo, "{0:c}", _tongTienNo); lbTongTienSach.Text = String.Format(_cultureInfo, "{0:c}", _tongTienNhap); lbTongDaChi.Text = String.Format(_cultureInfo, "{0:c}", _tongTienNhap - _tongTienNo); }
public ActionResult DoanhThu(DateTime?startDate, DateTime?endDate, int dlpage = 1, int dlpageSize = 10, int nxbpage = 1, int nxbpageSize = 10, string searchDaiLy = null, string searchNXB = null) { if (startDate != null && endDate != null) { ViewBag.cultureInfo = CultureInfo; ViewBag.startDate = startDate; ViewBag.endDate = endDate; List <DaiLy> DMDaily = DaiLyManager.getAllAlive() .Where(dl => dl.tinhTongTienThanhToanTheoThang( ((DateTime)startDate).Month, ((DateTime)startDate).Year, ((DateTime)endDate).Month, ((DateTime)endDate).Year) > 0).ToList(); ViewBag.tongTienThu = DMDaily.Sum(s => s.TongTienThanhToanTheoThang); if (!String.IsNullOrEmpty(searchDaiLy)) { DMDaily = DaiLyManager.filter(searchDaiLy, DMDaily); ViewBag.SearchKeyDaiLy = searchDaiLy; } List <NhaXuatBan> DMNXB = NhaXuatBanManager.getAllAlive() .Where(nxb => nxb.tinhTongTienThanhToanTheoThang( ((DateTime)startDate).Month, ((DateTime)startDate).Year, ((DateTime)endDate).Month, ((DateTime)endDate).Year) > 0).ToList(); ViewBag.tongTienChi = DMNXB.Sum(s => s.TongTienThanhToanTheoThang); if (!String.IsNullOrEmpty(searchNXB)) { DMNXB = NhaXuatBanManager.filter(searchNXB, DMNXB); ViewBag.SearchKeyNXB = searchNXB; } ViewBag.tongCongDaiLy = DMDaily.Sum(dl => dl.TongTienThanhToan); ViewBag.tongCongDaiLyTheoThang = DMDaily.Sum(dl => dl.TongTienThanhToanTheoThang); ViewBag.tongCongNXB = DMNXB.Sum(nxb => nxb.TongTienThanhToan); ViewBag.tongCongNXBTheoThang = DMNXB.Sum(nxb => nxb.TongTienThanhToanTheoThang); ViewBag.DaiLymodels = DMDaily.ToPagedList(dlpage, dlpageSize); ViewBag.NXBmodels = DMNXB.ToPagedList(nxbpage, nxbpageSize); setAlertMessage(); return(View()); } setAlertMessage(); return(View()); }
// GET: Sach/Create public ActionResult Create() { var model = new Sach(); //Combobox nhà xuất bản ViewBag.DMNXB = new SelectList(NhaXuatBanManager.getAllAlive(), nameof(NhaXuatBanManager.Properties.MaSoNXB), nameof(NhaXuatBanManager.Properties.TenNXB), ""); //Combobox lĩnh vực ViewBag.DMLinhVuc = new SelectList(LinhVucManager.getAllALive(), nameof(LinhVucManager.Properties.MaSoLinhVuc), nameof(LinhVucManager.Properties.TenLinhVuc), ""); setAlertMessage(); return(View(model)); }
private void LoadTT() { _DSDaiLy = DaiLyManager.getAllAlive() .Where(dl => dl.tinhTongTienThanhToanTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList(); gdvDaiLy.DataSource = _DSDaiLy; lbTongThu.Text = _DSDaiLy.Sum(s => s.TongTienThanhToanTheoThang) + ""; int tongthu = int.Parse(lbTongThu.Text.ToString()); _DSNXB = NhaXuatBanManager.getAllAlive() .Where(dl => dl.tinhTongTienThanhToanTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList(); gdvNXB.DataSource = _DSNXB; lbTongChi.Text = _DSNXB.Sum(s => s.TongTienThanhToanTheoThang) + ""; int tongchi = int.Parse(lbTongChi.Text.ToString()); lbLoiNhuan.Text = tongthu - tongchi + ""; }
// GET: NhaXuatBan public ActionResult Index(int page = 1, int pageSize = 10, string search = null) { List <NhaXuatBan> DMNXB = null; if (!String.IsNullOrEmpty(search)) { DMNXB = NhaXuatBanManager.filter(search); ViewBag.searchKey = search; } else { DMNXB = NhaXuatBanManager.getAllAlive(); } var models = DMNXB.ToPagedList(page, pageSize); setAlertMessage(); return(View(models)); }
public ActionResult TheoDoi(DateTime?startDate, DateTime?endDate, int page = 1, int pageSize = 10, string search = null) { if (startDate != null && endDate != null) { ViewBag.cultureInfo = CultureInfo; ViewBag.startDate = startDate; ViewBag.endDate = endDate; List <NhaXuatBan> DMNXB = NhaXuatBanManager.getAllAlive() .Where(nxb => nxb.tinhTongSoLuongNoTheoThang( ((DateTime)startDate).Month, ((DateTime)startDate).Year, ((DateTime)endDate).Month, ((DateTime)endDate).Year) > 0 && nxb.tongTienNoThang( ((DateTime)startDate).Month, ((DateTime)startDate).Year, ((DateTime)endDate).Month, ((DateTime)endDate).Year) > 0 && nxb.tongTienNhapThang( ((DateTime)startDate).Month, ((DateTime)startDate).Year, ((DateTime)endDate).Month, ((DateTime)endDate).Year) > 0).ToList(); if (!String.IsNullOrEmpty(search)) { DMNXB = NhaXuatBanManager.filter(search, DMNXB); ViewBag.SearchKey = search; } ViewBag.tongTienNhap = DMNXB.Sum(nxb => nxb.TongTienNhapTheoThang); ViewBag.tongSoLuongNo = DMNXB.Sum(nxb => nxb.TongSoLuongNoTheoThang); ViewBag.tongTienNo = DMNXB.Sum(s => s.TongTienNoThang); var models = DMNXB.ToPagedList(page, pageSize); setAlertMessage(); return(View(models)); } setAlertMessage(); return(View()); }
public FileStreamResult DoanhThu(DateTime startDate, DateTime endDate) { List <DaiLy> DMDaily = DaiLyManager.getAllAlive() .Where(dl => dl.tinhTongTienThanhToanTheoThang( ((DateTime)startDate).Month, ((DateTime)startDate).Year, ((DateTime)endDate).Month, ((DateTime)endDate).Year) > 0).ToList(); List <NhaXuatBan> DMNXB = NhaXuatBanManager.getAllAlive() .Where(nxb => nxb.tinhTongTienThanhToanTheoThang( ((DateTime)startDate).Month, ((DateTime)startDate).Year, ((DateTime)endDate).Month, ((DateTime)endDate).Year) > 0).ToList(); var printer = new PrintHelper(); printer.FileName = "report.pdf"; printer.FolderPath = "D://"; printer.Title = "Thống kê doanh thu"; var info = new MemoryStream(printer.printDoanhThu(DMDaily, DMNXB, startDate, endDate)); return(new FileStreamResult(info, "application/pdf")); }
// GET: PhieuNhap/ThanhToan public ActionResult ThanhToan(int?masonxb) { if (masonxb != null) { var nxb = NhaXuatBanManager.find((int)masonxb); if (nxb == null || nxb.TrangThai == 0) { putErrorMessage("Không tìm thấy nhà xuất bản"); return(RedirectToAction("ThanhToan")); } ViewBag.cultureInfo = CultureInfo; ViewBag.currentNXB = nxb; ViewBag.DMSach = new SelectList(nxb.Sach.Where(s => s.CongNoNXB.Count > 0).ToList(), nameof(SachManager.Properties.MaSoSach), nameof(SachManager.Properties.TenSach), ""); if (_hoadon == null) { _hoadon = new HoaDonNXB(); } _hoadon.MaSoNXB = nxb.MaSoNXB; _hoadon.NXB = nxb; _hoadon.NgayLap = DateTime.Now; setAlertMessage(); return(View(_hoadon)); } else { ViewBag.DMNXB = new SelectList(NhaXuatBanManager.getAllAlive() .Where(nxb => nxb.TongTienNo > 0).ToList(), nameof(NhaXuatBanManager.Properties.MaSoNXB), nameof(NhaXuatBanManager.Properties.TenNXB), ""); _hoadon = new HoaDonNXB(); setAlertMessage(); return(View()); } }
/// <summary> /// Load danh sách NXB và đưa lên giao diện /// </summary> public void loadNXB() { _DMNXB = NhaXuatBanManager.getAllAlive(); gdvDMNXB.DataSource = _DMNXB; }