6919f997c6
后端返回字段是 totalPay,前端误用 grossPay(不存在的字段), 导致应发合计始终显示 0。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import prisma from '../src/lib/prisma'
|
|
|
|
async function main() {
|
|
// 查看已发布的7条工资条明细
|
|
const published = await prisma.$queryRaw<any[]>`
|
|
SELECT p."employeeId", e.name, e.department,
|
|
p."baseSalary", p."overtimePay", p.allowance, p.deduction, p.bonus,
|
|
p."totalPay", p."socialEmp", p."housingEmp", p.tax, p."netPay",
|
|
p."publishStatus", p.status, p.month
|
|
FROM "Payslip" p
|
|
JOIN "Employee" e ON p."employeeId" = e.id
|
|
WHERE p.month='2026-08' AND p."publishStatus" = 'PUBLISHED'
|
|
ORDER BY e.name
|
|
`
|
|
console.log('=== 已发布工资条(7条)===')
|
|
for (const p of published) {
|
|
console.log(`${p.name} | ${p.department} | base=${p.baseSalary} total=${p.totalPay} net=${p.netPay} social=${p.socialEmp} housing=${p.housingEmp} tax=${p.tax}`)
|
|
}
|
|
|
|
// 查看未发布的23条
|
|
const unpublished = await prisma.$queryRaw<any[]>`
|
|
SELECT e.name, e.department,
|
|
p."totalPay", p."netPay", p."publishStatus"
|
|
FROM "Payslip" p
|
|
JOIN "Employee" e ON p."employeeId" = e.id
|
|
WHERE p.month='2026-08' AND p."publishStatus" IS NULL
|
|
ORDER BY e.name
|
|
`
|
|
console.log('\n=== 未发布工资条(23条)===')
|
|
for (const p of unpublished) {
|
|
console.log(`${p.name} | ${p.department} | total=${p.totalPay} net=${p.netPay}`)
|
|
}
|
|
|
|
await prisma.$disconnect()
|
|
}
|
|
main()
|