public static void printOpenOrders(Main frmMain, string sCompanyName, string sReportHeader, DataSet dsOpenOrder) { using (Solsage_Process_Management_System.Documents.crOpenOrder reportOpenOrder = new Solsage_Process_Management_System.Documents.crOpenOrder()) { using (Solsage_Process_Management_System.Documents.PrintInvoice frmPrint = new Solsage_Process_Management_System.Documents.PrintInvoice()) { reportOpenOrder.SetDataSource(dsOpenOrder.Tables["OpenOrder"]); foreach (CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition forReport in reportOpenOrder.DataDefinition.FormulaFields) { switch (forReport.FormulaName) { case "{@sCompanyName}": forReport.Text = "'" + sCompanyName + "'"; break; case "{@sReportHeading}": forReport.Text = "'" + sReportHeader + "'"; break; } } frmPrint.crystalReportViewer1.ReportSource = reportOpenOrder; frmPrint.printThisDocument(); } } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { crOpenOrder rpt = new crOpenOrder(); rpt.Site = this.Site; return rpt; }