/Reports/ReportMaker.cs
C# | 47 lines | 31 code | 8 blank | 8 comment | 2 complexity | 29ec70620134f86bf82b42d3f92cc60d MD5 | raw file
1using System; 2using CrystalDecisions.CrystalReports.Engine; 3using CrystalDecisions.Shared; 4using CrystalDecisions.Web; 5 6namespace Reports 7{ 8/// <summary> 9/// Summary description for ReportMaker. 10/// </summary> 11 12 13public class ReportMaker 14{ 15 protected string PrinterName; 16 17 public ReportMaker() 18 { 19 //PrinterName="\\\\Orders1\\LQ300_O1"; 20 //PrinterName="\\\\mohammad\\LQ300_O2"; 21 //PrinterName="\\\\AHOKI\\LQ300_O3"; 22 //PrinterName="\\\\GOLABI\\LQ300_C"; 23 //PrinterName="\\\\KOOCHAK\\LQ300_P1"; 24 PrinterName="none"; 25 } 26 27 public void SetPrinter(String IP) 28 { 29 PrinterName=Util.choosePrinter(IP); 30 } 31 32 public Boolean printReport(ReportClass report, ParameterFields parameterFields) 33 { 34 if (PrinterName=="none") 35 return false; 36 37 for (int i=0; i<report.DataDefinition.ParameterFields.Count; i++) 38 { 39 report.DataDefinition.ParameterFields[i].ApplyCurrentValues(parameterFields[i].CurrentValues); 40 } 41 report.PrintOptions.PrinterName = PrinterName; 42 report.PrintToPrinter(1,false,1,99); 43 44 return true; 45 } 46} 47}