Exemplo n.º 1
0
        public void load_idphieunhap()
        {
            PhieuNhapBLL pnBLL = new PhieuNhapBLL();

            cbx_IDPHIEUN.DataSource    = pnBLL.show_idPN();
            cbx_IDPHIEUN.DisplayMember = "IDPHIEUN";
            cbx_IDPHIEUN.ValueMember   = "IDPHIEUN";
        }
Exemplo n.º 2
0
        private void Load_Data_PhieuNhap()
        {
            PhieuNhapBLL nhapBLL = new PhieuNhapBLL();

            grvPhieuNhap.DataSource = nhapBLL.GetData(cbx_IDPHIEUN.Text);

            cbx_IDNCCN.Enabled       = false;
            cbx_IDHANGPN.Enabled     = false;
            txtTenHangPN.Enabled     = false;
            txtDTV.Enabled           = false;
            txtLuongNhap.Enabled     = false;
            txtGiaNhapPN.Enabled     = false;
            txtThanhTienPN.Enabled   = false;
            cbx_IDNhanVienPN.Enabled = false;
        }
        private void btnGhiSo_Click(object sender, EventArgs e)
        {
            PhieuNhapBLL bLL       = new PhieuNhapBLL();
            PhieuNhapKho phieuNhap = new PhieuNhapKho();

            phieuNhap.SoChungTu     = txbSohieu.Text;
            phieuNhap.MaKho         = ((DataRowView)cbKhoNhap.SelectedItem)["MaKho"].ToString();
            phieuNhap.NgayLapPhieu  = dateTimePickerNgayLapPhieu.Value.Date;
            phieuNhap.NguoiLapPhieu = txbTenNV.Text;
            phieuNhap.NguoiGiaoHang = txbNguoigiao.Text;
            phieuNhap.MaNSX         = ((DataRowView)cbNhaSX.SelectedItem)["MaNsx"].ToString();
            if (bLL.InsertPhieuNhapKho(phieuNhap, dtgvDsHangNhap))
            {
                MessageBox.Show("Đã thêm thành công phiếu nhập!");
            }
            else
            {
                MessageBox.Show("Không thể thêm phiếu nhập!");
            }
        }
        public void Load_DsPhieuNhap()
        {
            PhieuNhapBLL bLL = new PhieuNhapBLL();

            dtgvDsPhieuNhap.DataSource = bLL.GetListPhieuNhap();
        }
Exemplo n.º 5
0
        private void Excute_NCC(string query)
        {
            if (query == "insert")
            {
                try
                {
                    PhieuNhapBLL pnBLL = new PhieuNhapBLL();
                    //mã tự động
                    string date = DateTime.Now.Day.ToString();
                    if (DateTime.Now.Month < 10)
                    {
                        date = date + "0" + DateTime.Now.Month.ToString();
                    }
                    else
                    {
                        date = date + DateTime.Now.Month.ToString();
                    }
                    id_pn = date + DateTime.Now.Year.ToString().Substring(2, 2);
                    var a    = pnBLL.show_idPN();
                    int soPN = 0;
                    foreach (var item in a)
                    {
                        if (item.IDPHIEUN.Contains(id_pn))
                        {
                            soPN++;
                        }
                    }
                    if (soPN != 0)
                    {
                        if (soPN < 10)
                        {
                            id_pn = "N" + id_pn + "00" + (soPN + 1).ToString();
                        }
                        else
                        {
                            if (soPN >= 10 && soPN <= 99)
                            {
                                id_pn = "N" + id_pn + "0" + (soPN + 1).ToString();
                            }
                            else
                            {
                                id_pn = "N" + id_pn + (soPN + 1).ToString();
                            }
                        }
                    }
                    else
                    {
                        id_pn = "N" + id_pn + "001";
                    }
                    //cbx_IDPHIEUN.Text = id_pn;
                    cbx_IDPHIEUN.Enabled = false;
                    cbx_IDPHIEUN.Text    = id_pn;
                    MessageBox.Show("Vui lòng chọn mã nhà cung cấp của phiếu nhập số " + id_pn);

                    //grvPhieuNhap.DataSource = null;
                }


                catch (Exception ex)
                {
                    MessageBox.Show("Thêm bị lỗi: " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //if (query == "delete")
            //{
            //    try
            //    {
            //        string id = txtID.Text.Trim();
            //        NhaCungCapBLL capBLL = new NhaCungCapBLL();
            //        capBLL.Delete(id);
            //        Load_Data_NCC();
            //        MessageBox.Show("Đã xóa thành công:");

            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("Không thể xóa: " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    }
            //}
        }