Cronjob SalaryPeriod
This commit is contained in:
parent
b93fb6c1e5
commit
382866d1cd
2 changed files with 56 additions and 1 deletions
|
|
@ -872,4 +872,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