Пример #1
0
        private void Luu(int Trang_thai)
        {
            int rs = 0;

            KiemTraDuLieu(ref rs);

            if (rs == 1)
            {
                rs = PhieuNhapCtrl.Insert(ledNhanVienNhap.EditValue, ledNhaCungCap.EditValue, ledKhoNhap.EditValue, txtChungTuGoc.Text, dteNgayNhap.EditValue, mmoGhiChu.Text, 6);

                if (rs == 0)
                {
                    NotifyHelper.ShowError("Thêm phiếu nhập không thành công", "Lỗi thêm phiếu nhập");
                    return;
                }

                rs = PhieuNhapCtrl.AddDetails(rs, Trang_thai, grvPhieuNhapCT);

                if (rs == 0)
                {
                    NotifyHelper.ShowError("Thêm các chi tiết phiếu nhập không thành công", "Lỗi thêm chi tiết phiếu nhập");
                    PhieuNhapCtrl.Delete(rs);

                    return;
                }

                NotifyHelper.ShowInfo("Thêm phiếu nhập thành công", "Thêm phiếu nhập");

                btnLamLai.PerformClick();
            }
        }
        private void btnXoa_Click(object sender, EventArgs e)
        {
            ViewPhieuNhap pn = (ViewPhieuNhap)grvPhieuNhap.GetFocusedRow();

            if (pn == null)
            {
                return;
            }

            if (pn.ID_trang_thai != 0)
            {
                XtraMessageBox.Show("Phiếu nhập này bị khóa và hàng đã vào kho nên không thể xóa!", "Xóa phiếu nhập", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (XtraMessageBox.Show("Các dữ liệu bị xóa sẽ không thể phục hồi!\nBạn có thực sự muốn xóa phiếu nhập này hay không?", "Xóa phiếu nhập", MessageBoxButtons.OK, MessageBoxIcon.Question) == DialogResult.OK)
            {
                int rs = PhieuNhapCtrl.Delete(pn.ID_phieu_nhap);

                if (rs == 0)
                {
                    XtraMessageBox.Show("Xóa phiếu nhập không thành công!", "Xóa phiếu nhập", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    XtraMessageBox.Show("Xóa phiếu nhập thành công!", "Xóa phiếu nhập", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    btnTimKiem.PerformClick();
                }
            }
        }
Пример #3
0
        private void Luu(int Trang_thai)
        {
            int rs = 0;

            KiemTraDuLieu(ref rs);

            if (rs == 1)
            {
                rs = PhieuNhapCtrl.Insert(ledNhanVienNhap.EditValue, null, ledKhoNhap.EditValue, null, dteNgayNhap.EditValue, mmoGhiChu.Text, 2);

                if (rs == 0)
                {
                    XtraMessageBox.Show("Thêm phiếu nhập lại không thành công. Vui lòng thử lại!", "Thêm phiếu nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                rs = PhieuNhapCtrl.AddDetails(rs, Trang_thai, grvPhieuNhapCT);

                if (rs == 0)
                {
                    XtraMessageBox.Show("Thêm chi tiết phiếu nhập lại không thành công. Vui lòng thử lại!", "Thêm chi tiết phiếu nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    PhieuNhapCtrl.Delete(rs);

                    return;
                }

                XtraMessageBox.Show("Thêm phiếu nhập lại thành công.", "Thêm phiếu nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Information);

                btnLamLai.PerformClick();
            }
        }
Пример #4
0
        private void Luu(int Trang_thai)
        {
            int rs = 0;

            KiemTraDuLieu(ref rs);

            if (rs == 1)
            {
                rs = PhieuNhapCtrl.Update(pn.ID_phieu_nhap, grvPhieuNhapCT, ledNhanVienNhap.EditValue, ledNhaCungCap.EditValue, ledKhoNhap.EditValue, txtChungTuGoc.Text, dteNgayNhap.EditValue, mmoGhiChu.Text, pn.ID_loai_nhap, Trang_thai);

                if (rs == 0)
                {
                    XtraMessageBox.Show("Sửa phiếu nhập không thành công. Vui lòng thử lại!", "Sửa phiếu nhập", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                XtraMessageBox.Show("Sửa phiếu nhập thành công!", "Sửa phiếu nhập", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.DialogResult = DialogResult.OK;
            }
        }
Пример #5
0
 private void dteNgayNhap_EditValueChanged(object sender, EventArgs e)
 {
     txtChungTuGoc.Text = PhieuNhapCtrl.GetNextCode(dteNgayNhap.EditValue);
 }
 private void btnTimKiem_Click(object sender, EventArgs e)
 {
     PhieuNhapCtrl.LoadBindingSource(iMPPhieuNhapBindingSource, (DateTime)dteNgayBatDau.EditValue, (DateTime)dteNgayKetThuc.EditValue);
 }
Пример #7
0
 private void btnSinhMaPhieu_Click(object sender, EventArgs e)
 {
     txtChungTuGoc.Text = PhieuNhapCtrl.GetNextCode(dteNgayNhap.EditValue);
 }