예제 #1
0
 public void loadTheKho()
 {
     _DMTheKho            = TheKhoManager.getAllByDate(dtpNgayGhi.Value);
     gdvTheKho.DataSource = _DMTheKho;
     _tongLuongSach       = _DMTheKho.Sum(tk => tk.SoLuong);
     lbTongLuongSach.Text = _tongLuongSach.ToString();
 }
        public ActionResult TonKho(DateTime?date, int page = 1, int pageSize = 10, string search = null)
        {
            if (date != null)
            {
                List <TheKho> DMTheKho = null;
                if (!String.IsNullOrEmpty(search))
                {
                    DMTheKho          = TheKhoManager.filter(search, TheKhoManager.getAllByDate((DateTime)date));
                    ViewBag.SearchKey = search;
                }
                else
                {
                    DMTheKho = TheKhoManager.getAllByDate((DateTime)date);
                }
                ViewBag.tongLuongSach = DMTheKho.Sum(tk => tk.SoLuong);
                ViewBag.cultureInfo   = CultureInfo;
                ViewBag.currentDate   = date;

                var models = DMTheKho.ToPagedList(page, pageSize);
                setAlertMessage();
                return(View(models));
            }
            setAlertMessage();
            return(View());
        }
        public FileStreamResult TonKho(DateTime date)
        {
            var models  = TheKhoManager.getAllByDate(date);
            var printer = new PrintHelper();

            printer.FileName   = "report.pdf";
            printer.FolderPath = "D://";
            printer.Title      = "Thống kê tồn kho";
            var info = new MemoryStream(printer.printTonKho(models, date));

            return(new FileStreamResult(info, "application/pdf"));
        }