예제 #1
0
        public static void ObojiRedove(CustomDataGridView dataGridView1, Label label20)
        {
            double razlika = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells[3].FormattedValue.ToString().Contains("HZZO"))
                {
                    if (Convert.ToInt32(row.Cells[13].Value) != 0)
                    {
                        row.DefaultCellStyle.BackColor = Color.MistyRose;
                    }
                    if (Convert.ToInt32(row.Cells[15].Value) - Convert.ToInt32(row.Cells[14].Value) < 5 && Convert.ToInt32(row.Cells[14].Value) != 0)
                    {
                        row.DefaultCellStyle.BackColor = Color.FromArgb(204, 255, 153);
                    }
                    else
                    {
                        if (Convert.ToInt32(row.Cells[13].Value) == 0)
                        {
                            razlika += Convert.ToDouble(row.Cells[14].Value) - Convert.ToDouble(row.Cells[15].Value);
                        }
                    }
                }
            }
            label20.Text = "Razlika-HZZO: " + Math.Round(razlika, 2).ToString("C", CultureInfo.CreateSpecificCulture("hr-HR"));
        }
예제 #2
0
        public void Filtriraj(string textFilter, CustomDataGridView dataGridView1, int column)
        {
            BindingSource bs = new BindingSource
            {
                DataSource = dataGridView1.DataSource,
                Filter     = dataGridView1.Columns[column].HeaderText.ToString() + " LIKE '%" + textFilter + "%'"
            };

            dataGridView1.DataSource = bs;
        }
예제 #3
0
        public static void Ispisi(string datumOdBox, string datumDoBox, CustomDataGridView dataGridView1)
        {
            string connStr = "datasource=localhost;port=3306;username=root;password=pass123";
            string query   = string.Format("SELECT * FROM poreznaura.ira WHERE datum_rn BETWEEN "
                                           + "'{0}' AND '{1}' ;", datumOdBox, datumDoBox);

            using (MySqlConnection conn = new MySqlConnection(connStr))
            {
                using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn))
                {
                    DataSet ds = new DataSet();
                    adapter.Fill(ds);
                    dataGridView1.DataSource = ds.Tables[0];
                }
            }
        }
예제 #4
0
        private UraStavka ZbrojiTroskove(CustomDataGridView dataGridView1)
        {
            UraStavka stavka = new UraStavka();

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                stavka.UkIznos += Convert.ToDouble(dataGridView1.Rows[i].Cells[4].Value.ToString());
            }

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                stavka.Osn5 += Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value.ToString());
            }

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                stavka.Osn13 += Convert.ToDouble(dataGridView1.Rows[i].Cells[8].Value.ToString());
            }

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                stavka.Osn25 += Convert.ToDouble(dataGridView1.Rows[i].Cells[9].Value.ToString());
            }
            stavka.OsnovicaUkupno = stavka.Osn5 + stavka.Osn13 + stavka.Osn25;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                stavka.PretPorUk += Convert.ToDouble(dataGridView1.Rows[i].Cells[10].Value.ToString());
            }

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                stavka.Por5 += Convert.ToDouble(dataGridView1.Rows[i].Cells[11].Value.ToString());
            }

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                stavka.Por13 += Convert.ToDouble(dataGridView1.Rows[i].Cells[12].Value.ToString());
            }

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                stavka.Por25 += Convert.ToDouble(dataGridView1.Rows[i].Cells[13].Value.ToString());
            }

            return(stavka);
        }
예제 #5
0
        public UraStavka Troškovi(CustomDataGridView dataGridView1, string datumOdBox, string datumDoBox)
        {
            string connStr = "datasource=localhost;port=3306;database=poreznaura;username=root;" +
                             "password=pass123;Allow User Variables=True";
            string query = string.Format("CALL troskovi('{0}','{1}');", datumOdBox, datumDoBox);

            using (MySqlConnection conn = new MySqlConnection(connStr))
            {
                using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn))
                {
                    DataSet ds = new DataSet();
                    _ = adapter.Fill(ds);
                    dataGridView1.DataSource = ds.Tables[0];
                }
            }
            return(ZbrojiTroskove(dataGridView1));
        }