Esempio n. 1
0
        /* Sự kiện lưu thông tin đã thay đổi của các đầu sách cần nhập */
        private void btnSave_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Bạn có muốn lưu lại thay đổi thông tin phiếu nhập không?", "Thông báo", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                List <TTPhieuNhapDTO> receiptNote = new List <TTPhieuNhapDTO>();
                foreach (PReceiptNote item in pnlreceiptNotes)
                {
                    if (!item.IsDisposed)
                    {
                        receiptNote.Add(new TTPhieuNhapDTO(phieuNhap.Ngaynhap, item.DauSach, item.Price, item.Quantity, item.DeliveryDay, item.Supplier));
                    }
                    else
                    {
                        receiptNote.Add(new TTPhieuNhapDTO(phieuNhap.Ngaynhap, item.DauSach, 0, item.Quantity, item.DeliveryDay, item.Supplier));
                    }
                }
                if (TTPhieuNhapBUS.ChangeReceiptNote(phieuNhap, receiptNote) < 1)
                {
                    MessageBox.Show("Lưu không thành công.", "Thông báo");
                }
                else
                {
                    this.Close();
                }
            }
        }
Esempio n. 2
0
        /* Phương thức khỏi tạo tab thông tin phiếu nhập dựa trên rdb để lấy thông tin phiếu nhập */
        private void InitReceNotes()
        {
            List <PhieuDTO> receNotes;

            if (rdbAllReceptNotes.Checked)
            {
                receNotes = TTPhieuNhapBUS.GetReceiptNotes();
            }
            else
            {
                receNotes = TTPhieuNhapBUS.GetReceiptNotesNotDeliveryNotes();
            }
            if (receNotes.Count > 0)
            {
                dgvReceNotes.DataSource            = receNotes;
                dgvReceNotes.Columns[0].HeaderText = "Thời gian lập";
            }
            else
            {
                dgvReceNotes.DataSource = null;
                lbDayReceNote.Text      = String.Empty;
                dgvReceNote.DataSource  = null;
                lbSumPriceRN.Text       = "0";
                btnEditReceNote.Enabled = false;
            }
        }
Esempio n. 3
0
        /* Khởi tạo khi truyền một phiếu nhập vào để lấy thông tin chi tiết phiếu nhập */
        public FEditReceiptNote(PhieuDTO phieuNhap)
        {
            InitializeComponent();
            this.phieuNhap = phieuNhap;
            int gia = TTPhieuNhapBUS.GetReceiptNote(phieuNhap, out List <TTPhieuNhapDTO> chitiet);

            ConvertToPanel(chitiet);
            lblSum.Text = gia.ToString("#,0");
        }
Esempio n. 4
0
 /* Sự kiện chọn giá trị trong cbb để load danh sách đơn nhập chưa giao */
 private void cbbSupplier_SelectedValueChanged(object sender, EventArgs e)
 {
     dgvReceNote.DataSource            = TTPhieuNhapBUS.GetReceiptNotesOfSupplier(cbbSupplier.SelectedValue as NXBDTO);
     dgvReceNote.Columns[0].Visible    = false;
     dgvReceNote.Columns[1].Visible    = false;
     dgvReceNote.Columns[2].HeaderText = "Đầu sách";
     dgvReceNote.Columns[3].Visible    = false;
     dgvReceNote.Columns[4].Visible    = false;
     dgvReceNote.Columns[5].HeaderText = "Số lượng";
     dgvReceNote.Columns[6].HeaderText = "Ngày hẹn";
     dgvReceNote.Columns[7].Visible    = false;
     dgvReceNote.Columns[8].HeaderText = "Đơn giá";
     while (pnldeliveryNotes.Count > 0)
     {
         pnldeliveryNotes[0].Delete.PerformClick();
     }
 }
Esempio n. 5
0
        /* Phương thức khỏi tạo tab thông tin phiếu giao là lấy toàn bộ danh sách phiếu giao đổ vào dgv */
        private void InitDeliNotes()
        {
            List <PhieuDTO> deliNotes = TTPhieuNhapBUS.GetDeliveryNotes();

            if (deliNotes.Count > 0)
            {
                dgvDeliNotes.DataSource            = deliNotes;
                dgvDeliNotes.Columns[0].HeaderText = "Thời gian lập";
            }
            else
            {
                dgvDeliNotes.DataSource = null;
                lbDayDeliNote.Text      = String.Empty;
                lbNCC.Text             = String.Empty;
                dgvDeliNote.DataSource = null;
                lbSumPriceDN.Text      = "0";
            }
        }
