Exemplo n.º 1
0
        private void ButtonSubmit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Apakah anda sudah yakin dengan data tersebut?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                try
                {
                    if (ClassConnection.Instance().Connecting())
                    {
                        string       commandText = "INSERT INTO dataprojectacc VALUES(@kode,@nama,@tanggal,@lanjut,null,null)";
                        MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                        cmd.Parameters.AddWithValue("@kode", textBoxKodeGen.Text);
                        cmd.Parameters.AddWithValue("@nama", textBoxNama.Text);
                        cmd.Parameters.AddWithValue("@tanggal", dateTimePicker1.Value.ToString("yyyy-MM-dd"));
                        cmd.Parameters.AddWithValue("@lanjut", checkBoxLanjut.Checked ? 1 : 0);

                        int rowsAffected = cmd.ExecuteNonQuery();
                        MessageBox.Show("Data telah Terinput", "Berhasil");

                        ClassConnection.Instance().Close();
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
        }
Exemplo n.º 2
0
        private void FormAddProjectACC_Load(object sender, EventArgs e)
        {
            ClassConnection.Instance().IsConnect();
            ClassConnection.Instance().Close();

            resetKodeProjectACC();
        }
Exemplo n.º 3
0
 private void ButtonSubmit_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Apakah anda sudah yakin dengan data tersebut?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         try
         {
             if (ClassConnection.Instance().Connecting())
             {
                 string       commandText = "INSERT INTO dpvendor VALUES(null,@kodepeg,@kodepr,@kodevd,@jumlah,@tanggal,0,null,null)";
                 MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                 cmd.Parameters.AddWithValue("@kodepeg", kode);
                 cmd.Parameters.AddWithValue("@kodepr", comboBoxProjectDP.SelectedValue.ToString());
                 cmd.Parameters.AddWithValue("@kodevd", comboBoxVendorDP.SelectedValue.ToString());
                 cmd.Parameters.AddWithValue("@jumlah", Convert.ToInt64(numericUpDownJumlah.Value));
                 cmd.Parameters.AddWithValue("@tanggal", dateTimePickerTanggalDP.Value.ToString("yyyy-MM-dd"));
                 int rowsAffected = cmd.ExecuteNonQuery();
                 MessageBox.Show("Data telah Tersimpan", "Berhasil");
                 ClassConnection.Instance().Close();
                 this.Close();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error Submit");
         }
     }
 }
Exemplo n.º 4
0
 private void FormKepCab_Load(object sender, EventArgs e)
 {
     ClassConnection.Instance().IsConnect();
     ClassConnection.Instance().Close();
     updateDGVKaryawan();
     dataGridViewNotif.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
 }
Exemplo n.º 5
0
 private void FormTambahAkun_Load(object sender, EventArgs e)
 {
     ClassConnection.Instance().Connecting();
     ClassConnection.Instance().Close();
     try
     {
         MySqlDataAdapter adapterCA;
         if (status == 1)
         {
             adapterCA = new MySqlDataAdapter("SELECT concat(kode,' - ',nama) as nama,kode from dataakun where kode != '-' order by kode", ClassConnection.Instance().Connection);
         }
         else
         {
             adapterCA = new MySqlDataAdapter("SELECT concat(kode,' - ',nama) as nama,kode from dataakun order by kode", ClassConnection.Instance().Connection);
         }
         DataSet datasetCA = new DataSet();
         adapterCA.Fill(datasetCA);
         comboBoxParent.DisplayMember = "nama";
         comboBoxParent.ValueMember   = "kode";
         comboBoxParent.DataSource    = datasetCA.Tables[0];
         if (status == 1)
         {
             resetKodeGenAkun();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 6
0
        public void tampilData(string kode = "")
        {
            try
            {
                if (ClassConnection.Instance().Connecting())
                {
                    DataTable        table  = new DataTable();
                    MySqlDataAdapter reader = null;
                    MySqlCommand     cmd    = new MySqlCommand("SELECT * FROM datavendor where kode ='" + kode + "'", ClassConnection.Instance().Connection);
                    reader = new MySqlDataAdapter(cmd);
                    //reader = cmd.ExecuteReader();
                    reader.Fill(table);

                    textBoxKodeKlien.Text       = table.Rows[0][0].ToString();
                    textBoxNamaKlien.Text       = table.Rows[0][1].ToString();
                    textBoxAlamatKlien.Text     = table.Rows[0][2].ToString();
                    textBoxKota.Text            = table.Rows[0][3].ToString();
                    textBoxEmail.Text           = table.Rows[0][4].ToString();
                    textBoxNoTelpKlien.Text     = table.Rows[0][5].ToString();
                    textBoxNPWPKlien.Text       = table.Rows[0][6].ToString();
                    textBoxNoRek.Text           = table.Rows[0][7].ToString();
                    textBoxNamaContact.Text     = table.Rows[0][8].ToString();
                    comboBoxJenis.SelectedIndex = comboBoxJenis.FindStringExact(table.Rows[0][9].ToString());

                    ClassConnection.Instance().Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemplo n.º 7
0
 public void tampilData(string kode = "")
 {
     try
     {
         if (ClassConnection.Instance().Connecting())
         {
             MySqlDataReader reader = null;
             MySqlCommand    cmd    = new MySqlCommand("SELECT * FROM dataklien where kode ='" + kode + "'", ClassConnection.Instance().Connection);
             reader = cmd.ExecuteReader();
             while (reader.Read())
             {
                 textBoxAlamatKlien.Text         = reader["alamat"].ToString();
                 textBoxEmailKlien.Text          = reader["email"].ToString();
                 textBoxFaxKlien.Text            = reader["fax"].ToString();
                 textBoxNamaKlien.Text           = reader["nama"].ToString();
                 textBoxNoTelpKlien.Text         = reader["notelp"].ToString();
                 textBoxNPWPKlien.Text           = reader["npwp"].ToString();
                 textBoxKodeKlien.Text           = reader["kode"].ToString();
                 numericUpDownPiutangKlien.Value = Convert.ToInt32(reader["bataspiutang"].ToString());
                 textBoxPrincipal.Text           = reader["principal"].ToString();
                 textBoxUser.Text = reader["user"].ToString();
             }
             ClassConnection.Instance().Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
Exemplo n.º 8
0
 private void FormVendor_Load(object sender, EventArgs e)
 {
     ClassConnection.Instance().IsConnect();
     ClassConnection.Instance().Close();
     if (status == 1)
     {
         resetKodeVendor();
     }
     else if (status == 3)
     {
         textBoxNamaKlien.ReadOnly   = true;
         textBoxNPWPKlien.ReadOnly   = true;
         textBoxAlamatKlien.ReadOnly = true;
         textBoxEmail.ReadOnly       = true;
         textBoxKota.ReadOnly        = true;
         textBoxNoTelpKlien.ReadOnly = true;
         buttonSubmitKlien.Visible   = false;
         buttonClearKlien.Visible    = false;
         textBoxNoRek.ReadOnly       = true;
         textBoxNamaContact.ReadOnly = true;
         comboBoxJenis.Enabled       = false;
     }
     comboBoxJenis.Items.Add("Produksi");
     comboBoxJenis.Items.Add("Show Management");
     comboBoxJenis.Items.Add("Digital/IT");
     comboBoxJenis.Items.Add("Merchandise");
     comboBoxJenis.Items.Add("Cetak");
     comboBoxJenis.Items.Add("Team/Tukang");
     comboBoxJenis.Items.Add("Transportasi");
     comboBoxJenis.Items.Add("Venue");
     comboBoxJenis.Items.Add("Permit");
     comboBoxJenis.Items.Add("Property");
     comboBoxJenis.Items.Add("Konsumsi");
     comboBoxJenis.Items.Add("Talent");
 }
Exemplo n.º 9
0
        private void ButtonOpsSubmitPengeluaran_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Apakah anda sudah yakin dengan data tersebut?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                try
                {
                    if (ClassConnection.Instance().Connecting())
                    {
                        string       commandText = "UPDATE pettyops set jumlah = @jumlah,norek=@norek, tanggal = @tanggal, deskripsi = @deskripsi, status = 1 where kode=@kode";
                        MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                        cmd.Parameters.AddWithValue("@kode", textBoxOpsKodePengeluaran.Text);
                        cmd.Parameters.AddWithValue("@norek", textBoxOpsNoRekPengeluaran.Text);
                        cmd.Parameters.AddWithValue("@jumlah", numericUpDownOpsJumlahPengeluaran.Value);
                        cmd.Parameters.AddWithValue("@tanggal", dateTimePickerOpsTanggalPengeluaran.Value.ToString("yyyy-MM-dd"));
                        cmd.Parameters.AddWithValue("@deskripsi", richTextBoxOpsDeskripsiPengeluaran.Text);

                        int rowsAffected = cmd.ExecuteNonQuery();
                        MessageBox.Show("Data telah Tersimpan", "Berhasil");
                        ClassConnection.Instance().Close();
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
        }
Exemplo n.º 10
0
 public void resetKodeGenAkun()
 {
     try
     {
         if (ClassConnection.Instance().Connecting())
         {
             string       kode        = comboBoxParent.SelectedValue.ToString() + ".";
             int          len         = kode.Length + 2;
             MySqlCommand cmd         = new MySqlCommand("SELECT MAX((SUBSTRING_INDEX(kode, '.', -1) * 1)) from dataakun where kode like '" + kode + "%' and LENGTH(kode) <= " + len, ClassConnection.Instance().Connection);
             int          dataAutoInc = 1;
             if (cmd.ExecuteScalar().ToString() != "")
             {
                 string[] temp = cmd.ExecuteScalar().ToString().Split('.');
                 dataAutoInc  = Convert.ToInt32(temp[temp.Length - 1]);
                 dataAutoInc += 1;
             }
             kode = kode + dataAutoInc.ToString();
             ClassConnection.Instance().Close();
             textBoxKodeGen.Text = kode;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
Exemplo n.º 11
0
 private void DataGridViewItem_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridViewItem.Columns[e.ColumnIndex].Name == "Edit")
     {
         ((FormParent)this.MdiParent).panggilItem(2, dataGridViewItem.Rows[e.RowIndex].Cells[0].Value.ToString(), comboBoxVendor.SelectedValue.ToString(), comboBoxVendor.Text);
     }
     else if (dataGridViewItem.Columns[e.ColumnIndex].Name == "View")
     {
         ((FormParent)this.MdiParent).panggilItem(3, dataGridViewItem.Rows[e.RowIndex].Cells[0].Value.ToString(), comboBoxVendor.SelectedValue.ToString(), comboBoxVendor.Text);
     }
     else if (dataGridViewItem.Columns[e.ColumnIndex].Name == "Delete")
     {
         if (MessageBox.Show("Apakah anda yakin ingin mendelete " + dataGridViewItem.Rows[e.RowIndex].Cells[1].Value.ToString() + " ?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             try
             {
                 if (ClassConnection.Instance().Connecting())
                 {
                     string       commandText = "DELETE FROM dataitemvendor WHERE kode = @kode";
                     MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                     cmd.Parameters.AddWithValue("@kode", dataGridViewItem.Rows[e.RowIndex].Cells[0].Value.ToString());
                     int rowsAffected = cmd.ExecuteNonQuery();
                     MessageBox.Show("Data telah terhapus", "Berhasil");
                     ClassConnection.Instance().Close();
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "Error");
             }
         }
     }
     updateDGVItem();
 }
Exemplo n.º 12
0
        private void FormAPC_Load(object sender, EventArgs e)
        {
            ClassConnection.Instance().IsConnect();
            ClassConnection.Instance().Close();

            groupBoxLogin.Visible = true;
        }
Exemplo n.º 13
0
        public void tampilData(string kode = "")
        {
            try
            {
                if (ClassConnection.Instance().Connecting())
                {
                    DataTable        table  = new DataTable();
                    MySqlDataAdapter reader = null;
                    MySqlCommand     cmd    = new MySqlCommand("SELECT i.kode, i.namabarang, i.satuan, i.hargasatuan,i.jenis FROM dataitemvendor i where kode ='" + kode + "'", ClassConnection.Instance().Connection);
                    reader = new MySqlDataAdapter(cmd);
                    //reader = cmd.ExecuteReader();
                    reader.Fill(table);

                    textBoxKode.Text         = table.Rows[0][0].ToString();
                    textBoxNama.Text         = table.Rows[0][1].ToString();
                    textBoxSatuan.Text       = table.Rows[0][2].ToString();
                    numericUpDownHarga.Value = Convert.ToInt32(table.Rows[0][3].ToString());
                    textBoxJenis.Text        = table.Rows[0][4].ToString();
                    ClassConnection.Instance().Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemplo n.º 14
0
        public void ambilBuatOps(string kode = "", int status = 0)
        {
            try
            {
                this.status = status;
                if (ClassConnection.Instance().Connecting())
                {
                    groupBoxProjectPengeluaran.Visible = false;
                    groupBoxOpsPengeluaran.Visible     = true;
                    MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT norek,nama,jumlah,tanggal,deskripsi,dividen from pettyops where kode='" + kode + "'", ClassConnection.Instance().Connection);
                    DataTable        table   = new DataTable();
                    adapter.Fill(table);

                    textBoxOpsKodePengeluaran.Text = kode;

                    textBoxOpsNoRekPengeluaran.Text         = table.Rows[0][0].ToString();
                    textBoxOpsNamaPengeluaran.Text          = table.Rows[0][1].ToString();
                    numericUpDownOpsJumlahPengeluaran.Value = Convert.ToInt64(table.Rows[0][2].ToString());

                    //MessageBox.Show(table.Rows[0][3].ToString());

                    dateTimePickerOpsTanggalPengeluaran.Value = Convert.ToDateTime(table.Rows[0][3].ToString());
                    richTextBoxOpsDeskripsiPengeluaran.Text   = table.Rows[0][4].ToString();
                    checkBoxDividen.Checked = Convert.ToBoolean(status);
                    checkBoxDividen.Enabled = false;
                    ClassConnection.Instance().Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemplo n.º 15
0
        private void ButtonSubmit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Apakah anda sudah yakin dengan data tersebut?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                try
                {
                    if (ClassConnection.Instance().Connecting())
                    {
                        if (status == 1)
                        {
                            string       commandText = "INSERT INTO dataakun VALUES(@kode,@nama,@nominal,@level,@parent,null,null)";
                            MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@kode", textBoxKodeGen.Text);
                            cmd.Parameters.AddWithValue("@nama", textBoxNama.Text);
                            cmd.Parameters.AddWithValue("@nominal", numericUpDownNominal.Value);
                            cmd.Parameters.AddWithValue("@level", (textBoxKodeGen.Text.Split('.').Length - 1).ToString());
                            cmd.Parameters.AddWithValue("@parent", comboBoxParent.SelectedValue);
                            int rowsAffected = cmd.ExecuteNonQuery();
                            MessageBox.Show("Data telah Terinput", "Berhasil");

                            if (textBoxKodeGen.Text.Split('.')[textBoxKodeGen.Text.Split('.').Length - 1] == "1")
                            {
                                cmd = new MySqlCommand("SELECT nominal from dataakun where kode='" + comboBoxParent.SelectedValue + "'", ClassConnection.Instance().Connection);
                                int tempNominalParent = Convert.ToInt32(cmd.ExecuteScalar().ToString());
                                commandText = "INSERT INTO dataakun VALUES(@kode,@nama,@nominal,@level,@parent,null,null)";
                                cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                                cmd.Parameters.AddWithValue("@kode", textBoxKodeGen.Text.Substring(0, textBoxKodeGen.Text.Length - 1) + "2");
                                cmd.Parameters.AddWithValue("@nama", "Lain-Lain");
                                cmd.Parameters.AddWithValue("@nominal", tempNominalParent);
                                cmd.Parameters.AddWithValue("@level", (textBoxKodeGen.Text.Split('.').Length - 1).ToString());
                                cmd.Parameters.AddWithValue("@parent", comboBoxParent.SelectedValue);
                                rowsAffected = cmd.ExecuteNonQuery();
                                MessageBox.Show("Parent telah terforward ke lain-lain", "Berhasil");
                                cmd          = new MySqlCommand("update dataakun set nominal = 0 where kode='" + comboBoxParent.SelectedValue + "'", ClassConnection.Instance().Connection);
                                rowsAffected = cmd.ExecuteNonQuery();
                            }
                            ClassConnection.Instance().Close();
                            this.Close();
                        }
                        else
                        {
                            string       commandText = "UPDATE dataakun set nama = @nama, nominal = @nominal, level = @level where kode=@kode";
                            MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@kode", textBoxKodeGen.Text);
                            cmd.Parameters.AddWithValue("@nama", textBoxNama.Text);
                            cmd.Parameters.AddWithValue("@nominal", numericUpDownNominal.Value);
                            cmd.Parameters.AddWithValue("@level", (textBoxKodeGen.Text.Split('.').Length - 1).ToString());
                            int rowsAffected = cmd.ExecuteNonQuery();
                            MessageBox.Show("Data telah terupdate", "Berhasil");
                            ClassConnection.Instance().Close();
                            this.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
        }
Exemplo n.º 16
0
 private void ButtonSubForward_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Apakah anda sudah yakin dengan data tersebut?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         try
         {
             DataTable dt = (DataTable)dataGridViewGaji.DataSource;
             foreach (DataRow r in dt.Rows)
             {
                 if (ClassConnection.Instance().Connecting())
                 {
                     string       commandText = "UPDATE penggajian set gaji = @gaji, tunjangan = @tunjangan, potongan = @potongan, status = 1 where kode = @kode";
                     MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                     cmd.Parameters.AddWithValue("@kode", r[0].ToString());
                     cmd.Parameters.AddWithValue("@gaji", Convert.ToInt32(r[2].ToString()));
                     cmd.Parameters.AddWithValue("@tunjangan", Convert.ToInt32(r[3].ToString()));
                     cmd.Parameters.AddWithValue("@potongan", Convert.ToInt32(r[4].ToString()));
                     int rowsAffected = cmd.ExecuteNonQuery();
                     ClassConnection.Instance().Close();
                 }
             }
             MessageBox.Show("Gaji telah cair dan terlempar pada Petty", "Berhasil");
             this.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error");
         }
     }
 }
Exemplo n.º 17
0
        public void tampilData(string kode)
        {
            try
            {
                if (ClassConnection.Instance().Connecting())
                {
                    DataTable        table  = new DataTable();
                    MySqlDataAdapter reader = null;
                    MySqlCommand     cmd    = new MySqlCommand("Select a.kode,a.nama,a.nominal,concat(p.kode,' - ',p.nama) from dataakun a, dataakun p where p.kode = a.parent and a.kode = '" + kode + "'", ClassConnection.Instance().Connection);
                    reader = new MySqlDataAdapter(cmd);
                    //reader = cmd.ExecuteReader();
                    reader.Fill(table);

                    comboBoxParent.SelectedIndex = comboBoxParent.FindStringExact(table.Rows[0][3].ToString());
                    comboBoxParent.Enabled       = false;
                    textBoxKodeGen.Text          = table.Rows[0][0].ToString();
                    textBoxNama.Text             = table.Rows[0][1].ToString();
                    numericUpDownNominal.Value   = Convert.ToInt64(table.Rows[0][2].ToString());

                    ClassConnection.Instance().Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemplo n.º 18
0
        public void tampilData(string kode)
        {
            try
            {
                if (ClassConnection.Instance().Connecting())
                {
                    MySqlDataAdapter adapter = new MySqlDataAdapter("select p.kode,p.nama from dataproject p where (p.kode_pot = '" + kode + "' or p.kode_ae = '" + kode + "' or p.kode_pot = '" + kode + "') and p.status = 0 ", ClassConnection.Instance().Connection);
                    DataTable        tb      = new DataTable();
                    adapter.Fill(tb);
                    //MessageBox.Show(tb.Rows.Count.ToString());
                    if (tb.Rows.Count > 0)
                    {
                        comboBoxProjectDP.DisplayMember = "nama";
                        comboBoxProjectDP.ValueMember   = "kode";
                        comboBoxProjectDP.DataSource    = tb;
                        adapter = new MySqlDataAdapter("select v.kode, v.nama from datavendorproject vp, datavendor v where vp.kodevendor = v.kode and vp.kodeproject ='" + comboBoxProjectDP.SelectedValue.ToString() + "'", ClassConnection.Instance().Connection);
                        tb      = new DataTable();
                        adapter.Fill(tb);
                    }

                    if (tb.Rows.Count > 0)
                    {
                        comboBoxVendorDP.DisplayMember = "nama";
                        comboBoxVendorDP.ValueMember   = "kode";
                        comboBoxVendorDP.DataSource    = tb;
                    }
                    ClassConnection.Instance().Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Tampil Data");
            }
        }
Exemplo n.º 19
0
 public void resetMoney()
 {
     try
     {
         if (ClassConnection.Instance().Connecting())
         {
             MySqlDataReader reader = null;
             MySqlCommand    cmd    = new MySqlCommand("SELECT Nama,Money FROM saldo", ClassConnection.Instance().Connection);
             reader = cmd.ExecuteReader();
             while (reader.Read())
             {
                 for (int i = 0; i < comboBoxTipeUang.Items.Count; i++)
                 {
                     if (comboBoxTipeUang.Items[i].ToString() == reader["Nama"].ToString())
                     {
                         duit[comboBoxTipeUang.Items[i].ToString()] = Convert.ToInt64(reader["Money"]);
                         break;
                     }
                 }
             }
             ClassConnection.Instance().Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
Exemplo n.º 20
0
        private void ButtonSubmitKlien_Click(object sender, EventArgs e)
        {
            if (status == 1)
            {
                if (MessageBox.Show("Apakah anda sudah yakin dengan data tersebut?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    try
                    {
                        if (ClassConnection.Instance().Connecting())
                        {
                            string       commandText = "INSERT INTO dataitemvendor VALUES(@kode,@nama,@satuan,@hargasatuan,@kodevendor,@jenis,null,null)";
                            MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@kode", textBoxKode.Text);
                            cmd.Parameters.AddWithValue("@nama", textBoxNama.Text);
                            cmd.Parameters.AddWithValue("@satuan", textBoxSatuan.Text);
                            cmd.Parameters.AddWithValue("@hargasatuan", numericUpDownHarga.Value);
                            cmd.Parameters.AddWithValue("@kodevendor", kodevendor);
                            cmd.Parameters.AddWithValue("@jenis", textBoxJenis.Text);
                            int rowsAffected = cmd.ExecuteNonQuery();
                            MessageBox.Show("Data telah Tersimpan", "Berhasil");
                            ClassConnection.Instance().Close();
                            resetKodeItem(namavendor);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error");
                    }
                }
            }
            else if (status == 2)
            {
                if (MessageBox.Show("Apakah anda sudah yakin dengan data tersebut?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    try
                    {
                        if (ClassConnection.Instance().Connecting())
                        {
                            string commandText = "UPDATE dataitemvendor SET namabarang = @nama,satuan = @satuan,hargasatuan = @hargasatuan,jenis = @jenis WHERE kode = @kode";

                            MySqlCommand cmd = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@kode", textBoxKode.Text);
                            cmd.Parameters.AddWithValue("@nama", textBoxNama.Text);
                            cmd.Parameters.AddWithValue("@satuan", textBoxSatuan.Text);
                            cmd.Parameters.AddWithValue("@jenis", textBoxJenis.Text);
                            cmd.Parameters.AddWithValue("@hargasatuan", numericUpDownHarga.Value);
                            int rowsAffected = cmd.ExecuteNonQuery();
                            MessageBox.Show("Data telah Tersimpan", "Berhasil");
                            ClassConnection.Instance().Close();
                            this.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error");
                    }
                }
            }
        }
Exemplo n.º 21
0
 public static ClassConnection Instance()
 {
     if (_instance == null)
     {
         _instance = new ClassConnection();
     }
     return(_instance);
 }
Exemplo n.º 22
0
 private void FormAEPO_Load(object sender, EventArgs e)
 {
     ClassConnection.Instance().IsConnect();
     ClassConnection.Instance().Close();
     if (MessageBox.Show("Apakah untuk Jakarta ?", "Pertanyaan Jakarta", MessageBoxButtons.YesNo) == DialogResult.No)
     {
         jakartatidak = false;
     }
 }
Exemplo n.º 23
0
        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            string[] tipe = { "CEO", "KEPALA CABANG", "FINANCE", "PETTY", "AR", "AP", "ACCOUNTING", "KARYAWAN", "AR_AP" };
            string   area = "";

            try
            {
                if (ClassConnection.Instance().Connecting())
                {
                    DataTable        table  = new DataTable();
                    MySqlDataAdapter reader = null;
                    MySqlCommand     cmd    = new MySqlCommand("SELECT kode, nama, pass, jabatan,user,area FROM datakaryawan where upper(kode) ='" + textUser.Text.ToUpper() + "' or upper(user) = '" + textUser.Text.ToUpper() + "' or upper(nama) = '" + textUser.Text.ToUpper() + "'", ClassConnection.Instance().Connection);
                    reader = new MySqlDataAdapter(cmd);
                    //reader = cmd.ExecuteReader();
                    reader.Fill(table);
                    foreach (DataRow r in table.Rows)
                    {
                        if (textUser.Text.ToUpper() == r[1].ToString().ToUpper() || textUser.Text.ToUpper() == r[4].ToString().ToUpper() || textUser.Text.ToUpper() == r[0].ToString().ToUpper())
                        {
                            if (textPass.Text.ToUpper().ToUpper() == r[2].ToString().ToUpper())
                            {
                                ((FormParent)this.MdiParent).statusForm = 8;
                                for (int i = 0; i < tipe.Length; i++)
                                {
                                    if (r[3].ToString().ToUpper() == tipe[i])
                                    {
                                        ((FormParent)this.MdiParent).statusForm = i + 1;

                                        area = r[5].ToString().ToUpper();
                                        break;
                                    }
                                }
                                if (((FormParent)this.MdiParent).statusForm == 8)
                                {
                                    ((FormParent)this.MdiParent).gantiData(r[0].ToString().ToUpper());
                                }
                            }
                        }
                    }

                    if (((FormParent)this.MdiParent).statusForm <= 0)
                    {
                        MessageBox.Show("Username / Password Salah", "Wrong");
                    }
                    else
                    {
                        ((FormParent)this.MdiParent).doAfterLogin(textUser.Text, area);
                        this.Close();
                    }
                    ClassConnection.Instance().Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemplo n.º 24
0
 private void FormLiquidation_Load(object sender, EventArgs e)
 {
     ClassConnection.Instance().IsConnect();
     ClassConnection.Instance().Close();
     dataGridViewIsi.Columns[3].ValueType = System.Type.GetType("System.Decimal");
     dataGridViewIsi.Columns[4].ValueType = System.Type.GetType("System.Decimal");
     dataGridViewIsi.Columns[4].DefaultCellStyle.Format         = "c2";
     dataGridViewIsi.Columns[4].DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("id-ID");
     dataGridViewIsi.Columns[5].ValueType = System.Type.GetType("System.Decimal");
     dataGridViewIsi.Columns[5].DefaultCellStyle.Format         = "c2";
     dataGridViewIsi.Columns[5].DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("id-ID");
 }
Exemplo n.º 25
0
        private void DataGridViewPrVd_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridViewPrVd.Columns[e.ColumnIndex].Name == "Delete")
            {
                if (MessageBox.Show("Apakah anda yakin ingin mendelete " + dataGridViewPrVd.Rows[e.RowIndex].Cells[1].Value.ToString() + " ?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    try
                    {
                        if (ClassConnection.Instance().Connecting())
                        {
                            string       commandText = "select subtotal from dataitemproject where kode=@kode";
                            MySqlCommand cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@kode", Convert.ToInt32(dataGridViewPrVd.Rows[e.RowIndex].Cells[0].Value.ToString()));
                            int subtotal = Convert.ToInt32(cmd.ExecuteScalar().ToString());

                            commandText = "SELECT vp.kodevendor FROM dataitemproject ip, dataitemvendor iv, datavendorproject vp WHERE ip.`kodebarang` = iv.`kode` AND iv.`kodevendor` = vp.`kodevendor` AND ip.`kode`=@kode";
                            cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@kode", Convert.ToInt32(dataGridViewPrVd.Rows[e.RowIndex].Cells[0].Value.ToString()));
                            string kdvndr = cmd.ExecuteScalar().ToString();

                            commandText = "update datavendorproject set total = total - @subtotal WHERE kodevendor = @kodevendor and kodeproject = @kodeproject";
                            cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@subtotal", subtotal);
                            cmd.Parameters.AddWithValue("@kodevendor", kdvndr);
                            cmd.Parameters.AddWithValue("@kodeproject", comboBoxPr.SelectedValue.ToString());
                            int rowsAffected = cmd.ExecuteNonQuery();

                            numericUpDownTotal.Value -= subtotal;

                            commandText = "DELETE FROM dataitemproject WHERE kode = @kode";
                            cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@kode", Convert.ToInt32(dataGridViewPrVd.Rows[e.RowIndex].Cells[0].Value.ToString()));
                            rowsAffected = cmd.ExecuteNonQuery();

                            commandText = "DELETE FROM datavendorproject WHERE total = 0";
                            cmd         = new MySqlCommand(commandText, ClassConnection.Instance().Connection);
                            cmd.Parameters.AddWithValue("@kode", Convert.ToInt32(dataGridViewPrVd.Rows[e.RowIndex].Cells[0].Value.ToString()));
                            rowsAffected = cmd.ExecuteNonQuery();

                            MessageBox.Show("Data telah terhapus", "Berhasil");
                            ClassConnection.Instance().Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error");
                    }
                }
            }
            updateDGVPrVd();
        }
Exemplo n.º 26
0
        private void FormKaryawan_Load(object sender, EventArgs e)
        {
            ClassConnection.Instance().IsConnect();
            ClassConnection.Instance().Close();

            comboBoxJabatan.Items.Add("Kepala Cabang");
            comboBoxJabatan.Items.Add("Ar_Ap");
            comboBoxJabatan.Items.Add("Project Officer Teknis");
            comboBoxJabatan.Items.Add("Project Officer Non Teknis");
            comboBoxJabatan.Items.Add("Accounting");
            comboBoxJabatan.Items.Add("Account Executive");
            comboBoxJabatan.Items.Add("Design");
            comboBoxJabatan.Items.Add("Finance");
            comboBoxJabatan.Items.Add("Petty");
            comboBoxJabatan.Items.Add("Tenaga Produksi");
            comboBoxJabatan.Items.Add("CEO");

            comboBoxArea.Items.Add("Surabaya");
            comboBoxArea.Items.Add("Jakarta");
            comboBoxArea.SelectedIndex        = 0;
            textBoxPass.UseSystemPasswordChar = PasswordPropertyTextAttribute.Yes.Password;;

            pictureBoxFotoKaryawan.SizeMode = PictureBoxSizeMode.StretchImage;
            if (status == 1)
            {
                resetKodeKaryawan();
            }
            else if (status == 3)
            {
                textBoxNama.ReadOnly         = true;
                textBoxAlamat.ReadOnly       = true;
                textBoxNoTelp.ReadOnly       = true;
                textBoxEmail.ReadOnly        = true;
                textBoxFax.ReadOnly          = true;
                textBoxNPWP.ReadOnly         = true;
                textBoxPathPhoto.ReadOnly    = true;
                textBoxNIK.ReadOnly          = true;
                numericUpDownGaji.Enabled    = false;
                dateTimePickerLahir.Enabled  = false;
                dateTimePickerMasuk.Enabled  = false;
                textBoxPathPhoto.ReadOnly    = true;
                buttonPhoto.Enabled          = false;
                buttonSubmitKaryawan.Visible = false;
                buttonClearKlien.Visible     = false;
                textBoxPass.ReadOnly         = true;
                textBoxUname.ReadOnly        = true;
                textBoxTempat.ReadOnly       = true;
                comboBoxArea.Enabled         = false;
                comboBoxJabatan.Enabled      = false;
            }
        }
Exemplo n.º 27
0
        private void FormParent_Load(object sender, EventArgs e)
        {
            ClassConnection.Instance().DatabaseName = "btwo";
            this.IsMdiContainer = true;

            FormLoading f = new FormLoading();

            f.MdiParent       = this;
            f.FormBorderStyle = FormBorderStyle.None;
            f.ControlBox      = false;
            f.Size            = this.Size;
            f.Show();
            f.Location = new Point(0, 0);
        }
Exemplo n.º 28
0
 private void FormItem_Load(object sender, EventArgs e)
 {
     ClassConnection.Instance().IsConnect();
     ClassConnection.Instance().Close();
     textBoxVendor.Text = namavendor;
     if (status == 1)
     {
         resetKodeItem(namavendor);
     }
     else if (status == 3)
     {
         textBoxSatuan.ReadOnly     = true;
         textBoxNama.ReadOnly       = true;
         numericUpDownHarga.Enabled = false;
     }
 }
Exemplo n.º 29
0
        public void updateDGVItem(string kodeitem = "")
        {
            string cmd = "SELECT Kode,namabarang as 'Nama Barang',Satuan,concat('Rp. ',format(hargasatuan,2)) as 'Harga Satuan',Jenis FROM dataitemvendor where kodevendor ='" + comboBoxVendor.SelectedValue.ToString() + "' and namabarang like '%" + kodeitem + "%' order by kode ";

            try
            {
                datasetVendor = new DataSet();
                dataGridViewItem.DataSource = null;
                dataGridViewItem.Columns.Clear();
                MySqlDataAdapter adapterKlien = new MySqlDataAdapter(cmd, ClassConnection.Instance().Connection);

                adapterKlien.Fill(datasetVendor);
                dataGridViewItem.DataSource = datasetVendor.Tables[0];
                DataGridViewButtonColumn edit = new DataGridViewButtonColumn();
                edit.HeaderText = "Edit";
                edit.Text       = "Edit";
                edit.Name       = "Edit";
                edit.UseColumnTextForButtonValue = true;
                dataGridViewItem.Columns.Add(edit);

                DataGridViewButtonColumn view = new DataGridViewButtonColumn();
                view.HeaderText = "View";
                view.Text       = "View";
                view.Name       = "View";
                view.UseColumnTextForButtonValue = true;
                dataGridViewItem.Columns.Add(view);

                DataGridViewButtonColumn delete = new DataGridViewButtonColumn();
                delete.HeaderText = "Delete";
                delete.Text       = "Delete";
                delete.Name       = "Delete";
                delete.UseColumnTextForButtonValue = true;
                dataGridViewItem.Columns.Add(delete);

                dataGridViewItem.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
                for (int i = 0; i < dataGridViewItem.ColumnCount; i++)
                {
                    dataGridViewItem.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 30
0
        public void updateDGVKaryawan(string cmd = "SELECT Kode,Nama,notelp as 'No. Telp',Jabatan,Area from datakaryawan where insertdata > str_to_date('2019-08-10','%Y-%m-%d') order by kode")
        {
            try
            {
                datasetKaryawan = new DataSet();
                dataGridViewTampilKaryawan.DataSource = null;
                dataGridViewTampilKaryawan.Columns.Clear();
                MySqlDataAdapter adapterKlien = new MySqlDataAdapter(cmd, ClassConnection.Instance().Connection);

                adapterKlien.Fill(datasetKaryawan);
                dataGridViewTampilKaryawan.DataSource = datasetKaryawan.Tables[0];
                DataGridViewButtonColumn edit = new DataGridViewButtonColumn();
                edit.HeaderText = "Edit";
                edit.Text       = "Edit";
                edit.Name       = "Edit";
                edit.UseColumnTextForButtonValue = true;
                dataGridViewTampilKaryawan.Columns.Add(edit);

                DataGridViewButtonColumn view = new DataGridViewButtonColumn();
                view.HeaderText = "View";
                view.Text       = "View";
                view.Name       = "View";
                view.UseColumnTextForButtonValue = true;
                dataGridViewTampilKaryawan.Columns.Add(view);

                DataGridViewButtonColumn delete = new DataGridViewButtonColumn();
                delete.HeaderText = "Delete";
                delete.Text       = "Delete";
                delete.Name       = "Delete";
                delete.UseColumnTextForButtonValue = true;
                dataGridViewTampilKaryawan.Columns.Add(delete);

                dataGridViewTampilKaryawan.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
                for (int i = 0; i < dataGridViewTampilKaryawan.ColumnCount; i++)
                {
                    dataGridViewTampilKaryawan.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                    dataGridViewTampilKaryawan.Columns[i].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Karyawan");
            }
        }