private void btnAddPayout_Click(object sender, EventArgs e)
        {
            if (txtPay.Text == "")
            {
                XtraMessageBox.Show("Bạn phải điền đầy đủ thông tin  !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            QuanLi_TienNoKH_DTO thanhtoan = new QuanLi_TienNoKH_DTO();

            thanhtoan.MaTT      = txtIDPay.Text;
            thanhtoan.MaKH      = txtIDCustomer.Text;
            thanhtoan.NgayTra   = Convert.ToDateTime(dateTimePicker1.Text);
            thanhtoan.SoTienTra = Convert.ToDouble(txtPay.Text);
            thanhtoan.TinhTrang = 0;
            try
            {
                if (QuanLi_TienNoKH_BUS.ThemThongTinTienNo(thanhtoan))
                {
                    LoadThongTin_ThanhToanKH(txtIDCustomer.Text.ToString());

                    txtIDPay.Text          = DataProvider.ExcuteScalar(string.Format("SELECT MaTT=dbo.fcGetMaTT()"));
                    sum                    = ((double)sum - Double.Parse(txtPay.Text.ToString()));
                    txtTotalDebtOfPay.Text = sum.ToString();
                    XtraMessageBox.Show("Thêm thông tin thanh toán thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        private void LoadThongTin_ThanhToanKH(string s)
        {
            List <QuanLi_TienNoKH_DTO> ds = QuanLi_TienNoKH_BUS.ThongTinTienNo(s);

            dtgvListPay.DataSource = ds;
            if (dtgvListPay.Rows.Count == 0)
            {
                dtgvListPay.ColumnCount          = 5;
                dtgvListPay.ColumnHeadersVisible = true;
                dtgvListPay.Columns[0].Name      = "MaTT";
                dtgvListPay.Columns[1].Name      = "MaKH";
                dtgvListPay.Columns[2].Name      = "NgayTra";
                dtgvListPay.Columns[3].Name      = "SoTienTra";
                dtgvListPay.Columns[4].Name      = "TinhTrang";

                dtgvListPay.Columns[0].DataPropertyName = "MaTT";
                dtgvListPay.Columns[1].DataPropertyName = "MaKH";
                dtgvListPay.Columns[2].DataPropertyName = "NgayTra";
                dtgvListPay.Columns[3].DataPropertyName = "SoTienTra";
                dtgvListPay.Columns[4].DataPropertyName = "TinhTrang";

                dtgvListPay.Columns[0].HeaderText = "Mã TT";
                dtgvListPay.Columns[1].HeaderText = "Mã KH";
                dtgvListPay.Columns[2].HeaderText = "Ngày trả";
                dtgvListPay.Columns[3].HeaderText = "Số tiền trả";
                dtgvListPay.Columns[4].HeaderText = "Tình trạng";

                dtgvListPay.Columns[0].Width = 100;
                dtgvListPay.Columns[1].Width = 100;
                dtgvListPay.Columns[2].Width = 100;
                dtgvListPay.Columns[3].Width = 100;
                dtgvListPay.Columns[4].Width = 100;
            }
        }
        private void btnDeletePay_Click(object sender, EventArgs e)
        {
            if (txtPay.Text == "")
            {
                XtraMessageBox.Show("Bạn phải điền đầy đủ thông tin  !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            QuanLi_TienNoKH_DTO thanhtoan = new QuanLi_TienNoKH_DTO();

            thanhtoan.MaTT = txtIDPay.Text;

            try
            {
                if (QuanLi_TienNoKH_BUS.XoaThongTinTienNo(thanhtoan))
                {
                    LoadDSKH_NoTien();
                    LoadThongTin_ThanhToanKH(txtIDCustomer.Text.ToString());

                    txtIDPay.Text          = DataProvider.ExcuteScalar(string.Format("SELECT MaTT=dbo.fcGetMaTT()"));
                    sum                    = ((double)sum + Double.Parse(txtPay.Text.ToString()));
                    txtTotalDebtOfPay.Text = sum.ToString();

                    txtPay.Text = "";
                    XtraMessageBox.Show("Xóa thông tin thanh toán thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }