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);
            }
        }
Example #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);
        }