add report
This commit is contained in:
68
Controllers/Budget.Controller.cs
Normal file
68
Controllers/Budget.Controller.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FastReport;
|
||||
using FastReport.Export.Csv;
|
||||
using FastReport.Export.Mht;
|
||||
using FastReport.Export.OoXML;
|
||||
using FastReport.Export.Pdf;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using rmutr_report.Models;
|
||||
using rmutr_report.Models.Hr;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace rmutr_report.Controllers
|
||||
{
|
||||
[SwaggerTag("สำหรับรายงาน_budget")]
|
||||
public class Budget: Controller
|
||||
{
|
||||
readonly Setting _setting;
|
||||
|
||||
public Budget(Setting setting)
|
||||
{
|
||||
this._setting = setting;
|
||||
}
|
||||
|
||||
[HttpPost, Route("reports/budget_report/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetSum1Report([FromRoute] string type, [FromBody] List<budget_report> budget_reports)
|
||||
{
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "budget_report.frx");
|
||||
report.RegisterData(budget_reports, "budget_report");
|
||||
report.Prepare();
|
||||
|
||||
MemoryStream stream = new MemoryStream();
|
||||
switch (type)
|
||||
{
|
||||
case "pdf":
|
||||
PDFExport pdf = new PDFExport();
|
||||
report.Export(pdf, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "application/pdf");
|
||||
|
||||
case "xls":
|
||||
Excel2007Export excel = new Excel2007Export();
|
||||
report.Export(excel, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "application/vnd.ms-excel");
|
||||
break;
|
||||
case "mht":
|
||||
MHTExport mht = new MHTExport();
|
||||
report.Export(mht, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "multipart/related");
|
||||
break;
|
||||
case "csv":
|
||||
CSVExport csv = new CSVExport();
|
||||
report.Export(csv, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "text/csv");
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
12
Models/budget_report.cs
Normal file
12
Models/budget_report.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace rmutr_report.Models
|
||||
{
|
||||
public class budget_report
|
||||
{
|
||||
public string fac { get; set; }
|
||||
public string salaya { get; set; }
|
||||
public string bophitphimuk { get; set; }
|
||||
public string pohchang { get; set; }
|
||||
public string klai_kangwon { get; set; }
|
||||
public string total { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ build_property.TargetFramework = net5.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb = true
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.PublishSingleFile =
|
||||
build_property.IncludeAllContentForSelfExtract =
|
||||
build_property._SupportedPlatformList = Android,iOS,Linux,macOS,Windows
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = rmutr_report
|
||||
build_property.ProjectDir = C:\Users\Mercedes Benz\Documents\rmutr_report\
|
||||
|
||||
@@ -89,7 +89,6 @@ C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\rmutr-report.deps
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\rmutr-report.runtimeconfig.json
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\rmutr-report.runtimeconfig.dev.json
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\rmutr-report.dll
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\ref\rmutr-report.dll
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\rmutr-report.pdb
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\rmutr-report.xml
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\FastReport.dll
|
||||
@@ -155,7 +154,6 @@ C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\rmutr-report.cspr
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\rmutr-report.MvcApplicationPartsAssemblyInfo.cs
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\rmutr-report.MvcApplicationPartsAssemblyInfo.cache
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\staticwebassets\rmutr-report.StaticWebAssets.Manifest.cache
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\staticwebassets\rmutr-report.StaticWebAssets.xml
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\scopedcss\bundle\rmutr-report.styles.css
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\rmutr-report.RazorTargetAssemblyInfo.cache
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\rmutr-report.csproj.CopyComplete
|
||||
@@ -165,3 +163,5 @@ C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\rmutr-report.xml
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\rmutr-report.pdb
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\rmutr-report.genruntimeconfig.cache
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\Swashbuckle.AspNetCore.Annotations.dll
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\bin\Debug\net5.0\rmutr-report.StaticWebAssets.xml
|
||||
C:\Users\Mercedes Benz\Documents\rmutr_report\obj\Debug\net5.0\refint\rmutr-report.dll
|
||||
|
||||
@@ -1688,6 +1688,12 @@
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Host.win-x64",
|
||||
"version": "[5.0.17, 5.0.17]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.AspNetCore.App": {
|
||||
"privateAssets": "none"
|
||||
@@ -1696,7 +1702,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.403\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.302\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
"restore":{"projectUniqueName":"C:\\Users\\Mercedes Benz\\Documents\\rmutr_report\\rmutr-report.csproj","projectName":"rmutr-report","projectPath":"C:\\Users\\Mercedes Benz\\Documents\\rmutr_report\\rmutr-report.csproj","outputPath":"C:\\Users\\Mercedes Benz\\Documents\\rmutr_report\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net5.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{},"https://nuget.71dev.com/v3/index.json":{}},"frameworks":{"net5.0":{"targetAlias":"net5.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net5.0":{"targetAlias":"net5.0","dependencies":{"FastReport.Core":{"target":"Package","version":"[2021.3.0, )"},"Swashbuckle.AspNetCore":{"target":"Package","version":"[5.6.3, )"},"Swashbuckle.AspNetCore.Annotations":{"target":"Package","version":"[6.0.7, )"}},"imports":["net461","net462","net47","net471","net472","net48"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.AspNetCore.App":{"privateAssets":"none"},"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\5.0.403\\RuntimeIdentifierGraph.json"}}
|
||||
"restore":{"projectUniqueName":"C:\\Users\\Mercedes Benz\\Documents\\rmutr_report\\rmutr-report.csproj","projectName":"rmutr-report","projectPath":"C:\\Users\\Mercedes Benz\\Documents\\rmutr_report\\rmutr-report.csproj","outputPath":"C:\\Users\\Mercedes Benz\\Documents\\rmutr_report\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net5.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{},"https://nuget.71dev.com/v3/index.json":{},"https://nuget.71dev.com/v3/index.json":{}},"frameworks":{"net5.0":{"targetAlias":"net5.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net5.0":{"targetAlias":"net5.0","dependencies":{"FastReport.Core":{"target":"Package","version":"[2021.3.0, )"},"Swashbuckle.AspNetCore":{"target":"Package","version":"[5.6.3, )"},"Swashbuckle.AspNetCore.Annotations":{"target":"Package","version":"[6.0.7, )"}},"imports":["net461","net462","net47","net471","net472","net48"],"assetTargetFallback":true,"warn":true,"downloadDependencies":[{"name":"Microsoft.NETCore.App.Host.win-x64","version":"[5.0.17, 5.0.17]"}],"frameworkReferences":{"Microsoft.AspNetCore.App":{"privateAssets":"none"},"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\6.0.302\\RuntimeIdentifierGraph.json"}}
|
||||
@@ -1 +1 @@
|
||||
16584898792009463
|
||||
16613086405383533
|
||||
@@ -24,6 +24,7 @@
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {},
|
||||
"https://nuget.71dev.com/v3/index.json": {},
|
||||
"https://nuget.71dev.com/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
@@ -65,6 +66,12 @@
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Host.win-x64",
|
||||
"version": "[5.0.17, 5.0.17]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.AspNetCore.App": {
|
||||
"privateAssets": "none"
|
||||
@@ -73,7 +80,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.403\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.302\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mercedes Benz\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.0.0</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.2.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Mercedes Benz\.nuget\packages\" />
|
||||
|
||||
64
wwwroot/reports/budget_report.frx
Normal file
64
wwwroot/reports/budget_report.frx
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Report ScriptLanguage="CSharp" ReportInfo.Created="09/14/2021 15:20:39" ReportInfo.Modified="08/24/2022 09:52:52" ReportInfo.CreatorVersion="2022.1.0.0">
|
||||
<Dictionary>
|
||||
<BusinessObjectDataSource Name="budget_report" ReferenceName="budget_report" DataType="null" Enabled="true">
|
||||
<Column Name="fac" DataType="System.String"/>
|
||||
<Column Name="salaya" DataType="System.String"/>
|
||||
<Column Name="bophitphimuk" DataType="System.String"/>
|
||||
<Column Name="pohchang" DataType="System.String"/>
|
||||
<Column Name="klai_kangwon" DataType="System.String"/>
|
||||
<Column Name="total" DataType="System.String"/>
|
||||
</BusinessObjectDataSource>
|
||||
</Dictionary>
|
||||
<ReportPage Name="Page1" RawPaperSize="9" Watermark.Font="Arial, 60pt">
|
||||
<PageHeaderBand Name="PageHeader1" Width="718.2"/>
|
||||
<DataBand Name="Data1" Top="4.12" Width="718.2" Height="56.7">
|
||||
<TableObject Name="Table1" Width="718.2" Height="56.7">
|
||||
<TableColumn Name="Column1" Width="37.8"/>
|
||||
<TableColumn Name="Column2" Width="226.8"/>
|
||||
<TableColumn Name="Column3" Width="368.55"/>
|
||||
<TableColumn Name="Column4" Width="85.05"/>
|
||||
<TableRow Name="Row1" Height="56.7">
|
||||
<TableCell Name="Cell1" Border.Lines="All" Fill.Color="ActiveCaption" Text="ลำดับ" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt, style=Bold"/>
|
||||
<TableCell Name="Cell2" Border.Lines="All" Fill.Color="ActiveCaption" Text="คณะ" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt, style=Bold"/>
|
||||
<TableCell Name="Cell3" Border.Lines="All" Fill.Color="ActiveCaption" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt, style=Bold">
|
||||
<TextObject Name="Text1" Width="368.55" Height="28.35" Text="พื้นที่" HorzAlign="Center" VertAlign="Bottom" Font="TH Sarabun New, 11pt, style=Bold"/>
|
||||
</TableCell>
|
||||
<TableCell Name="Cell4" Border.Lines="All" Fill.Color="ActiveCaption" Text="รวม" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt, style=Bold"/>
|
||||
</TableRow>
|
||||
</TableObject>
|
||||
<TableObject Name="Table23" Left="264.6" Top="28.35" Width="368.55" Height="28.35" Border.Lines="All">
|
||||
<TableColumn Name="Column163" Width="94.5"/>
|
||||
<TableColumn Name="Column164" Width="94.5"/>
|
||||
<TableColumn Name="Column165" Width="94.5"/>
|
||||
<TableColumn Name="Column166" Width="85.05"/>
|
||||
<TableRow Name="Row23" Height="28.35">
|
||||
<TableCell Name="Cell223" Border.Lines="All" Text="ศาลายา" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt, style=Bold"/>
|
||||
<TableCell Name="Cell224" Border.Lines="All" Text="บพิตรพิมุขจักรวรรดิ" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt, style=Bold"/>
|
||||
<TableCell Name="Cell225" Border.Lines="All" Text="เพาะช่าง" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt, style=Bold"/>
|
||||
<TableCell Name="Cell226" Text="วังไกลกังวล" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt, style=Bold"/>
|
||||
</TableRow>
|
||||
</TableObject>
|
||||
<DataBand Name="Data2" Top="64.95" Width="718.2" Height="28.35" DataSource="budget_report">
|
||||
<TableObject Name="Table14" Width="718.2" Height="28.35" Border.Lines="All">
|
||||
<TableColumn Name="Column70" Width="37.8"/>
|
||||
<TableColumn Name="Column71" Width="226.8"/>
|
||||
<TableColumn Name="Column72" Width="94.5"/>
|
||||
<TableColumn Name="Column73" Width="94.5"/>
|
||||
<TableColumn Name="Column74" Width="94.5"/>
|
||||
<TableColumn Name="Column75" Width="85.05"/>
|
||||
<TableColumn Name="Column76" Width="85.05"/>
|
||||
<TableRow Name="Row14" Height="28.35">
|
||||
<TableCell Name="Cell110" Text="[Row#]" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
||||
<TableCell Name="Cell111" Border.Lines="All" Text="[budget_report.fac]" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
||||
<TableCell Name="Cell112" Border.Lines="All" Text="[budget_report.salaya]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
||||
<TableCell Name="Cell113" Border.Lines="All" Text="[budget_report.bophitphimuk]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
||||
<TableCell Name="Cell114" Border.Lines="All" Text="[budget_report.pohchang]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
||||
<TableCell Name="Cell135" Border.Lines="All" Text="[budget_report.klai_kangwon]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
||||
<TableCell Name="Cell136" Border.Lines="All" Text="[budget_report.total]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
||||
</TableRow>
|
||||
</TableObject>
|
||||
</DataBand>
|
||||
</DataBand>
|
||||
</ReportPage>
|
||||
</Report>
|
||||
Reference in New Issue
Block a user