Example #1
0
        private void FormTambahBarang_Load(object sender, EventArgs e)
        {
            frmDaftar = (FormDaftarBarang)this.Owner;

            listHasilData.Clear();
            textBoxKodeBarang.Text         = "";
            textBoxNamaBarang.Text         = "";
            textBoxSatuanBarang.Text       = "";
            numericUpDownHargaSatuan.Value = 0;
            numericUpDownJumlah.Value      = 0;
            numericUpDownJumlah.Enabled    = false;
            comboBoxPO.Text = "";
            pictureBoxGambar.BackgroundImage = null;
            richTextBoxKeterangan.Text       = "";
            string hasil = OrderPenjualan.BacaData("", "", listHasilData);

            if (hasil == "1")
            {
                for (int i = 0; i < listHasilData.Count; i++)
                {
                    comboBoxPO.Items.Add(listHasilData[i].NoOrder + " - " + listHasilData[i].Customer.Nama);
                }
            }
            else
            {
                MessageBox.Show("ERROR");
            }
        }
Example #2
0
        public void FormDaftarOrderPenjualan_Load(object sender, EventArgs e)
        {
            comboBoxCari.DropDownStyle = ComboBoxStyle.DropDownList;

            FormatDataGrid();
            listHasilData.Clear();

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

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

                for (int i = 0; i < listHasilData.Count; i++)
                {
                    for (int j = 0; j < listHasilData[i].ListBarang.Count; j++)
                    {
                        dataGridViewBarang.Rows.Add(listHasilData[i].NoOrder, listHasilData[i].Tanggal, listHasilData[i].Customer.IdCustomer,
                                                    listHasilData[i].Customer.Nama, listHasilData[i].Unit, listHasilData[i].ListBarang[j].Kode,
                                                    listHasilData[i].ListBarang[j].Nama, listHasilData[i].ListBarang[j].Jumlah, listHasilData[i].ListBarang[j].HargaSatuan,
                                                    listHasilData[i].ListBarang[j].Keterangan);
                    }
                }
            }
        }
        private void FormTambahSPK_Load(object sender, EventArgs e)
        {
            frmDaftar = (FormDaftarSPK)this.Owner;

            try
            {
                string codebaru;
                string hasilgen = Spk.GenerateCode(out codebaru);
                if (hasilgen == "1")
                {
                    textBoxNoSPK.Text    = codebaru;
                    textBoxNoSPK.Enabled = false;
                }
                else
                {
                    MessageBox.Show("Gagal melakukan generate code. Pesan kesalahan: " + hasilgen);
                }

                ListDatapeg.Clear();
                listdatabarang.Clear();

                string hasilbaca2 = OrderPenjualan.BacaData("", "", listorderpenjualan);
                if (hasilbaca2 == "1")
                {
                    comboBox1.Items.Clear();
                    for (int i = 0; i < listorderpenjualan.Count; i++)
                    {
                        comboBox1.Items.Add(listorderpenjualan[i].NoOrder);
                    }
                }

                string hasilBaca3 = Pekerja.BacaData("", "", ListDatapeg);


                if (hasilBaca3 == "1")
                {
                    comboBoxPekerja.Items.Clear();
                    for (int i = 0; i < ListDatapeg.Count; i++)
                    {
                        comboBoxPekerja.Items.Add(ListDatapeg[i].IdPekerja + " . " + ListDatapeg[i].Nama);
                    }
                }
                else
                {
                    MessageBox.Show("Data Pekerja gagal ditampilkan. Pesan kesalahan: " + hasilBaca3);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
        public void FormBatalOrderPenjualan_Load(object sender, EventArgs e)
        {
            try
            {
                frmDaftar = (FormDaftarOrderPenjualan)this.Owner;

                FormatDataGrid();

                listDataOP.Clear();

                dateTimePickerTanggal.Value   = DateTime.Now;
                textBoxCustomer.Text          = "";
                textBoxUnit.Text              = "";
                dateTimePickerTanggal.Enabled = false;
                textBoxCustomer.Enabled       = false;
                textBoxUnit.Enabled           = false;

                string hasilBaca = OrderPenjualan.BacaData("", "", lists);

                bool idSama = false;
                if (hasilBaca == "1")
                {
                    comboBoxNoOrderPenjualan.Items.Clear();
                    for (int i = 0; i < lists.Count; i++)
                    {
                        for (int j = 0; j < comboBoxNoOrderPenjualan.Items.Count; j++)
                        {
                            if (comboBoxNoOrderPenjualan.GetItemText(comboBoxNoOrderPenjualan.Items[j]) == lists[i].NoOrder)
                            {
                                idSama = true;
                                break;
                            }
                        }

                        if (!idSama)
                        {
                            comboBoxNoOrderPenjualan.Items.Add(lists[i].NoOrder);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Data Order Penjualan gagal ditampilkan. Pesan kesalahan: " + hasilBaca);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Example #5
0
        private void textBoxCari_TextChanged(object sender, EventArgs e)
        {
            string kriteria = "";

            if (comboBoxCari.Text == "No Order Penjualan")
            {
                kriteria = "OP.id";
            }
            else if (comboBoxCari.Text == "Id Customer")
            {
                kriteria = "C.Id";
            }
            else if (comboBoxCari.Text == "Nama Customer")
            {
                kriteria = "C.Nama";
            }
            else if (comboBoxCari.Text == "Kode Barang")
            {
                kriteria = "B.Kode";
            }
            else if (comboBoxCari.Text == "Nama Barang")
            {
                kriteria = "B.Nama";
            }
            else if (comboBoxCari.Text == "Jumlah")
            {
                kriteria = "B.Jumlah";
            }
            else if (comboBoxCari.Text == "Harga Satuan")
            {
                kriteria = "B.harga_satuan";
            }

            listHasilData.Clear();

            // Tampilkan data kategori sesuai kriteria
            string hasilBaca = OrderPenjualan.BacaData(kriteria, textBoxCari.Text, listHasilData);

            if (hasilBaca == "1")
            {
                dataGridViewBarang.DataSource = null;
                dataGridViewBarang.DataSource = listHasilData;
            }
        }
        private void comboBoxNoOrderPenjualan_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                listDataOP.Clear();
                string hasilBaca = OrderPenjualan.BacaData("OP.Id", comboBoxNoOrderPenjualan.Text, listDataOP);
                if (hasilBaca == "1")
                {
                    if (listDataOP.Count > 0)
                    {
                        dateTimePickerTanggal.Value = listDataOP[0].Tanggal;
                        textBoxCustomer.Text        = listDataOP[0].Customer.IdCustomer + " - " + listDataOP[0].Customer.Nama;
                        textBoxUnit.Text            = listDataOP[0].Unit;

                        // Ambil data barang
                        listDataBarang.Clear();
                        string hasilBacaBarang = Barang.BacaData("id_order_penjualan", comboBoxNoOrderPenjualan.Text, listDataBarang);

                        if (hasilBacaBarang == "1")
                        {
                            dataGridViewBarang.Rows.Clear();

                            for (int i = 0; i < listDataBarang.Count; i++)
                            {
                                dataGridViewBarang.Rows.Add(listDataBarang[i].Kode, listDataBarang[i].Nama,
                                                            listDataBarang[i].Jumlah, listDataBarang[i].Satuan, listDataBarang[i].HargaSatuan, listDataBarang[i].Keterangan);
                            }
                        }
                    }
                }
                else
                {
                    dateTimePickerTanggal.Value = DateTime.Now;
                    textBoxCustomer.Text        = "";
                    textBoxUnit.Text            = "";
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }