Beispiel #1
0
        private void buttonHapus_Click(object sender, EventArgs e)
        {
            string h = "";

            if (checkBox1.Checked == true)
            {
                h = BOM.HapusData(comboBox1.Text, "");
            }
            else
            {
                h = BOM.HapusData(comboBox1.Text, comboBox2.Text);
            }
            if (h == "1")
            {
                MessageBox.Show("BOM telah dihapus");
                FormDaftarBOM f = (FormDaftarBOM)this.Owner;
                f.FormDaftarBOM_Load(sender, e);
                textBoxbahan.Text       = "";
                textBoxNamaJabatan.Text = "";
                comboBox1.Text          = "";
                comboBox2.Text          = "";
                FormHapusBOM_Load(sender, e);
            }
            else
            {
                MessageBox.Show("BOM gagal dihapus. Pesan: " + h);
            }
        }
        private void FormTambahBOM_Load(object sender, EventArgs e)
        {
            try
            {
                frmDaftar = (FormDaftarBOM)this.Owner;
                FormatDataGrid();
                listBahanBaku.Clear();
                listBarang.Clear();
                comboBoxBahan.Items.Clear();
                comboBoxKodeBarang.Items.Clear();
                comboBoxKodeBarang.Enabled = true;
                groupBox1.Enabled          = false;

                numericUpDownBiayaTukang.Value      = 0;
                numericUpDownBiayaOperasional.Value = 0;
                numericUpDownPengajuanHarga.Value   = 0;
                numericUpDownJumlahBagian.Value     = 0;
                numericUpDownJumlahSpesifik.Value   = 0;
                numericUpDownTotalBiaya.Value       = 0;

                numericUpDownBiayaTukang.Enabled      = false;
                numericUpDownBiayaOperasional.Enabled = false;
                numericUpDownPengajuanHarga.Enabled   = false;
                numericUpDownJumlahBagian.Enabled     = false;
                numericUpDownJumlahSpesifik.Enabled   = false;
                numericUpDownTotalBiaya.Enabled       = false;

                string hasil = BahanBaku.BacaData("", "", listBahanBaku);
                if (hasil == "1")
                {
                    for (int i = 0; i < listBahanBaku.Count; i++)
                    {
                        comboBoxBahan.Items.Add(listBahanBaku[i].Id + " - " + listBahanBaku[i].Nama);
                    }
                }
                else
                {
                    MessageBox.Show(hasil, "Error");
                }
                string hasil1 = Barang.BacaData("", "", listBarang);
                if (hasil1 == "1")
                {
                    for (int i = 0; i < listBarang.Count; i++)
                    {
                        comboBoxKodeBarang.Items.Add(listBarang[i].Kode + " - " + listBarang[i].Nama);
                    }
                }
                else
                {
                    MessageBox.Show(hasil1, "Error");
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
        private void bOMToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form form = Application.OpenForms["FormDaftarBOM"];

            if (form == null)
            {
                FormDaftarBOM frm = new FormDaftarBOM();
                frm.Owner = this;
                frm.Show();
            }
            else
            {
                form.Show();
                form.BringToFront();
            }
        }
Beispiel #4
0
        private void buttonUbahData_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text != "" && comboBox2.Text != "")
            {
                BOM b = new BOM(comboBox2.Text, comboBox1.Text, numericUpDownJumlahBagian.Value.ToString(),
                                numericUpDownJumlahSpesifik.Value.ToString(), (int)numericUpDownTotalBiaya.Value, (int)numericUpDownBiayaOperasional.Value,
                                (int)numericUpDownBiayaTukang.Value, (int)numericUpDownPengajuanHarga.Value);

                string hasil = BOM.UbahData(b);
                if (hasil == "1")
                {
                    MessageBox.Show("BOM telah diubah");
                    FormDaftarBOM d = (FormDaftarBOM)this.Owner;
                    d.FormDaftarBOM_Load(sender, e);
                    comboBox2.Enabled = true;
                    comboBox1.Enabled = true;
                    comboBox1.Text    = "";
                    comboBox2.Text    = "";

                    numericUpDownTotalBiaya.Value       = 0;
                    numericUpDownBiayaOperasional.Value = 0;
                    numericUpDownPengajuanHarga.Value   = 0;
                    numericUpDownJumlahBagian.Value     = 0;
                    numericUpDownJumlahSpesifik.Value   = 0;

                    numericUpDownBiayaOperasional.Enabled = false;
                    numericUpDownBiayaTukang.Enabled      = false;
                    numericUpDownPengajuanHarga.Enabled   = false;
                    numericUpDownJumlahBagian.Enabled     = false;
                    numericUpDownJumlahSpesifik.Enabled   = false;
                    FormUbahBOM_Load(sender, e);
                }
            }
            else
            {
                MessageBox.Show("Silahkan mengisi data yang dibutuhkan terlebih dahulu");
            }
        }