fix: 合同管理未签合同统计修正
原查询查contractType=UNSIGNED的合同数(=0),但实际有12名员工完全无合同记录。
改为查contracts: { none: {} }的在职员工数,getHealthCheck和getComplianceScore均修复。
This commit is contained in:
@@ -1408,7 +1408,8 @@ export async function getComplianceScore(orgId: string) {
|
||||
lastMonthRisks,
|
||||
] = await Promise.all([
|
||||
prisma.employee.count({ where: { orgId, status: 'ACTIVE' } }),
|
||||
prisma.laborContract.count({ where: { orgId, contractType: 'UNSIGNED', employee: { status: 'ACTIVE' } } }),
|
||||
// 未签合同:完全无合同记录的在职员工
|
||||
prisma.employee.count({ where: { orgId, status: 'ACTIVE', contracts: { none: {} } } }),
|
||||
prisma.laborContract.count({
|
||||
where: {
|
||||
orgId,
|
||||
@@ -1583,7 +1584,8 @@ export async function getHealthCheck(orgId: string) {
|
||||
totalPayslips,
|
||||
] = await Promise.all([
|
||||
prisma.employee.count({ where: { orgId, status: 'ACTIVE' } }),
|
||||
prisma.laborContract.count({ where: { orgId, contractType: 'UNSIGNED', employee: { status: 'ACTIVE' } } }),
|
||||
// 未签合同:完全无合同记录的在职员工
|
||||
prisma.employee.count({ where: { orgId, status: 'ACTIVE', contracts: { none: {} } } }),
|
||||
prisma.laborContract.count({
|
||||
where: {
|
||||
orgId,
|
||||
|
||||
Reference in New Issue
Block a user