This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ClosedXML.Excel;
|
||||
using FastReport;
|
||||
using FastReport.Export.OoXML;
|
||||
@@ -20,6 +21,7 @@ namespace rmutr_report.Controllers
|
||||
{
|
||||
this._setting = setting;
|
||||
}
|
||||
|
||||
[SwaggerOperation("รับเงินแผ่นดิน")]
|
||||
[HttpPost, Route("reports/receive_government/{type}")] //รับเงินแผ่นดิน
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
@@ -62,6 +64,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[SwaggerOperation("การจัดสรรงบประมาณแผ่นดินรวมทุกแผนงาน, แผนงานบุคลากร, พื้นฐาน+ยุทธศาตร์")]
|
||||
[HttpPost, Route("reports/budget_government_allocate/{type}")] // (พื้นฐาน+ยุทธศาตร์)
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
@@ -71,7 +74,7 @@ namespace rmutr_report.Controllers
|
||||
var workbook = new XLWorkbook();
|
||||
var ws = workbook.Worksheets.Add("การจัดสรรงบประมาณแผ่นดิน");
|
||||
ws.Range("A1:S1").Merge().Value = "การจัดสรรงบประมาณแผ่นดิน ปีงบประมาณ พ.ศ. " + allocate.budget_year
|
||||
+ " (" + allocate.report_name + ")";//" (แผนงาน พื้นฐาน และ แผนงาน ยุทธศาสตร์ฯ)";
|
||||
+ " (" + allocate.report_name + ")"; //" (แผนงาน พื้นฐาน และ แผนงาน ยุทธศาสตร์ฯ)";
|
||||
ws.Range("A1:S1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range("A1:S1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range("A1:S1").Style.Font.FontName = "TH SarabunPSK";
|
||||
@@ -394,7 +397,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
if (detail.color == 3) // ชื่อคณะ สีแดงอ่อน
|
||||
{
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row + 1, 1)).Merge().Value = detail.list;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row + 1, 1)).Merge().Value = detail.list;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 5)).Merge().Value = detail.total_budget_personnel;
|
||||
ws.Range(ws.Cell(row, 6), ws.Cell(row, 9)).Merge().Value = detail.total_budget_operating;
|
||||
ws.Range(ws.Cell(row, 10), ws.Cell(row, 11)).Merge().Value = detail.total_budget_investment;
|
||||
@@ -428,6 +431,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
if (detail.color == 5) // ชื่อคณะ สีขาว
|
||||
{
|
||||
ws.Cell(row, 1).Value = "'- " + detail.list;
|
||||
@@ -466,7 +470,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
if (detail.color == 4) // ชื่อย่อยคณะ สีเทาอ่อน
|
||||
{
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row + 1, 1)).Merge().Value = detail.list;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row + 1, 1)).Merge().Value = detail.list;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 5)).Merge().Value = detail.total_budget_personnel;
|
||||
ws.Range(ws.Cell(row, 6), ws.Cell(row, 9)).Merge().Value = detail.total_budget_operating;
|
||||
ws.Range(ws.Cell(row, 10), ws.Cell(row, 11)).Merge().Value = detail.total_budget_investment;
|
||||
@@ -737,6 +741,7 @@ namespace rmutr_report.Controllers
|
||||
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
|
||||
if (detail2.color == 5) // ชื่อคณะ สีขาว detail
|
||||
{
|
||||
ws.Cell(row, 1).Value = null;
|
||||
@@ -934,7 +939,6 @@ namespace rmutr_report.Controllers
|
||||
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,5 +952,227 @@ namespace rmutr_report.Controllers
|
||||
"budget_government_allocate" + ".xlsx");
|
||||
}
|
||||
}
|
||||
|
||||
[SwaggerOperation("1 รายการวัสดุ 2 รายการค่าใช้สอย")]
|
||||
[HttpPost, Route("reports/national_budget_list/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetNationalBudgetListReport([FromRoute] string type,
|
||||
[FromBody] national_budget_list _nationalBudgetList)
|
||||
{
|
||||
string item = "รายการวัสดุ (คำของบประมาณรายจ่าย ปี ";
|
||||
string item2 = "รายการค่าใช้สอย (คำของบประมาณรายจ่าย ปี ";
|
||||
if (_nationalBudgetList.report_type == 1)
|
||||
{
|
||||
_nationalBudgetList.budget_year = item + _nationalBudgetList.budget_year + ")";
|
||||
}
|
||||
|
||||
if (_nationalBudgetList.report_type == 2)
|
||||
{
|
||||
_nationalBudgetList.budget_year = item2 + _nationalBudgetList.budget_year + ")";
|
||||
}
|
||||
|
||||
|
||||
foreach (var detail in _nationalBudgetList.data)
|
||||
{
|
||||
if (detail != null)
|
||||
{
|
||||
detail.total_amount = (detail.quantity * detail.unit_price);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var nationalBudgetLists = new List<national_budget_list>() { _nationalBudgetList };
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "national_budget_list.frx");
|
||||
report.RegisterData(nationalBudgetLists, "national_budget_list");
|
||||
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();
|
||||
}
|
||||
|
||||
[SwaggerOperation("ค่าคณะกรรมการตรวจสอบพัสดุในงานจ้างก่อสร้าง,ค่าคณะกรรมการอื่น ๆ")]
|
||||
[HttpPost, Route("reports/parcel_inspection_committee/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetCommitteeReport([FromRoute] string type,
|
||||
[FromBody] parcel_inspection_committee committee)
|
||||
{
|
||||
int no = 1;
|
||||
|
||||
foreach (var data in committee.data)
|
||||
{
|
||||
data.list = "รายการ " + no;
|
||||
no++;
|
||||
foreach (var detail in data.data_detail)
|
||||
{
|
||||
if (detail != null)
|
||||
{
|
||||
data.total_amount = (detail.quantity * detail.quantity_person * detail.quantity_work *
|
||||
detail.amount);
|
||||
}
|
||||
}
|
||||
|
||||
var s = committee.data.Sum(d => d.total_amount);
|
||||
committee.total_all_amount = s;
|
||||
}
|
||||
|
||||
|
||||
var _committees = new List<parcel_inspection_committee>() { committee };
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "other_committee_fee.frx");
|
||||
report.RegisterData(_committees, "parcel_inspection_committee");
|
||||
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",
|
||||
"national_budget_list" + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[SwaggerOperation("ค่าจ้างให้บริการงานจ้างออกแบบ")]
|
||||
[HttpPost, Route("reports/design_services/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetDesignServicesReport([FromRoute] string type,
|
||||
[FromBody] parcel_inspection_committee committee)
|
||||
{
|
||||
int no = 1;
|
||||
string per = "%";
|
||||
|
||||
foreach (var data in committee.data)
|
||||
{
|
||||
data.list = "รายการ " + no;
|
||||
no++;
|
||||
foreach (var detail in data.data_detail)
|
||||
{
|
||||
if (detail != null)
|
||||
{
|
||||
detail.unit = detail.quantity_work + per;
|
||||
detail.amount = (detail.quantity * detail.quantity_person * detail.quantity_work)/100;
|
||||
}
|
||||
}
|
||||
|
||||
var total = data.data_detail.Sum(d => d.amount);
|
||||
data.total_amount = total;
|
||||
|
||||
var s = committee.data.Sum(d => d.total_amount);
|
||||
committee.total_all_amount = s;
|
||||
}
|
||||
|
||||
var _committees = new List<parcel_inspection_committee>() { committee };
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "design_services.frx");
|
||||
report.RegisterData(_committees, "parcel_inspection_committee");
|
||||
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();
|
||||
}
|
||||
[SwaggerOperation("ค่าอาหารทำการนอกเวลา 1 วันทำการปกติ 2 วันหยุดราชการ")]
|
||||
[HttpPost, Route("reports/meal_costs_outside/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetDesignServicesReport([FromRoute] string type,
|
||||
[FromBody] meal_costs_outside mealCostsOutsides)
|
||||
{
|
||||
var meals = mealCostsOutsides.data.ToList();
|
||||
if (mealCostsOutsides.topic_type==1)
|
||||
{
|
||||
mealCostsOutsides.topic = "วันทำการปกติ";
|
||||
}
|
||||
if (mealCostsOutsides.topic_type==2)
|
||||
{
|
||||
mealCostsOutsides.topic = "วันหยุดราชการ";
|
||||
}
|
||||
foreach (var detail in mealCostsOutsides.data)
|
||||
{
|
||||
detail.total_amount = (detail.day*detail.person*detail.amount);
|
||||
}
|
||||
mealCostsOutsides.day = mealCostsOutsides.data.Sum(d => d.day);
|
||||
mealCostsOutsides.person = mealCostsOutsides.data.Sum(d => d.person);
|
||||
mealCostsOutsides.amount = mealCostsOutsides.data.Sum(d => d.amount);
|
||||
mealCostsOutsides.total_amount = meals.Sum(f => f.total_amount);
|
||||
|
||||
var meal = new List<meal_costs_outside>() { mealCostsOutsides };
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "meal_costs_outside.frx");
|
||||
report.RegisterData(meal, "meal_costs_outside");
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user