Пример #1
0
        private void load_toSettingGrade()
        {
            MysqlClass db = new MysqlClass();
            DataTable  tb = db.GetData("SELECT cou.keterangan FROM(SELECT keterangan FROM tb_grade group by keterangan) as cou");



            //MessageBox.Show(tb.Rows.Count.ToString());
            foreach (DataRow row in tb.Rows)
            {
                TabPage tp = new TabPage(row["keterangan"].ToString());
                Bunifu.Framework.UI.BunifuCustomDataGrid dgv = new Bunifu.Framework.UI.BunifuCustomDataGrid();
                dgv.Dock = DockStyle.Fill;
                dgv.Columns.Add("no", "No");
                dgv.Columns.Add("grade", "Grade");
                dgv.Columns.Add("biaya", "Biaya");
                dgv.RowHeadersVisible = false;
                dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(67, 20, 109);
                dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                dgv.Dock     = DockStyle.Fill;
                dgv.Location = new Point(20, 10);
                tp.Controls.Add(dgv);
                // settingGrade1.tabControl1.TabPages.Add(tp);
            }
        }
Пример #2
0
        void BunifuFlatButton4Click(object sender, EventArgs e)
        {
            MysqlClass db = new MysqlClass();

            db.Execute("INSERT INTO tb_dana_tetap (keterangan,lama,grade,kat, biaya) VALUES (@a, @b, @c, @d, @e)",
                       new MySql.Data.MySqlClient.MySqlParameter("@a", bunifuMetroTextbox3.Text),
                       new MySql.Data.MySqlClient.MySqlParameter("@b", txtlama.Text),
                       new MySql.Data.MySqlClient.MySqlParameter("@d", cmbketerangan.selectedValue.ToString()),
                       new MySql.Data.MySqlClient.MySqlParameter("@c", cmbgrade.selectedValue.ToString()),
                       new MySql.Data.MySqlClient.MySqlParameter("@e", txtbiaya.Text)
                       );
            DataTable tb2 = db.GetData("select * from tb_dana_tetap");
            int       nub = 0;

            bunifuCustomDataGrid1.Rows.Clear();

            for (int i = 0; i < tb2.Rows.Count; i++)
            {
                nub++;
                bunifuCustomDataGrid1.Rows.Add(tb2.Rows[i]["id"].ToString(), nub.ToString(), tb2.Rows[i]["keterangan"].ToString(), tb2.Rows[i]["lama"].ToString(), tb2.Rows[i]["kat"].ToString(), tb2.Rows[i]["grade"].ToString(), tb2.Rows[i]["biaya"].ToString(), tb2.Rows[i]["total"].ToString());
            }
            foreach (DataGridViewRow row in bunifuCustomDataGrid1.Rows)
            {
                row.Cells[7].Value = (double.Parse(row.Cells[3].Value.ToString()) * double.Parse(row.Cells[6].Value.ToString())).ToString();
                //More code here
            }
        }
Пример #3
0
        private void load_dataBiayaTetap()
        {
            MysqlClass db = new MysqlClass();
            DataTable  tb = db.GetData("SELECT cou.keterangan FROM(SELECT keterangan FROM tb_grade group by keterangan) as cou");

            //load
        }
Пример #4
0
        void CmbgradeonItemSelected(object sender, EventArgs e)
        {
            MysqlClass db = new MysqlClass();
            DataTable  tb = db.GetData("select biaya from tb_grade where keterangan = @ket and grade = @gr",
                                       new MySql.Data.MySqlClient.MySqlParameter("@ket", cmbketerangan.selectedValue.ToString()),
                                       new MySql.Data.MySqlClient.MySqlParameter("@gr", cmbgrade.selectedValue.ToString().Substring(0, 1)));

            //MessageBox.Show(tb.Rows.Count.ToString());
            txtbiaya.Text = tb.Rows[0]["biaya"].ToString();
        }
Пример #5
0
 void BunifuFlatButton3Click(object sender, EventArgs e)
 {
     if (bunifuCustomDataGrid1.SelectedRows.Count > 0)
     {
         var        id_edit = bunifuCustomDataGrid1.CurrentRow.Cells[0].Value.ToString();
         MysqlClass db      = new MysqlClass();
         DataTable  tb2     = db.GetData("select a.* ,b.biaya from tb_dana_tetap as a, tb_grade as b WHERE a.grade = b.grade AND a.kat = b.keterangan AND id = @id",
                                         new MySql.Data.MySqlClient.MySqlParameter("@id", id_edit));
     }
     else
     {
         MessageBox.Show("Pilih Data");
     }
 }
Пример #6
0
        void CmbketeranganonItemSelected(object sender, EventArgs e)
        {
            if (cmbketerangan.selectedIndex != -1)
            {
                MysqlClass db = new MysqlClass();
                DataTable  tb = db.GetData("select grade, biaya from tb_grade where keterangan = @ket",
                                           new MySql.Data.MySqlClient.MySqlParameter("@ket", cmbketerangan.selectedValue.ToString()));
                cmbgrade.Clear();

                foreach (DataRow row in tb.Rows)
                {
                    cmbgrade.AddItem(row["grade"].ToString() + " " + string.Format("{0:N0}", double.Parse(row["biaya"].ToString())));
                }
            }
            else
            {
                cmbgrade.Clear();
            }
        }
Пример #7
0
        void load_data()
        {
            MysqlClass db = new MysqlClass();
            DataTable  tb = db.GetData("select keterangan from tb_grade group by keterangan");

            biayaTetap.Instance.bunifuCustomDataGrid1.Columns[0].Visible = false;
            foreach (DataRow row in tb.Rows)
            {
                biayaTetap.Instance.cmbketerangan.AddItem(row["keterangan"].ToString());
            }

            DataTable tb2 = db.GetData("select * from tb_dana_tetap");

            int num = 0;

            for (int i = 0; i < tb2.Rows.Count; i++)
            {
                num++;
                bunifuCustomDataGrid1.Rows.Add(tb2.Rows[i]["id"].ToString(), num.ToString(), tb2.Rows[i]["keterangan"].ToString(), tb2.Rows[i]["lama"].ToString(), tb2.Rows[i]["kat"].ToString(), tb2.Rows[i]["grade"].ToString(), tb2.Rows[i]["biaya"].ToString(), tb2.Rows[i]["total"].ToString());
            }
        }