update
This commit is contained in:
@@ -826,6 +826,202 @@ namespace rmutr_report.Controllers
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/material_agricultural/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetMaterial9Report([FromRoute] string type, [FromBody] material_ro_three three)
|
||||
{
|
||||
if (three.data != null)
|
||||
{
|
||||
var s = three.data.Sum(f => f.material_amount);
|
||||
|
||||
three.total_amount = s;
|
||||
}
|
||||
|
||||
var threes = new List<material_ro_three>() { three };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "material_agricultural.frx");
|
||||
report.RegisterData(threes, "material_ro_three");
|
||||
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",
|
||||
date + ".xlsx");
|
||||
break;
|
||||
case "doc":
|
||||
case "docx":
|
||||
Word2007Export word = new Word2007Export();
|
||||
report.Export(word, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "appllication/vnd.ms-word");
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/material_housework/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetMaterial10Report([FromRoute] string type, [FromBody] material_ro_three three)
|
||||
{
|
||||
if (three.data != null)
|
||||
{
|
||||
var s = three.data.Sum(f => f.material_amount);
|
||||
|
||||
three.total_amount = s;
|
||||
}
|
||||
|
||||
var threes = new List<material_ro_three>() { three };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "material_housework.frx");
|
||||
report.RegisterData(threes, "material_ro_three");
|
||||
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",
|
||||
date + ".xlsx");
|
||||
break;
|
||||
case "doc":
|
||||
case "docx":
|
||||
Word2007Export word = new Word2007Export();
|
||||
report.Export(word, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "appllication/vnd.ms-word");
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/material_science_medical/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetMaterial11Report([FromRoute] string type, [FromBody] material_ro_three three)
|
||||
{
|
||||
if (three.data != null)
|
||||
{
|
||||
var s = three.data.Sum(f => f.material_amount);
|
||||
|
||||
three.total_amount = s;
|
||||
}
|
||||
|
||||
var threes = new List<material_ro_three>() { three };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "material_science_medical.frx");
|
||||
report.RegisterData(threes, "material_ro_three");
|
||||
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",
|
||||
date + ".xlsx");
|
||||
break;
|
||||
case "doc":
|
||||
case "docx":
|
||||
Word2007Export word = new Word2007Export();
|
||||
report.Export(word, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "appllication/vnd.ms-word");
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/material_sport/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetMaterial12Report([FromRoute] string type, [FromBody] material_ro_three three)
|
||||
{
|
||||
if (three.data != null)
|
||||
{
|
||||
var s = three.data.Sum(f => f.material_amount);
|
||||
|
||||
three.total_amount = s;
|
||||
}
|
||||
|
||||
var threes = new List<material_ro_three>() { three };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "material_sport.frx");
|
||||
report.RegisterData(threes, "material_ro_three");
|
||||
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",
|
||||
date + ".xlsx");
|
||||
break;
|
||||
case "doc":
|
||||
case "docx":
|
||||
Word2007Export word = new Word2007Export();
|
||||
report.Export(word, stream);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return File(stream, "appllication/vnd.ms-word");
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user