Esempio n. 1
0
        public DataTable DataTable_DSP(List <PhieuCheckIn_Ent> dsPCI)
        {
            Phong_WCFClient     ph_wcf = new Phong_WCFClient();
            KhachHang_WCFClient kh_wcf = new KhachHang_WCFClient();
            DichVu_WCFClient    dv_wcf = new DichVu_WCFClient();
            DataTable           dt     = new DataTable();

            dt.Columns.Add("Mã Phiếu Check In", typeof(string));
            dt.Columns.Add("Loại Phòng", typeof(string));
            dt.Columns.Add("Số Phòng", typeof(string));
            dt.Columns.Add("Họ Tên Khách Hàng", typeof(string));
            dt.Columns.Add("Thời Gian Check In", typeof(string));
            dt.Columns.Add("Thời gian Check Out", typeof(string));
            dt.Columns.Add("Tên Dịch Vụ", typeof(string));
            dt.Columns.Add("Số Lượng Dịch Vụ", typeof(string));


            foreach (PhieuCheckIn_Ent p_ent in dsPCI)
            {
                string nameServ = dv_wcf.GetTenDichVu_byIdDichVu(p_ent.Id_DichVu);

                dt.Rows.Add(p_ent.Id_phieu_checkin, ph_wcf.GetTenLoaiPhong_by_IDLoai(p_ent.Id_Phong), ph_wcf.getsoPhong_byID(p_ent.Id_Phong), kh_wcf.getHoKhacHang_byID(p_ent.Id_khach) + " " + kh_wcf.getTenKhacHang_byID(p_ent.Id_khach),
                            p_ent.Gio_check_in + " " + p_ent.Ngay_check_in.ToShortDateString(), p_ent.Gio_check_out + " " + p_ent.Ngay_check_out.ToShortDateString(), nameServ, p_ent.SoLuongDichVu.ToString());
            }
            return(dt);
        }
Esempio n. 2
0
        //DataTable
        public DataTable DataTable_DSP(List <PhieuCheckIn_Ent> dsPCI)
        {
            Phong_WCFClient     ph_wcf = new Phong_WCFClient();
            KhachHang_WCFClient kh_wcf = new KhachHang_WCFClient();
            DichVu_WCFClient    dv_wcf = new DichVu_WCFClient();
            DataTable           dt     = new DataTable();



            dt.Columns.Add("Mã Phiếu Check In", typeof(string));
            dt.Columns.Add("Loại Phòng", typeof(string));
            dt.Columns.Add("Số Phòng", typeof(string));
            dt.Columns.Add("Họ Tên Khách Hàng", typeof(string));
            dt.Columns.Add("Thời Gian Check In", typeof(string));
            dt.Columns.Add("Thời gian Check Out", typeof(string));
            dt.Columns.Add("Tên Dịch Vụ", typeof(string));
            dt.Columns.Add("Số Lượng Dịch Vụ", typeof(string));
            dt.Columns.Add("Tổng Tiền", typeof(string));
            dt.Columns.Add("Tình Trạng", typeof(string));

            //Lọc Dữ Liệu Phiếu Đặt Phòng và Phiếu Mua Bán Dịch Vụ
            foreach (PhieuCheckIn_Ent p_ent in dsPCI)
            {
                string nameServ = dv_wcf.GetTenDichVu_byIdDichVu(p_ent.Id_DichVu);

                if (p_ent.Id_DichVu != 0)
                {
                    string tinhTrang = "";

                    if (p_ent.TrangThaiHoaDon == 0)
                    {
                        tinhTrang = "Chưa Thanh Toán";
                    }
                    if (p_ent.TrangThaiHoaDon == 1)
                    {
                        tinhTrang = "Đã Thanh Toán";
                    }

                    dt.Rows.Add(p_ent.Id_phieu_checkin, ph_wcf.GetTenLoaiPhong_by_IDLoai(p_ent.Id_Phong), ph_wcf.getsoPhong_byID(p_ent.Id_Phong), kh_wcf.getHoKhacHang_byID(p_ent.Id_khach) + " " + kh_wcf.getTenKhacHang_byID(p_ent.Id_khach),
                                p_ent.Gio_check_in + " " + p_ent.Ngay_check_in.ToShortDateString(), p_ent.Gio_check_out + " " + p_ent.Ngay_check_out.ToShortDateString(), nameServ, p_ent.SoLuongDichVu.ToString(), (p_ent.SoLuongDichVu * dv_wcf.GetGiaDichVu_byIdDichVu(p_ent.Id_DichVu)), tinhTrang);
                }
                else
                {
                    TimeSpan date      = p_ent.Ngay_check_out - p_ent.Ngay_check_in;
                    decimal  donGia    = ph_wcf.DonGia(ph_wcf.GetIDLoaiPhong_by_IDPhong(p_ent.Id_Phong).ToString());
                    string   tienPhong = (donGia * Convert.ToInt32(date.Days)).ToString();

                    string tinhTrang = "";

                    if (p_ent.TrangThaiHoaDon == 0)
                    {
                        tinhTrang = "Trống";
                    }
                    if (p_ent.TrangThaiHoaDon == 1)
                    {
                        tinhTrang = "Có Khách";
                    }

                    dt.Rows.Add(p_ent.Id_phieu_checkin, ph_wcf.GetTenLoaiPhong_by_IDLoai(p_ent.Id_Phong), ph_wcf.getsoPhong_byID(p_ent.Id_Phong), kh_wcf.getHoKhacHang_byID(p_ent.Id_khach) + " " + kh_wcf.getTenKhacHang_byID(p_ent.Id_khach),
                                p_ent.Gio_check_in + " " + p_ent.Ngay_check_in.ToShortDateString(), p_ent.Gio_check_out + " " + p_ent.Ngay_check_out.ToShortDateString(), nameServ, p_ent.SoLuongDichVu.ToString(), tienPhong, tinhTrang);
                }
            }

            return(dt);
        }