Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            NhapXuatTon nhapXuatTon = db.NhapXuatTons.Find(id);

            db.NhapXuatTons.Remove(nhapXuatTon);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "STT,MaHangHoa,SoNhap,SoXuat,SoTon")] NhapXuatTon nhapXuatTon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhapXuatTon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(nhapXuatTon));
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "id,Nhap,Xuat,Ton,VatTu_id")] NhapXuatTon nhapXuatTon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhapXuatTon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.VatTu_id = new SelectList(db.VatTus, "id", "TenVatTu", nhapXuatTon.VatTu_id);
     return(View(nhapXuatTon));
 }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Mahanghoa,STT,SoNhap,SoXuat,SoTon")] NhapXuatTon nhapXuatTon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nhapXuatTon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Mahanghoa = new SelectList(db.Hanghoas, "Mahanghoa", "Tenhanghoa", nhapXuatTon.Mahanghoa);
     return(View(nhapXuatTon));
 }
        public ActionResult Create([Bind(Include = "STT,MaHangHoa,SoNhap,SoXuat,SoTon")] NhapXuatTon nhapXuatTon)
        {
            if (ModelState.IsValid)
            {
                db.NhapXuatTons.Add(nhapXuatTon);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(nhapXuatTon));
        }
Exemplo n.º 6
0
        public ActionResult Create([Bind(Include = "id,Nhap,Xuat,Ton,VatTu_id")] NhapXuatTon nhapXuatTon)
        {
            if (ModelState.IsValid)
            {
                db.NhapXuatTons.Add(nhapXuatTon);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.VatTu_id = new SelectList(db.VatTus, "id", "TenVatTu", nhapXuatTon.VatTu_id);
            return(View(nhapXuatTon));
        }
Exemplo n.º 7
0
        public ActionResult Create([Bind(Include = "Mahanghoa,STT,SoNhap,SoXuat,SoTon")] NhapXuatTon nhapXuatTon)
        {
            if (ModelState.IsValid)
            {
                db.NhapXuatTons.Add(nhapXuatTon);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Mahanghoa = new SelectList(db.Hanghoas, "Mahanghoa", "Tenhanghoa", nhapXuatTon.Mahanghoa);
            return(View(nhapXuatTon));
        }
Exemplo n.º 8
0
        // GET: Admin/NhapXuatTons/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NhapXuatTon nhapXuatTon = db.NhapXuatTons.Find(id);

            if (nhapXuatTon == null)
            {
                return(HttpNotFound());
            }
            return(View(nhapXuatTon));
        }
Exemplo n.º 9
0
        // GET: Admin/NhapXuatTons/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NhapXuatTon nhapXuatTon = db.NhapXuatTons.Find(id);

            if (nhapXuatTon == null)
            {
                return(HttpNotFound());
            }
            ViewBag.VatTu_id = new SelectList(db.VatTus, "id", "TenVatTu", nhapXuatTon.VatTu_id);
            return(View(nhapXuatTon));
        }
Exemplo n.º 10
0
        // GET: NhapXuatTons/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NhapXuatTon nhapXuatTon = db.NhapXuatTons.Find(id);

            if (nhapXuatTon == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Mahanghoa = new SelectList(db.Hanghoas, "Mahanghoa", "Tenhanghoa", nhapXuatTon.Mahanghoa);
            return(View(nhapXuatTon));
        }
Exemplo n.º 11
0
        public List <NhapXuatTon> getListNhapXuatTon(int check, string maKho)
        {
            List <NhapXuatTon> ListNhapXuatTon = new List <NhapXuatTon>();
            DataTable          data;

            if (check == 0)
            {
                data = tk.getTonKho();
            }
            else
            {
                data = tk.getTonKhoFromMaKho(maKho);
            }

            if (data.Rows.Count > 0)
            {
                foreach (DataRow dataRow in data.Rows)
                {
                    NhapXuatTon x = new NhapXuatTon();
                    x.MaHang    = dataRow["MaHang"].ToString();
                    x.TenHang   = dataRow["TenHang"].ToString();
                    x.TenKho    = dataRow["TenKho"].ToString();
                    x.MaKho     = dataRow["MaKho"].ToString();;
                    x.ConQuanLy = bool.Parse(dataRow["Active"].ToString());
                    x.DonVi     = dataRow["Ten"].ToString();
                    x.slDauKy   = 0;
                    x.TienDauKy = 0;
                    if (getSumSoLuongNhap(x.MaHang, x.MaKho).ToString() == "")
                    {
                        x.slNhapKho = 0;
                    }
                    else
                    {
                        x.slNhapKho = Convert.ToInt32(getSumSoLuongNhap(x.MaHang, x.MaKho));
                    }

                    if (getSumTongTienNhap(x.MaHang, x.MaKho).ToString() == "")
                    {
                        x.TienNhapKho = 0;
                    }
                    else
                    {
                        x.TienNhapKho = (float)Convert.ToDouble(getSumTongTienNhap(x.MaHang, x.MaKho));
                    }

                    if (getSumSoLuongXuat(x.MaHang, x.MaKho).ToString() == "")
                    {
                        x.slXuatKho = 0;
                    }
                    else
                    {
                        x.slXuatKho = Convert.ToInt32(getSumSoLuongXuat(x.MaHang, x.MaKho));
                    }

                    if (getSumTongTienXuat(x.MaHang, x.MaKho).ToString() == "")
                    {
                        x.TienXuatKho = 0;
                    }
                    else
                    {
                        x.TienXuatKho = (float)Convert.ToDouble(getSumTongTienXuat(x.MaHang, x.MaKho));
                    }

                    x.slCuoiKy   = x.slNhapKho - x.slXuatKho;
                    x.TienCuoiKy = x.TienNhapKho - x.TienXuatKho;
                    ListNhapXuatTon.Add(x);
                }
            }
            return(ListNhapXuatTon);
        }