Example #1
0
 private void ThongTinHoaDon_Load(object sender, EventArgs e)
 {
     using (quanlithucungEntities1 quanli = new quanlithucungEntities1())
     {
         RPHoaDon  report = new RPHoaDon();
         DataTable table  = new DataTable();
         table.Columns.Add("mahd");
         table.Columns.Add("ngaylap");
         table.Columns.Add("nhanvien");
         table.Columns.Add("tensanpham");
         table.Columns.Add("soluong");
         table.Columns.Add("dongia");
         table.Columns.Add("thanhtien");
         table.Columns.Add("TongTien");
         List <reportHD_Result> ds_hoadon = quanli.reportHD("HD001").ToList();
         foreach (var item in ds_hoadon)
         {
             table.Rows.Add(item.mahd, item.ngaylap, item.nhanvien, item.tensanpham, item.soluong, item.dongia, item.thanhtien, item.tongtien);
         }
         HoaDonBan1.SetDataSource(table);
         rpHoaDon.ReportSource = HoaDonBan1;
         rpHoaDon.Show();
     }
 }
Example #2
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            using (quanlithucungEntities1 quanli = new quanlithucungEntities1())
            {
                DataTable table = new DataTable();
                table.Columns.Add("mahd");
                table.Columns.Add("ngaylap");
                table.Columns.Add("nhanvien");
                table.Columns.Add("tensanpham");
                table.Columns.Add("soluong");
                table.Columns.Add("dongia");
                table.Columns.Add("thanhtien");


                List <reportHD_Result> ds_hoadon = quanli.reportHD(comboBox1.SelectedValue.ToString()).ToList();
                foreach (var item in ds_hoadon)
                {
                    table.Rows.Add(item.mahd, item.ngaylap, item.nhanvien, item.tensanpham, item.soluong, item.dongia, item.thanhtien);
                }
                HoaDonBan1.SetDataSource(table);
                crystalReportViewer1.ReportSource = HoaDonBan1;
                crystalReportViewer1.Show();
            }
        }