fix: 后端统一非劳动合同类型不缴社保公积金
- payroll.service.ts: isNoSocialContract 补充 PARTTIME/OUTSOURCING/UNSIGNED - payroll.routes.ts tax-preview: 增加 contract 类型判断,非劳动合同 socialBase/housingBase 强制 0 - roster.routes.ts: 之前已修复
This commit is contained in:
@@ -584,7 +584,7 @@ router.post('/tax-preview', async (req: AuthRequest, res: Response, next: NextFu
|
||||
|
||||
// 获取员工和配置
|
||||
const [employee, socialConfig, housingConfig] = await Promise.all([
|
||||
employeeId ? prisma.employee.findFirst({ where: { id: employeeId, orgId } }) : null,
|
||||
employeeId ? prisma.employee.findFirst({ where: { id: employeeId, orgId }, include: { contracts: { orderBy: { createdAt: 'desc' }, take: 1 } } }) : null,
|
||||
prisma.socialInsuranceConfig.findFirst({
|
||||
where: { orgId, effectiveFrom: { lte: month }, OR: [{ effectiveTo: null }, { effectiveTo: { gte: month } }] },
|
||||
orderBy: { effectiveFrom: 'desc' },
|
||||
@@ -595,9 +595,12 @@ router.post('/tax-preview', async (req: AuthRequest, res: Response, next: NextFu
|
||||
}),
|
||||
])
|
||||
|
||||
const emp = employee || { socialInsBase: baseSalary, housingFundBase: baseSalary }
|
||||
const socialBase = emp.socialInsBase != null ? emp.socialInsBase : baseSalary
|
||||
const housingBase = emp.housingFundBase != null ? emp.housingFundBase : baseSalary
|
||||
const emp = employee || { socialInsBase: baseSalary, housingFundBase: baseSalary } as any
|
||||
// 非劳动合同类型不缴纳社保公积金
|
||||
const contractType = (employee as any)?.contracts?.[0]?.contractType
|
||||
const isNoSocialContract = contractType && ['LABOR', 'INTERNSHIP', 'PARTTIME', 'OUTSOURCING', 'UNSIGNED'].includes(contractType)
|
||||
const socialBase = isNoSocialContract ? 0 : (emp.socialInsBase != null ? emp.socialInsBase : baseSalary)
|
||||
const housingBase = isNoSocialContract ? 0 : (emp.housingFundBase != null ? emp.housingFundBase : baseSalary)
|
||||
|
||||
// 计算社保公积金
|
||||
let socialEmp = 0, housingEmp = 0
|
||||
|
||||
@@ -214,7 +214,7 @@ export async function calcBatchEntry(
|
||||
|
||||
// 劳务协议/实习协议人员:不缴纳社保公积金,基数强制 0
|
||||
const latestContract = employee.contracts[0]
|
||||
const isNoSocialContract = latestContract && ['LABOR', 'INTERNSHIP'].includes(latestContract.contractType)
|
||||
const isNoSocialContract = latestContract && ['LABOR', 'INTERNSHIP', 'PARTTIME', 'OUTSOURCING', 'UNSIGNED'].includes(latestContract.contractType)
|
||||
|
||||
// 通过员工账户查年度标准(新逻辑),回退到旧配置(兼容)
|
||||
const { socialAccount, housingAccount } = await getEmployeeAccounts(orgId, employeeId)
|
||||
|
||||
Reference in New Issue
Block a user