Merge branch 'develop' of github.com:Frappet/bma-ehr-salary into develop
This commit is contained in:
commit
4d24a34674
7 changed files with 76 additions and 21 deletions
|
|
@ -626,7 +626,7 @@ export class SalaryPeriodController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
if (!chk_SalaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
}
|
||||
|
||||
const chk_toUpper = ["SPECIAL", "APR", "OCT"];
|
||||
|
|
@ -670,7 +670,7 @@ export class SalaryPeriodController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
if (!SalaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
}
|
||||
const SalaryOrg = await this.salaryOrgRepository.findOne({
|
||||
where: { salaryPeriodId: SalaryPeriod.id },
|
||||
|
|
@ -705,7 +705,7 @@ export class SalaryPeriodController extends Controller {
|
|||
],
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
}
|
||||
return new HttpSuccess(salaryPeriod);
|
||||
}
|
||||
|
|
@ -876,4 +876,49 @@ export class SalaryPeriodController extends Controller {
|
|||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cronjob SalaryPeriod
|
||||
*/
|
||||
async CronjobSalaryPeriod() {
|
||||
const current = new Date();
|
||||
let salaryPeriod: any
|
||||
// console.log(current.getDate(), current.getMonth() , current.getFullYear())
|
||||
if(current.getDate() == 1 && current.getMonth() == 2){
|
||||
salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
year: current.getFullYear(),
|
||||
period: "MAR",
|
||||
isActive: true
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(current.getDate() == 1 && current.getMonth() == 3){
|
||||
salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
year: current.getFullYear(),
|
||||
period: "APR",
|
||||
isActive: true
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(current.getDate() == 1 && current.getMonth() == 8){
|
||||
salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
year: current.getFullYear(),
|
||||
period: "SEP",
|
||||
isActive: true
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(current.getDate() == 1 && current.getMonth() == 9){
|
||||
salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
year: current.getFullYear(),
|
||||
period: "OCT",
|
||||
isActive: true
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue