private void btnLapPhieuThu_Click(object sender, EventArgs e)
        {
            GridView gridView     = grcBangKeThanhToanNgay.FocusedView as GridView;
            var      maPhieu      = gridView.GetRowCellValue(gridView.FocusedRowHandle, "MaPhieu");// lấy được mã phiếu
            var      ngayLap      = gridView.GetRowCellValue(gridView.FocusedRowHandle, "NgayLap");
            var      tenKhachHang = gridView.GetRowCellValue(gridView.FocusedRowHandle, "TenKH");
            var      maKhachHang  = gridView.GetRowCellValue(gridView.FocusedRowHandle, "MaKH");
            var      soTien       = gridView.GetRowCellValue(gridView.FocusedRowHandle, "TongTienNhan");

            if (maPhieu == null)
            {
                XtraMessageBox.Show("Mời bạn chọn mã phiếu nhập hàng cần lập phiếu thu tiền");
            }
            else
            {
                PhieuThuTien phieuThu = new PhieuThuTien();
                phieuThu.MaChungTu = (string)maPhieu;
                phieuThu.NgayLap   = (DateTime)ngayLap;
                phieuThu.SoTien    = (float)Convert.ToDouble(soTien);
                phieuThu.TenKH     = (string)tenKhachHang;
                phieuThu.MaKH      = (string)maKhachHang;
                frmCM_LapPhieuThu fCM_LapPhieuThu = new frmCM_LapPhieuThu(phieuThu);
                fCM_LapPhieuThu.ShowDialog();

                grcBangKeThanhToanNgay.DataSource = inforSell.getListThanhToanCongNo(a, b, 0);
            }
        }
예제 #2
0
        private void btnLapPhieuThu_Click(object sender, EventArgs e)
        {
            GridView gridView     = grcBangKeThanhToanNgay.FocusedView as GridView;
            var      maPhieu      = gridView.GetRowCellValue(gridView.FocusedRowHandle, "MaPhieu");// lấy được mã phiếu
            var      ngayLap      = gridView.GetRowCellValue(gridView.FocusedRowHandle, "NgayLap");
            var      tenKhachHang = gridView.GetRowCellValue(gridView.FocusedRowHandle, "TenKH");
            var      maKhachHang  = gridView.GetRowCellValue(gridView.FocusedRowHandle, "MaKH");
            var      soTien       = gridView.GetRowCellValue(gridView.FocusedRowHandle, "TongTienNhan");

            int checkInPhieuThu = inforSellBus.checkMaChungTuInPhieuThu((string)maPhieu);

            if (checkInPhieuThu == 1)
            {
                DialogResult dr;
                dr = XtraMessageBox.Show("Đơn hàng đã được thu tiền.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (maPhieu == null)
            {
                XtraMessageBox.Show("Mời bạn chọn mã phiếu nhập hàng cần xóa");
            }
            else
            {
                PhieuThuTien phieuThu = new PhieuThuTien();
                phieuThu.MaChungTu = (string)maPhieu;
                phieuThu.NgayLap   = (DateTime)ngayLap;
                phieuThu.SoTien    = (float)Convert.ToDouble(soTien);
                phieuThu.TenKH     = (string)tenKhachHang;
                phieuThu.MaKH      = (string)maKhachHang;
                frmCM_LapPhieuThu fCM_LapPhieuThu = new frmCM_LapPhieuThu(phieuThu);
                fCM_LapPhieuThu.ShowDialog();
                grcBangKeThanhToanNgay.DataSource = inforSellBus.getListThanhToanNgay(a, b, 0);
            }
        }