private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                Supplier   supplierDipilih   = (Supplier)comboBoxSupplier.SelectedItem;
                Pembayaran pembayaranDipilih = (Pembayaran)comboBoxPayment.SelectedItem;
                notaBeli = new NotaBeli(textBoxNoNota.Text, dateTimePickerDate.Value, formMenu.pegawaiLogin,
                                        supplierDipilih, pembayaranDipilih);

                for (int i = 0; i < dataGridViewNotaBeli.Rows.Count; i++)
                {
                    string IdBuku = dataGridViewNotaBeli.Rows[i].Cells["IdBuku"].Value.ToString();

                    listBuku = Buku.BacaData("B.IdBuku", IdBuku);

                    int harga  = int.Parse(dataGridViewNotaBeli.Rows[i].Cells[textBoxHarga.Text].Value.ToString());
                    int jumlah = int.Parse(dataGridViewNotaBeli.Rows[i].Cells["Jumlah"].Value.ToString());

                    notaBeli.TambahNotaBeliDetil(listBuku[0], harga, jumlah);
                }

                NotaBeli.TambahData(notaBeli);
                MessageBox.Show("Data Nota Pembelian Telah Tersimpan.", "Informasi");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Gagal Menyimpan Nota. Pesan Kesalahan : " + ex.Message, "Kesalahan");
            }
        }
        private void buttonSimpan_Click(object sender, EventArgs e)
        {
            if (dataGridViewTambahNotaBeli.Rows.Count >= 1)
            {
                try
                {
                    Supplier supplier = (Supplier)comboBoxDaftarSupplier.SelectedItem;
                    nota = new NotaBeli(
                        textBoxNoNota.Text,
                        dateTimePickerTanggal.Value,
                        supplier,
                        form.pegawaiLogin);

                    for (int i = 0; i < dataGridViewTambahNotaBeli.Rows.Count - 1; i++)
                    {
                        string kode = dataGridViewTambahNotaBeli.Rows[i].Cells[0].Value.ToString();

                        listBarang = barang.QueryData("Barang.KodeBarang", kode);

                        int harga  = int.Parse(dataGridViewTambahNotaBeli.Rows[i].Cells[2].Value.ToString());
                        int jumlah = int.Parse(dataGridViewTambahNotaBeli.Rows[i].Cells[3].Value.ToString());

                        nota.TambahNotaBeliDetil((Barang)listBarang[0], harga, jumlah);
                    }

                    nota.Insert();
                    MessageBox.Show("Data Berhasil Disimpan", "Info");
                    ClearFocus();
                }
                catch (Exception error)
                {
                    MessageBox.Show($"Gagal Menyimpan Nota, Error : {error.Message}", "Error");
                }
            }
        }