fix: 员工端首页应发合计显示为0
后端返回字段是 totalPay,前端误用 grossPay(不存在的字段), 导致应发合计始终显示 0。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
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()
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import prisma from '../src/lib/prisma'
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const payslips = await prisma.$queryRaw<any[]>`
|
||||||
|
SELECT month, status, "publishStatus", count(*)::int as cnt
|
||||||
|
FROM "Payslip" WHERE month='2026-08'
|
||||||
|
GROUP BY month, status, "publishStatus"
|
||||||
|
`
|
||||||
|
console.log('Payslip 2026-08:', JSON.stringify(payslips, null, 2))
|
||||||
|
|
||||||
|
const batches = await prisma.$queryRaw<any[]>`
|
||||||
|
SELECT id, name, month, status, "batchNo"::text as bn
|
||||||
|
FROM "PayrollBatch" WHERE month='2026-08' ORDER BY "batchNo"
|
||||||
|
`
|
||||||
|
console.log('Batches 2026-08:', JSON.stringify(batches, null, 2))
|
||||||
|
|
||||||
|
const totalPayslips = await prisma.$queryRaw<any[]>`
|
||||||
|
SELECT count(*)::int as cnt FROM "Payslip" WHERE month='2026-08'
|
||||||
|
`
|
||||||
|
console.log('Total payslips 2026-08:', JSON.stringify(totalPayslips))
|
||||||
|
|
||||||
|
await prisma.$disconnect()
|
||||||
|
}
|
||||||
|
main()
|
||||||
@@ -124,7 +124,7 @@ export default function EmployeeHome() {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className="text-xs text-gray-400">应发合计</div>
|
<div className="text-xs text-gray-400">应发合计</div>
|
||||||
<div className="font-medium">¥{fmt(latestPayslip.grossPay)}</div>
|
<div className="font-medium">¥{fmt(latestPayslip.totalPay)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className="text-xs text-gray-400">实发合计</div>
|
<div className="text-xs text-gray-400">实发合计</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user