Beispiel #1
0
        public IActionResult Dashboards()
        {
            var dashboardFiles = Directory.GetFiles($"{environment.ContentRootPath}\\Dashboards", "*.mrt");
            var fileNames      = new string[dashboardFiles.Length];
            var index          = 0;

            foreach (var filePath in dashboardFiles)
            {
                fileNames[index++] = Path.GetFileNameWithoutExtension(filePath);
            }

            ViewBag.FileNames = fileNames;

            var fileName = RouteData.Values["id"].ToString();
            var report   = StiReport.CreateNewDashboard();

            report.Load(StiNetCoreHelper.MapPath(this, $"Dashboards/{fileName}.mrt"));

            var dashboard = report.Pages[0] as StiDashboard;

            ViewBag.ForeHtmlColor = ColorTranslator.ToHtml(dashboard != null ? StiDashboardStyleHelper.GetForeColor(dashboard) : Color.Black);
            ViewBag.BackHtmlColor = ColorTranslator.ToHtml(dashboard != null ? StiDashboardStyleHelper.GetDashboardBackColor(dashboard, true) : Color.White);
            ViewBag.BackColor     = dashboard != null?StiDashboardStyleHelper.GetDashboardBackColor(dashboard, true) : Color.White;

            return(View());
        }
        public ActionResult GetReport()
        {
            // Cria o relatório
            StiReport report = new StiReport();

            // Carrega o arquivo de relatório da pasta Reports do projeto
            report.Load(StiNetCoreHelper.MapPath(this, "Reports/relatorio_dados.mrt"));
            // Criar DataSet com o mesmo nome usado no editor de relatórios
            DataSet dataSet = new DataSet("dataSet");
            // Criar DataTable com o mesmo nome usado para o DataSource
            // no editor de relatórios
            DataTable dataTable = new DataTable("Gastos");
            // Instrução sql que retorna os dados
            // com formatação para Data e Moeda
            string sql = @"select CONVERT(VARCHAR(10),Data,103) as Data
                           ,Area
                           ,FORMAT(VALOR, 'c', 'pt-BR') as Valor
                           from Gastos";

            // Preenchendo o DataTable com os dados
            // trazidos do banco de dados Sql Server
            dataTable = data.retornaDataTable <SqlConnection>(sql);
            // Adicionando o DataTable ao DataSet
            dataSet.Tables.Add(dataTable);
            // Adicionando o DataSet ao relatório
            // Informando nome e alias
            report.RegData("dataSet", "dataSet", dataSet);
            // retorna o relatório com dados para o Visualizador
            return(StiNetCoreViewer.GetReportResult(this, report));
        }
 public IActionResult GetReport()
 {
     StiReport report = new StiReport();
     report.LoadDocument(StiNetCoreHelper.MapPath(this, "Reports/SimpleList.mdc"));
     
     return StiNetCoreViewer.GetReportResult(this, report);
 }
Beispiel #4
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));
        }
Beispiel #5
0
        public IActionResult GetReport(string id)
        {
            // Create the report object and load data from xml file
            var report = new StiReport();

            // Load report from MDZ document file
            // If not found - load from MRT template
            switch (id)
            {
            // Interactive Reports
            case "DrillDownSorting":

            // Parameters
            case "ParametersDetailedCategories":
            case "ParametersDetailedOrders":
            case "ParametersHighlightCondition":
            case "ParametersSelectingCountry":
            case "ParametersInvoice":

            // {Today} function is used
            case "MultiColumnListContainers":
                var data = new DataSet("Demo");
                data.ReadXml(StiNetCoreHelper.MapPath(this, "Data/Demo.xml"));
                report.Load(StiNetCoreHelper.MapPath(this, "ReportTemplates/" + id + ".mrt"));
                report.RegData(data);
                break;

            default:
                report.LoadPackedDocument(StiNetCoreHelper.MapPath(this, "ReportSnapshots/" + id + ".mdz"));
                break;
            }

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
        public IActionResult GetReport()
        {
            // Loading the report template
            var reportPath = StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt");
            var report     = new StiReport();

            report.Load(reportPath);

            // Deleting connections in the report template
            report.Dictionary.Databases.Clear();

            // Loading data from the XML file
            var dataPath = StiNetCoreHelper.MapPath(this, "Reports/Data/Demo.xml");
            var data     = new DataSet();

            data.ReadXml(dataPath);

            // Registering data in the report
            report.RegData(data);

            // Syncing the data structure, if required
            //report.Dictionary.Synchronize();

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
Beispiel #7
0
        public IActionResult Xml()
        {
            var path = StiNetCoreHelper.MapPath(this, "Reports/Data/XMLFile.xml");
            var xml  = System.IO.File.ReadAllText(path);

            return(Ok(xml));
        }
Beispiel #8
0
        public IActionResult GetReport(string reportPath, string dataKey = null)
        {
            if (!string.IsNullOrWhiteSpace(reportPath))
            {
                EnsureAllowAccess(reportPath);

                var report = new StiReport();

                string contentRootPath = _hostingEnvironment.ContentRootPath;
                Stimulsoft.Base.StiLicense.LoadFromFile(contentRootPath + "/Stimulsoft/license.key");

                var fullReportPath = StiNetCoreHelper.MapPath(this, reportPath);

                report.Load(fullReportPath);
                // report.Dictionary.Variables["OrganizationName"].Value = "AwroNore";
                // report.Dictionary.Variables["OrganizationLogo"].Value = $"{Request.Scheme}://{Request.Host}{""}";
                if (!string.IsNullOrWhiteSpace(dataKey))
                {
                    var reportDatasource = _context.HttpContext.Session.Get <List <ReportDatasourceModel> >(dataKey);
                    foreach (var item in reportDatasource)
                    {
                        report.RegData(item.Name, item.Name, item.Value);
                    }
                    report.Render();
                }
                return(StiNetCoreViewer.GetReportResult(this, report));
            }
            else
            {
                //Raise error path is empty;
                return(null);
            }
        }
        public IActionResult ReportDesigner()
        {
            string Report = "demoreport";

            var       reportPath = HostEnvironment.WebRootPath + "\\Reports\\" + Report + ".mrt";
            StiReport report     = new StiReport();

            //report.Load(reportPath);

            ///What is the code for desgining from  json her
            ///The link to json is , considering that the json api is protected
            ///http://localhost:52507/api/Reports/GetEmployees

            report.Load(StiNetCoreHelper.MapPath(this, reportPath));

            var jsonString = "{ }"; // Your code to autorization and get JSON string
            var dataSet    = StiJsonToDataSetConverter.GetDataSet(jsonString);

            report.RegData("ConnectionName", dataSet);
            report.Dictionary.Synchronize();



            return(StiNetCoreDesigner.GetReportResult(this, report));
        }
        public IActionResult GetReport(int id = 1)
        {
            // Create the report object
            StiReport report = new StiReport();

            switch (id)
            {
            // Dynamic sorting
            case 1:
                report.Load(StiNetCoreHelper.MapPath(this, "Reports/Sorting.mrt"));
                break;

            // Drill down
            case 2:
                report.Load(StiNetCoreHelper.MapPath(this, "Reports/ListOfProducts.mrt"));
                break;

            // Collapsing
            case 3:
                report.Load(StiNetCoreHelper.MapPath(this, "Reports/GroupWithCollapsing.mrt"));
                break;

            // Bookmarks
            case 4:
                report.Load(StiNetCoreHelper.MapPath(this, "Reports/ParametersSelectingCountry.mrt"));
                break;

            // Parameters
            case 5:
                report.Load(StiNetCoreHelper.MapPath(this, "Reports/InteractiveCharts.mrt"));
                break;
            }

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
        public IActionResult GetReport()
        {
            var report = new StiReport();

            //Load and add font to the resources
            var fileContent = System.IO.File.ReadAllBytes(StiNetCoreHelper.MapPath(this, "Fonts/Roboto-Black.ttf"));
            var resource    = new StiResource("Roboto-Black", "Roboto-Black", false, StiResourceType.FontTtf, fileContent, false);

            report.Dictionary.Resources.Add(resource);

            //Add resource font to the font collection
            StiFontCollection.AddResourceFont(resource.Name, resource.Content, "ttf", resource.Alias);

            //Create a text component
            var dataText = new StiText();

            dataText.ClientRectangle = new RectangleD(1, 1, 3, 2);
            dataText.Text            = "Sample Text";
            dataText.Font            = StiFontCollection.CreateFont("Roboto-Black", 12, FontStyle.Regular);
            dataText.Border.Side     = StiBorderSides.All;

            report.Pages[0].Components.Add(dataText);

            return(StiNetCoreDesigner.GetReportResult(this, report));
        }
Beispiel #12
0
        public IActionResult GetReport(string id)
        {
            // Create the report object
            StiReport report = new StiReport();

            // Load report
            switch (id)
            {
            // Load report snapshot
            case "1":
                report.LoadDocument(StiNetCoreHelper.MapPath(this, "Reports/SimpleList.mdc"));
                break;

            // Load report template
            case "2":
                report.Load(StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt"));
                break;

            // Load report snapshot
            default:
                report.LoadDocument(StiNetCoreHelper.MapPath(this, "Reports/SimpleList.mdc"));
                break;
            }

            // Load data from XML file for report template
            if (!report.IsDocument)
            {
                DataSet data = new DataSet("Demo");
                data.ReadXml(StiNetCoreHelper.MapPath(this, "Reports/Data/Demo.xml"));

                report.RegData(data);
            }

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
Beispiel #13
0
        public IActionResult GetReport()
        {
            StiReport report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, "reports/13contest.mrt"));
            return(StiNetCoreViewer.GetReportResult(this, report));
        }
Beispiel #14
0
        public async Task <IActionResult> GetReport()
        {
            XDocument       doc        = XDocument.Load("Reports/ReportV3.mrt");
            List <XElement> components = doc.Element("StiSerializer").Elements("Pages").Elements("Page1").Elements("Components")
                                         .ToList();

            foreach (XElement elem in components)
            {
                elem.Element("Text1").Element("Text").Value = "31.12.2020";
                elem.Element("Text2").Element("Text").Value = "31.03.2021";
                elem.Element("Text3").Element("Text").Value = "01.09.2020*";
                elem.Element("Text4").Element("Text").Value = "31.12.2020";
                elem.Element("Text5").Element("Text").Value = "31.03.2021**";
                elem.Element("Text6").Element("Text").Value = "31.03.2021***";
            }

            doc.Save("Reports/ReportV3.mrt");

            StiReport report = new StiReport();

            // Загрузит шаблон отчета из папки.
            report.Load(StiNetCoreHelper.MapPath(this, "Reports/ReportV3.mrt"));

            // Рендерит отчет.
            await report.RenderAsync();

            // Экспорт в PDF в указанную папку.
            await report.ExportDocumentAsync(StiExportFormat.Pdf, @"C:\StimulsoftReports\ReportResult.pdf");

            return(Ok("Save success"));
        }
        public string ProvisionForDepreciationOfFixedAssets([FromBody] JObject data)
        {
            string    startDate         = data.GetValue("startDate").ToString();
            DateTime  sdate             = ChangeDateFormat(startDate);
            string    endDate           = data.GetValue("endDate").ToString();
            DateTime  edate             = ChangeDateFormat(endDate);
            string    companyBranchCode = data.GetValue("companyBranchCode").ToString();
            string    databaseID        = data.GetValue("databaseID").ToString();
            StiReport report            = new StiReport();
            string    AccountID         = data.GetValue("AccountID").ToString();
            var       path = StiNetCoreHelper.MapPath(this, "C:/MohamedFahmy/BinHamranAdminPanelFront/src/reports/ProvisionForDepreciationOfFixedAssets.mrt");

            report.Load(path);
            report["FromDate"]         = startDate;
            report["ToDate"]           = endDate;
            report["@STARTDATE"]       = sdate;
            report["@ENDDATE"]         = edate;
            report["@CompanyBranchID"] = companyBranchCode;
            report["@ACCOUNTID"]       = AccountID;
            report["@DatabaseID"]      = databaseID;


            var dbMS_SQL = (StiSqlDatabase)report.Dictionary.Databases["MS SQL"];

            dbMS_SQL.ConnectionString = appSettings.Report_Connection;
            report.Render(false);
            return(report.SaveDocumentJsonToString());
        }
        public IActionResult GetReport(string id)
        {
            var report = StiReport.CreateNewDashboard();

            report.Load(StiNetCoreHelper.MapPath(this, $"Dashboards/{id}.mrt"));

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
        public IActionResult GetReport()
        {
            StiReport report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, "Reports/relatorio_teste.mrt"));

            return(StiNetCoreDesigner.GetReportResult(this, report));
        }
        public IActionResult GetReport(string id)
        {
            var report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, $"Dashboards/{id}.mrt"));

            return(StiNetCoreDesigner.GetReportResult(this, report));
        }
        public IActionResult GetReport(string id)
        {
            var report = StiReport.CreateNewDashboard();

            report.Load(StiNetCoreHelper.MapPath(this, "/Dashboards/" + id + ".mrt"));

            return(StiNetCoreDesigner.GetReportResult(this, report));
        }
        public IActionResult GetReport()
        {
            StiReport report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt"));

            return(StiNetCoreDesignerFx.GetReportResult(this, report));
        }
        private StiReport GetDashboard()
        {
            var reportPath = StiNetCoreHelper.MapPath(this, "Dashboards/DashboardChristmas.mrt");
            var report     = StiReport.CreateNewDashboard();

            report.Load(reportPath);

            return(report);
        }
        private StiReport GetReport()
        {
            var reportPath = StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt");
            var report     = new StiReport();

            report.Load(reportPath);

            return(report);
        }
        public IActionResult GetReport()
        {
            StiReport report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, "Reports/payments-preset.mrt"));


            return(StiNetCoreViewer.GetReportResult(this, report));
        }
        public IActionResult GetReport()
        {
            var report = new StiReport();
            var path   = StiNetCoreHelper.MapPath(this, "Reports/Report.mrt");

            report.Load(path);

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
        public IActionResult GetReportIEnumerable()
        {
            StiReport report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, "Reports/BusinessObjects_IEnumerable.mrt"));
            report.RegData("EmployeeIEnumerable", CreateBusinessObjectsIEnumerable.GetEmployees());

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
Beispiel #26
0
        public IActionResult GetReport()
        {
            // Create the report object
            var report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt"));

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
Beispiel #27
0
        public IActionResult GetReport(string id = "SimpleList")
        {
            // Create the report object and load data from xml file
            var report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, "/Reports/" + id + ".mrt"));

            return(StiNetCoreDesigner.GetReportResult(this, report));
        }
Beispiel #28
0
        public IActionResult GetReportITypedList()
        {
            var report = new StiReport();

            report.Load(StiNetCoreHelper.MapPath(this, "Reports/BusinessObjects_ITypedList.mrt"));
            report.RegData("EmployeeITypedList", CreateBusinessObjectsITypedList.GetEmployees());

            return(StiNetCoreViewer.GetReportResult(this, report));
        }
        public string getReportForDesigner(string reportName)
        {
            var          path = StiNetCoreHelper.MapPath(this, "/Reports/" + reportName + ".mrt");
            StreamReader rd   = new StreamReader(path);
            string       data = rd.ReadToEnd();

            rd.Close();
            return(data);
        }
        public IActionResult GetReport()
        {
            // Loading the report template
            var reportPath = StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleLists.mrt");
            var report     = new StiReport();

            report.Load(reportPath);

            return(StiNetCoreDesigner.GetReportResult(this, report));
        }