public void HienThiChiTietPhieuNhap(String id, ListView lvw)
        {
            MaSanPhamController ctrlMSP = new MaSanPhamController();
            PhieuNhapController ctrlPN  = new PhieuNhapController();
            DataTable           tbl     = factory.LayChiTietPhieuNhap(id);

            lvw.Items.Clear();
            foreach (DataRow row in tbl.Rows)
            {
                ChiTietPhieuNhap ct = new ChiTietPhieuNhap();
                ct.MaSanPham = ctrlMSP.LayMaSanPham(Convert.ToString(row["ID_MA_SAN_PHAM"]));
                ct.PhieuNhap = ctrlPN.LayPhieuNhap(Convert.ToString((row["ID_PHIEU_NHAP"])));

                ListViewItem item = new ListViewItem(Convert.ToString(lvw.Items.Count + 1));
                item.SubItems.Add(ct.MaSanPham.SanPham.TenSanPham);
                item.SubItems.Add(ct.MaSanPham.Id);
                item.SubItems.Add(ct.MaSanPham.GiaNhap.ToString("#,###0"));
                item.SubItems.Add(ct.MaSanPham.SoLuong.ToString("#,###0"));
                long thanhtien = (ct.MaSanPham.SoLuong + ct.MaSanPham.GiaNhap);
                item.SubItems.Add(thanhtien.ToString("#,###0"));
                item.SubItems.Add(ct.MaSanPham.NgaySanXuat.ToString("dd/MM/yyyy"));
                item.SubItems.Add(ct.MaSanPham.NgayHetHan.ToString("dd/MM/yyyy"));

                item.Tag = ct;
                lvw.Items.Add(item);
            }
        }
Beispiel #2
0
        public IList <ChiTietPhieuBan> ChiTietPhieuBan(int thang, int nam)
        {
            IList <ChiTietPhieuBan> ds = new List <ChiTietPhieuBan>();

            DataTable tbl = factory.LayChiTietPhieuBan(thang, nam);

            foreach (DataRow row in tbl.Rows)
            {
                MaSanPhamController ctrl = new MaSanPhamController();
                ChiTietPhieuBan     ct   = new ChiTietPhieuBan();
                ct.DonGia    = Convert.ToInt64(row["DON_GIA"]);
                ct.SoLuong   = Convert.ToInt32(row["SO_LUONG"]);
                ct.ThanhTien = Convert.ToInt64(row["THANH_TIEN"]);
                ct.MaSanPham = ctrl.LayMaSanPham(Convert.ToString(row["ID_MA_SAN_PHAM"]));

                ds.Add(ct);
            }
            return(ds);
        }
        public PhieuNhap LayPhieuNhap(String id)
        {
            DataTable            tbl     = factory.LayPhieuNhap(id);
            PhieuNhap            ph      = null;
            NhaCungCapController ctrlNCC = new NhaCungCapController();

            if (tbl.Rows.Count > 0)
            {
                ph            = new PhieuNhap();
                ph.Id         = Convert.ToString(tbl.Rows[0]["ID"]);
                ph.NgayNhap   = Convert.ToDateTime(tbl.Rows[0]["NGAY_NHAP"]);
                ph.TongTien   = Convert.ToInt64(tbl.Rows[0]["TONG_TIEN"]);
                ph.DaTra      = Convert.ToInt64(tbl.Rows[0]["TONG_TIEN"]);
                ph.ConNo      = Convert.ToInt64(tbl.Rows[0]["TONG_TIEN"]);
                ph.NhaCungCap = ctrlNCC.LayNCC(Convert.ToString(tbl.Rows[0]["ID_NHA_CUNG_CAP"]));
                MaSanPhamController ctrl = new MaSanPhamController();
                ph.ChiTiet = ctrl.ChiTietPhieuNhap(ph.Id);
            }
            return(ph);
        }