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()
