add report
This commit is contained in:
@@ -245,13 +245,14 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/summary_building_table/{type}")]
|
||||
|
||||
[HttpPost, Route("reports/summary_building_table/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetSumbuildingReport([FromRoute] string type,
|
||||
[FromBody] budget_summary_report budget_summary_reports)
|
||||
{
|
||||
var _budget_summary_report = new List<budget_summary_report>() { budget_summary_reports };
|
||||
if (budget_summary_reports.building_1 != null)
|
||||
if (budget_summary_reports.building_1 != null)
|
||||
{
|
||||
foreach (var bDetail in budget_summary_reports.building_1)
|
||||
{
|
||||
@@ -306,7 +307,8 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/summary_durable_articles_table/{type}")]
|
||||
|
||||
[HttpPost, Route("reports/summary_durable_articles_table/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetSumDurableArticlesReport([FromRoute] string type,
|
||||
[FromBody] budget_summary_report budget_summary_reports)
|
||||
@@ -350,6 +352,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPost, Route("reports/summary_all_project_table/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetSumAllProjectReport([FromRoute] string type,
|
||||
@@ -1747,11 +1750,11 @@ namespace rmutr_report.Controllers
|
||||
public IActionResult GetBudgetReport([FromRoute] string type,
|
||||
[FromBody] budget_expenditure_from_revenue budget_expenditure_from_revenues)
|
||||
{
|
||||
// var topic2 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
|
||||
// .Where(i => i.topic_type == 2).ToList();
|
||||
// var topic3 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
|
||||
// .Where(i => i.topic_type == 3).OrderBy(f=>f.couse_uid).ThenBy(m=>m.major_uid)
|
||||
// .ThenBy(r=>r.row).ToList();
|
||||
// var topic2 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
|
||||
// .Where(i => i.topic_type == 2).ToList();
|
||||
// var topic3 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
|
||||
// .Where(i => i.topic_type == 3).OrderBy(f=>f.couse_uid).ThenBy(m=>m.major_uid)
|
||||
// .ThenBy(r=>r.row).ToList();
|
||||
// var sum_1 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
|
||||
// .Where(h => h.topic_type == 2).Sum(j =>
|
||||
// j.current_students);
|
||||
@@ -1867,8 +1870,8 @@ namespace rmutr_report.Controllers
|
||||
var sum12 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
|
||||
.Where(h => h.topic_type == 1).Sum(j =>
|
||||
j.education_fee_less_fee_total);
|
||||
budget_expenditure_from_revenues.sum_12 = sum12;
|
||||
|
||||
budget_expenditure_from_revenues.sum_12 = sum12;
|
||||
|
||||
// detail.current_students = topic3.Sum(d=>d.current_students);
|
||||
//
|
||||
// detail.students_reduced = topic3.Sum(d=>d.students_reduced);
|
||||
@@ -1900,30 +1903,30 @@ namespace rmutr_report.Controllers
|
||||
detail.topic_1 = detail.topic;
|
||||
detail.topic_2 = null;
|
||||
|
||||
// detail.current_students = topic2.Sum(d=>d.current_students);
|
||||
//
|
||||
// detail.students_reduced = topic2.Sum(d=>d.students_reduced);
|
||||
//
|
||||
// detail.students_estimates = topic2.Sum(d=>d.students_estimates);
|
||||
//
|
||||
// detail.price_regis_flat_payment = topic2.Sum(d=>d.price_regis_flat_payment);
|
||||
//
|
||||
// detail.library_total = topic2.Sum(d=>d.library_total);
|
||||
//
|
||||
// detail.utilities_total =topic2.Sum(d=>d.utilities_total);
|
||||
//
|
||||
// detail.student_club_library_total = topic2.Sum(d=>d.student_club_library_total);
|
||||
//
|
||||
// detail.accident_insurance_total = topic2.Sum(d=>d.accident_insurance_total);
|
||||
//
|
||||
// detail.academic_activities_total = topic2.Sum(d=>d.academic_activities_total);
|
||||
//
|
||||
// detail.examination_and_x_rays_total = topic2.Sum(d=>d.examination_and_x_rays_total);
|
||||
//
|
||||
// detail.tuition_fee_total = topic2.Sum(d=>d.tuition_fee_total);
|
||||
//
|
||||
// detail.education_fee_less_fee_total = topic2.Sum(d=>d.education_fee_less_fee_total);
|
||||
}
|
||||
// detail.current_students = topic2.Sum(d=>d.current_students);
|
||||
//
|
||||
// detail.students_reduced = topic2.Sum(d=>d.students_reduced);
|
||||
//
|
||||
// detail.students_estimates = topic2.Sum(d=>d.students_estimates);
|
||||
//
|
||||
// detail.price_regis_flat_payment = topic2.Sum(d=>d.price_regis_flat_payment);
|
||||
//
|
||||
// detail.library_total = topic2.Sum(d=>d.library_total);
|
||||
//
|
||||
// detail.utilities_total =topic2.Sum(d=>d.utilities_total);
|
||||
//
|
||||
// detail.student_club_library_total = topic2.Sum(d=>d.student_club_library_total);
|
||||
//
|
||||
// detail.accident_insurance_total = topic2.Sum(d=>d.accident_insurance_total);
|
||||
//
|
||||
// detail.academic_activities_total = topic2.Sum(d=>d.academic_activities_total);
|
||||
//
|
||||
// detail.examination_and_x_rays_total = topic2.Sum(d=>d.examination_and_x_rays_total);
|
||||
//
|
||||
// detail.tuition_fee_total = topic2.Sum(d=>d.tuition_fee_total);
|
||||
//
|
||||
// detail.education_fee_less_fee_total = topic2.Sum(d=>d.education_fee_less_fee_total);
|
||||
}
|
||||
|
||||
if (detail.topic_type == 3)
|
||||
{
|
||||
@@ -2466,6 +2469,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPost, Route("reports/budget_expenditure_report_from_revenue/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type,
|
||||
@@ -2476,7 +2480,7 @@ namespace rmutr_report.Controllers
|
||||
{
|
||||
bb.personnel_list_s = new List<personnel_list> { bb.personnel_lists };
|
||||
}
|
||||
|
||||
|
||||
var budgetExpenditure = new List<budget_expenditure_report_from_revenue>() { budget };
|
||||
|
||||
Report report = new Report();
|
||||
@@ -2508,5 +2512,248 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPost, Route("reports/summary_government_budget_plan/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetSumGovernmentPlanReport([FromRoute] string type,
|
||||
[FromBody] summary_government_budget_plan government_budget)
|
||||
{
|
||||
var budget1 = government_budget.data.Sum(h => h.personnel_government_budget);
|
||||
var budget2 = government_budget.data.Sum(h => h.personnel_income_budget);
|
||||
var budget3 = budget1 + budget2;
|
||||
var budget4 = government_budget.data.Sum(h => h.operating_government_budget);
|
||||
var budget5 = government_budget.data.Sum(h => h.operating_income_budget);
|
||||
var budget6 = budget4 + budget5;
|
||||
var budget7 = government_budget.data.Sum(h => h.investment_government_budget);
|
||||
var budget8 = government_budget.data.Sum(h => h.investment_income_budget);
|
||||
var budget9 = budget7 + budget8;
|
||||
var budget10 = government_budget.data.Sum(h => h.subsidy_government_budget);
|
||||
var budget11 = government_budget.data.Sum(h => h.subsidy_income_budget);
|
||||
var budget12 = budget10 + budget11;
|
||||
var budget13 = government_budget.data.Sum(h => h.expenses_government_budget);
|
||||
var budget14 = government_budget.data.Sum(h => h.expenses_income_budget);
|
||||
var budget15 = budget13 + budget14;
|
||||
var budget16 = budget1 + budget4 + budget7 + budget10 + budget13;
|
||||
var budget17 = budget2 + budget5 + budget8 + budget11 + budget14;
|
||||
var budget18 = budget16 + budget17;
|
||||
int row = 1;
|
||||
int datarow = 1;
|
||||
|
||||
foreach (var datas in government_budget.data)
|
||||
{
|
||||
datas.total_personnel_income_budget = datas.personnel_government_budget + datas.personnel_income_budget;
|
||||
datas.total_operating_income_budget = datas.operating_government_budget + datas.operating_income_budget;
|
||||
datas.total_investment_income_budget =
|
||||
datas.investment_government_budget + datas.investment_income_budget;
|
||||
datas.total_subsidy_income_budget = datas.subsidy_government_budget + datas.subsidy_income_budget;
|
||||
datas.total_expenses_income_budget = datas.expenses_government_budget + datas.expenses_income_budget;
|
||||
datas.government_budget = datas.personnel_government_budget + datas.operating_government_budget +
|
||||
datas.investment_government_budget +
|
||||
datas.subsidy_government_budget + datas.expenses_government_budget;
|
||||
datas.government_income_budget =
|
||||
datas.personnel_income_budget + datas.operating_income_budget + datas.investment_income_budget +
|
||||
datas.subsidy_income_budget + datas.expenses_income_budget;
|
||||
datas.total_government_income_budget = datas.government_budget + datas.government_income_budget;
|
||||
government_budget.budget_1 = budget1;
|
||||
government_budget.budget_2 = budget2;
|
||||
government_budget.budget_3 = budget3;
|
||||
government_budget.budget_4 = budget4;
|
||||
government_budget.budget_5 = budget5;
|
||||
government_budget.budget_6 = budget6;
|
||||
government_budget.budget_7 = budget7;
|
||||
government_budget.budget_8 = budget8;
|
||||
government_budget.budget_9 = budget9;
|
||||
government_budget.budget_10 = budget10;
|
||||
government_budget.budget_11 = budget11;
|
||||
government_budget.budget_12 = budget12;
|
||||
government_budget.budget_13 = budget13;
|
||||
government_budget.budget_14 = budget14;
|
||||
government_budget.budget_15 = budget15;
|
||||
government_budget.budget_16 = budget16;
|
||||
government_budget.budget_17 = budget17;
|
||||
government_budget.budget_18 = budget18;
|
||||
if (datas.topic_type == 2)
|
||||
{
|
||||
datas.row_no = datarow.ToString();
|
||||
datarow++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var notation in government_budget.notations)
|
||||
{
|
||||
int subrow = 1;
|
||||
notation.row_no = row.ToString();
|
||||
if (notation.row_no == "1")
|
||||
{
|
||||
notation.row_no = "หมายเหตุ : " + "1";
|
||||
}
|
||||
|
||||
foreach (var notation2 in notation.notations_detail)
|
||||
{
|
||||
if (notation2.list != null && notation2.amount != null)
|
||||
{
|
||||
notation2.sub_row_no = row + "." + subrow;
|
||||
subrow++;
|
||||
notation2.free_text = "บาท";
|
||||
}
|
||||
|
||||
if (notation2.list == null || notation2.list == "")
|
||||
{
|
||||
notation2.sub_row_no = null;
|
||||
notation2.free_text = null;
|
||||
}
|
||||
}
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
var governmentbudget = new List<summary_government_budget_plan>() { government_budget };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "summary_government_budget_plan.frx");
|
||||
report.RegisterData(governmentbudget, "summary_government_budget_plan");
|
||||
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 "doc":
|
||||
Word2007Export word = new Word2007Export();
|
||||
report.Export(word, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "appllication/vnd.ms-word");
|
||||
case "docx":
|
||||
Word2007Export word1 = new Word2007Export();
|
||||
report.Export(word1, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "appllication/vnd.ms-word");
|
||||
case "xlsx":
|
||||
Excel2007Export excel = new Excel2007Export();
|
||||
report.Export(excel, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
return File(
|
||||
stream,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"summary_government_budget_plan" + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPost, Route("reports/budget_projects/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetBudgetProjectsReport([FromRoute] string type,
|
||||
[FromBody] budget_projects budget)
|
||||
{
|
||||
foreach (var detail in budget.data)
|
||||
{
|
||||
int row = 1;
|
||||
foreach (var dataDetail in detail.detail)
|
||||
{
|
||||
if (dataDetail.topic_type == 5)
|
||||
{
|
||||
dataDetail.row_no = row.ToString();
|
||||
row++;
|
||||
}
|
||||
else
|
||||
{
|
||||
dataDetail.row_no = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var budgets = new List<budget_projects>() { budget };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "budget_projects.frx");
|
||||
report.RegisterData(budgets, "budget_projects");
|
||||
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.ms-excel");
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
return File(
|
||||
stream,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"budget_project_" + date + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/total_budget/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetBudgetTotalReport([FromRoute] string type,
|
||||
[FromBody] total_budget budget)
|
||||
{
|
||||
int row = 1;
|
||||
foreach (var detail2 in budget.data)
|
||||
{
|
||||
var a = "- ";
|
||||
if (detail2.topic_type == 2)
|
||||
{
|
||||
detail2.list = a + detail2.list;
|
||||
}
|
||||
|
||||
if (detail2.topic_type == 5)
|
||||
{
|
||||
detail2.row_no = row.ToString();
|
||||
row++;
|
||||
}
|
||||
else
|
||||
{
|
||||
detail2.row_no = null;
|
||||
}
|
||||
|
||||
}
|
||||
var summaryBudget = new List<total_budget>() { budget };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "total_budget.frx");
|
||||
report.RegisterData(summaryBudget, "total_budget");
|
||||
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.ms-excel");
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
return File(
|
||||
stream,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"total_budget_" + date + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user