예제 #1
0
        private void btnFilter_Click(object sender, EventArgs e)
        {
            try
            {
                int i = 0;
                tk.DateOne = DateTime.Parse(dtmTuNgay.Value.ToShortDateString());
                tk.DateTwo = DateTime.Parse(dtmDenNgay.Value.ToShortDateString());

                List <ThongKe> tklist = tkbll.ThongKePhieuXuatTheoNgayThang(tk);
                dgvThongKePhieuXuatHang.Rows.Clear();
                foreach (ThongKe tks in tklist)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.CreateCells(dgvThongKePhieuXuatHang);
                    row.Cells[0].Value = i + 1;
                    row.Cells[1].Value = tks.MaSp.ToString();
                    row.Cells[2].Value = tks.TenSp.ToString();
                    row.Cells[3].Value = tks.TenLoai.ToString();
                    row.Cells[4].Value = tks.TenSx.ToString();
                    row.Cells[5].Value = tks.TenKh.ToString();
                    row.Cells[6].Value = tks.Slx.ToString();
                    row.Cells[7].Value = tks.TongTien.ToString();
                    row.Cells[8].Value = tks.PhanTram.ToString();
                    row.Cells[9].Value = tks.ThanhTien.ToString();

                    dgvThongKePhieuXuatHang.Rows.Add(row);
                    ++i;
                }
                lbTong.Text = i.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }