public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { BarcodeReport rpt = new BarcodeReport(); rpt.Site = this.Site; return(rpt); }
public void assignDataToReport(DataTable dt) { BarcodeReport report = new BarcodeReport(); DataTable manipulatedDataTable = dt.Clone(); //manipulatedDataTable.TableName = "Processed"; try { foreach (DataRow dr in dt.Rows) { if (Convert.ToInt32(dr["Quantity"]) > 1) { //dr.BeginEdit(); int toCreate = Convert.ToInt32(dr["Quantity"]); for (int i = 0; i < toCreate; i++) { DataRow manipulatedDatarow = manipulatedDataTable.NewRow(); manipulatedDatarow["CustomerName"] = dr["CustomerName"]; manipulatedDatarow["ProjectName"] = dr["ProjectName"]; manipulatedDatarow["JobNO"] = dr["JobNO"]; manipulatedDatarow["SerialNO"] = dr["SerialNO"]; manipulatedDatarow["ItemDescription"] = dr["ItemDescription"]; manipulatedDatarow["W"] = Convert.ToInt32(dr["W"]); manipulatedDatarow["H"] = Convert.ToInt32(dr["H"]); // manipulatedDatarow["W1"] = dr["W1"]; //manipulatedDatarow["H1"] = dr["H1"]; manipulatedDatarow["Guage"] = dr["Guage"]; //manipulatedDatarow["Barcode"] = "*"; manipulatedDatarow["Barcode"] = "*" + Convert.ToInt32(dr["Barcode"]) + "*"; manipulatedDatarow["Area"] = dr["Area"]; manipulatedDataTable.Rows.Add(manipulatedDatarow); } } else { DataRow manipulatedDatarow1 = manipulatedDataTable.NewRow(); manipulatedDatarow1["CustomerName"] = dr["CustomerName"]; manipulatedDatarow1["ProjectName"] = dr["ProjectName"]; manipulatedDatarow1["JobNO"] = dr["JobNO"]; manipulatedDatarow1["SerialNO"] = dr["SerialNO"]; manipulatedDatarow1["ItemDescription"] = dr["ItemDescription"]; manipulatedDatarow1["W"] = Convert.ToInt32(dr["W"]); manipulatedDatarow1["H"] = Convert.ToInt32(dr["H"]); // manipulatedDatarow1["W1"] = dr["W1"]; //manipulatedDatarow1["H1"] = dr["H1"]; manipulatedDatarow1["Guage"] = dr["Guage"]; manipulatedDatarow1["Barcode"] = "*" + dr["Barcode"] + "*"; manipulatedDatarow1["Area"] = dr["Area"]; manipulatedDataTable.Rows.Add(manipulatedDatarow1); } } report.Database.Tables["Barcodes"].SetDataSource((DataTable)manipulatedDataTable); crystalReportViewer1.ReportSource = report; crystalReportViewer1.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }