This commit is contained in:
@@ -1344,7 +1344,7 @@ namespace rmutr_report.Controllers
|
||||
// return Ok();
|
||||
// }
|
||||
|
||||
[SwaggerOperation("ค่าใช้จ่ายดำเนินงาน รายละเอียดการคำนวณค่าใช้จ่ายในการประชุม")]
|
||||
[SwaggerOperation("1 ค่าอาหารว่าง 2 ค่าเบี้ยประชุมคณะกรรมการ")]
|
||||
[HttpPost, Route("reports/calculate_meeting_expenses/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetCalReport([FromRoute] string type,
|
||||
@@ -1367,50 +1367,37 @@ namespace rmutr_report.Controllers
|
||||
calculate.text4 = "รวมค่าเบี้ยประชุม";
|
||||
}
|
||||
|
||||
//var newlist = new List<calculate_meeting_expenses>() { };
|
||||
//var newlist2 = newlist.SelectMany(newlist => newlist.data);
|
||||
//var newList = new List<calculate_meeting_expenses>() { };
|
||||
//var newList2 = newList.SelectMany(f => f.data).Where(d => d.topic_type == 2).Sum(g => g.disbursement_result);
|
||||
int n = 1;
|
||||
foreach (var data in calculate.data)
|
||||
foreach (var data in calculate.data)
|
||||
{
|
||||
int r = 1;
|
||||
if (data.topic_type == 1)
|
||||
{
|
||||
data.row_no = null;
|
||||
data.no = n.ToString();
|
||||
n++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.topic_type == 2)
|
||||
{
|
||||
data.total = data.expense_rate * data.count_person * data.count_meetings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
calculate.disbursement_result = c.Where(e => e.topic_type == 1).Sum(d => d.disbursement_result);
|
||||
calculate.expense_rate = c.Where(e => e.topic_type == 1).Sum(d => d.expense_rate);
|
||||
calculate.count_person = c.Where(e => e.topic_type == 1).Sum(d => d.count_person);
|
||||
calculate.count_meetings = c.Where(e => e.topic_type == 1).Sum(d => d.count_meetings);
|
||||
calculate.total = c.Where(e => e.topic_type == 1).Sum(d => d.total);
|
||||
|
||||
var calculateMeeting = new List<calculate_meeting_expenses>() { calculate };
|
||||
// calculate.data.Add(new calculate_meeting_expenses_data_datail()
|
||||
// {
|
||||
// topic_type = 1,
|
||||
// disbursement_result = calculateMeeting.SelectMany(d => d.data).Where(t => t.topic_type == 2)
|
||||
// .Sum(c => c.disbursement_result),
|
||||
// count_person = calculateMeeting.SelectMany(d => d.data).Where(t => t.topic_type == 2)
|
||||
// .Sum(c => c.count_person)
|
||||
// });
|
||||
// foreach (var cc in c)
|
||||
// {
|
||||
// if (cc.topic_type==1)
|
||||
// {
|
||||
// cc.disbursement_result = calculateMeeting.SelectMany(d => d.data).Where(t => t.topic_type == 2)
|
||||
// .Sum(c => c.disbursement_result);
|
||||
// cc.count_person = calculateMeeting.SelectMany(d => d.data).Where(t => t.topic_type == 2)
|
||||
// .Sum(c => c.count_person);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "calculate_meeting_expenses.frx");
|
||||
report.RegisterData(calculateMeeting, "calculate_meeting_expenses");
|
||||
@@ -1438,5 +1425,48 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[SwaggerOperation("ค่าตอบแทนผู้ปฏิบัติงานให้ราชการ (ค่าควบคุมงานก่อสร้าง)")]
|
||||
[HttpPost, Route("reports/control_cost_construction_wages/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetConstructionReport([FromRoute] string type,
|
||||
[FromBody] control_cost_construction_wages _expense)
|
||||
{
|
||||
var wages = _expense.data.ToList();
|
||||
|
||||
foreach (var detail in _expense.data)
|
||||
{
|
||||
detail.total_amount = (detail.quantity_work*detail.quantity_day * detail.quantity_person * detail.amount);
|
||||
}
|
||||
_expense.total_amount = wages.Sum(f => f.total_amount);
|
||||
|
||||
var expenses = new List<control_cost_construction_wages>() { _expense };
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "control_cost_construction_wages.frx");
|
||||
report.RegisterData(expenses, "control_cost_construction_wages");
|
||||
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",
|
||||
"control_cost_construction_wages" + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user