Exemple #1
0
 public ActionResult Index()
 {
     ViewBag.lstNhaKho   = khoDao.GetNhaKhos();
     ViewBag.lstViTriSua = vitrisuaDao.GetVitriSuas();
     ViewBag.selectNSS   = new SelectList(NhomspDao.GetNhomSanPhams().Where(x => x.Status == true), "ID_Nhom", "TenNhom");
     ViewBag.selectNCC   = new SelectList(nhacugcapDao.GetNhacugcaps().Where(x => x.Status == true), "MaNCC", "TenNCC");
     ViewBag.selectHH    = new SelectList(SanPhamDao.GetSanPhams().Where(x => x.Status == true), "MaHH", "TenHH");
     return(View(SanPhamDao.GetSanPhams().Where(x => x.Status == true).ToList()));
 }
Exemple #2
0
 public ActionResult Index()
 {
     ViewBag.SP = SanPhamDao.GetSanPhams();
     ViewBag.XK = new dbQLKhoEntities().CT_XuatKho.ToList();
     ViewBag.NV = nhanvienDao.GetNhanViens();
     return(View());
 }
        public ActionResult Index(int ID_PhieuNhap, string export_excel = null)
        {
            var pn = phieunhapDao.GetPhieuNhaps().FirstOrDefault(q => q.ID_PhieuNhap == ID_PhieuNhap);

            ViewBag.phieuNhap = pn;
            var data = SanPhamDao.GetSanPhams().Where(q => q.ID_PhieuNhap == ID_PhieuNhap).ToList();

            if (string.IsNullOrWhiteSpace(export_excel) == false && data != null && data.Count > 0)
            {
                XLWorkbook wb        = new XLWorkbook(Server.MapPath(@"\Content\Export\phieunhap.xlsx"));
                var        ws        = wb.Worksheet(1);
                var        index_row = 5;

                ws.Row(index_row++).Cell(5).Value = pn.ID_PhieuNhap;
                ws.Row(index_row++).Cell(5).Value = pn.ThoiGian;
                ws.Row(index_row++).Cell(5).Value = string.Format("{0} - {1}", pn.NhanVien.MaNV, pn.NhanVien.TenNV);

                index_row = 10;
                for (int i = 0; i < data.Count; i++)
                {
                    var item      = data[i];
                    var index_col = 1;
                    ws.Row(index_row).Cell(index_col++).Value = i + 1;
                    ws.Row(index_row).Cell(index_col++).Value = item.MaHH;
                    ws.Row(index_row).Cell(index_col++).Value = item.NSX;
                    ws.Row(index_row).Cell(index_col++).Value = item.HSD;
                    ws.Row(index_row).Cell(index_col++).Value = item.NhaCungCap.TenNCC;
                    ws.Row(index_row).Cell(index_col++).Value = string.Format("Tầng {0} - Hàng {1} - Cột {2}", item.Tang, item.Hang, item.Cot);
                    ws.Row(index_row).Cell(index_col++).Value = string.Format("{0:0,0}", item.DonGia);
                    ws.Row(index_row).Cell(index_col++).Value = item.SoLuongTon;
                    ws.Row(index_row).Cell(index_col++).Value = string.Format("{0:0,0}", item.DonGia * item.SoLuongTon);
                }

                using (MemoryStream stream = new MemoryStream())
                {
                    wb.SaveAs(stream);
                    return(File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
                }
            }
            return(View(data));
        }
 public ActionResult Index()
 {
     return View(SanPhamDao.GetSanPhams());
 }