diff --git a/src/pages/accounting/AccountingAssessmentsPage.tsx b/src/pages/accounting/AccountingAssessmentsPage.tsx index ddb9b5b..849569c 100644 --- a/src/pages/accounting/AccountingAssessmentsPage.tsx +++ b/src/pages/accounting/AccountingAssessmentsPage.tsx @@ -55,7 +55,7 @@ export default function AccountingAssessmentsPage() { queryKey: ["income-accounts", cid], enabled: !!cid, queryFn: async () => - (await accounting.from("accounts").select("id,name,code").eq("company_id", cid).eq("type", "income").order("code")).data ?? [], + (await accounting.from("accounts").select("id,name,code").eq("company_id", cid).eq("type", "income").eq("is_archived", false).order("code")).data ?? [], }); const allSelected = selectedHomeowners.size === (homeowners as any[]).length && (homeowners as any[]).length > 0; diff --git a/src/pages/accounting/AccountingBillsPage.tsx b/src/pages/accounting/AccountingBillsPage.tsx index 936037e..c5285ec 100644 --- a/src/pages/accounting/AccountingBillsPage.tsx +++ b/src/pages/accounting/AccountingBillsPage.tsx @@ -89,7 +89,7 @@ export default function AccountingBillsPage() { queryKey: ["expense-accounts", cid], enabled: !!cid, queryFn: async () => - (await accounting.from("accounts").select("id,name,code,type").eq("company_id", cid).eq("type", "expense").order("code")).data ?? [], + (await accounting.from("accounts").select("id,name,code,type").eq("company_id", cid).eq("type", "expense").eq("is_archived", false).order("code")).data ?? [], }); const enriched = useMemo( @@ -320,7 +320,9 @@ export default function AccountingBillsPage() { queryKey: ["bank-accounts", cid], enabled: !!cid, queryFn: async () => - (await accounting.from("accounts").select("id,name,code,balance,is_bank").eq("company_id", cid).eq("is_bank", true).order("code")).data ?? [], + // Payment accounts: banks plus equity accounts (e.g. reserve components + // paid directly from equity). Archived accounts never appear. + (await accounting.from("accounts").select("id,name,code,balance,is_bank,type").eq("company_id", cid).or("is_bank.eq.true,type.eq.equity").eq("is_archived", false).order("code")).data ?? [], }); const openPayment = async (b: any) => { @@ -404,7 +406,7 @@ export default function AccountingBillsPage() { }; const savePayment = async () => { - if (!payBill || !payAccountId) return toast.error("Bank account required"); + if (!payBill || !payAccountId) return toast.error("Payment account required"); if (!payAmount || payAmount <= 0) return toast.error("Invalid amount"); setPaying(true); try { @@ -810,7 +812,7 @@ export default function AccountingBillsPage() {
- +