search report leave
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m4s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m4s
This commit is contained in:
parent
6bfe89b5a3
commit
07d03f5134
1 changed files with 19 additions and 8 deletions
|
|
@ -6240,7 +6240,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
isRetirement?: boolean;
|
isRetirement?: boolean;
|
||||||
reqNode?: number;
|
reqNode?: number;
|
||||||
reqNodeId?: string;
|
reqNodeId?: string;
|
||||||
date?: Date;
|
date: Date;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
let typeCondition: any = {};
|
let typeCondition: any = {};
|
||||||
|
|
@ -6380,9 +6380,8 @@ export class OrganizationDotnetController extends Controller {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const date = body.date ? new Date(body.date) : new Date();
|
|
||||||
// set เวลาเป็น 23:59:59 ของวันนั้น
|
// set เวลาเป็น 23:59:59 ของวันนั้น
|
||||||
date.setHours(23, 59, 59, 999);
|
const date = body.date.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
let profile = await this.posMasterHistoryRepository.find({
|
let profile = await this.posMasterHistoryRepository.find({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -6810,7 +6809,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
isRetirement?: boolean;
|
isRetirement?: boolean;
|
||||||
reqNode?: number;
|
reqNode?: number;
|
||||||
reqNodeId?: string;
|
reqNodeId?: string;
|
||||||
date?: Date;
|
date: Date;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
let typeCondition: any = {};
|
let typeCondition: any = {};
|
||||||
|
|
@ -6950,9 +6949,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const date = body.date ? new Date(body.date) : new Date();
|
const date = body.date.setHours(23, 59, 59, 999);
|
||||||
// set เวลาเป็น 23:59:59 ของวันนั้น
|
|
||||||
date.setHours(23, 59, 59, 999);
|
|
||||||
|
|
||||||
let profile = await this.posMasterHistoryRepository.find({
|
let profile = await this.posMasterHistoryRepository.find({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -6996,9 +6993,23 @@ export class OrganizationDotnetController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// group3: group by firstName-lastName จากค่าที่ได้จาก group2
|
||||||
|
const grouped3 = new Map<string, PosMasterHistory>();
|
||||||
|
for (const item of Array.from(grouped2.values())) {
|
||||||
|
const key = `${item.firstName}-${item.lastName}`;
|
||||||
|
if (!grouped3.has(key)) {
|
||||||
|
grouped3.set(key, item);
|
||||||
|
} else {
|
||||||
|
// ถ้าเจอซ้ำ ให้เลือก createdAt ล่าสุด
|
||||||
|
const exist = grouped3.get(key);
|
||||||
|
if (exist && item.createdAt > exist.createdAt) {
|
||||||
|
grouped3.set(key, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const profile_ = await Promise.all(
|
const profile_ = await Promise.all(
|
||||||
Array.from(grouped2.values())
|
Array.from(grouped3.values())
|
||||||
.filter((x) => x.profileId != null)
|
.filter((x) => x.profileId != null)
|
||||||
.map(async (item: PosMasterHistory) => {
|
.map(async (item: PosMasterHistory) => {
|
||||||
let profile = await this.profileRepo.findOne({
|
let profile = await this.profileRepo.findOne({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue