เพิ่มreport
This commit is contained in:
parent
76e2de989e
commit
e340b6d8a8
1 changed files with 82 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ import { CommandSendCC } from "../entities/CommandSendCC";
|
||||||
import { CommandSalary } from "../entities/CommandSalary";
|
import { CommandSalary } from "../entities/CommandSalary";
|
||||||
import { CommandRecive } from "../entities/CommandRecive";
|
import { CommandRecive } from "../entities/CommandRecive";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
|
import Extension from "../interfaces/extension";
|
||||||
|
|
||||||
@Route("api/v1/org/command")
|
@Route("api/v1/org/command")
|
||||||
@Tags("Command")
|
@Tags("Command")
|
||||||
|
|
@ -697,6 +698,9 @@ export class CommandController extends Controller {
|
||||||
if (!command) {
|
if (!command) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||||
}
|
}
|
||||||
|
await this.commandSendCCRepository.delete({ commandSend: { commandId: command.id } });
|
||||||
|
await this.commandReciveRepository.delete({ commandId: command.id });
|
||||||
|
await this.commandSendRepository.delete({ commandId: command.id });
|
||||||
await this.commandRepository.delete(command.id);
|
await this.commandRepository.delete(command.id);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
@ -838,4 +842,82 @@ export class CommandController extends Controller {
|
||||||
await this.commandRepository.save(command);
|
await this.commandRepository.save(command);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API รายละเอียดรายการคำสั่ง tab4 คำสั่ง
|
||||||
|
*
|
||||||
|
* @summary API รายละเอียดรายการคำสั่ง tab4 คำสั่ง
|
||||||
|
*
|
||||||
|
* @param {string} id Id คำสั่ง
|
||||||
|
*/
|
||||||
|
@Get("tab4/cover/{id}")
|
||||||
|
async GetByIdTab4Cover(@Path() id: string) {
|
||||||
|
const command = await this.commandRepository.findOne({
|
||||||
|
where: { id },
|
||||||
|
relations: ["commandType"],
|
||||||
|
});
|
||||||
|
if (!command) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
const _command = {
|
||||||
|
issue: "...................................",
|
||||||
|
commandNo: command.commandNo,
|
||||||
|
commandYear: command.commandYear,
|
||||||
|
commandTitle: command.issue,
|
||||||
|
detailHeader: command.detailHeader,
|
||||||
|
detailBody: command.detailBody,
|
||||||
|
detailFooter: command.detailFooter,
|
||||||
|
commandDate: Extension.ToThaiNumber(Extension.ToThaiFullDate2(command.commandAffectDate)),
|
||||||
|
commandExcecuteDate: Extension.ToThaiNumber(
|
||||||
|
Extension.ToThaiFullDate2(command.commandExcecuteDate),
|
||||||
|
),
|
||||||
|
name: "...................................",
|
||||||
|
position: "...................................",
|
||||||
|
};
|
||||||
|
return new HttpSuccess({
|
||||||
|
template: command.commandType.fileCover,
|
||||||
|
reportName: "docx-report",
|
||||||
|
data: { _command },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API รายละเอียดรายการคำสั่ง tab4 แนบท้าย
|
||||||
|
*
|
||||||
|
* @summary API รายละเอียดรายการคำสั่ง tab4 แนบท้าย
|
||||||
|
*
|
||||||
|
* @param {string} id Id คำสั่ง
|
||||||
|
*/
|
||||||
|
@Get("tab4/attachment/{id}")
|
||||||
|
async GetByIdTab4Attachment(@Path() id: string) {
|
||||||
|
const command = await this.commandRepository.findOne({
|
||||||
|
where: { id },
|
||||||
|
relations: ["commandType"],
|
||||||
|
});
|
||||||
|
if (!command) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
const _command = {
|
||||||
|
issue: "...................................",
|
||||||
|
commandNo: command.commandNo,
|
||||||
|
commandYear: command.commandYear,
|
||||||
|
commandTitle: command.issue,
|
||||||
|
detailHeader: command.detailHeader,
|
||||||
|
detailBody: command.detailBody,
|
||||||
|
detailFooter: command.detailFooter,
|
||||||
|
commandDate: Extension.ToThaiNumber(Extension.ToThaiFullDate2(command.commandAffectDate)),
|
||||||
|
commandExcecuteDate: Extension.ToThaiNumber(
|
||||||
|
Extension.ToThaiFullDate2(command.commandExcecuteDate),
|
||||||
|
),
|
||||||
|
name: "...................................",
|
||||||
|
position: "...................................",
|
||||||
|
};
|
||||||
|
return new HttpSuccess({
|
||||||
|
template: command.commandType.fileAttachment,
|
||||||
|
reportName: "xlsx-report",
|
||||||
|
data: { _command },
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue