private void btnInputCust_Click(object sender, EventArgs e)
        {
            var cekKosong = this.Controls.OfType <MetroFramework.Controls.MetroTextBox>().Where((txt) => txt.Text.Length == 0 && txt.Visible == true);

            if (cekKosong.Any() || !rboPriaCust.Checked && !rboWanitaCust.Checked)
            {
                MessageBox.Show("Harap masukkan input-input yang tersedia", "Pesan");
            }
            else
            {
                try
                {
                    Dictionary <string, object> parameters = new Dictionary <string, object> {
                    };
                    parameters.Add("nama", txtNamaCust.Text.ToString());
                    parameters.Add("alamat", txtAlamatCust.Text.ToString());
                    parameters.Add("no_hp", txtNoHpCust.Text.ToString());
                    parameters.Add("jenis_kelamin", rboPriaCust.Checked ? 1 : 0);
                    GlobalSql.InsertData("customer", parameters);
                    function.ClearAllText(this);
                    MessageBox.Show("Data customer berhasil diinput", "Informasi");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        private void btnInput_Click(object sender, EventArgs e)
        {
            var cekKosong = this.Controls.OfType <MetroFramework.Controls.MetroTextBox>().Where((txt) => txt.Text.Length == 0 && txt.Visible == true);

            if (cekKosong.Any())
            {
                MessageBox.Show("Harap masukkan input-input yang tersedia", "Pesan");
            }
            else
            {
                try
                {
                    Dictionary <string, object> parameters = new Dictionary <string, object> {
                    };
                    parameters.Add("kode_barang", txtKode.Text.ToString());
                    parameters.Add("nama_barang", txtNama.Text.ToString());
                    parameters.Add("jumlah_awal", Convert.ToDouble(txtJumlah.Text));
                    parameters.Add("harga_hpp", Convert.ToDouble(txtHpp.Text));
                    parameters.Add("harga_jual", Convert.ToDouble(txtHargaJual.Text));
                    GlobalSql.InsertData("pos.item", parameters);
                    function.ClearAllText(this);
                    MessageBox.Show("Barang berhasil di-input", "Informasi");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
 private void btnJual_Click(object sender, EventArgs e)
 {
     if (dataItem.Count <= 0)
     {
         MessageBox.Show("Harap memilih item", "Informasi");
     }
     else if (dataCustomer.Count <= 0)
     {
         MessageBox.Show("Harap memilih customer", "Informasi");
     }
     else if (txtJumlahBarangJual.Text == "")
     {
         MessageBox.Show("Harap mengisi jumlah barang", "Informasi");
     }
     else if (Convert.ToInt16(dataItem["jumlah_awal"]) < Convert.ToInt16(txtJumlahBarangJual.Text))
     {
         MessageBox.Show("Stok item hanya tersisa : " + dataItem["jumlah_awal"], "Informasi");
     }
     else
     {
         try
         {
             Dictionary <string, object> parameters = new Dictionary <string, object> {
             };
             parameters.Add("id_item", Convert.ToInt16(dataItem["id"]));
             parameters.Add("id_customer", Convert.ToInt16(dataCustomer["id"]));
             parameters.Add("jumlah_barang", Convert.ToInt16(txtJumlahBarangJual.Text));
             GlobalSql.InsertData("pos.penjualan", parameters);
             parameters = new Dictionary <string, object> {
             };
             int sisa = Convert.ToInt16(dataItem["jumlah_awal"]) - Convert.ToInt16(txtJumlahBarangJual.Text);
             parameters.Add("jumlah_awal", sisa);
             GlobalSql.UpdateData("pos.item", parameters, Convert.ToInt16(dataItem["id"]));
             dataItem.Clear();
             dataCustomer.Clear();
             function.ClearAllText(this);
             MessageBox.Show("Transaksi berhasil", "Informasi");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
 private void btnBeli_Click(object sender, EventArgs e)
 {
     if (dataItem.Count <= 0)
     {
         MessageBox.Show("Harap memilih item", "Informasi");
     }
     else if (dataSupplier.Count <= 0)
     {
         MessageBox.Show("Harap memilih supplier", "Informasi");
     }
     else if (txtJumlahBarang.Text == "")
     {
         MessageBox.Show("Harap mengisi jumlah barang", "Informasi");
     }
     else
     {
         try
         {
             Dictionary <string, object> parameters = new Dictionary <string, object> {
             };
             parameters.Add("id_item", Convert.ToInt16(dataItem["id"]));
             parameters.Add("id_supplier", Convert.ToInt16(dataSupplier["id"]));
             parameters.Add("jumlah_barang", Convert.ToInt16(txtJumlahBarang.Text));
             GlobalSql.InsertData("pos.pembelian", parameters);
             parameters = new Dictionary <string, object> {
             };
             parameters.Add("jumlah_awal", Convert.ToInt16(txtJumlahBarang.Text) + Convert.ToInt16(dataItem["jumlah_awal"]));
             GlobalSql.UpdateData("pos.item", parameters, Convert.ToInt16(dataItem["id"]));
             dataItem.Clear();
             dataSupplier.Clear();
             function.ClearAllText(this);
             MessageBox.Show("Transaksi berhasil", "Informasi");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }