public static List <HocPhiHocVien_PlusDTO> Select(HocPhiHocVienFilter _filter)
        {
            try
            {
                var query = (from obj in GlobalSettings.Database.HOCPHIHOCVIENs
                             select new HocPhiHocVien_PlusDTO
                {
                    HocPhiHocVienId = obj.HocPhiHocVienId,
                    HocVienId = obj.HocVienId,
                    TenHocVien = obj.HOCVIEN.TenHocVien,
                    Stt = obj.Stt,
                    DmDichVuId = obj.DmDichVuId,
                    TenDichVu = obj.TenDichVu,
                    SoTien = obj.SoTien,
                    SoLuong = obj.SoLuong,
                    PhieuThuId = obj.PhieuThuId,
                    GhiChu = obj.GhiChu,
                    IsRemove = obj.IsRemove,
                    CreatedDate = obj.CreatedDate,
                    CreatedBy = obj.CreatedBy,
                    CreatedLog = obj.CreatedLog,
                    ModifiedDate = obj.ModifiedDate,
                    ModifiedBy = obj.ModifiedBy,
                    ModifiedLog = obj.ModifiedLog,
                }).ToList();
                if (_filter.HocPhiHocVienId != null && _filter.HocPhiHocVienId != 0)
                {
                    query = query.Where(o => o.HocPhiHocVienId == _filter.HocPhiHocVienId).ToList();
                }
                if (_filter.HocVienId != null && _filter.HocVienId != 0)
                {
                    query = query.Where(o => o.HocVienId == _filter.HocVienId).ToList();
                }
                if (_filter.PhieuThuId != null && _filter.PhieuThuId != 0)
                {
                    query = query.Where(o => o.PhieuThuId == _filter.PhieuThuId).ToList();
                }
                if (_filter.CreatedDate_Tu != null && _filter.CreatedDate_Den != null)
                {
                    query = query.Where(o => o.CreatedDate >= _filter.CreatedDate_Tu && o.CreatedDate <= _filter.CreatedDate_Den).ToList();
                }
                return(query.ToList());
            }
            catch (System.Exception ex)
            {
                return(null);

                O2S_Common.Logging.LogSystem.Error(ex);
            }
        }
        private void InBienLaiThuTien(PHIEUTHU _phieuthu)
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));

                PHIEUGHIDANH _phieughidanh = PhieuGhiDanhLogic.SelectSingle(_phieuthu.PhieuGhiDanhId ?? 0);


                var rowHandle = gridViewDSHocVien.FocusedRowHandle;
                List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>();

                reportExcelDTO item_MAPHIEUTHU = new reportExcelDTO();
                item_MAPHIEUTHU.name  = "MAPHIEUTHU";
                item_MAPHIEUTHU.value = _phieuthu.MaPhieuThu;
                thongTinThem.Add(item_MAPHIEUTHU);

                reportExcelDTO item_MAHOCVIEN = new reportExcelDTO();
                item_MAHOCVIEN.name  = "MAHOCVIEN";
                item_MAHOCVIEN.value = lblMaHocVien.Text;
                thongTinThem.Add(item_MAHOCVIEN);

                reportExcelDTO item_TENHOCVIEN = new reportExcelDTO();
                item_TENHOCVIEN.name  = "TENHOCVIEN";
                item_TENHOCVIEN.value = lblTenHocVien.Text;
                thongTinThem.Add(item_TENHOCVIEN);

                reportExcelDTO item_DIACHI = new reportExcelDTO();
                item_DIACHI.name  = "DIACHI";
                item_DIACHI.value = gridViewDSHocVien.GetRowCellValue(rowHandle, "DiaChi").ToString();
                thongTinThem.Add(item_DIACHI);

                reportExcelDTO item_KHOAHOC = new reportExcelDTO();
                item_KHOAHOC.name  = "KHOAHOC";
                item_KHOAHOC.value = gridViewDSHocVien.GetRowCellValue(rowHandle, "TenKhoaHoc").ToString();
                thongTinThem.Add(item_KHOAHOC);

                DateTime       _namsinh     = O2S_Common.TypeConvert.Parse.ToDateTime(gridViewDSHocVien.GetRowCellValue(rowHandle, "NgaySinh").ToString());
                reportExcelDTO item_NAMSINH = new reportExcelDTO();
                item_NAMSINH.name  = "NAMSINH";
                item_NAMSINH.value = _namsinh.ToString("dd/MM/yyyy");
                thongTinThem.Add(item_NAMSINH);

                reportExcelDTO item_LOPHOC = new reportExcelDTO();
                item_LOPHOC.name  = "LOPHOC";
                item_LOPHOC.value = gridViewDSHocVien.GetRowCellValue(rowHandle, "TenLopHoc").ToString();
                thongTinThem.Add(item_LOPHOC);
                //
                reportExcelDTO item_TONGTIEN = new reportExcelDTO()
                {
                    name  = "TONGTIEN",
                    value = O2S_Common.Number.Convert.NumberToString(_phieughidanh.TongTien ?? 0, 0) + " đ",
                };
                thongTinThem.Add(item_TONGTIEN);

                reportExcelDTO item_MIENGIAM_TIEN = new reportExcelDTO()
                {
                    name  = "MIENGIAM_TIEN",
                    value = O2S_Common.Number.Convert.NumberToString(_phieughidanh.MienGiam_Tien ?? 0, 0) + " đ",
                };
                thongTinThem.Add(item_MIENGIAM_TIEN);

                reportExcelDTO item_CONNO = new reportExcelDTO()
                {
                    name  = "CONNO",
                    value = O2S_Common.Number.Convert.NumberToString(_phieughidanh.ConNo ?? 0, 0) + " đ",
                };
                thongTinThem.Add(item_CONNO);

                reportExcelDTO item_SOTIEN = new reportExcelDTO()
                {
                    name  = "SOTIEN",
                    value = O2S_Common.Number.Convert.NumberToString(_phieuthu.SoTien ?? 0, 0) + " đ",
                };
                thongTinThem.Add(item_SOTIEN);

                reportExcelDTO item_sotienchu = new reportExcelDTO();
                item_sotienchu.name  = "SOTIENBANGCHU";
                item_sotienchu.value = O2S_Common.Strings.Convert.CurrencyToVneseString(O2S_Common.Number.Convert.NumberToNumberRoundAuto(_phieuthu.SoTien ?? 0, 0).ToString());
                thongTinThem.Add(item_sotienchu);

                //
                DataTable dataExport = new DataTable();
                dataExport.Columns.Add("STT", typeof(string));
                dataExport.Columns.Add("KHOANTHU", typeof(string));
                dataExport.Columns.Add("SOTIEN", typeof(string));
                dataExport.Columns.Add("GHICHU", typeof(string));
                HocPhiHocVienFilter _filter = new HocPhiHocVienFilter()
                {
                    PhieuThuId = _phieuthu.PhieuThuId,
                    HocVienId  = this.HocVienId_Select,
                };
                List <HocPhiHocVien_PlusDTO> _lsthocPhiHV = HocPhiHocVienLogic.Select(_filter);
                if (_lsthocPhiHV != null && _lsthocPhiHV.Count > 0)
                {
                    _lsthocPhiHV.OrderBy(o => o.Stt).ToList();
                    for (int i = 0; i < _lsthocPhiHV.Count; i++)
                    {
                        DataRow newRow_khac = dataExport.NewRow();
                        newRow_khac["STT"]      = _lsthocPhiHV[i].Stt;
                        newRow_khac["KHOANTHU"] = _lsthocPhiHV[i].TenDichVu == null ? "" : _lsthocPhiHV[i].TenDichVu;
                        newRow_khac["SOTIEN"]   = O2S_Common.Number.Convert.NumberToString(O2S_Common.TypeConvert.Parse.ToDecimal(_lsthocPhiHV[i].SoTien.ToString()), 0);
                        newRow_khac["GHICHU"]   = _lsthocPhiHV[i].GhiChu == null ? "" : _lsthocPhiHV[i].GhiChu;
                        dataExport.Rows.Add(newRow_khac);
                    }
                }

                string fileTemplatePath = LuaChonTemplateInBienLai(_lsthocPhiHV);

                Utilities.Prints.PrintPreview.ShowPrintPreview_UsingExcelTemplate(fileTemplatePath, thongTinThem, dataExport);
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
            SplashScreenManager.CloseForm();
        }