Example #1
0
 private void textBoxSearch_TextChanged(object sender, EventArgs e)
 {
     if (comboBoxSearch.Text == "No Nota")
     {
         kriteria = "N.NoNota";
     }
     else if (comboBoxSearch.Text == "Tanggal")
     {
         kriteria = "N.Tanggal";
     }
     else if (comboBoxSearch.Text == "Id Pegawai")
     {
         kriteria = "N.IdPegawai";
     }
     else if (comboBoxSearch.Text == "Id Supplier")
     {
         kriteria = "N.IdSupplier";
     }
     else if (comboBoxSearch.Text == "Jenis Pembayaran")
     {
         kriteria = "p.JenisPembayaran";
     }
     listNotaBeli = NotaBeli.BacaData(kriteria, textBoxSearch.Text);
     TampilDataGrid();
 }
Example #2
0
 private void textBoxNoNota_TextChanged(object sender, EventArgs e)
 {
     if (textBoxNoNota.Text.Length == textBoxNoNota.MaxLength)
     {
         string hasilBaca = NotaBeli.BacaData("NoNota", textBoxNoNota.Text, listDataNotaBeli);
         if (hasilBaca == "1")
         {
             if (listDataNotaBeli.Count() > 0)
             {
                 dateTimePickerTanggal.Value     = listDataNotaBeli[0].Tanggal;
                 comboBoxPelanggan.SelectedIndex = comboBoxPelanggan.Items.IndexOf(listDataNotaBeli[0].Supplier.KodeSupplier + " - " + listDataNotaBeli[0].Supplier.NamaSupplier);
                 labelAlamat.Text = listDataNotaBeli[0].Supplier.Alamat;
                 textBoxBarcode.Focus();
                 textBoxNoNota.Enabled = false;
             }
             else
             {
                 MessageBox.Show("Nomor Nota tidak ditemukan. Proses Ubah Data tidak bisa dilakukan.");
                 textBoxNoNota.Text = "";
             }
         }
         else
         {
             MessageBox.Show("Perintah SQL gagal dijalankan.Pesan kesalahan = " + hasilBaca);
         }
     }
 }
        private void textBoxCari_TextChanged(object sender, EventArgs e)
        {
            if (comboBoxNotaBeli.Text == "Nomor Nota")
            {
                kriteria = "N.NoNota";
            }
            else if (comboBoxNotaBeli.Text == "Tanggal")
            {
                kriteria = "N.Tanggal";
            }
            else if (comboBoxNotaBeli.Text == "Kode Supplier")
            {
                kriteria = "N.KodeSupplier";
            }
            else if (comboBoxNotaBeli.Text == "Nama Supplier")
            {
                kriteria = "S.Nama";
            }
            else if (comboBoxNotaBeli.Text == "Alamat Supplier")
            {
                kriteria = "S.Alamat";
            }
            else if (comboBoxNotaBeli.Text == "Kode Pegawai")
            {
                kriteria = "N.KodePegawai";
            }
            else if (comboBoxNotaBeli.Text == "Nama Pegawai")
            {
                kriteria = "PG.Nama";
            }

            //tampilkan data barang sesuai kriteria
            string hasilBaca = NotaBeli.BacaData(kriteria, textBoxCari.Text, listHasilData);

            if (hasilBaca == "1")
            {
                dataGridView1.Rows.Clear();

                //tampilkan semua isi listBarang di datagridview
                for (int i = 0; i < listHasilData.Count; i++)
                {
                    dataGridView1.Rows.Add(listHasilData[i].NoNotaBeli, listHasilData[i].Tanggal, listHasilData[i].Supplier.KodeSupplier, listHasilData[i].Supplier.NamaSupplier, listHasilData[i].Supplier.Alamat, listHasilData[i].Pegawai.KodePegawai, listHasilData[i].Pegawai.Nama);
                }
            }
        }
Example #4
0
        private void textBoxNoNota_TextChanged(object sender, EventArgs e)
        {
            if (textBoxNoNota.Text.Length == textBoxNoNota.MaxLength)
            {
                string hasilBaca = NotaBeli.BacaData("NoNota", textBoxNoNota.Text, listDataNotaBeli);
                if (hasilBaca == "1")
                {
                    if (listDataNotaBeli.Count() > 0)
                    {
                        dateTimePickerTanggal.Value     = listDataNotaBeli[0].Tanggal;
                        comboBoxPelanggan.SelectedIndex = comboBoxPelanggan.Items.IndexOf(listDataNotaBeli[0].Supplier.KodeSupplier + " - " + listDataNotaBeli[0].Supplier.NamaSupplier);
                        //kosongi isi datagridview
                        dataGridViewBarang.Rows.Clear();

                        //tampilkan semua isi listBarang di datagridview
                        for (int i = 0; i < listDataNotaBeli[0].ListNotaBeliDetil.Count(); i++)
                        {
                            int subTotal = listDataNotaBeli[0].ListNotaBeliDetil[i].Harga * listDataNotaBeli[0].ListNotaBeliDetil[i].Jumlah;
                            dataGridViewBarang.Rows.Add(listDataNotaBeli[0].ListNotaBeliDetil[i].Barang.KodeBarang, listDataNotaBeli[0].ListNotaBeliDetil[i].Barang.Nama, listDataNotaBeli[0].ListNotaBeliDetil[i].Harga, listDataNotaBeli[0].ListNotaBeliDetil[i].Jumlah, subTotal);
                        }
                        labelAlamat.Text      = listDataNotaBeli[0].Supplier.Alamat;
                        labelGrandTotal.Text  = HitungGrandTotal().ToString("0,###");
                        textBoxNoNota.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("Nomor Nota tidak ditemukan. Proses Ubah Data tidak bisa dilakukan.");
                        textBoxNoNota.Text = "";
                    }
                }
                else
                {
                    MessageBox.Show("Perintah SQL gagal dijalankan.Pesan kesalahan = " + hasilBaca);
                }
            }
        }
        public void FormNotaBeli_Load(object sender, EventArgs e)
        {
            comboBoxNotaBeli.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBoxNotaBeli.SelectedIndex = 0;
            FormatDataGrid();

            string hasilBaca = NotaBeli.BacaData("", "", listHasilData);

            if (hasilBaca == "1")
            {
                //kosongi isi datagridview
                dataGridView1.Rows.Clear();

                //tampilkan semua isi listBarang di datagridview
                for (int i = 0; i < listHasilData.Count(); i++)
                {
                    dataGridView1.Rows.Add(listHasilData[i].NoNotaBeli, listHasilData[i].Tanggal, listHasilData[i].Supplier.KodeSupplier, listHasilData[i].Supplier.NamaSupplier, listHasilData[i].Supplier.Alamat, listHasilData[i].Pegawai.KodePegawai, listHasilData[i].Pegawai.Nama);
                }
            }
            else
            {
                dataGridView1.DataSource = null;
            }
        }
Example #6
0
 private void FormListNotaBeli_Load(object sender, EventArgs e)
 {
     FormatDataGrid();
     listNotaBeli = NotaBeli.BacaData("", "");
     TampilDataGrid();
 }