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