private void btXoa_Click(object sender, EventArgs e) { PHIEUTHUTIEN ptt = new PHIEUTHUTIEN(gView_DSPTT.GetRowCellValue(gView_DSPTT.FocusedRowHandle, "Mã phiếu thu").ToString(), 0, DateTime.Now, ""); ptt.Xoa(); load_DSPTT_TheoMaKH(gView_DSKH.GetRowCellValue(gView_DSKH.FocusedRowHandle, "Mã KH").ToString()); }
private void btReport_Click(object sender, EventArgs e) { if (btReport.Text == "Xuất report") { string t = txtTen.Text; fmReportPhieuThuTien hd = new fmReportPhieuThuTien(t); hd.ShowDialog(); } else // lệnh cho hàm sửa PTT bên form DSPTT { PHIEUTHUTIEN xoa_ptt = new PHIEUTHUTIEN(btEditMa.Text, 0, DateTime.Now, ""); xoa_ptt.Xoa(); if (txtMa.Text == "" || btEditMa.Text == "" || txtSTT.Text == "") { MessageBox.Show("Chưa nhập đầy đủ thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (timKH_TheoMa(txtMa.Text) == false || timKH_TheoTen(txtTen.Text) == false) { MessageBox.Show("Mã hoặc tên khách hàng không tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (ktMaPTT(btEditMa.Text)) { MessageBox.Show("Mã phiếu đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { PHIEUTHUTIEN ptt = new PHIEUTHUTIEN(btEditMa.Text, float.Parse(txtSTT.Text.Trim()), Convert.ToDateTime(datiNgayLap.Text), txtMa.Text); ptt.Them(); MessageBox.Show("Sửa phiếu thu tiền thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } }