Exemplo n.º 1
0
        public IActionResult GetReport()
        {
            var reportName  = "MasterDetail.mrt";
            var httpContext = new Stimulsoft.System.Web.HttpContext(this.HttpContext);
            var properties  = httpContext.Request.Params["properties"]?.ToString();

            if (properties != null)
            {
                var        data      = Convert.FromBase64String(properties);
                var        json      = Encoding.UTF8.GetString(data);
                JContainer container = JsonConvert.DeserializeObject <JContainer>(json);
                foreach (JToken token in container.Children())
                {
                    if (((JProperty)token).Name == "reportName")
                    {
                        reportName = ((JProperty)token).Value.Value <string>();
                    }
                }
            }

            var report = StiReport.CreateNewReport();
            var path   = StiAngularHelper.MapPath(this, $"Reports/{reportName}");

            report.Load(path);

            return(StiAngularViewer.GetReportResult(this, report));
        }
Exemplo n.º 2
0
        public IActionResult PrintB()
        {
            StiReport sti = new StiReport();

            sti.Load(StiNetCoreHelper.MapPath(this, "wwwroot/Report/address.mrt"));
            //var ppp =  _context.Factor1
            //        .Include(f => f.IdfactorstateNavigation)
            //        .Include(a => a.IdproductaddressNavigation)
            //        .FirstAsync();

            var addres = _context.Productaddresses.ToList();

            sti.Dictionary.Variables["variableName"].Value = "Yar";


            var report = StiReport.CreateNewReport();
            var path   = StiNetCoreHelper.MapPath(this, "wwwroot/Report/address.mr");

            report.Load(path);

            return(StiNetCoreReportResponse.ResponseAsPdf(report));

            //sti.RegData("st", addres);
            return(StiNetCoreViewer.GetReportResult(this, sti));
        }
        public IActionResult ViewerEvent()

        {
            var requestParams = StiAngularViewer.GetRequestParams(this);
            var reportName    = GetReportName();
            var data          = GetData();

            var dt = JsonConvert.DeserializeObject(data.ToString());

            //var json = StiJsonConnector.Get();
            //var dataSet = json.GetDataSet(new StiJsonOptions(data));÷


            if (requestParams.Action == StiAction.GetReport)

            {
                var report = StiReport.CreateNewReport();
                System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar();
                var    path        = StiAngularHelper.MapPath(this, "wwwroot/Reports/Currency/" + reportName);
                string Date_shamsi = pc.GetYear(DateTime.Now) + "/" + pc.GetMonth(DateTime.Now) + "/" +
                                     pc.GetDayOfMonth(DateTime.Now);
                report.Load(path);
                //report.RegData("dt", data.ToString());
                report.RegData("dt", dt);
                report.Dictionary.Variables["shamsiDate"].Value = Date_shamsi;
                return(StiAngularViewer.GetReportResult(this, report));
            }

            return(StiAngularViewer.ProcessRequestResult(this));
        }
Exemplo n.º 4
0
        public IActionResult GetReport()
        {
            var report = StiReport.CreateNewReport();
            var path   = StiAngularHelper.MapPath(this, "Reports/MasterDetail.mrt");

            report.Load(path);

            return(StiAngularDesigner.GetReportResult(this, report));
        }
        public ActionResult GetReport()
        {
            var report = StiReport.CreateNewReport();
            var path   = Server.MapPath("~/Reports/MasterDetail.mrt");

            report.Load(path);

            return(StiMvcDesigner.GetReportResult(report));
        }
Exemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            var report = StiReport.CreateNewReport();



            report.Render();
            report.Show();
        }
Exemplo n.º 7
0
        private void GetReportStimulsoft(string xmltext)
        {
            try
            {
                global::Stimulsoft.Base.StiLicense.Key = "6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn6T1QyRLNg9ob5/AoMlKpfD06YlnbaK+apLpkPGy58/hwEVP" +
                                                         "JFLu2ahVXhoRuQ6rqqr2dmiE1sVk+HoFVWz15idNVym7+T9lWeQUbd8FI/gJCJVd9zEPTA3yfhJpZx1s2ZXumj8n0P" +
                                                         "FAahfNUT8qlOCjmeZ2admzNVdRlTcH/uN3Ms51HIix2g7C0cuupRUJOYBM36vuEOSXp1B07rV6NwU0iACQHiUQ/Y4c" +
                                                         "Gx2SVSiZdVGKY4hVgfWDeHCTr5MaqXWo6p6EOSVB0bM3Y421Tv2qitJ3Utj/zcYDVbW5nSwhahuygT3ZCY5iftNvzw" +
                                                         "gwIEjS2LnGME3QghFEWnC04Vld/zxSQyxGcMyK7/03VkqfHlBN8jIVHEjFT0YQUhPAbiC2pfFKa6MIgJqvXTJDNQgn" +
                                                         "6y8c9RwfwPdC6PJjL/9c0kEpaG198A2R0mVZNzjvXHpG/mEUIeWN2zmWJMJNm5fgySzlV9BLUwKlM1jpv4rQcf5MR/" +
                                                         "/ZONmx6qqmjYcSASNmW/ICM72fwSsJE7F7chh1Q0VMkOe6sriXsdhkqC3lV5yTifwCK3JYM9i08XF1HXDMeNF6/tss" +
                                                         "wdMaaCVQDGJJp3stA8KlSyAeLFvRo5uMFl/5vvCuK3lV275SRgStTvS4uAu2yWIkUMnxMey6mZ";



                String sPath = Path.GetDirectoryName(this.GetType().Assembly.Location);
                sPath = sPath + @"/Report/OVReportMasivo.mrt";

                XmlDocument xml = new XmlDocument();
                xml.LoadXml(xmltext);

                StiReport rep = StiReport.CreateNewReport();

                MemoryStream stream = new MemoryStream();

                rep.Load(sPath);
                rep.Dictionary.Databases.Clear();
                var ds = ConvertXMLToDataSet(xml.InnerXml);
                rep.Dictionary.DataSources.Clear(); //refrescar reporte con campo nuevo
                rep.RegData(ds);
                rep.Dictionary.Synchronize();       //refrescar reporte con campo nuevo
                rep.Render();


                DateTime now     = DateTime.Now;
                string   pdfName = now.ToString("yyyyMMddTHHmmssZ") + "OVReportMasivo.pdf";


                //rep.ExportDocument(StiExportFormat.Pdf, stream); //intento de abrirlo pdf en memoria, pero no funciono

                rep.ExportDocument(StiExportFormat.Pdf, "C:\\Windows\\Temp\\" + pdfName);
                sPath = Path.GetDirectoryName(this.GetType().Assembly.Location);
                //string filename = "OVReportMasivo.pdf";
                System.Diagnostics.Process.Start("C:\\Windows\\Temp\\" + pdfName);
            }
            catch (Exception e)
            {
                Application.SBO_Application.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                log.AddLog(e.Message + " ** Trace: ");
            }
            finally
            {
            }
        }
Exemplo n.º 8
0
        public IActionResult ViewerEvent()
        {
            var requestParams = StiAngularViewer.GetRequestParams(this);

            if (requestParams.Action == StiAction.GetReport)
            {
                var report = StiReport.CreateNewReport();
                var path   = StiAngularHelper.MapPath(this, $"Reports/EmployeeReport.mrt");
                report.Load(path);
                return(StiAngularViewer.GetReportResult(this, report));
            }
            return(StiAngularViewer.ProcessRequestResult(this));
        }
Exemplo n.º 9
0
            public async Task <IActionResult> GetReport([FromQuery] Guid template)
            {
                var stiReport = StiReport.CreateNewReport();

                if (_memoryCache.TryGetValue <byte[]>(template.ToString("D"), out var data))
                {
                    stiReport.Load(data);
                }

                stiReport.RegBusinessObject("Data", new
                {
                    Test = "Test"
                });
                stiReport.Dictionary.SynchronizeBusinessObjects(5);
                await stiReport.Dictionary.SynchronizeAsync();

                return(await StiNetCoreDesigner.GetReportResultAsync(this, stiReport));
            }
Exemplo n.º 10
0
        public string getStimulsoftReportBase64(string path, XmlDocument xml, XmlDocument xmlTed)
        {
            StiReport report = StiReport.CreateNewReport();

            try
            {
                string codigoBarra = xmlTed.InnerText;

                using (var pdf417Bar = new IDAutomation.Windows.Forms.PDF417Barcode.PDF417Barcode())
                {
                    pdf417Bar.DataToEncode        = codigoBarra;
                    pdf417Bar.PDFMode             = IDAutomation.Windows.Forms.PDF417Barcode.PDF417Barcode.PDF417Modes.Binary;
                    pdf417Bar.PDFColumns          = 12;
                    pdf417Bar.Resolution          = IDAutomation.Windows.Forms.PDF417Barcode.PDF417Barcode.Resolutions.Custom;
                    pdf417Bar.ResolutionCustomDPI = 120;
                    pdf417Bar.Height    = 160;
                    pdf417Bar.Width     = 190;
                    pdf417Bar.XtoYRatio = 4;
                    pdf417Bar.PDFErrorCorrectionLevel = 1;
                    pdf417Bar.RefreshImage();
                    MemoryStream myMemoryStream = new MemoryStream();
                    pdf417Bar.Picture.Save(myMemoryStream, System.Drawing.Imaging.ImageFormat.Png);

                    report.Load(path);
                    report.Dictionary.Databases.Clear();
                    var ds = ConvertXMLToDataSet(xml.InnerXml);
                    report.RegData(ds);

                    Image imagenTimbre = System.Drawing.Image.FromStream(myMemoryStream);
                    try
                    {
                        report.Dictionary.Variables["codigoBarra"].ValueObject = imagenTimbre;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Excepcion " + e.Message);
                        return("");
                    }
                }

                //report.Dictionary.Variables["Variabletest"].ValueObject = "Envio Desde c#";
                report.Render();
                //report.ExportDocument(StiExportFormat.Pdf, "42Report.pdf");

                MemoryStream oStream = new MemoryStream();
                report.ExportDocument(StiExportFormat.Pdf, oStream);
                byte[] b1 = new byte[oStream.Length];
                oStream.Seek(0, System.IO.SeekOrigin.Begin);
                oStream.Read(b1, 0, Convert.ToInt32(oStream.Length));



                return(Convert.ToBase64String(b1));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Excepcion " + ex.Message);
            }

            return("");
        }