This commit is contained in:
@@ -964,49 +964,87 @@ namespace rmutr_report.Controllers
|
||||
if (_nationalBudgetList.report_type == 1)
|
||||
{
|
||||
_nationalBudgetList.budget_year = item + _nationalBudgetList.budget_year + ")";
|
||||
foreach (var detail in _nationalBudgetList.data)
|
||||
{
|
||||
if (detail != null)
|
||||
{
|
||||
detail.total_amount = (detail.quantity * detail.unit_price);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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*detail.quantity_month);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach (var detail in _nationalBudgetList.data)
|
||||
var nationalBudgetLists = new List<national_budget_list>() { _nationalBudgetList };
|
||||
Report report = new Report();
|
||||
if (_nationalBudgetList.report_type == 2)
|
||||
{
|
||||
if (detail != null)
|
||||
report.Load(_setting.report_path + "national_budget_list_type2.frx");
|
||||
report.RegisterData(nationalBudgetLists, "national_budget_list");
|
||||
report.Prepare();
|
||||
|
||||
MemoryStream stream1 = new MemoryStream();
|
||||
switch (type)
|
||||
{
|
||||
detail.total_amount = (detail.quantity * detail.unit_price);
|
||||
case "pdf":
|
||||
PDFExport pdf = new PDFExport();
|
||||
report.Export(pdf, stream1);
|
||||
stream1.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream1, "application/pdf");
|
||||
|
||||
case "xls":
|
||||
case "xlsx":
|
||||
Excel2007Export excel = new Excel2007Export();
|
||||
report.Export(excel, stream1);
|
||||
stream1.Seek(0, SeekOrigin.Begin);
|
||||
return File(
|
||||
stream1,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"ค่าเช่าทรัพย์สิน" + ".xlsx");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
if (_nationalBudgetList.report_type == 1)
|
||||
{
|
||||
case "pdf":
|
||||
PDFExport pdf = new PDFExport();
|
||||
report.Export(pdf, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "application/pdf");
|
||||
report.Load(_setting.report_path + "national_budget_list.frx");
|
||||
report.RegisterData(nationalBudgetLists, "national_budget_list");
|
||||
report.Prepare();
|
||||
|
||||
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");
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -1274,6 +1312,11 @@ namespace rmutr_report.Controllers
|
||||
_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.quantity_4);
|
||||
}
|
||||
}
|
||||
|
||||
if (_expense.topic_type == 2)
|
||||
@@ -1281,6 +1324,10 @@ namespace rmutr_report.Controllers
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
||||
if (_expense.topic_type == 3)
|
||||
@@ -1288,44 +1335,74 @@ namespace rmutr_report.Controllers
|
||||
_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);
|
||||
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.quantity_4 = _expense.data.Sum(d => d.quantity_4);
|
||||
_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)
|
||||
if (_expense.topic_type == 1)
|
||||
{
|
||||
case "pdf":
|
||||
PDFExport pdf = new PDFExport();
|
||||
report.Export(pdf, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "application/pdf");
|
||||
report.Load(_setting.report_path + "expense_allowance.frx");
|
||||
report.RegisterData(expenses, "expense");
|
||||
report.Prepare();
|
||||
MemoryStream stream1 = new MemoryStream();
|
||||
switch (type)
|
||||
{
|
||||
case "pdf":
|
||||
PDFExport pdf = new PDFExport();
|
||||
report.Export(pdf, stream1);
|
||||
stream1.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream1, "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");
|
||||
case "xls":
|
||||
case "xlsx":
|
||||
Excel2007Export excel = new Excel2007Export();
|
||||
report.Export(excel, stream1);
|
||||
stream1.Seek(0, SeekOrigin.Begin);
|
||||
return File(
|
||||
stream1,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"ค่าเบี้ยเลี้ยง" + ".xlsx");
|
||||
}
|
||||
}
|
||||
|
||||
if (_expense.topic_type != 1)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user