add form ro 1
This commit is contained in:
@@ -646,7 +646,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
[HttpPost, Route("reports/revenue_estimate_register_credits/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetDetailKpiReport([FromRoute] string type,
|
||||
public IActionResult GetRegisterCreditsReport([FromRoute] string type,
|
||||
[FromBody] revenue_estimate_register_credits revenueEstimate)
|
||||
{
|
||||
var workbook = new XLWorkbook();
|
||||
@@ -4049,5 +4049,215 @@ namespace rmutr_report.Controllers
|
||||
"revenueEstimate_register" + ".xlsx");
|
||||
}
|
||||
}
|
||||
[HttpPost, Route("reports/form_1_2/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetForm2Report([FromRoute] string type,
|
||||
[FromBody] form_1_2 form1)
|
||||
{
|
||||
form1.dates = form1.date.Value.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("th-TH"));
|
||||
form1.day_start_workings = form1.start_working.Value.ToString("dd", CultureInfo.CreateSpecificCulture("th-TH"));
|
||||
form1.month_start_workings = form1.start_working.Value.ToString("MMMM", CultureInfo.CreateSpecificCulture("th-TH"));
|
||||
form1.year_start_workings = form1.start_working.Value.ToString("yyyy", CultureInfo.CreateSpecificCulture("th-TH"));
|
||||
var form_1 = new List<form_1_2>() { form1 };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "change_position_offer_request_form.frx");
|
||||
report.RegisterData(form_1, "form_1_2");
|
||||
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",
|
||||
"change_position_offer_request_form" + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/form_1_3/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetForm3Report([FromRoute] string type,
|
||||
[FromBody] form_1_3 form3)
|
||||
{
|
||||
form3.dates = form3.date.Value.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("th-TH"));
|
||||
if (form3.checkbox_1 == true)
|
||||
{
|
||||
form3.checkbox1 = "/";
|
||||
form3.checkbox2 = null;
|
||||
form3.checkbox3 = null;
|
||||
form3.checkbox4 = null;
|
||||
form3.checkbox5 = null;
|
||||
}
|
||||
|
||||
if (form3.checkbox_1 ==false )
|
||||
{
|
||||
form3.checkbox1 = null;
|
||||
}
|
||||
if (form3.checkbox_2 == true)
|
||||
{
|
||||
form3.checkbox2 = "/";
|
||||
form3.checkbox1 = null;
|
||||
form3.checkbox3 = null;
|
||||
form3.checkbox4 = null;
|
||||
form3.checkbox5 = null;
|
||||
}
|
||||
|
||||
if (form3.checkbox_2 ==false )
|
||||
{
|
||||
form3.checkbox2 = null;
|
||||
}
|
||||
if (form3.checkbox_3 == true)
|
||||
{
|
||||
form3.checkbox3 = "/";
|
||||
form3.checkbox2 = null;
|
||||
form3.checkbox1 = null;
|
||||
form3.checkbox4 = null;
|
||||
form3.checkbox5 = null;
|
||||
}
|
||||
|
||||
if (form3.checkbox_3 ==false )
|
||||
{
|
||||
form3.checkbox3 = null;
|
||||
}
|
||||
if (form3.checkbox_4 == true)
|
||||
{
|
||||
form3.checkbox4 = "/";
|
||||
form3.checkbox2 = null;
|
||||
form3.checkbox3 = null;
|
||||
form3.checkbox1 = null;
|
||||
form3.checkbox5 = null;
|
||||
}
|
||||
|
||||
if (form3.checkbox_4 ==false )
|
||||
{
|
||||
form3.checkbox4 = null;
|
||||
}
|
||||
if (form3.checkbox_5 == true)
|
||||
{
|
||||
form3.checkbox5 = "/";
|
||||
form3.checkbox2 = null;
|
||||
form3.checkbox3 = null;
|
||||
form3.checkbox4 = null;
|
||||
form3.checkbox1 = null;
|
||||
}
|
||||
|
||||
if (form3.checkbox_5 ==false )
|
||||
{
|
||||
form3.checkbox5 = null;
|
||||
}
|
||||
|
||||
if (form3.other_remark!=null||form3.other_remark!="")
|
||||
{
|
||||
form3.checkbox6 = "/";
|
||||
}
|
||||
if (form3.other_remark==null||form3.other_remark=="")
|
||||
{
|
||||
form3.checkbox6 = null;
|
||||
}
|
||||
|
||||
if (form3.form_1_3_details != null)
|
||||
{
|
||||
foreach (var detail in form3.form_1_3_details)
|
||||
{
|
||||
detail.order_dates =
|
||||
detail.order_date.Value.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("th-TH"));
|
||||
detail.Informations_as_of =
|
||||
detail.Information_as_of.Value.ToString("dd MMMM yyyy",
|
||||
CultureInfo.CreateSpecificCulture("th-TH"));
|
||||
if (detail.checkbox_1 == true)
|
||||
{
|
||||
detail.checkbox1 = "/";
|
||||
detail.checkbox2 = null;
|
||||
|
||||
}
|
||||
|
||||
if (detail.checkbox_1 ==false )
|
||||
{
|
||||
detail.checkbox1 = null;
|
||||
}
|
||||
if (detail.checkbox_2 == true)
|
||||
{
|
||||
detail.checkbox2 = "/";
|
||||
detail.checkbox1 = null;
|
||||
|
||||
}
|
||||
|
||||
if (detail.checkbox_2 ==false )
|
||||
{
|
||||
detail.checkbox2 = null;
|
||||
}
|
||||
var a = detail.effects_if;
|
||||
var b = detail.workload;
|
||||
foreach (var aa in a)
|
||||
{
|
||||
detail.effects_if1 = aa;
|
||||
}
|
||||
foreach (var bb in b)
|
||||
{
|
||||
detail.workloads = bb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var form_3 = new List<form_1_3>() { form3 };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "new_rate_offer_request_form.frx");
|
||||
report.RegisterData(form_3, "form_1_3");
|
||||
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",
|
||||
"change_position_offer_request_form" + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user