mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 09:50:01 +00:00
Accounting Banking: allow cash deposits with no homeowner
The Banking-page deposit form required a homeowner, blocking general/cash deposits. Drop that requirement: a deposit still needs an income account, and post_transaction_gl already books Dr Bank / Cr income when no customer is set (vs. Dr Bank / Cr A/R with one). The Homeowner field is now optional with an explicit "No homeowner (general deposit)" choice. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -298,7 +298,8 @@ export default function AccountingBankingPage() {
|
|||||||
if (!amount || amount <= 0) return toast.error("Amount can't be zero");
|
if (!amount || amount <= 0) return toast.error("Amount can't be zero");
|
||||||
if (!coa_account_id) return toast.error(`${type === "credit" ? "Income" : "Expense"} account (COA) required`);
|
if (!coa_account_id) return toast.error(`${type === "credit" ? "Income" : "Expense"} account (COA) required`);
|
||||||
if (type === "debit" && !vendor_id) return toast.error("Vendor required for payments");
|
if (type === "debit" && !vendor_id) return toast.error("Vendor required for payments");
|
||||||
if (type === "credit" && !customer_id) return toast.error("Homeowner required for deposits");
|
// Homeowner is optional on a deposit: a cash/general deposit posts Dr Bank /
|
||||||
|
// Cr the chosen income account (no A/R). With a homeowner it clears A/R instead.
|
||||||
|
|
||||||
const coaName = (accounts as any[]).find((a) => a.id === coa_account_id)?.name ?? "";
|
const coaName = (accounts as any[]).find((a) => a.id === coa_account_id)?.name ?? "";
|
||||||
const vendorName = (vendors as any[]).find((v) => v.id === vendor_id)?.name ?? "";
|
const vendorName = (vendors as any[]).find((v) => v.id === vendor_id)?.name ?? "";
|
||||||
@@ -910,10 +911,11 @@ export default function AccountingBankingPage() {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<Label>Homeowner *</Label>
|
<Label>Homeowner <span className="text-muted-foreground text-xs">(optional — leave blank for a cash/general deposit)</span></Label>
|
||||||
<Select value={txForm.customer_id} onValueChange={(v) => setTxForm({ ...txForm, customer_id: v })}>
|
<Select value={txForm.customer_id || "__none"} onValueChange={(v) => setTxForm({ ...txForm, customer_id: v === "__none" ? "" : v })}>
|
||||||
<SelectTrigger><SelectValue placeholder="Select homeowner" /></SelectTrigger>
|
<SelectTrigger><SelectValue placeholder="No homeowner (general deposit)" /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
<SelectItem value="__none">No homeowner (general deposit)</SelectItem>
|
||||||
{(customers as any[]).map((c: any) => (
|
{(customers as any[]).map((c: any) => (
|
||||||
<SelectItem key={c.id} value={c.id}>{c.name}</SelectItem>
|
<SelectItem key={c.id} value={c.id}>{c.name}</SelectItem>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user