Beispiel #1
0
        internal static List <HoaDon_View> getAll_HoaDon_TheoThoiGian(DateTime startD, DateTime endD)
        {
            var hd = from hoadon in Context.getInstance().db.HOADONs
                     where hoadon.NgayLap >= startD.Date
                     where hoadon.NgayLap <= endD.Date
                     select new HoaDon_View
            {
                MaHoaDon       = hoadon.MaHoaDon,
                NgayLap        = hoadon.NgayLap,
                NhanVien       = hoadon.NHANVIEN1.TenNhanVien,
                MaNhanVien     = hoadon.MaNguoiLap,
                TongTien       = hoadon.TongTien,
                TongLoiNhuan   = hoadon.TongLoiNhuan,
                TrangThai      = hoadon.TrangThai,
                KhachHang      = hoadon.KHACHHANG.TenKhachHang,
                MaKhachHang    = hoadon.MaKhachHang,
                SoDienThoai    = hoadon.KHACHHANG.SoDienThoai,
                MaNhanVienSua  = hoadon.MaNguoiSua,
                TenNhanVienSua = hoadon.NHANVIEN.TenNhanVien,
                NgaySua        = (DateTime)hoadon.NgaySua,
                GhiChu         = hoadon.GhiChu
            };
            var khp = hd.ToList();

            foreach (var item in khp)
            {
                item.ChiTietHoaDon = CT_HoaDon_DAL.get_CTHoaDon_By_MaHD_TT01(item.MaHoaDon);
                item.InitOldData();
                if (item.TrangThai == 0)
                {
                    item.Mode = TT.DELETE;
                }
            }
            return(khp);
        }
Beispiel #2
0
        public static HoaDon_View get_HoaDon_By_MaHD(string maHD)
        {
            var hd = from hoadon in Context.getInstance().db.HOADONs
                     where hoadon.MaHoaDon == maHD
                     select new HoaDon_View
            {
                MaHoaDon       = hoadon.MaHoaDon,
                NgayLap        = hoadon.NgayLap,
                NhanVien       = hoadon.NHANVIEN1.TenNhanVien,
                MaNhanVien     = hoadon.MaNguoiLap,
                TongTien       = hoadon.TongTien,
                TongLoiNhuan   = hoadon.TongLoiNhuan,
                TrangThai      = hoadon.TrangThai,
                KhachHang      = hoadon.KHACHHANG.TenKhachHang,
                MaKhachHang    = hoadon.MaKhachHang,
                SoDienThoai    = hoadon.KHACHHANG.SoDienThoai,
                MaNhanVienSua  = hoadon.MaNguoiSua,
                TenNhanVienSua = hoadon.NHANVIEN.TenNhanVien,
                NgaySua        = (DateTime)hoadon.NgaySua,
                GhiChu         = hoadon.GhiChu
            };
            HoaDon_View hdV = hd.ToList()[0];

            hdV.ChiTietHoaDon = CT_HoaDon_DAL.get_CTHoaDon_By_MaHD_TT01(hdV.MaHoaDon);
            hdV.InitOldData();
            if (hdV.TrangThai == 0)
            {
                hdV.Mode = TT.DELETE;
            }
            return(hdV);
        }