private void PrintMethod() { Mouse.OverrideCursor = Cursors.Wait; DS ds = new DS(); ds.RequiredCategory.Rows.Clear(); int i = 0; foreach (var item in _categoryServ.GetAllRequiredCategories().Where(w => w.RequiredQty > 0)) { ds.RequiredCategory.Rows.Add(); ds.RequiredCategory[i]["Serial"] = i + 1; ds.RequiredCategory[i]["Company"] = item.Company; ds.RequiredCategory[i]["Category"] = item.Category; //ds.RequiredCategory[i]["Cost"] = item.Cost; //ds.RequiredCategory[i]["Qty"] = item.Qty; ds.RequiredCategory[i]["Required"] = item.RequiredQty; i++; } ReportWindow rpt = new ReportWindow(); RequiredCategoryReport requiredCategoryRPT = new RequiredCategoryReport(); requiredCategoryRPT.SetDataSource(ds.Tables["RequiredCategory"]); rpt.crv.ViewerCore.ReportSource = requiredCategoryRPT; Mouse.OverrideCursor = null; rpt.ShowDialog(); }
private void PrintMethod() { Mouse.OverrideCursor = Cursors.Wait; DS ds = new DS(); ds.RequiredCategory.Rows.Clear(); int i = 0; foreach (var item in categories.Where(w => w.RequiredQty > 0)) { ds.RequiredCategory.Rows.Add(); ds.RequiredCategory[i]["Serial"] = i + 1; ds.RequiredCategory[i]["Category"] = item.Category + " " + item.Company; ds.RequiredCategory[i]["Required"] = item.RequiredQty; i++; } ReportWindow rpt = new ReportWindow(); RequiredCategoryReport requiredCategoryRPT = new RequiredCategoryReport(); requiredCategoryRPT.SetDataSource(ds.Tables["RequiredCategory"]); rpt.crv.ViewerCore.ReportSource = requiredCategoryRPT; Mouse.OverrideCursor = null; rpt.ShowDialog(); //requiredCategoryRPT.PrintOptions.PrinterName = _selectedPrinter; //requiredCategoryRPT.PrintToPrinter(1, true, 0, 0); }