This commit is contained in:
@@ -1172,6 +1172,68 @@ namespace rmutr_report.Controllers
|
|||||||
"ค่าอาหารทำการนอกเวลา" + ".xlsx");
|
"ค่าอาหารทำการนอกเวลา" + ".xlsx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
[SwaggerOperation("ค่าเบี้ยเลี้ยง ที่พัก พาหนะ")]
|
||||||
|
[HttpPost, Route("reports/expense/{type}")]
|
||||||
|
[ApiExplorerSettings(GroupName = "reports")]
|
||||||
|
public IActionResult GetExpenseReport([FromRoute] string type,
|
||||||
|
[FromBody] expense _expense)
|
||||||
|
{
|
||||||
|
var meals = _expense.data.ToList();
|
||||||
|
if (_expense.topic_type==1)
|
||||||
|
{
|
||||||
|
_expense.topic = "ค่าเบี้ยเลี้ยง";
|
||||||
|
_expense.text_1 = "จำนวนเงิน/วัน";
|
||||||
|
_expense.text_2 = "จำนวน (วัน)";
|
||||||
|
}
|
||||||
|
if (_expense.topic_type==2)
|
||||||
|
{
|
||||||
|
_expense.topic = "ค่าเช่าที่พัก";
|
||||||
|
_expense.text_1 = "จำนวนเงิน/คน/คืน";
|
||||||
|
_expense.text_2 = "จำนวนวัน";
|
||||||
|
}
|
||||||
|
if (_expense.topic_type==3)
|
||||||
|
{
|
||||||
|
_expense.topic = "ค่าพาหนะ";
|
||||||
|
_expense.text_1 = "จำนวนเงิน";
|
||||||
|
_expense.text_2 = "จำนวนครั้ง";
|
||||||
|
}
|
||||||
|
foreach (var detail in _expense.data)
|
||||||
|
{
|
||||||
|
detail.total_amount = (detail.quantity_1*detail.quantity_2*detail.quantity_3);
|
||||||
|
}
|
||||||
|
_expense.quantity_1 = _expense.data.Sum(d => d.quantity_1);
|
||||||
|
_expense.quantity_2 = _expense.data.Sum(d => d.quantity_2);
|
||||||
|
_expense.quantity_3 = _expense.data.Sum(d => d.quantity_3);
|
||||||
|
_expense.total_amount = meals.Sum(f => f.total_amount);
|
||||||
|
|
||||||
|
var expenses = new List<expense>() { _expense };
|
||||||
|
Report report = new Report();
|
||||||
|
report.Load(_setting.report_path + "expense.frx");
|
||||||
|
report.RegisterData(expenses, "expense");
|
||||||
|
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":
|
||||||
|
case "xlsx":
|
||||||
|
Excel2007Export excel = new Excel2007Export();
|
||||||
|
report.Export(excel, stream);
|
||||||
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
return File(
|
||||||
|
stream,
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
|
"ค่าใช้สอย" + ".xlsx");
|
||||||
|
}
|
||||||
|
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
26
Models/budget/expense.cs
Normal file
26
Models/budget/expense.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace rmutr_report.Models
|
||||||
|
{
|
||||||
|
public class expense
|
||||||
|
{
|
||||||
|
public int? topic_type { get; set; }
|
||||||
|
public string topic { get; set; }
|
||||||
|
public string text_1 { get; set; }
|
||||||
|
public string text_2 { get; set; }
|
||||||
|
public decimal? quantity_1 { get; set; }
|
||||||
|
public decimal? quantity_2 { get; set; }
|
||||||
|
public decimal? quantity_3 { get; set; }
|
||||||
|
public decimal? total_amount { get; set; }
|
||||||
|
public List<expense_detail> data { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class expense_detail
|
||||||
|
{
|
||||||
|
public string topic { get; set; }
|
||||||
|
public decimal? quantity_1 { get; set; }
|
||||||
|
public decimal? quantity_2 { get; set; }
|
||||||
|
public decimal? quantity_3 { get; set; }
|
||||||
|
public decimal? total_amount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
4fe8cf0520c1058922f88691f3962ea94be0b3dc
|
e9a9c6e955618e76948e873e71c05dce5d7a9f21
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -416,6 +416,22 @@
|
|||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expenditure_budget_proposal.frx))</OriginalItemSpec>
|
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expenditure_budget_proposal.frx))</OriginalItemSpec>
|
||||||
</StaticWebAsset>
|
</StaticWebAsset>
|
||||||
|
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expense.frx))">
|
||||||
|
<SourceType>Package</SourceType>
|
||||||
|
<SourceId>rmutr_report</SourceId>
|
||||||
|
<ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
|
||||||
|
<BasePath>_content/rmutr_report</BasePath>
|
||||||
|
<RelativePath>reports\expense.frx</RelativePath>
|
||||||
|
<AssetKind></AssetKind>
|
||||||
|
<AssetMode></AssetMode>
|
||||||
|
<AssetRole></AssetRole>
|
||||||
|
<RelatedAsset></RelatedAsset>
|
||||||
|
<AssetTraitName></AssetTraitName>
|
||||||
|
<AssetTraitValue></AssetTraitValue>
|
||||||
|
<CopyToOutputDirectory></CopyToOutputDirectory>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expense.frx))</OriginalItemSpec>
|
||||||
|
</StaticWebAsset>
|
||||||
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\external_research.frx))">
|
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\external_research.frx))">
|
||||||
<SourceType>Package</SourceType>
|
<SourceType>Package</SourceType>
|
||||||
<SourceId>rmutr_report</SourceId>
|
<SourceId>rmutr_report</SourceId>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
5f92d7595eb0985f81447ccd37a39776df99a9b9
|
1bc0222191ea46a217e835e2056c22982a61bd8d
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
bde60c3a1e262956ffbc03163cd461622f8b5747
|
0389217213dc28262c345e10fcde26c9d129a140
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -416,6 +416,22 @@
|
|||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expenditure_budget_proposal.frx))</OriginalItemSpec>
|
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expenditure_budget_proposal.frx))</OriginalItemSpec>
|
||||||
</StaticWebAsset>
|
</StaticWebAsset>
|
||||||
|
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expense.frx))">
|
||||||
|
<SourceType>Package</SourceType>
|
||||||
|
<SourceId>rmutr_report</SourceId>
|
||||||
|
<ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
|
||||||
|
<BasePath>_content/rmutr_report</BasePath>
|
||||||
|
<RelativePath>reports\expense.frx</RelativePath>
|
||||||
|
<AssetKind></AssetKind>
|
||||||
|
<AssetMode></AssetMode>
|
||||||
|
<AssetRole></AssetRole>
|
||||||
|
<RelatedAsset></RelatedAsset>
|
||||||
|
<AssetTraitName></AssetTraitName>
|
||||||
|
<AssetTraitValue></AssetTraitValue>
|
||||||
|
<CopyToOutputDirectory></CopyToOutputDirectory>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expense.frx))</OriginalItemSpec>
|
||||||
|
</StaticWebAsset>
|
||||||
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\external_research.frx))">
|
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\external_research.frx))">
|
||||||
<SourceType>Package</SourceType>
|
<SourceType>Package</SourceType>
|
||||||
<SourceId>rmutr_report</SourceId>
|
<SourceId>rmutr_report</SourceId>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
5f92d7595eb0985f81447ccd37a39776df99a9b9
|
1bc0222191ea46a217e835e2056c22982a61bd8d
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
16978702836935477
|
16978837858099535
|
||||||
@@ -1 +1 @@
|
|||||||
16978837858099535
|
16978973146201897
|
||||||
75
wwwroot/reports/expense.frx
Normal file
75
wwwroot/reports/expense.frx
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Report ScriptLanguage="CSharp" ReportInfo.Created="01/13/2021 00:11:35" ReportInfo.Modified="10/21/2023 20:59:43" ReportInfo.CreatorVersion="2021.1.0.0">
|
||||||
|
<Dictionary>
|
||||||
|
<BusinessObjectDataSource Name="expense" ReferenceName="expense" DataType="null" Enabled="true">
|
||||||
|
<Column Name="topic_type" DataType="System.Int32"/>
|
||||||
|
<Column Name="topic" DataType="System.String"/>
|
||||||
|
<Column Name="text_1" DataType="System.String"/>
|
||||||
|
<Column Name="text_2" DataType="System.String"/>
|
||||||
|
<Column Name="quantity_1" DataType="System.Decimal"/>
|
||||||
|
<Column Name="quantity_2" DataType="System.Decimal"/>
|
||||||
|
<Column Name="quantity_3" DataType="System.Decimal"/>
|
||||||
|
<Column Name="total_amount" DataType="System.Decimal"/>
|
||||||
|
<BusinessObjectDataSource Name="data" DataType="null" Enabled="true">
|
||||||
|
<Column Name="topic" DataType="System.String"/>
|
||||||
|
<Column Name="quantity_1" DataType="System.Decimal"/>
|
||||||
|
<Column Name="quantity_2" DataType="System.Decimal"/>
|
||||||
|
<Column Name="quantity_3" DataType="System.Decimal"/>
|
||||||
|
<Column Name="total_amount" DataType="System.Decimal"/>
|
||||||
|
</BusinessObjectDataSource>
|
||||||
|
</BusinessObjectDataSource>
|
||||||
|
</Dictionary>
|
||||||
|
<ReportPage Name="Sheet1" Landscape="true" PaperWidth="297" PaperHeight="210" RawPaperSize="9" Watermark.Font="Arial, 60pt">
|
||||||
|
<PageHeaderBand Name="PageHeader1" Width="1047.06" Height="85.05">
|
||||||
|
<TextObject Name="Text1" Width="916.65" Height="37.8" Text="[expense.topic]" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableObject Name="Table1" Top="37.8" Width="916.69" Height="47.25">
|
||||||
|
<TableColumn Name="Column1" Width="396.92"/>
|
||||||
|
<TableColumn Name="Column2" Width="85.07"/>
|
||||||
|
<TableColumn Name="Column3" Width="141.75"/>
|
||||||
|
<TableColumn Name="Column4" Width="141.75"/>
|
||||||
|
<TableColumn Name="Column19" Width="151.2"/>
|
||||||
|
<TableRow Name="Row1" Height="47.25">
|
||||||
|
<TableCell Name="Cell1" Border.Lines="All" Fill.Color="214, 220, 228" Text="รายการ" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell2" Border.Lines="All" Fill.Color="214, 220, 228" Text="จำนวนคน" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell3" Border.Lines="All" Fill.Color="214, 220, 228" Text="[expense.text_1]" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell4" Border.Lines="All" Fill.Color="214, 220, 228" Text="[expense.text_2]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell19" Border.Lines="All" Fill.Color="214, 220, 228" Text="จำนวนเงินรวม" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
</TableRow>
|
||||||
|
</TableObject>
|
||||||
|
</PageHeaderBand>
|
||||||
|
<DataBand Name="Data1" Top="90.53" Width="1047.06">
|
||||||
|
<DataBand Name="Data3" Top="96.01" Width="1047.06" Height="37.8" DataSource="data">
|
||||||
|
<TableObject Name="Table2" Width="916.69" Height="37.8">
|
||||||
|
<TableColumn Name="Column15" Width="396.92"/>
|
||||||
|
<TableColumn Name="Column16" Width="85.07"/>
|
||||||
|
<TableColumn Name="Column17" Width="141.75"/>
|
||||||
|
<TableColumn Name="Column18" Width="141.75"/>
|
||||||
|
<TableColumn Name="Column21" Width="151.2"/>
|
||||||
|
<TableRow Name="Row2" Height="37.8">
|
||||||
|
<TableCell Name="Cell15" Border.Lines="All" Text="[expense.data.topic]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" AutoShrink="FontSize" AutoShrinkMinSize="11" VertAlign="Center" Font="TH Sarabun New, 16pt"/>
|
||||||
|
<TableCell Name="Cell16" Border.Lines="All" Text="[expense.data.quantity_1]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" AutoShrink="FontSize" AutoShrinkMinSize="12" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt"/>
|
||||||
|
<TableCell Name="Cell17" Border.Lines="All" Text="[expense.data.quantity_2]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" AutoShrink="FontSize" AutoShrinkMinSize="11" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt"/>
|
||||||
|
<TableCell Name="Cell18" Border.Lines="All" Text="[expense.data.quantity_3]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" AutoShrink="FontSize" AutoShrinkMinSize="9" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt"/>
|
||||||
|
<TableCell Name="Cell21" Border.Lines="All" Text="[expense.data.total_amount]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" VertAlign="Center" Font="TH Sarabun New, 16pt"/>
|
||||||
|
</TableRow>
|
||||||
|
</TableObject>
|
||||||
|
</DataBand>
|
||||||
|
</DataBand>
|
||||||
|
<ReportSummaryBand Name="ReportSummary1" Top="139.29" Width="1047.06" Height="37.8">
|
||||||
|
<TableObject Name="Table3" Width="916.69" Height="37.8">
|
||||||
|
<TableColumn Name="Column22" Width="396.92"/>
|
||||||
|
<TableColumn Name="Column23" Width="85.07"/>
|
||||||
|
<TableColumn Name="Column24" Width="141.75"/>
|
||||||
|
<TableColumn Name="Column25" Width="141.75"/>
|
||||||
|
<TableColumn Name="Column26" Width="151.2"/>
|
||||||
|
<TableRow Name="Row3" Height="37.8">
|
||||||
|
<TableCell Name="Cell22" Border.Lines="All" Text="รวมทั้งสิ้น" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" AutoShrink="FontSize" AutoShrinkMinSize="11" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell23" Border.Lines="All" Text="[expense.quantity_1]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" AutoShrink="FontSize" AutoShrinkMinSize="12" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell24" Border.Lines="All" Text="[expense.quantity_2]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" AutoShrink="FontSize" AutoShrinkMinSize="11" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell25" Border.Lines="All" Text="[expense.quantity_3]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" AutoShrink="FontSize" AutoShrinkMinSize="9" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
<TableCell Name="Cell26" Border.Lines="All" Text="[expense.total_amount]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" VertAlign="Center" Font="TH Sarabun New, 16pt, style=Bold"/>
|
||||||
|
</TableRow>
|
||||||
|
</TableObject>
|
||||||
|
</ReportSummaryBand>
|
||||||
|
</ReportPage>
|
||||||
|
</Report>
|
||||||
Reference in New Issue
Block a user