public ActionResult LoNhap(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 <Sach> DMSach = SachManager.getAll()
                              .Where(s => s.tongSoLuongNhapTheoThang(
                                         ((DateTime)startDate).Month,
                                         ((DateTime)startDate).Year,
                                         ((DateTime)endDate).Month,
                                         ((DateTime)endDate).Year) > 0 &&
                                     s.tongTienNhapTheoThang(
                                         ((DateTime)startDate).Month,
                                         ((DateTime)startDate).Year,
                                         ((DateTime)endDate).Month,
                                         ((DateTime)endDate).Year) > 0).ToList();
         if (!String.IsNullOrEmpty(search))
         {
             DMSach            = SachManager.filter(search, DMSach);
             ViewBag.SearchKey = search;
         }
         ViewBag.tongSoLuongNhap = DMSach.Sum(s => s.SoLuongNhapTheoThang);
         ViewBag.tongTienNhap    = DMSach.Sum(s => s.TongTienNhapTheoThang);
         var models = DMSach.ToPagedList(page, pageSize);
         setAlertMessage();
         return(View(models));
     }
     setAlertMessage();
     return(View());
 }
Beispiel #2
0
 private void LoadTT()
 {
     _Sach = SachManager.getAll()
             .Where(s => s.tongSoLuongBanTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0 &&
                    s.tongTienBanTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList();
     gdvDMSach.DataSource = _Sach;
     lbSachBanDuoc.Text   = _Sach.Sum(s => s.TongSoLuongBanTheoThang) + "";
     lbTongTien.Text      = _Sach.Sum(s => s.TongTienBanTheoThang) + "";
 }
Beispiel #3
0
 private void loadTT()
 {
     if (x == 1)
     {
         _DMSachNXB = SachManager.getAll()
                      .Where(s => s.tongSoLuongNXBNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0 &&
                             s.tongTienNXBNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList();
         gdvDMSach.DataSource = _DMSachNXB;
         lbSoLuongNo.Text     = _DMSachNXB.Sum(s => s.TongSoLuongNXBNoTheoThang) + "";
         lbTongTien.Text      = _DMSachNXB.Sum(s => s.TongTienNXBNoTheoThang) + "";
     }
     if (x == 2)
     {
         _DMSachDLy = SachManager.getAll()
                      .Where(s => s.tongSoLuongDaiLyNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0 && s.tongTienDaiLyNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList();
         gdvDMSach.DataSource = _DMSachDLy;
         lbSoLuongNo.Text     = _DMSachDLy.Sum(s => s.TongSoLuongDaiLyNoTheoThang) + "";
         lbTongTien.Text      = _DMSachDLy.Sum(s => s.TongTienDaiLyNoTheoTang) + "";
     }
 }
        public FileStreamResult LoNhap(DateTime startDate, DateTime endDate)
        {
            List <Sach> DMSach = SachManager.getAll()
                                 .Where(s => s.tongSoLuongNhapTheoThang(
                                            ((DateTime)startDate).Month,
                                            ((DateTime)startDate).Year,
                                            ((DateTime)endDate).Month,
                                            ((DateTime)endDate).Year) > 0 &&
                                        s.tongTienNhapTheoThang(
                                            ((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ê lô nhập";
            var info = new MemoryStream(printer.printLoNhap(DMSach, startDate, endDate));

            return(new FileStreamResult(info, "application/pdf"));
        }
Beispiel #5
0
 public void loadSach()
 {
     _DMSach = SachManager.getAll();
 }