Esempio n. 6
0
 /* Sự kiện chọn một dòng để lấy thông tin chi tiết của phiếu nhập */
 private void dgvReceNotes_SelectionChanged(object sender, EventArgs e)
 {
     if (dgvReceNotes.CurrentRow != null)
     {
         int      index     = dgvReceNotes.CurrentRow.Index;
         PhieuDTO phieuNhap = (dgvReceNotes.DataSource as List <PhieuDTO>)[index];
         int      gia       = TTPhieuNhapBUS.GetReceiptNote(phieuNhap, out List <TTPhieuNhapDTO> chiTiet);
         lbDayReceNote.Text                = phieuNhap.Ngaynhap.ToString();
         dgvReceNote.DataSource            = chiTiet;
         dgvReceNote.Columns[0].Visible    = false;
         dgvReceNote.Columns[1].Visible    = false;
         dgvReceNote.Columns[2].HeaderText = "Đầu sách";
         dgvReceNote.Columns[3].Visible    = false;
         dgvReceNote.Columns[4].HeaderText = "Nhà cung cấp";
         dgvReceNote.Columns[5].HeaderText = "Số lượng";
         dgvReceNote.Columns[6].HeaderText = "Ngày giao dự kiến";
         dgvReceNote.Columns[7].HeaderText = "Ngày giao";
         dgvReceNote.Columns[8].HeaderText = "Giá";
         lbSumPriceRN.Text = gia.ToString("#,0");
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Tabpage phiếu giao
 /// </summary>
 /* Sự kiện chọn một dòng để lấy thông tin chi tiết của phiếu giao */
 private void dgvDeliNotes_SelectionChanged(object sender, EventArgs e)
 {
     if (dgvReceNotes.CurrentRow != null)
     {
         int      index     = dgvDeliNotes.CurrentRow.Index;
         PhieuDTO phieuGiao = (dgvDeliNotes.DataSource as List <PhieuDTO>)[index];
         int      gia       = TTPhieuNhapBUS.GetDeliveryNote(phieuGiao, out List <TTPhieuNhapDTO> chiTiet);
         lbDayDeliNote.Text                = phieuGiao.Ngaynhap.ToString();
         lbNCC.Text                        = chiTiet[0].Manxb.Ten;
         dgvDeliNote.DataSource            = chiTiet;
         dgvDeliNote.Columns[0].Visible    = false;
         dgvDeliNote.Columns[1].Visible    = false;
         dgvDeliNote.Columns[2].HeaderText = "Đầu sách";
         dgvDeliNote.Columns[3].Visible    = false;
         dgvDeliNote.Columns[4].Visible    = false;
         dgvDeliNote.Columns[5].HeaderText = "Số lượng";
         dgvDeliNote.Columns[6].Visible    = false;
         dgvDeliNote.Columns[7].HeaderText = "Ngày giao";
         dgvDeliNote.Columns[8].HeaderText = "Giá";
         lbSumPriceDN.Text                 = gia.ToString("#,0");
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Tabpage Nhà cung cấp
        /// </summary>

        /* Sự kiện chọn một dòng trong dgv để hiện thị chi tiết nhà cung cấp
         * và hiện thị những cuốn sách đang đặt */
        private void dgvSuppliers_SelectionChanged(object sender, EventArgs e)
        {
            if (dgvSuppliers.CurrentRow != null)
            {
                int    index      = dgvSuppliers.CurrentRow.Index;
                NXBDTO nhaCungCap = (dgvSuppliers.DataSource as List <NXBDTO>)[index];
                lbNameSupplier.Text                  = nhaCungCap.Ten;
                lbEmailSupplier.Text                 = nhaCungCap.Email;
                lbPhoneSupplier.Text                 = nhaCungCap.Sdt;
                lbFaxSupplier.Text                   = nhaCungCap.Fax;
                dgvNotDeliBook.DataSource            = TTPhieuNhapBUS.GetReceiptNotesOfSupplier(nhaCungCap);
                dgvNotDeliBook.Columns[0].HeaderText = "Ngày nhập";
                dgvNotDeliBook.Columns[1].Visible    = false;
                dgvNotDeliBook.Columns[2].HeaderText = "Đầu sách";
                dgvNotDeliBook.Columns[3].Visible    = false;
                dgvNotDeliBook.Columns[4].Visible    = false;
                dgvNotDeliBook.Columns[5].HeaderText = "Số lượng";
                dgvNotDeliBook.Columns[6].HeaderText = "Ngày hẹn";
                dgvNotDeliBook.Columns[7].Visible    = false;
                dgvNotDeliBook.Columns[8].HeaderText = "Giá";
            }
        }
Esempio n. 9
0
        /* Sự kiện lưu thông tin phiếu nhập được tạo */
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (pnlreceiptNotes.Count < 1)
            {
                MessageBox.Show("Chưa có đầu sách cần nhập.", "Thông báo");
                return;
            }
            List <TTPhieuNhapDTO> phieuNhaps = new List <TTPhieuNhapDTO>();
            DateTime ngaynhap = DateTime.Now;

            foreach (PReceiptNote item in pnlreceiptNotes)
            {
                if (item.CheckReceiptNote())
                {
                    phieuNhaps.Add(new TTPhieuNhapDTO(
                                       ngaynhap,
                                       item.DauSach,
                                       item.Price,
                                       item.Quantity,
                                       item.DeliveryDay,
                                       item.Supplier
                                       ));
                }
                else
                {
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin", "Thông báo");
                    return;
                }
            }
            if (TTPhieuNhapBUS.AddReceiptNote(phieuNhaps) < 1)
            {
                MessageBox.Show("Lưu không thành công.", "Thông báo");
            }
            else
            {
                this.Close();
            }
        }
Esempio n. 10
0
        /* Sự kiện lưu thông tin phiếu giao */
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (pnldeliveryNotes.Count < 1)
            {
                MessageBox.Show("Chưa có đầu sách nào được giao.", "Thông báo");
                return;
            }
            List <TTPhieuNhapDTO> phieuGiaos = new List <TTPhieuNhapDTO>();
            DateTime ngaygiao = DateTime.Now;

            foreach (PDeliveryNote item in pnldeliveryNotes)
            {
                item.Chitiet.Mapg = ngaygiao;
                phieuGiaos.Add(item.Chitiet);
            }
            if (TTPhieuNhapBUS.AddDeliveryNote(phieuGiaos) < 1)
            {
                MessageBox.Show("Lưu không thành công.", "Thông báo");
            }
            else
            {
                this.Close();
            }
        }