Exemplo n.º 1
0
        private void btnAddProductImportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbIDBillImportDetail.Text == "" || cmbIDProductDetailStore.Text == "" || txtAmountOfProductImportDetail.Text == "")
                {
                    XtraMessageBox.Show("Bạn phải điền đầy đủ thông tin !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                ChiTietHoaDonNhap_DTO phieunhap = new ChiTietHoaDonNhap_DTO();
                phieunhap.MaHDN   = cmbIDBillImportDetail.Text;
                phieunhap.MaSPDL  = cmbIDProductDetailStore.Text;
                phieunhap.SoLuong = Convert.ToInt32(txtAmountOfProductImportDetail.Text.ToString());

                if (ChiTietHoaDonNhap_BUS.ThemChiTietPHNhap(phieunhap))
                {
                    LoadPhieuNhapHang();
                    LoadChiTietPhieuNhapHang();
                    XtraMessageBox.Show("Thêm chi tiết phiếu nhập hàng thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    uctSanPhamCH.uctSPCH.LoadSanPhamCH1();
                    ClearDisplay1();
                    return;
                }
            }catch
            {
                XtraMessageBox.Show("Sản phẩm đã tồn tại trong Hóa đơn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemplo n.º 2
0
        private void btnDeleteProductImportDetail_Click(object sender, EventArgs e)
        {
            if (cmbIDBillImportDetail.Text == "" || txtAmountOfProductImportDetail.Text == "" || cmbIDProductDetailStore.Text == "")
            {
                MessageBox.Show("Bạn phải chọn chi tiết phiếu cần xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            ChiTietHoaDonNhap_DTO phieunhap = new ChiTietHoaDonNhap_DTO();

            phieunhap.MaHDN = (string)dtgvListOfDetailProductImport.CurrentRow.Cells["MaSPDL"].Value;


            if (ChiTietHoaDonNhap_BUS.XoaChiTietPHNhap(phieunhap))
            {
                LoadPhieuNhapHang();
                LoadChiTietPhieuNhapHang();
                MessageBox.Show("Chi tiết hóa đơn xóa thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearDisplay1();
                return;
            }

            MessageBox.Show("Xóa chi tiết hóa đơn thất bại ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
        }
Exemplo n.º 3
0
        private void btnUpdateProductImportDetail_Click(object sender, EventArgs e)
        {
            if (cmbIDBillImportDetail.Text == "")
            {
                MessageBox.Show("Bạn phải chọn chi tiết phiếu cần chỉnh sửa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            ChiTietHoaDonNhap_DTO phieunhap = new ChiTietHoaDonNhap_DTO();

            phieunhap.MaHDN   = (string)dtgvListOfDetailProductImport.CurrentRow.Cells["MaHDN1"].Value;
            phieunhap.MaSPDL  = cmbIDProductDetailStore.Text;
            phieunhap.SoLuong = Convert.ToInt32(txtAmountOfProductImportDetail.Text.ToString());


            if (ChiTietHoaDonNhap_BUS.SuaChiTietPHNhap(phieunhap))
            {
                LoadPhieuNhapHang();
                LoadChiTietPhieuNhapHang();
                MessageBox.Show("Chi tiết phiếu nhập hàng cập nhật thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearDisplay1();
                return;
            }

            MessageBox.Show("Cập nhật Chi tiết hóa đơn thất bại ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
        }
Exemplo n.º 4
0
        private void btnDeleteProductImportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbIDBillImportDetail.Text == "" || txtAmountOfProductImportDetail.Text == "" || cmbIDProductDetailStore.Text == "")
                {
                    XtraMessageBox.Show("Bạn phải chọn chi tiết phiếu cần xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                ChiTietHoaDonNhap_DTO phieunhap = new ChiTietHoaDonNhap_DTO();
                phieunhap.MaHDN  = (string)dtgvListOfDetailProductImport.CurrentRow.Cells["MaHDN1"].Value;
                phieunhap.MaSPDL = cmbIDProductDetailStore.Text;


                if (ChiTietHoaDonNhap_BUS.XoaChiTietPHNhap(phieunhap))
                {
                    LoadPhieuNhapHang();
                    LoadChiTietPhieuNhapHang();
                    uctSanPhamCH.uctSPCH.LoadSanPhamCH1();
                    XtraMessageBox.Show("Chi tiết hóa đơn xóa thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearDisplay1();
                    if (dtgvListOfDetailProductImport.Rows.Count == 0)
                    {
                        dtgvListOfDetailProductImport.ColumnCount          = 3;
                        dtgvListOfDetailProductImport.ColumnHeadersVisible = true;
                        dtgvListOfDetailProductImport.Columns[0].Name      = "MaHDN1";
                        dtgvListOfDetailProductImport.Columns[1].Name      = "MaSPDL";
                        dtgvListOfDetailProductImport.Columns[2].Name      = "SoLuong";

                        dtgvListOfDetailProductImport.Columns[0].DataPropertyName = "MaHDN";
                        dtgvListOfDetailProductImport.Columns[1].DataPropertyName = "MaSPDL";
                        dtgvListOfDetailProductImport.Columns[2].DataPropertyName = "SoLuong";

                        dtgvListOfDetailProductImport.Columns[0].HeaderText = "Mã HD nhập";
                        dtgvListOfDetailProductImport.Columns[1].HeaderText = "Mã SP Đại lí";
                        dtgvListOfDetailProductImport.Columns[2].HeaderText = "Số lượng";

                        dtgvListOfDetailProductImport.Columns[0].Width = 140;
                        dtgvListOfDetailProductImport.Columns[1].Width = 140;
                        dtgvListOfDetailProductImport.Columns[2].Width = 125;
                    }
                    return;
                }
            }catch
            {
                XtraMessageBox.Show("Xóa chi tiết hóa đơn thất bại ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        private void frmChiTietHoaDonNhap_Load(object sender, EventArgs e)
        {
            ChiTietHoaDonNhap_BUS cTHDN_BUS = new ChiTietHoaDonNhap_BUS();

            dsCTHDN = cTHDN_BUS.LayDanhSach();
            dataGridViewCTHDN.DataSource    = dsCTHDN;
            dataGridViewCTHDN.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridViewCTHDN.Columns["MAHDN"].HeaderText     = "Mã Hoá Đơn Bán";
            dataGridViewCTHDN.Columns["MAHH"].HeaderText      = "Mã Hàng Hoá";
            dataGridViewCTHDN.Columns["SOLUONG"].HeaderText   = "Số Lượng";
            dataGridViewCTHDN.Columns["GIAMGIA"].HeaderText   = "Giảm Giá";
            dataGridViewCTHDN.Columns["THANHTIEN"].HeaderText = "Thành Tiền";
            dataGridViewCTHDN.AutoSizeColumnsMode             = DataGridViewAutoSizeColumnsMode.Fill;
        }
Exemplo n.º 6
0
        private void btnThemSP_Click(object sender, EventArgs e)
        {
            if (txtTenGiay.Text != "")
            {
                txtMaNCC.Enabled = false;
                HoaDonNhap_BUS        hdnhap_bus   = new HoaDonNhap_BUS();
                ChiTietHoaDonNhap_BUS cthdnhap_bus = new ChiTietHoaDonNhap_BUS();
                HoaDonNhap_DTO        hd_nhap      = new HoaDonNhap_DTO();
                hd_nhap = hdnhap_bus.LayHoaDonChuaNhapTheoMaNCC(txtMaNCC.Text);

                if (hd_nhap.id == -1)
                {
                    HoaDonNhap_DTO hdnhap_moi = new HoaDonNhap_DTO(-1, BienToanCuc.nvDangNhap.idNhanVien, txtMaNCC.Text, DateTime.Now, 0, 0);
                    if (hdnhap_bus.Them(hdnhap_moi))
                    {
                        ChiTietHoaDonNhap_DTO cthd_nhap = new ChiTietHoaDonNhap_DTO(hdnhap_bus.LastID(), idGiay, cbSize.Text, int.Parse(txtSoLuongNhap.Text), int.Parse(txtGiaNhap.Text));
                        cthdnhap_bus.Them(cthd_nhap);
                        HienThiCTHoaDonNhap(hdnhap_bus.LastID());
                        lvHoaDon.Tag = hdnhap_bus.LayHoaDonChuaNhapTheoMaNCC(txtMaNCC.Text);
                        LoadHDNhap();
                    }
                }
                else
                {
                    ChiTietHoaDonNhap_DTO cthd_nhap = new ChiTietHoaDonNhap_DTO(hd_nhap.id, idGiay, cbSize.Text, int.Parse(txtSoLuongNhap.Text), int.Parse(txtGiaNhap.Text));
                    cthdnhap_bus.Them(cthd_nhap);
                    HienThiCTHoaDonNhap(hd_nhap.id);
                    lvHoaDon.Tag = hd_nhap;
                    LoadHDNhap();
                }
                ResetSP();
            }
            else
            {
                MessageBox.Show("Vui lòng chọn sản phẩm !!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 7
0
        private void LoadChiTietPhieuNhapHang()
        {
            List <ChiTietHoaDonNhap_DTO> listChiTietPhieuNhap = ChiTietHoaDonNhap_BUS.LoadChiTietPhieuNhap();

            dtgvListOfDetailProductImport.DataSource = listChiTietPhieuNhap;
        }