import { prisma } from "@/lib/prisma"; import { Plus, Search, Filter, ArrowUpRight, ArrowDownRight, Download, Calendar, Wallet, ArrowRightLeft } from "lucide-react"; import { Card } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { formatCurrency } from "@/lib/utils"; export default async function LedgerPage() { const transactions = await prisma.companyTransaction.findMany({ orderBy: { date: 'desc' }, include: { category: true, account: true } }); return (

Company Ledger

Full transaction history and cash flow tracking.

{[ { label: 'Total Inflow', amount: 452000, color: 'emerald', icon: ArrowUpRight }, { label: 'Total Outflow', amount: 128400, color: 'rose', icon: ArrowDownRight }, { label: 'Net Balance', amount: 323600, color: 'indigo', icon: Wallet }, ].map((stat, i) => (

{stat.label}

{formatCurrency(stat.amount.toString())}

))}
{transactions.map((tx) => ( ))}
Transaction Account Category Amount Date
{tx.type === 'DEBIT' ? : }

{tx.description}

TX-{tx.id.substring(0, 8).toUpperCase()}

{tx.account.name} {tx.category?.name || 'Uncategorized'} {tx.type === 'DEBIT' ? '-' : '+'}{formatCurrency(tx.amount.toString())}

{new Date(tx.date).toLocaleDateString()}

14:20 PM

{transactions.length === 0 && (

No Transactions Found

Start recording financial activities to see them here.

)}
); }