private void LayDanhSachHocVien()
        {
            try
            {
                HocVienFilter _filter = new HocVienFilter();
                _filter.CoSoId           = GlobalSettings.CoSoId;
                _filter.LoaiHocVienId    = KeySetting.LOAIHOCVIEN_CHINHTHUC;
                _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
                _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;

                this.lstHocVien = HocVienLogic.SelectQuanLyHocVien(_filter);

                if (this.lstHocVien != null && this.lstHocVien.Count > 0)
                {
                    for (int i = 0; i < this.lstHocVien.Count; i++)
                    {
                        this.lstHocVien[i].Stt = i + 1;
                    }
                    gridControlDSHocVien.DataSource = this.lstHocVien;
                }
                else
                {
                    gridControlDSHocVien.DataSource = null;
                }
                lblTongCong.Text = string.Format("Tổng cộng: {0} học viên", gridViewDSHocVien.RowCount);
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
Beispiel #2
0
        private void LayDanhSachHocVien()
        {
            try
            {
                HocVienFilter _filter = new HocVienFilter();
                _filter.CoSoId           = GlobalSettings.CoSoId;
                _filter.LoaiHocVienId    = KeySetting.LOAIHOCVIEN_CHOLOP;
                _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
                _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;

                this.lstHocVien = HocVienLogic.Select(_filter);

                if (this.lstHocVien != null && this.lstHocVien.Count > 0)
                {
                    for (int i = 0; i < this.lstHocVien.Count; i++)
                    {
                        this.lstHocVien[i].Stt = i + 1;
                    }
                    gridControlDSHocVien.DataSource = this.lstHocVien;
                }
                else
                {
                    gridControlDSHocVien.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
 private void btnXoa_Click(object sender, EventArgs e)
 {
     try
     {
         //Validate xoa du lieu
         ValidateXoaHocVien(this.hocvienId_Select);
         if (MessageBox.Show("Bạn có muốn xóa?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             if (HocVienLogic.Delete(this.hocvienId_Select))
             {
                 O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.XOA_THANH_CONG);
                 frmthongbao.Show();
                 LoadDanhSachHocVien();
                 ResetPanelControl();
             }
             else
             {
                 O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THAO_TAC_THAT_BAI);
                 frmthongbao.Show();
             }
         }
     }
     catch (ArgumentException ex)
     {
         MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     catch (Exception ex)
     {
         O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CO_LOI_XAY_RA);
         frmthongbao.Show();
         O2S_Common.Logging.LogSystem.Error(ex);
     }
 }
        private void LoadDanhSachHocVien()
        {
            try
            {
                gridControlDSHocVien.DataSource = null;
                //Thread th = new Thread(() =>
                //{
                HocVienFilter _filter = new HocVienFilter();
                _filter.CoSoId           = GlobalSettings.CoSoId;
                _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
                _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;
                List <HocVien_PlusDTO> _lstHocVien = HocVienLogic.Select(_filter);
                if (_lstHocVien != null && _lstHocVien.Count > 0)
                {
                    //gridControlDSHocVien.Invoke((MethodInvoker)delegate
                    //{
                    gridControlDSHocVien.DataSource = _lstHocVien;
                    lblTongCong.Text = string.Format("Tổng cộng: {0} học viên ({1} học viên chính thức; {2} học viên tiềm năng; {3} học viên chờ lớp)", _lstHocVien.Count, _lstHocVien.Where(o => o.LoaiHocVienId == KeySetting.LOAIHOCVIEN_CHINHTHUC).ToList().Count, _lstHocVien.Where(o => o.LoaiHocVienId == KeySetting.LOAIHOCVIEN_TIEMNANG).ToList().Count, _lstHocVien.Where(o => o.LoaiHocVienId == KeySetting.LOAIHOCVIEN_CHOLOP).ToList().Count);
                    //});
                }
                else
                {
                    gridControlDSHocVien.DataSource = null;
                    lblTongCong.Text = string.Format("Tổng cộng: {0} học viên ({1} học viên chính thức; {2} học viên tiềm năng; {3} học viên chờ lớp)", 0, 0, 0);
                }
                //});

                //th.Start();
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
Beispiel #5
0
        private void btnLuuThongTin_Click(object sender, EventArgs e)
        {
            try
            {
                ValidateLuu();

                HocVienLogic.Update(new HOCVIEN()
                {
                    MaHocVien  = txtMaHV.Text,
                    TenHocVien = txtTenHocVien.Text,
                    GioiTinh   = cboGioiTinh.Text,
                    NgaySinh   = DateTime.ParseExact(dateNgaySinh.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture),
                    DiaChi     = txtDiaChi.Text,
                    Sdt        = txtSDT.Text,
                    Email      = txtEmail.Text,
                    HocVienId  = hv.HocVienId
                });

                MessageBox.Show("Cập nhật thông tin học viên thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void btnTimKiem_Click(object sender, EventArgs e)
 {
     SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));
     try
     {
         HocVienFilter _filter = new HocVienFilter();
         _filter.CoSoId           = GlobalSettings.CoSoId;
         _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
         _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;
         this._lstHocVien         = HocVienLogic.Select(_filter);
         if (this._lstHocVien != null && this._lstHocVien.Count > 0)
         {
             gridControlDSHocVien.DataSource = this._lstHocVien;
         }
         else
         {
             gridControlDSHocVien.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Error(ex);
     }
     SplashScreenManager.CloseForm();
 }
Beispiel #7
0
        private void frmThemTuVanHocVien_Load(object sender, EventArgs e)
        {
            dateNgayTuVan.DateTime = DateTime.Now;
            HOCVIEN _hocvien = HocVienLogic.SelectSingle(this.HocVienId_Select);

            lblMaHocVien.Text  = _hocvien.MaHocVien;
            lblTenHocVien.Text = _hocvien.TenHocVien;

            txtNguoiTuVan.Focus();
        }
Beispiel #8
0
        private void frmThayDoiThongTinHV_Load(object sender, EventArgs e)
        {
            hv = HocVienLogic.SelectSingle(GlobalSettings.UserID);

            txtMaHV.Text       = hv.MaHocVien;
            txtTenHocVien.Text = hv.TenHocVien;
            dateNgaySinh.Value = (DateTime)hv.NgaySinh;
            cboGioiTinh.Text   = hv.GioiTinh;
            txtDiaChi.Text     = hv.DiaChi;
            txtSDT.Text        = hv.Sdt;
            txtEmail.Text      = hv.Email;
        }
 public void LoadDSHVChuaCoLop()
 {
     try
     {
         int _lopHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString());
         this.dsChuaCoLop = HocVienLogic.HocVienChuaXepLopTheoKhoaHoc(_lopHocId);
         gridControlHV_ChuaXepLop.DataSource = this.dsChuaCoLop;
         lblTongCongHV.Text = string.Format("Tổng cộng: {0} học viên", this.dsChuaCoLop.Count);
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Warn(ex);
     }
 }
 private void gridViewDSHocVien_Click(object sender, EventArgs e)
 {
     try
     {
         var rowHandle = gridViewDSHocVien.FocusedRowHandle;
         this.hocvienId_Select = O2S_Common.TypeConvert.Parse.ToInt32(gridViewDSHocVien.GetRowCellValue(rowHandle, "HocVienId").ToString());
         HOCVIEN hocVien = HocVienLogic.SelectSingle(this.hocvienId_Select);
         LoadPanelControl(hocVien);
         LockAndUnlockPanelControl(false);
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Error(ex);
     }
 }
        private void btnLuuThongTin_Click(object sender, EventArgs e)
        {
            try
            {
                ValidateLuu();

                if (isInsert)
                {
                    int _hocvienId = 0;
                    if (HocVienLogic.Insert(LoadHocVien(), new TAIKHOAN()
                    {
                        TenDangNhap = txtTenDangNhap.Text,
                        MatKhau = txtMatKhau.Text,
                        LoaiTaiKhoanId = KeySetting.LOAITAIKHOAN_HocVien,
                    }, ref _hocvienId))
                    {
                        LoadDanhSachHocVien();
                        O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THEM_MOI_THANH_CONG);
                        frmthongbao.Show();
                        LockAndUnlockPanelControl(false);
                    }
                }
                else
                {
                    if (HocVienLogic.Update(LoadHocVien(), new TAIKHOAN()
                    {
                        TenDangNhap = txtTenDangNhap.Text,
                        MatKhau = txtMatKhau.Text,
                    }))
                    {
                        LoadDanhSachHocVien();
                        O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG);
                        frmthongbao.Show();
                        LockAndUnlockPanelControl(false);
                    }
                }
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CO_LOI_XAY_RA);
                frmthongbao.Show();
                O2S_Common.Logging.LogSystem.Error(ex);
            }
        }
        private void LoadDanhSachHocVien()
        {
            thHocVien = new Thread(() =>
            {
                //thPhieuGhiDanh.Join();
                HocVienFilter _filter    = new HocVienFilter();
                _filter.CoSoId           = GlobalSettings.CoSoId;
                _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
                _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;
                object source            = HocVienLogic.Select(_filter);

                gridControlDSHocVien.Invoke((MethodInvoker) delegate
                {
                    gridControlDSHocVien.DataSource = source;
                });
            });
            thHocVien.Start();
        }
 private void btnHocVien7So_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         if (HocVienLogic.UpdateMaHocVien7So())
         {
             MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Cập nhật thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Warn(ex);
     }
 }
        private void frmHocVienTiemNang_GuiMail_Load(object sender, EventArgs e)
        {
            try
            {
                //Load ds nguoi gui.
                CauHinhEmailFilter _filter = new CauHinhEmailFilter();
                _filter.CoSoId            = GlobalSettings.CoSoId;
                cboEmailGui.DataSource    = CauHinhEmailLogic.Select(_filter);
                cboEmailGui.DisplayMember = "TaiKhoan";
                cboEmailGui.ValueMember   = "CauHinhEmailId";

                HOCVIEN _hocvien = HocVienLogic.SelectSingle(this.HocVienId_Select);
                lblMaHocVien.Text  = _hocvien.MaHocVien;
                lblTenHocVien.Text = _hocvien.TenHocVien;
                txtEmailNhan.Text  = _hocvien.Email;

                txtTieuDeMail.Focus();
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
        }
        private void InBienLaiThuTien_Process(int _phieuthuId)
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));

                HOCVIEN      _hocvien      = HocVienLogic.SelectSingle(this.HocVienId_Select);
                PHIEUTHU     _phieuthu     = PhieuThuLogic.SelectSingle(_phieuthuId);
                PHIEUGHIDANH _phieughidanh = PhieuGhiDanhLogic.SelectSingle(this.PhieuGhiDanhId);


                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 = _hocvien.MaHocVien;
                thongTinThem.Add(item_MAHOCVIEN);

                reportExcelDTO item_TENHOCVIEN = new reportExcelDTO();
                item_TENHOCVIEN.name  = "TENHOCVIEN";
                item_TENHOCVIEN.value = _hocvien.TenHocVien;
                thongTinThem.Add(item_TENHOCVIEN);

                reportExcelDTO item_DIACHI = new reportExcelDTO();
                item_DIACHI.name  = "DIACHI";
                item_DIACHI.value = _hocvien.DiaChi;
                thongTinThem.Add(item_DIACHI);

                reportExcelDTO item_KHOAHOC = new reportExcelDTO();
                item_KHOAHOC.name  = "KHOAHOC";
                item_KHOAHOC.value = _phieuthu.PHIEUGHIDANH.KHOAHOC.TenKhoaHoc;
                thongTinThem.Add(item_KHOAHOC);

                reportExcelDTO item_NAMSINH = new reportExcelDTO();
                item_NAMSINH.name  = "NAMSINH";
                item_NAMSINH.value = _hocvien.NgaySinh != null ? (_hocvien.NgaySinh.Value.ToString("dd/MM/yyyy")) : "";
                thongTinThem.Add(item_NAMSINH);

                reportExcelDTO item_LOPHOC = new reportExcelDTO();
                item_LOPHOC.name  = "LOPHOC";
                item_LOPHOC.value = "";
                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(_phieuthu.SoTien.ToString().Replace(".", ""));
                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));
                //DataRow newRow = dataExport.NewRow();
                //newRow["STT"] = "1";
                //newRow["KHOANTHU"] = _phieuthu.PHIEUGHIDANH.KHOAHOC.TenKhoaHoc;
                //newRow["SOTIEN"] = O2S_Common.Number.Convert.NumberToString(O2S_Common.TypeConvert.Parse.ToDecimal(_phieuthu.PHIEUGHIDANH.KHOAHOC.HocPhi.ToString()), 0);
                //newRow["GHICHU"] = "";
                //dataExport.Rows.Add(newRow);

                HocPhiHocVienFilter _filter = new HocPhiHocVienFilter()
                {
                    PhieuThuId = _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();
        }
        private void btnLuuPhieu_Click(object sender, EventArgs e)
        {
            try
            {
                ValidateLuuPhieu();
                DOTHOC _dotHoc = null;
                if (cboDotHoc.SelectedValue != null)
                {
                    _dotHoc = DotHocLogic.SelectSingle(O2S_Common.TypeConvert.Parse.ToInt32(cboDotHoc.SelectedValue.ToString()));
                }
                //Insert bang PHIEUGHIDANH
                //insert bang PHIEUTHU; HOCPHIHOCVIEN
                //cap nhat bang HOCVIEN trang thai hoc vien = hoc vien chinh thuc + TAIKHOAN=chinh thuc
                PHIEUGHIDANH _phieughidanh = new PHIEUGHIDANH();
                _phieughidanh.HocVienId   = this.HocVienId_Select;
                _phieughidanh.KhoaHocId   = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString());
                _phieughidanh.LopHocId    = O2S_Common.TypeConvert.Parse.ToInt32(cboLopHoc.SelectedValue.ToString());
                _phieughidanh.NgayGhiDanh = DateTime.ParseExact(dateNgayGhiDanh.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture);
                //tong tien cua lop hoc den thoi diem hien tai
                List <DOTHOC> _lstDotHoc = DotHocLogic.SelectTheoLopHoc(_phieughidanh.LopHocId ?? 0);
                _phieughidanh.HocPhiKH = _lstDotHoc != null?_lstDotHoc.Sum(o => o.HocPhi) : 0;

                _phieughidanh.SoTietKH = _lstDotHoc != null?_lstDotHoc.Sum(o => o.SoBuoiHoc) : 0;

                _phieughidanh.HocPhiHocVienKH   = O2S_Common.TypeConvert.Parse.ToDecimal(lblThanhTienKhoaHoc.Text.Replace(",", ""));
                _phieughidanh.SoTietHocVienKH   = O2S_Common.TypeConvert.Parse.ToDecimal(numSoBuoiHVDangKy.Text);
                _phieughidanh.ThuKhoanKhac      = TinhTongTien_ThuThem();
                _phieughidanh.TongTien          = O2S_Common.TypeConvert.Parse.ToDecimal(numTongTien.Text);
                _phieughidanh.DaDong            = O2S_Common.TypeConvert.Parse.ToDecimal(numDaDong.Text.Replace(",", ""));
                _phieughidanh.ConNo             = O2S_Common.TypeConvert.Parse.ToDecimal(numConNo.Text);
                _phieughidanh.MienGiam_PhanTram = O2S_Common.TypeConvert.Parse.ToInt16(numMienGiam_PTram.Value.ToString());
                _phieughidanh.MienGiam_Tien     = O2S_Common.TypeConvert.Parse.ToDecimal(numMienGiam_Tien.Text.Replace(",", ""));
                _phieughidanh.LyDoMienGiam      = txtLyDoMienGiam.Text;
                if (GlobalSettings.UserID != -1)
                {
                    _phieughidanh.NhanVienId = GlobalSettings.UserID;
                }

                //insert bang PHIEUTHU
                PHIEUTHU             _phieuthu = new PHIEUTHU();
                List <HOCPHIHOCVIEN> _lsthphv  = new List <HOCPHIHOCVIEN>();
                if (O2S_Common.TypeConvert.Parse.ToDecimal(numDaDong.Text.Replace(",", "")) > 0)
                {
                    //_phieuthuInsert.PhieuGhiDanhId = this.PhieuGhiDanhId;
                    _phieuthu.CoSoId      = GlobalSettings.CoSoId;
                    _phieuthu.HocVienId   = this.HocVienId_Select;
                    _phieuthu.ThoiGianThu = DateTime.Now;
                    _phieuthu.SoTien      = O2S_Common.TypeConvert.Parse.ToDecimal(numDaDong.Text.Replace(",", ""));
                    _phieuthu.NoiDung     = cboDotHoc.Text;
                    _phieuthu.GhiChu      = "Thu tiền đợt học: " + cboDotHoc.Text;
                    //Tien Dot Hoc
                    if (cboDotHoc.SelectedValue != null)
                    {
                        HOCPHIHOCVIEN _hphv_kh = new HOCPHIHOCVIEN()
                        {
                            Stt        = 1,
                            HocVienId  = this.HocVienId_Select,
                            DmDichVuId = O2S_Common.TypeConvert.Parse.ToInt32(cboDotHoc.SelectedValue.ToString()),
                            TenDichVu  = cboDotHoc.Text,
                            SoTien     = O2S_Common.TypeConvert.Parse.ToDecimal(lblThanhTienKhoaHoc.Text.Replace(",", "")),
                            SoLuong    = O2S_Common.TypeConvert.Parse.ToDecimal(numSoBuoiHVDangKy.Text.Replace(",", "")),
                            DonGia     = O2S_Common.TypeConvert.Parse.ToDecimal(numHocPhi.Text) / O2S_Common.TypeConvert.Parse.ToDecimal(numSoTietHoc.Text),
                            //PhieuThuId = _phieuthuId,
                            GhiChu = "",
                        };
                        _lsthphv.Add(_hphv_kh);
                    }
                    //tien khoan Khac
                    if (gridViewKhoanKhac.RowCount > 0)
                    {
                        _phieuthu.NoiDung += " và khoản khác";
                        _phieuthu.GhiChu  += " và khoản khác";
                        int _stt_thuthem = 2;
                        for (int i = 0; i < gridViewKhoanKhac.RowCount; i++)
                        {
                            object _noidungkt = gridViewKhoanKhac.GetRowCellValue(i, "noidung");
                            if (_noidungkt != null)
                            {
                                HOCPHIHOCVIEN _hphv_khac = new HOCPHIHOCVIEN()
                                {
                                    Stt        = _stt_thuthem,
                                    HocVienId  = this.HocVienId_Select,
                                    DmDichVuId = 0,
                                    TenDichVu  = gridViewKhoanKhac.GetRowCellValue(i, "noidung") == null ? "" : gridViewKhoanKhac.GetRowCellValue(i, "noidung").ToString(),
                                    SoTien     = O2S_Common.TypeConvert.Parse.ToDecimal(gridViewKhoanKhac.GetRowCellValue(i, "sotien").ToString()),
                                    SoLuong    = 1,
                                    DonGia     = O2S_Common.TypeConvert.Parse.ToDecimal(gridViewKhoanKhac.GetRowCellValue(i, "sotien").ToString()),
                                    //PhieuThuId = _phieuthuId,
                                    GhiChu = gridViewKhoanKhac.GetRowCellValue(i, "ghichu") == null ? "" : gridViewKhoanKhac.GetRowCellValue(i, "ghichu").ToString(),
                                };
                                _lsthphv.Add(_hphv_khac);
                                _stt_thuthem += 1;
                            }
                        }
                    }
                }
                //bang diem
                BANGDIEM _bangdiem = new BANGDIEM();
                _bangdiem.HocVienId = this.HocVienId_Select;
                _bangdiem.LopHocId  = O2S_Common.TypeConvert.Parse.ToInt32(cboLopHoc.SelectedValue.ToString());
                // _bangdiem.PhieuGhiDanhId = item.PhieuGhiDanhId ?? 0;
                _bangdiem.KhoaHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString());
                _bangdiem.TrangThai = 0;//=0: xep lop; =1: dang hoc; =3: co diem; =99:ket thu

                if (PhieuGhiDanhLogic.InsertPGDFull_XepLop(_phieughidanh, _phieuthu, _lsthphv, _bangdiem, ref this.PhieuGhiDanhId, ref this.PhieuThuId))
                {
                    HOCVIEN _hv = HocVienLogic.SelectSingle(this.HocVienId_Select);
                    MessageBox.Show(string.Format("Học viên {0} đã được chuyển thành học viên chính thức với tài khoản:{1}Tên đăng nhập: {2}{3}Mật khẩu: {4}",
                                                  _hv.TenHocVien, Environment.NewLine, _hv.MaHocVien, Environment.NewLine, _hv.MaHocVien),
                                    "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    isSave = true;

                    btnLuuPhieu.Enabled = false;
                    LoadPhieuGhiDanh();

                    if (this.PhieuThuId != 0)
                    {
                        btnInBienLai.Enabled = true;
                        if (MessageBox.Show("Bạn có muốn in phiếu ghi danh vừa lưu?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            InBienLaiThuTien_Process(this.PhieuThuId);
                        }
                    }
                }
                else
                {
                    O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THEM_MOI_THAT_BAI);
                    frmthongbao.Show();
                }
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }