Exemple #1
0
        public void loadSoldItems()
        {
            try
            {
                dataGridView1.Rows.Clear();
                int    i         = 0;
                double totalSold = 0;
                using (MySqlDataReader reader = pos.loadSoldItems(dateTimePicker4.Value.ToString("yyyy-MM-dd"), dateTimePicker3.Value.ToString("yyyy-MM-dd")))
                {
                    while (reader.Read())
                    {
                        i++;
                        totalSold += Convert.ToDouble(reader["total"].ToString());
                        dataGridView1.Rows.Add(i, reader["products_id"].ToString(),
                                               reader["description"].ToString(),
                                               Double.Parse(reader["price"].ToString()).ToString("#,##0.00"),
                                               reader["qty"].ToString(),
                                               reader["disc"].ToString(),
                                               Double.Parse(reader["total"].ToString()).ToString("#,##0.00"));
                    }
                }

                total.Text = totalSold.ToString("#,##0.00");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }