Merge branch 'develop' into adiDev
This commit is contained in:
commit
f79704c7a7
1 changed files with 22 additions and 12 deletions
|
|
@ -178,25 +178,35 @@ export class SalaryPeriodController extends Controller {
|
||||||
@Query("keyword") keyword?: string,
|
@Query("keyword") keyword?: string,
|
||||||
@Query("year") year: number = 2024,
|
@Query("year") year: number = 2024,
|
||||||
) {
|
) {
|
||||||
const startOfYear = new Date(year, 0, 1);
|
|
||||||
const endOfYear = new Date(year, 11, 31);
|
let salaryPeriod: any
|
||||||
const [salaryPeriod, total] = await this.salaryPeriodRepository.findAndCount({
|
let total: any
|
||||||
skip: (page - 1) * pageSize,
|
if(year != 0){
|
||||||
take: pageSize,
|
const startOfYear = new Date(year, 0, 1);
|
||||||
where: {
|
const endOfYear = new Date(year, 11, 31);
|
||||||
effectiveDate: Between(startOfYear, endOfYear)
|
[salaryPeriod, total] = await this.salaryPeriodRepository.findAndCount({
|
||||||
}
|
skip: (page - 1) * pageSize,
|
||||||
});
|
take: pageSize,
|
||||||
|
where: {
|
||||||
|
effectiveDate: Between(startOfYear, endOfYear)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
[salaryPeriod, total] = await this.salaryPeriodRepository.findAndCount({
|
||||||
|
skip: (page - 1) * pageSize,
|
||||||
|
take: pageSize,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (keyword != undefined && keyword !== "") {
|
if (keyword != undefined && keyword !== "") {
|
||||||
const filteredSalaryPeriod = salaryPeriod.filter(
|
const filteredSalaryPeriod = salaryPeriod.filter(
|
||||||
(x) =>
|
(x:any) =>
|
||||||
x.period.toString().includes(keyword) ||
|
x.period.toString().includes(keyword) ||
|
||||||
x.isActive.toString().includes(keyword) ||
|
x.isActive.toString().includes(keyword) ||
|
||||||
x.effectiveDate.getFullYear().toString().includes(keyword)
|
x.effectiveDate.getFullYear().toString().includes(keyword)
|
||||||
);
|
);
|
||||||
|
|
||||||
const formattedData = filteredSalaryPeriod.map((item) => ({
|
const formattedData = filteredSalaryPeriod.map((item:any) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
period: item.period,
|
period: item.period,
|
||||||
isActive: item.isActive,
|
isActive: item.isActive,
|
||||||
|
|
@ -210,7 +220,7 @@ export class SalaryPeriodController extends Controller {
|
||||||
return new HttpSuccess([]);
|
return new HttpSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const formattedData = salaryPeriod.map((item) => ({
|
const formattedData = salaryPeriod.map((item:any) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
period: item.period,
|
period: item.period,
|
||||||
isActive: item.isActive,
|
isActive: item.isActive,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue