diff --git a/src/components/unit-profile/UnitLedgerAccountBreakdown.tsx b/src/components/unit-profile/UnitLedgerAccountBreakdown.tsx index d44b495..c9e9581 100644 --- a/src/components/unit-profile/UnitLedgerAccountBreakdown.tsx +++ b/src/components/unit-profile/UnitLedgerAccountBreakdown.tsx @@ -19,12 +19,14 @@ export default function UnitLedgerAccountBreakdown({ unitId }: Props) { if (!unitId) return; const fetchData = async () => { setLoading(true); - // Account breakdown reflects the active ledger only — exclude entries from archived owners. + // Account breakdown reflects the active ledger only — exclude entries from + // archived owners and archived (voided/duplicate) ledger entries. const { data } = await supabase .from("owner_ledger_entries") .select("id, transaction_type, description, debit, credit, date, created_at, owners!inner(status)") .eq("unit_id", unitId) .eq("owners.status", "active") + .not("is_archived", "is", true) .order("date", { ascending: true }) .order("created_at", { ascending: true }) .order("id", { ascending: true }); diff --git a/src/pages/CollectionsPage.tsx b/src/pages/CollectionsPage.tsx index 27aff0b..5c474b4 100644 --- a/src/pages/CollectionsPage.tsx +++ b/src/pages/CollectionsPage.tsx @@ -250,6 +250,7 @@ export default function CollectionsPage() { const { data, error } = await supabase .from("owner_ledger_entries") .select("owner_id, transaction_type, debit, credit, date") + .not("is_archived", "is", true) .range(from, from + pageSize - 1); if (error) throw error; if (!data || data.length === 0) break; diff --git a/src/pages/OutstandingBalancesPage.tsx b/src/pages/OutstandingBalancesPage.tsx index 886ab0c..24f1250 100644 --- a/src/pages/OutstandingBalancesPage.tsx +++ b/src/pages/OutstandingBalancesPage.tsx @@ -130,6 +130,7 @@ export default function OutstandingBalancesPage() { const { data, error } = await supabase .from("owner_ledger_entries") .select("owner_id, transaction_type, description, debit, credit, date") + .not("is_archived", "is", true) .range(from, from + pageSize - 1); if (error) throw error; all.push(...(data || []));