private void LoadCrystalReport() { ReportView rv = new ReportView(); ReportSet ds = new ReportSet(); foreach (ReportContainerClass rc in GPData.reportlist) { if (rc.soptype == 4) { valuecontainer = (rc.quantity - (rc.quantity * 2)); valuecontainer2 = (rc.price - (rc.price * 2)); } else { valuecontainer = rc.quantity; valuecontainer2 = rc.price; } DataRow cRow = ds.ReportViewer.NewRow(); cRow["SOPNUMBER"] = rc.sopnumber; cRow["ITEMNUMBER"] = rc.itemnumber; cRow["CUSTOMERNAME"] = rc.custname; cRow["QUANTITY"] = valuecontainer; cRow["PRICE"] = valuecontainer2; ds.ReportViewer.Rows.Add(cRow); } ReportContainerClass rc1 = new ReportContainerClass(); rv.DataDefinition.FormulaFields["startDate"].Text = "\"" + Date.date1 + "\""; rv.DataDefinition.FormulaFields["End Date"].Text = "\"" + Date.date2 + "\""; rv.DataDefinition.FormulaFields["Customer"].Text = "\"" + customer + "\""; rv.SetDataSource(ds); crystalReportViewer1.ReportSource = rv; crystalReportViewer1.Refresh(); }
private void PriceGroupReportViewer_Load(object sender, EventArgs e) { PriceGroup rv = new PriceGroup(); ReportSet ds = new ReportSet(); foreach (ReportContainerClass rc in GPData.reportlist) { if (rc.pricegroup == "") { PGroupChecker = "No PriceGroup Items"; } else { PGroupChecker = rc.pricegroup; } if (rc.soptype == 4) { valuecontainer = (rc.quantity - (rc.quantity * 2)); valuecontainer2 = (rc.price - (rc.price * 2)); } else { valuecontainer = rc.quantity; valuecontainer2 = rc.price; } DataRow cRow = ds.ReportViewer.NewRow(); cRow["PRICEGROUP"] = PGroupChecker; cRow["QUANTITY"] = valuecontainer; cRow["PRICE"] = valuecontainer2; ds.ReportViewer.Rows.Add(cRow); } rv.DataDefinition.FormulaFields["startDate"].Text = "\"" + Date.date1 + "\""; rv.DataDefinition.FormulaFields["End Date"].Text = "\"" + Date.date2 + "\""; rv.DataDefinition.FormulaFields["Customer"].Text = "\"" + customer + "\""; rv.SetDataSource(ds); crystalReportViewer1.ReportSource = rv; crystalReportViewer1.Refresh(); }