ปรับปรุง report

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-09-26 17:36:59 +07:00
parent 14c7df9d17
commit 0aac403a33
5 changed files with 31 additions and 8 deletions

View File

@@ -75,9 +75,7 @@ namespace TodoAPI2.Controllers
_logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex);
return StatusCode(500, $"{ex.Message}");
}
}
}
/// <summary>
/// Download Report
@@ -103,6 +101,8 @@ namespace TodoAPI2.Controllers
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
model.round_text = _repository.GetDisplayText(model.round_id);
string url = $"{mainurl}{reportsite}/rep_summary_a01.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
if (model.filetype == "xlsx")
@@ -121,7 +121,5 @@ namespace TodoAPI2.Controllers
return StatusCode(500, $"{ex.Message}");
}
}
}
}

View File

@@ -16,7 +16,7 @@ namespace TodoAPI2.Models
rep_summary_a01WithSelectionViewModel GetWithSelection(Guid id);
rep_summary_a01WithSelectionViewModel GetBlankItem();
string GetDisplayText(int? round_id);
}
}

View File

@@ -21,7 +21,7 @@ namespace TodoAPI2.Models
public int? round_id { get; set; }
public int? employee_id { get; set; }
public string round_text { get; set; }
}
}

View File

@@ -51,6 +51,31 @@ namespace TodoAPI2.Models
return i;
}
public string GetDisplayText(int? round_id)
{
var postponement = (from i in _repository.Context.eva_adjust_postponement
where i.id == round_id
select i).FirstOrDefault();
if(postponement != null)
{
var plan = (from i in _repository.Context.eva_performance_plan
where i.fiscal_year == postponement.fiscal_year
&& i.theTime == postponement.theRound
select i).FirstOrDefault();
if(plan != null)
{
var start = (from i in _repository.Context.eva_performance_plan_detail
where i.performance_plan_id == plan.id
select i.start_date).Min();
var end = (from i in _repository.Context.eva_performance_plan_detail
where i.performance_plan_id == plan.id
select i.end_date).Max();
return $"รอบที่ {postponement.theRound} ปี {postponement.fiscal_year} ({MyHelper.GetDateStringForReport(start)} - {MyHelper.GetDateStringForReport(end)})";
}
}
return null;
}
}
}

View File

@@ -33,7 +33,7 @@
<div class="form-group col-md-3">
<label id='lab_s_rep_summary_a01_round_id' for='s_rep_summary_a01_round_id'>รอบการประเมิน</label>
<select class="form-control" id="s_rep_summary_a01_round_id" iLabel="รอบการประเมิน" iRequire="false" iGroup="s_rep_summary_a01" title='รอบการประเมิน' placeholder='รอบการประเมิน'></select>
<select class="form-control" id="s_rep_summary_a01_round_id" iLabel="รอบการประเมิน" iRequire="true" iGroup="s_rep_summary_a01" title='รอบการประเมิน' placeholder='รอบการประเมิน'></select>
</div>
<div class="form-group col-md-3">