fix err
This commit is contained in:
parent
20ec8579e0
commit
b6fd61aad5
1 changed files with 27 additions and 5 deletions
|
|
@ -53,15 +53,37 @@ export class ReportController extends Controller {
|
|||
|
||||
//KPI1, KPI2, KPI3, KPI7, KPI9
|
||||
let data: any;
|
||||
let dataKpiUserEvaluations: any
|
||||
let period1: any;
|
||||
let period2: any;
|
||||
|
||||
if (requestBody.root && requestBody.periodId) {
|
||||
data = await this.kpiPeriodRepository.createQueryBuilder("period")
|
||||
.leftJoinAndSelect("period.kpiUserEvaluations", "kpiUserEvaluations")
|
||||
.where("period.id = :periodId", { periodId: requestBody.periodId })
|
||||
.andWhere("kpiUserEvaluations.orgId = :orgId", { orgId: requestBody.root })
|
||||
.getOne();
|
||||
// data = await this.kpiPeriodRepository.createQueryBuilder("period")
|
||||
// .leftJoinAndSelect("period.kpiUserEvaluations", "kpiUserEvaluations")
|
||||
// .where("period.id = :periodId", { periodId: requestBody.periodId })
|
||||
// .andWhere("kpiUserEvaluations.orgId = :orgId", { orgId: requestBody.root })
|
||||
// .getOne();
|
||||
|
||||
// if(data == null || data == undefined){
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการ ของหน่วยงานที่เลือก`);
|
||||
// }
|
||||
data = await this.kpiPeriodRepository.findOne({
|
||||
where: { id: requestBody.periodId }
|
||||
})
|
||||
dataKpiUserEvaluations = await this.kpiUserEvaluationRepository.find({
|
||||
where: {
|
||||
kpiPeriodId: String(requestBody.periodId),
|
||||
orgId: requestBody.root
|
||||
}
|
||||
})
|
||||
data = {
|
||||
id: data.id,
|
||||
year: data.year,
|
||||
durationKPI: data.durationKPI,
|
||||
startDate: data.startDate,
|
||||
endDate: data.endDate,
|
||||
kpiUserEvaluations: dataKpiUserEvaluations
|
||||
}
|
||||
|
||||
if(data.durationKPI == "APR") {
|
||||
period1 = `${Extension.ToThaiFullDate2(data.startDate)} ถึง ${Extension.ToThaiFullDate2(data.endDate)}`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue