Ejemplo n.º 1
0
        /// <summary>
        /// Prints the data from the worksheet.
        /// </summary>
        public virtual void print()
        {
            string titleString = getTitle();
            int    index       = titleString.IndexOf("-", StringComparison.Ordinal);

            if (index > -1)
            {
                titleString = (titleString.Substring(index + 1)).Trim();
            }
            IList <string> v = formatOutput(" ", false, false);

            if (v.Count > 40)
            {
                for (int i = v.Count - 1; i > 40; i--)
                {
                    v.RemoveAt(i);
                }
            }
            string s = (new RTi.Util.GUI.TextResponseJDialog(this, "Lines per page:")).response();

            if (RTi.Util.String.StringUtil.atoi(s) <= 0)
            {
                return;
            }
            int lines = RTi.Util.String.StringUtil.atoi(s);

            ReportPrinter.printText(v, lines, lines, titleString, false, null);     // do not use a pre-defined PageFormat for
            // this print job
        }
        public void btnPrint_Click(object sender, EventArgs e)
        {
            int i, startingNumber, printCount;
            ReportPrintJobCollection jobs = new ReportPrintJobCollection();
            ReportPrintJob           job;

            String[] paths;


            paths          = ReportPaths.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            startingNumber = Convert.ToInt32(tbStartingNumber.Text);
            printCount     = Convert.ToInt32(tbPrintCount.Text);

            for (i = startingNumber; i < startingNumber + printCount; i++)
            {
                List <ReportParameter> parameters = new List <ReportParameter>();

                parameters.Add(new ReportParameter("SecurityCode", String.Format("BK{0}", i.ToString())));
                foreach (String path in paths)
                {
                    job = new ReportPrintJob(ddlPrinter.SelectedValue, path, 1, false, parameters, true, "BackupLabel");
                    jobs.Add(job);
                }
            }

            ReportPrinter printer = new ReportPrinter();

            printer.PrintReports(jobs);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 数据报表打印器 绑定数据报表及数据。
        /// </summary>
        /// <param name="row"></param>
        protected void ReportPrinter_DataBind()
        {
            //设置报表模版路径。
            LocalReport report = new LocalReport();

            report.ReportPath = "综合减负医疗费报告.rdlc";

            reportPrinter = new ReportPrinter(report);


            //加载报表数据源。
            string reportDataSourceName = reportPrinter.LocalReport.GetDataSourceNames()[0];

            decimal zhjfylf = 0M;

            decimal.TryParse(tbZHJFYLF.Text, out zhjfylf);

            DataTable tableSource = bll_AccountBook.Create_Report_ZHJFYLF_Stat((cbbMPeriod.SelectedItem as MRS.Model.MPeriod).Id, zhjfylf);

            reportPrinter.LocalReport.DataSources.Add(new ReportDataSource(reportDataSourceName, tableSource));

            //设置报表参数值。
            ReportParameter[] parameters = new ReportParameter[1];
            parameters[0] = new ReportParameter("PARM_MPeriod", (cbbMPeriod.SelectedItem as MRS.Model.MPeriod).Name);
            //parameters[1] = new ReportParameter("PARM_IssueNumber", cbbIssueNumber.SelectedItem.ToString());

            report.SetParameters(parameters);
        }
Ejemplo n.º 4
0
        public void PrintReport(ReportPrinter printer)
        {
            int total = 0;
            int mealExpenses = 0;

            printer.Print("Expenses " + GetDate() + "\n");

            foreach (Expense expense in expenses) {
                if (expense.type == Expense.Type.BREAKFAST || expense.type == Expense.Type.DINNER)
                    mealExpenses += expense.amount;

                String name = "TILT";
                switch (expense.type) {
                case Expense.Type.DINNER: name = "Dinner"; break;
                case Expense.Type.BREAKFAST: name = "Breakfast"; break;
                case Expense.Type.CAR_RENTAL: name = "Car Rental"; break;
                }
                printer.Print(String.Format("{0}\t{1}\t${2:0.00}\n",
                                            (  (expense.type == Expense.Type.DINNER && expense.amount > 5000)
                 || (expense.type == Expense.Type.BREAKFAST && expense.amount > 1000)) ? "X" : " ",
                                            name, expense.amount / 100.0));

                total += expense.amount;
            }

            printer.Print(String.Format("\nMeal expenses ${0:0.00}",mealExpenses / 100.0 ));
            printer.Print(String.Format("\nTotal ${0:0.00}", total / 100.0));
        }
Ejemplo n.º 5
0
 public Report(DataAccess dataAccess,
               ReportFormatter reportFormatter, ReportPrinter reportPrinter)
 {
     _dataAccess      = dataAccess;
     _reportFormatter = reportFormatter;
     _reportPrinter   = reportPrinter;
 }
Ejemplo n.º 6
0
        private void btnPrintHistory_Click(object sender, EventArgs e)
        {
            DataRow[] rows = SelectProperGridRows(this.callHistoryDataset.CallHistory);

            ReportPrinter p = new ReportPrinter("CallButlerDataset_CallHistory", rows, "CallButler.Manager.Reports.CallHistoryReport.rdlc", this);

            p.OnPrintPageSelectionEvent += new ReportPrinter.PrintPageSelectionEventHandler(p_OnPrintPageSelectionEvent);
            p.Print();
        }
Ejemplo n.º 7
0
        public IActionResult DownloadReport(FluxoFilter filter)
        {
            var fluxos = _fluxoService.ListarFluxo(filter);

            var stream   = ReportPrinter.PrintAsStream(fluxos, filter);
            var filename = ReportPrinter.GetFileName();

            return(File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename));
        }
Ejemplo n.º 8
0
        static void Main()
        {
            ReportPrinter rp = new ReportPrinter();

            rp.PrintNextReport(new PrintInfoCallBack(Program.GetPrintInfo), "First Report");

            Console.WriteLine("");

            rp.PrintNextReport(new PrintInfoCallBack(Program.GetPrintInfo), "Second Report");
            Console.ReadLine();
        }
 public void Print()
 {
   var dataAccess = new DataAccess()
   dataAccess.GetData();
   
   var formatter = new ReportFormatter()
   formatter.FormatReport();
   
   var printer = new ReportPrinter()
   printer.Send();
 }
Ejemplo n.º 10
0
        private void p_OnPrintPageSelectionEvent(object source, PrintPageEventArgs e)
        {
            ReportPrinter p = source as ReportPrinter;

            if (p != null)
            {
                DataRow[] rows = GetSelectedGridRows();
                p.DataSource = rows;
                p.FinalizePrint(e);
            }
        }
Ejemplo n.º 11
0
        private static CompilerContext CreateContext(ReportPrinter reportPrinter)
        {
            var settings = new CompilerSettings
            {
                Version           = LanguageVersion.Experimental,
                GenerateDebugInfo = false,
                StdLib            = true,
                Target            = Target.Library
            };

            return(new CompilerContext(settings, reportPrinter));
        }
Ejemplo n.º 12
0
        private void PrintRSDirect(String printerName, String reportPath)
        {
            ReportPrintJob job;
            ReportPrinter  printer = new ReportPrinter();
            List <Arena.Reporting.ReportParameter> parameters = new List <Arena.Reporting.ReportParameter>();


            parameters.Add(new Arena.Reporting.ReportParameter("OccurrenceAttendanceID", "-1"));
            job = new ReportPrintJob(printerName, reportPath, 1, cbRSDirectLandscape.Checked, parameters, false, string.Empty);

            printer.PrintReport(job.PrinterName, job.ReportPath, job.Copies, job.Landscape, job.Parameters, job.PrinterName);
        }
Ejemplo n.º 13
0
    public static CompilerContext BuildContext(ReportPrinter rp)
    {
        var settings = new CompilerSettings()
        {
            Version           = LanguageVersion.Experimental,
            GenerateDebugInfo = false,
            StdLib            = true,
            //Unsafe = true,
            Target = Target.Library,
        };

        return(new CompilerContext(settings, rp));
    }
        public void ThenTheTrialBalanceShouldLookLikeThis(string ledgerName, Table table)
        {
            var expectedTrialBalanceLineItems = TrialBalanceTransform(table);

            var business = (IBusiness)ScenarioContext.Current["business"];
            var ledger   = business.Find <ILedger>(ledgerName);
            var reports  = ReportPrinter.For(ledger);

            reports.Print <ITrialBalance>();

            var actualTrialBalance = ledger.GetTrialBalance();

            Compare(expectedTrialBalanceLineItems, actualTrialBalance.LineItems);
        }
Ejemplo n.º 15
0
        private void PrintRSFramework(String printerName, String reportPath)
        {
            ReportPrintJobCollection jobs = new ReportPrintJobCollection();
            ReportPrintJob           job;
            ReportPrinter            printer = new ReportPrinter();
            List <Arena.Reporting.ReportParameter> parameters = new List <Arena.Reporting.ReportParameter>();


            parameters.Add(new Arena.Reporting.ReportParameter("OccurrenceAttendanceID", "-1"));
            job = new ReportPrintJob(printerName, reportPath, 1, cbRSDirectLandscape.Checked, parameters, false, string.Empty);
            jobs.Add(job);

            printer.PrintReports(jobs);
        }
Ejemplo n.º 16
0
        // [TestMethod]
        // This is a manual test.  Change the printer name in the ReportPrinter() constructor
        // and run the test when needed.
        public void Client_PrinterOutput()
        {
            var dataSources = new Dictionary <string, DataSource>()
            {
                { "MANF_DATA_2009", new XmlDataSource(File.OpenRead(SampleTemplatesFolder + @"\Manufacturing.xml")) }
            };

            var templateFilePath = SampleTemplatesFolder + @"\Manufacturing.docx";

            using (var templateFile = File.OpenRead(templateFilePath))
            {
                var report = new ReportPrinter(uri, templateFile, "Brother DCP-1610W series Printer");
                report.Process(dataSources);
            }
        }
        public void Print(FamilyMember person, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, ComputerSystem system)
        {
            // Don't new up Kiosk w/o empty constructor, might be too costly
            Kiosk kiosk = new Kiosk()
            {
                System = system
            };
            var           jobs    = kiosk.GetPrintJobs(attendance);
            ReportPrinter printer = new ReportPrinter();

            foreach (ReportPrintJob job in jobs)
            {
                printer.PrintReport(job.PrinterName, job.ReportPath, job.Copies, job.Landscape, job.Parameters, job.PrinterName);
            }
        }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            ReportPrinter test1 = new ReportPrinter();

            test1.data = "Przykład";
            test1.PrintReport();
            test1.FormatDocument();

            Report test2 = new Report();
            ReportPrinterBetter printer = new ReportPrinterBetter();
            DocumentFormatter   format  = new DocumentFormatter();

            test2.data = "Drugi przykład";
            format.FormatDocument(test2);
            printer.PrintReport(test2);
        }
Ejemplo n.º 19
0
        public void Print(FamilyMember person, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, ComputerSystem system)
        {
            // Don't new up Kiosk w/o empty constructor, might be too costly
            Kiosk kiosk = new Kiosk()
            {
                System = system
            };
            var           jobs    = kiosk.GetPrintJobs(attendance);
            ReportPrinter printer = new ReportPrinter();

            // Work around a bug in the way the ReportPrinter.PrintReports(jobs) method works...
            // ...it uses impersonation which seems to cause some problems with printing on Win 2008 R2 SP1.
            foreach (ReportPrintJob job in jobs)
            {
                printer.PrintReport(job.PrinterName, job.ReportPath, job.Copies, job.Landscape, job.Parameters, job.PrinterName);
            }
        }
Ejemplo n.º 20
0
        private void PrintDoc(RouteList route, RouteListPrintableDocuments type, PageOrientation orientation, int copies)
        {
            var reportInfo = PrintRouteListHelper.GetRDL(route, type, uow);

            var action = showDialog ? PrintOperationAction.PrintDialog : PrintOperationAction.Print;

            showDialog = false;

            Printer             = new PrintOperation();
            Printer.Unit        = Unit.Points;
            Printer.UseFullPage = true;
            //Printer.DefaultPageSetup = new PageSetup();

            if (PrintSettings == null)
            {
                Printer.PrintSettings = new PrintSettings();
            }
            else
            {
                Printer.PrintSettings = PrintSettings;
            }

            Printer.PrintSettings.Orientation = orientation;

            var rprint = new ReportPrinter(reportInfo);

            rprint.PrepareReport();

            Printer.NPages = rprint.PageCount;
            Printer.PrintSettings.NCopies = copies;
            if (copies > 1)
            {
                Printer.PrintSettings.Collate = true;
            }

            Printer.DrawPage += rprint.DrawPage;
            Printer.Run(action, null);

            PrintSettings = Printer.PrintSettings;
        }
Ejemplo n.º 21
0
        static void Main()
        {
            ReportPrinter     rp = new ReportPrinter();
            PrintInfoCallBack cb = new PrintInfoCallBack(Program.GetPrintInfo1);

            cb += new PrintInfoCallBack(Program.BackUpPrintInfo);

            //Define anonymous method in place of ThreadStart delegate
            System.Threading.Thread t = new System.Threading.Thread(delegate()
            {
                rp.PrintNextReport(cb, "First Report");
            });
            t.Start();

            //Define anonymous method in place of ThreadStart delegate
            System.Threading.Thread t2 = new System.Threading.Thread(delegate()
            {
                rp.PrintNextReport(cb, "Second Report");
            });
            t2.Start();

            Console.ReadLine();
        }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            int x = 0;

            try
            {
                ReportPrinter.YearReport();
            }
            catch(ReportException)
            {
                Debug.WriteLine("X should be great than 0");
            }
            catch (FormatException ex)
            {
                Debug.WriteLine(string.Format("ERR: {0}", ex.Message));
                Debug.WriteLine(ex);
                //Console.WriteLine("ERROR");
            }
            catch (Exception ex)
            {
                Debug.WriteLine("EXCEPTION: " + ex.Message);
            }
        }
Ejemplo n.º 23
0
        private string PrintPrinter(string templateLoc, string outputLoc, string source, string catalog, string autoTagSource, string[] paramFields, string[] paramValues)
        {
            try
            {
                var ds = new AdoDataSource("System.Data.SqlClient", "Data Source = " + source + "; Integrated Security = True; Initial Catalog = " + catalog);

                ds.Variables = new List <TemplateVariable>();

                for (int i = 0; i < paramFields.Length; i++)
                {
                    ds.Variables.Add(new TemplateVariable()
                    {
                        Name = paramFields[i], Value = paramValues[i]
                    });
                }

                var dataSources = new Dictionary <string, DataSource>()
                {
                    { autoTagSource, ds }
                };

                using (var templateFile = File.OpenRead(templateLoc))
                {
                    var report = new ReportPrinter(MachineEnvironment(), templateFile, outputLoc);
                    report.Process(dataSources);
                }

                return("0");
            }

            catch (Exception e)
            {
                errorMessage = e.ToString();
                return(errorMessage);
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 数据报表打印器 绑定数据报表及数据。
        /// </summary>
        /// <param name="row"></param>
        protected void ReportPrinter_DataBind()
        {
            //设置报表模版路径。
            LocalReport report = new LocalReport();

            report.ReportPath = "Report\\Payment.rdlc";

            reportPrinter = new ReportPrinter(report);


            //加载报表数据源。
            string reportDataSourceName = reportPrinter.LocalReport.GetDataSourceNames()[0];

            IList <Model.AccountBook> table = bllAccountBook.Select_AccountBook_PaymentList(beginDate, endDate);

            reportPrinter.LocalReport.DataSources.Add(new ReportDataSource(reportDataSourceName, table));

            //设置报表参数值。
            //ReportParameter[] parameters = new ReportParameter[1];
            //parameters[0] = new ReportParameter("PARM_MPeriod", (cbbMPeriod.SelectedItem as MRS.Model.MPeriod).Name);
            //parameters[1] = new ReportParameter("PARM_IssueNumber", cbbIssueNumber.SelectedItem.ToString());

            //report.SetParameters(parameters);
        }
Ejemplo n.º 25
0
 public MonoEngine(ReportPrinter printer)
 {
     _printer = printer;
 }
Ejemplo n.º 26
0
        // GET: CashBook
        public IActionResult Index(int?id, DateTime?EDate, string ModeType, string OpsType, string OutputType)
        {
            string   fileName = /*"ExcelFiles\\" +*/ "Export_CashBook_" + DateTime.Now.ToFileTimeUtc().ToString() + ".xlsx";
            string   path     = Path.Combine("wwwroot", fileName);
            FileInfo file     = new FileInfo(path);

            if (!file.Directory.Exists)
            {
                file.Directory.Create();
            }
            ViewBag.FileName = "";

            CashBookManager managerexporter = new CashBookManager(StoreId);
            CashBookManager manager         = new CashBookManager(StoreId);
            List <CashBook> cashList;

            if (!String.IsNullOrEmpty(OpsType))
            {
                if (OpsType == "Correct")
                {
                    //TODO: Implement Correct cash in hand
                    ViewBag.Message = "Cash Book Correction  ";

                    if (ModeType == "MonthWise")
                    {
                        cashList = managerexporter.CorrectCashInHands(db, EDate.Value.Date, path, StoreId, false);
                    }
                    else
                    {
                        cashList = managerexporter.CorrectCashInHands(db, EDate.Value.Date, path, StoreId, true);
                    }

                    ViewBag.FileName = "/" + fileName;
                }
                else
                {
                    ViewBag.Message = "";
                }
            }
            if (EDate != null)
            {
                if (ModeType == "MonthWise")
                {
                    cashList = manager.GetMontlyCashBook(db, EDate.Value.Date, StoreId);
                }
                else
                {
                    cashList = manager.GetDailyCashBook(db, EDate.Value.Date, StoreId);
                }
            }
            else if (id == 101)
            {
                cashList = manager.GetDailyCashBook(db, DateTime.Now, StoreId);
            }
            else
            {
                cashList = manager.GetMontlyCashBook(db, DateTime.Now, StoreId);
            }
            if (cashList != null)
            {
                if (!String.IsNullOrEmpty(OutputType) && OutputType == "PDF")
                {
                    string fName = ReportPrinter.PrintCashBook(cashList);
                    return(File(fName, "application/pdf"));
                }
                else if (!String.IsNullOrEmpty(OutputType) && OutputType == "XLS")
                {
                    //TODO: Remove Comment     if (OpsType == "List")
                    //TODO: Remove Comment     ExcelExporter.CashBookExporter(path, cashList, "CashBook", StoreId);

                    return(File(fileName, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
                }
                return(View(cashList));
            }
            else
            {
                return(NotFound());
            }
        }
Ejemplo n.º 27
0
 public MonoEngine(ReportPrinter printer)
 {
     _printer = printer;
 }
Ejemplo n.º 28
0
        // Mimicked from https://github.com/kkdevs/Patchwork/blob/master/Patchwork/MonoScript.cs#L124
        public static Assembly Compile(Dictionary <string, byte[]> sources, TextWriter logger = null)
        {
            ReportPrinter reporter = logger == null ? new ConsoleReportPrinter() : new StreamReportPrinter(logger);

            Location.Reset();

            var dllName = $"compiled_{DateTime.Now.Ticks}";

            compiledAssemblies.Add(dllName);

            var ctx = CreateContext(reporter);

            ctx.Settings.SourceFiles.Clear();

            var i = 0;

            SeekableStreamReader GetFile(SourceFile file)
            {
                return(new SeekableStreamReader(new MemoryStream(sources[file.OriginalFullPathName]), Encoding.UTF8));
            }

            foreach (var source in sources)
            {
                ctx.Settings.SourceFiles.Add(new SourceFile(Path.GetFileName(source.Key), source.Key, i, GetFile));
                i++;
            }

            var container = new ModuleContainer(ctx);

            RootContext.ToplevelTypes = container;
            Location.Initialize(ctx.Settings.SourceFiles);

            var session = new ParserSession {
                UseJayGlobalArrays = true, LocatedTokens = new LocatedToken[15000]
            };

            container.EnableRedefinition();

            foreach (var sourceFile in ctx.Settings.SourceFiles)
            {
                var stream = sourceFile.GetInputStream(sourceFile);
                var source = new CompilationSourceFile(container, sourceFile);
                source.EnableRedefinition();
                container.AddTypeContainer(source);
                var parser = new CSharpParser(stream, source, session);
                parser.parse();
            }

            var ass = new AssemblyDefinitionDynamic(container, dllName, $"{dllName}.dll");

            container.SetDeclaringAssembly(ass);

            var importer = new ReflectionImporter(container, ctx.BuiltinTypes);

            ass.Importer = importer;

            var loader = new DynamicLoader(importer, ctx);

            ImportAppdomainAssemblies(a => importer.ImportAssembly(a, container.GlobalRootNamespace));

            loader.LoadReferences(container);
            ass.Create(AppDomain.CurrentDomain, AssemblyBuilderAccess.RunAndSave);
            container.CreateContainer();
            loader.LoadModules(ass, container.GlobalRootNamespace);
            container.InitializePredefinedTypes();
            container.Define();

            if (ctx.Report.Errors > 0)
            {
                logger?.WriteLine("Found errors! Aborting compilation...");
                return(null);
            }

            try
            {
                ass.Resolve();
                ass.Emit();
                container.CloseContainer();
                ass.EmbedResources();
            }
            catch (Exception e)
            {
                logger?.WriteLine($"Failed to compile because {e}");
                return(null);
            }

            return(ass.Builder);
        }
Ejemplo n.º 29
0
 public void Print()
 {
     ReportPrinter reportPrinter = new ReportPrinter();
     reportPrinter.Print();
 }
Ejemplo n.º 30
0
    static void Main(string[] args)
    {
        ReportPrinter rp = new ReportPrinter();

        rp.printReport();
    }
 private void PrintInvoiceReport_Load(object sender, EventArgs e)
 {
     // Set the invoices report from the report printer based on the invoices from the selected client
     invoicesReport = ReportPrinter.PrintInvoices(this.ClientVM.Invoices);
     textBoxPrintInvoiceReport.Text = invoicesReport.ToString();
 }
Ejemplo n.º 32
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Parser parser, ReportPrinter reportPrinter)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                parser.Reader(@"C:\Users\andre\source\repos\QuakeLoggerAPI\raw.txt");
                reportPrinter.Print();
            }

            else
            {
                app.UseHsts();
            }



            app.UseSwagger();

            app.UseSwaggerUI(option =>
            {
                option.SwaggerEndpoint("/swagger/v1/swagger.json", "QuakeLogger V1");
            });


            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();



            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }