This commit is contained in:
@@ -1010,6 +1010,49 @@ namespace rmutr_report.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[SwaggerOperation("ค่าประกันภัยรถยนต์ราชการ")]
|
||||
[HttpPost, Route("reports/budget_progress_insurances/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetInsurancesListReport([FromRoute] string type,
|
||||
[FromBody] budget_progress_insurances insurances)
|
||||
{
|
||||
foreach (var detail in insurances.data)
|
||||
{
|
||||
if (detail != null)
|
||||
{
|
||||
detail.total_amount = (detail.amount + detail.car_act);
|
||||
}
|
||||
}
|
||||
|
||||
var _insurances = new List<budget_progress_insurances>() { insurances };
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "budget_progress_insurances.frx");
|
||||
report.RegisterData(_insurances, "budget_progress_insurances");
|
||||
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")]
|
||||
@@ -1064,8 +1107,8 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[SwaggerOperation("ค่าจ้างให้บริการงานจ้างออกแบบ")]
|
||||
|
||||
[SwaggerOperation("ค่าจ้างให้บริการงานจ้างออกแบบ")]
|
||||
[HttpPost, Route("reports/design_services/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetDesignServicesReport([FromRoute] string type,
|
||||
@@ -1083,7 +1126,7 @@ namespace rmutr_report.Controllers
|
||||
if (detail != null)
|
||||
{
|
||||
detail.unit = detail.quantity_work + per;
|
||||
detail.amount = (detail.quantity * detail.quantity_person * detail.quantity_work)/100;
|
||||
detail.amount = (detail.quantity * detail.quantity_person * detail.quantity_work) / 100;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,6 +1165,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[SwaggerOperation("ค่าอาหารทำการนอกเวลา 1 วันทำการปกติ 2 วันหยุดราชการ")]
|
||||
[HttpPost, Route("reports/meal_costs_outside/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
@@ -1129,23 +1173,26 @@ namespace rmutr_report.Controllers
|
||||
[FromBody] meal_costs_outside mealCostsOutsides)
|
||||
{
|
||||
var meals = mealCostsOutsides.data.ToList();
|
||||
if (mealCostsOutsides.topic_type==1)
|
||||
if (mealCostsOutsides.topic_type == 1)
|
||||
{
|
||||
mealCostsOutsides.topic = "วันทำการปกติ";
|
||||
}
|
||||
if (mealCostsOutsides.topic_type==2)
|
||||
|
||||
if (mealCostsOutsides.topic_type == 2)
|
||||
{
|
||||
mealCostsOutsides.topic = "วันหยุดราชการ";
|
||||
}
|
||||
|
||||
foreach (var detail in mealCostsOutsides.data)
|
||||
{
|
||||
detail.total_amount = (detail.day*detail.person*detail.amount);
|
||||
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");
|
||||
@@ -1174,40 +1221,45 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[SwaggerOperation("ค่าเบี้ยเลี้ยง ที่พัก พาหนะ")]
|
||||
|
||||
[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)
|
||||
if (_expense.topic_type == 1)
|
||||
{
|
||||
_expense.topic = "ค่าเบี้ยเลี้ยง";
|
||||
_expense.text_1 = "จำนวนเงิน/วัน";
|
||||
_expense.text_2 = "จำนวน (วัน)";
|
||||
}
|
||||
if (_expense.topic_type==2)
|
||||
|
||||
if (_expense.topic_type == 2)
|
||||
{
|
||||
_expense.topic = "ค่าเช่าที่พัก";
|
||||
_expense.text_1 = "จำนวนเงิน/คน/คืน";
|
||||
_expense.text_2 = "จำนวนวัน";
|
||||
}
|
||||
if (_expense.topic_type==3)
|
||||
|
||||
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);
|
||||
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");
|
||||
@@ -1236,5 +1288,59 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[SwaggerOperation("แบบคำนวณค่าวัสดุการศึกษา")]
|
||||
[HttpPost, Route("reports/material_edu_cal_form/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetCalFormReport([FromRoute] string type,
|
||||
[FromBody] material_edu_cal_form calForm)
|
||||
{
|
||||
foreach (var data in calForm.data)
|
||||
{
|
||||
int row_no = 1;
|
||||
var total = data.data_detail.ToList();
|
||||
foreach (var detail2 in data.data_detail)
|
||||
{
|
||||
if (detail2.topic_type == 2)
|
||||
{
|
||||
detail2.no = row_no.ToString();
|
||||
row_no++;
|
||||
// detail2.total_amount_1 = detail2.amount_1*detail2.rate_1;
|
||||
// detail2.total_amount_2 = detail2.amount_2*detail2.rate_2;
|
||||
// detail2.total_all_amount = detail2.total_amount_1 + detail2.total_amount_2;
|
||||
}
|
||||
|
||||
calForm.total_amount = calForm.data.Sum(d => d.amount);
|
||||
}
|
||||
}
|
||||
|
||||
var _cal = new List<material_edu_cal_form>() { calForm };
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "material_edu_cal_form.frx");
|
||||
report.RegisterData(_cal, "material_edu_cal_form");
|
||||
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