private void ResetAllText()
 {
     clsUtils.ResetAllText(this);
     Business = new DeNghiNhapLaiHangBussiness();
     //lst.Clear();
     //lstnt.Clear();
 }
        //Tìm kiếm phiếu xuất bán qua mã vạch(khuyến mãi or hàng mua)
        private void SearchByMaVach()
        {
            if (string.IsNullOrEmpty(txtMaVach.Text))
            {
                throw new InvalidOperationException("Bạn chưa nhập mã vạch, không thể kiểm tra!");
            }
            List <NhapHangTraMuaInfor> lst =
                NhapTraHangMuaDataProvider.Instance.SearchChungTuBanHangByMaVach(txtMaVach.Text.Trim());

            if (lst.Count == 1)
            {
                txtTenSanPham.Text = lst[0].TenSanPham;
                Business           = new DeNghiNhapLaiHangBussiness(BanHangDataProvider.Instance.LoadChungTuById(lst[0].IdChungTu));

                if (Business.ChungTu.TrangThai == Convert.ToInt32(OrderStatus.TRA_LAI_DON_HANG_XUAT_KHO))
                {
                    throw new ManagedException(String.Format("Đơn hàng {0} đã bị hủy.", Business.ChungTu.SoChungTu));
                }

                if (BanHangDataProvider.Instance.ExistPhieuTraHangMua(Business.ChungTu.SoChungTu))
                {
                    throw new ManagedException(String.Format("Đơn hàng {0} đã có phiếu trả lại hàng mua", Business.ChungTu.SoChungTu));
                }

                LoadOldChungTuInfor(Business.ChungTu);
                //LoadChiTietThanhToan(Business.ChungTu.IdChungTu);
                Business.ChungTu.IdChungTu = 0;
            }
            else if (lst.Count > 1)
            {
                txtTenSanPham.Text = lst[0].TenSanPham;
                frmMutilPhieuXuatBan frm = new frmMutilPhieuXuatBan(lst);
                frm.ShowDialog();
                if (frm.DialogResult == DialogResult.OK)
                {
                    Business =
                        new DeNghiNhapLaiHangBussiness(BanHangDataProvider.Instance.LoadChungTuById(frm.SelectItem.IdChungTu)
                                                       );

                    if (Business.ChungTu.TrangThai == Convert.ToInt32(OrderStatus.TRA_LAI_DON_HANG_XUAT_KHO))
                    {
                        throw new ManagedException(String.Format("Đơn hàng {0} đã bị hủy.", Business.ChungTu.SoChungTu));
                    }

                    if (BanHangDataProvider.Instance.ExistPhieuTraHangMua(Business.ChungTu.SoChungTu))
                    {
                        throw new ManagedException(String.Format("Đơn hàng {0} đã có phiếu trả lại hàng mua", Business.ChungTu.SoChungTu));
                    }

                    LoadOldChungTuInfor(Business.ChungTu);
                    //LoadChiTietThanhToan(Business.ChungTu.IdChungTu);
                    Business.ChungTu.IdChungTu = 0;
                }
            }
            else
            {
                throw new InvalidOperationException("Mã vạch này không có!");
            }
        }
示例#3
0
        private void ThemMoiDonHang()
        {
            Draft = -1;

            ResetAllText();
            txtSoPhieuNhap.Prefix = Declare.Prefix.PhieuNhapLaiKhac;
            txtSoPhieuNhap.ReSet();//.Text = CommonProvider.Instance.GetSoPhieu(Declare.Prefix.PhieuNhapLaiKhac);
            dteNgayNhap.EditValue = CommonProvider.Instance.GetSysDate();

            LoaiChungTu = (int)TransactionType.DON_HANG_NHAP_LAI;
            TrangThai   = (int)OrderStatus.DE_NGHI_TRA_LAI_HANG_BAN;
            Business    = new DeNghiNhapLaiHangBussiness(LoaiChungTu, nguoiDung.IdNhanVien, ((DMKhoInfo)bteKhoXuat.Tag).IdKho);

            Business.ListChiTietChungTu = new List <NhapHangTraChiTietHHInfor>();

            grcHangBan.DataSource = null;
            grcHangBan.DataSource = new BindingList <NhapHangTraChiTietHHInfor>(Business.ListChiTietChungTu);
        }
        private void btnSearchPhieuNhap_Click(object sender, EventArgs e)
        {
            try
            {
                if (Updating)
                {
                    if (MessageBox.Show("Dữ liệu đang cập nhật, bạn có muốn hủy bỏ không?", "Thông báo", MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        return;
                    }
                }
                NhapHangTraMuaInfor ct =
                    NhapTraHangMuaDataProvider.Instance.SearchChungTuBanHangByPN(txtSoPhieuNhap.Text.Trim().ToUpper(),
                                                                                 (int)TransactionType.NHAPTRAHANGMUA);
                if (ct != null)
                {
                    Business = new DeNghiNhapLaiHangBussiness(ct);
                    LoadChungTuInstance();

                    Updating = false;
                    setEDItems();
                    setEDFunctions();
                }
                else
                {
                    MessageBox.Show("Không tìm thấy chứng từ thích hợp!");
                    txtSoPhieuNhap.Text = Business.ChungTu.SoChungTu;
                }
            }
            catch (Exception ex)
            {
                EventLogProvider.Instance.WriteLog(ex.ToString()
                                                   + "\nUser: "******"\nMay: " + Declare.TenMay,
                                                   this.Name);
#if DEBUG
                MessageBox.Show("Lỗi thao tác\n" + ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show("Lỗi thao tác", Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
            }
        }
 public frmBH_SuaDonHangNhapLai()
 {
     InitializeComponent();
     Common.LoadStyle(this);
     this.Business = new DeNghiNhapLaiHangBussiness();
 }
示例#6
0
 public frmChiTietYeuCauNhapLaiKhac(ChungTuBanHangInfor ctu)
 {
     InitializeComponent();
     Common.LoadStyle(this);
     this.Business = new DeNghiNhapLaiHangBussiness(ctu);
 }
示例#7
0
        //private double TongTienThanhToan = 0;
        //private double TienThucTra = 0;
        //private double TienTraKhach = 0;
        //private double TienNoKhach = 0;

        #endregion

        public frmChiTietYeuCauNhapLaiKhac()
        {
            InitializeComponent();
            Common.LoadStyle(this);
            this.Business = new DeNghiNhapLaiHangBussiness(LoaiChungTu, nguoiDung.IdNhanVien, _IdKho);
        }