# Expenses

**Two concepts — that's it.**

PropertySage has exactly two cost concepts:

| Concept | What it is | When to use it |
|---|---|---|
| **Expense** | Every cost record — one-off or recurring. One page, filterable by *One-off* / *Recurring*. Recurring records show a period, may carry a vendor, and get an "auto" badge when generated from a template. | Any cost associated with a property. |
| **Automatic expense** | A set-once template (property, amount, frequency) that **spawns an expense record every period** — you never re-enter it. Two amount modes: **fixed** (constant amount) and **variable** (amount changes each period — e.g. electricity). | Recurring costs you want the system to generate for you. |

The old "Running Expense" and "Fixed Expense" terms are gone: a running expense was just a recurring expense, and a fixed expense was an automatic-expense template.

**Which one should I use?**
- Cost happens once → **Expense** (One-off).
- Cost repeats and you want to generate it automatically → **Automatic expense** — set it once, the system creates an entry each period (usually overnight). Generated entries appear on the Expenses page under the **Recurring** tab with an "auto" badge, where you mark them Paid and attach receipts.
- Cost repeats but you prefer to enter each period by hand → **Expense** (Recurring toggle) — you create a new record each period yourself.

---

What is an Expense?
An Expense records a cost associated with a property. This could be a one-off repair bill, a service fee, or a recurring cost (water, electricity, insurance). Each expense is linked to a property, categorized by expense type, can carry a vendor and a period (for recurring entries), and can have receipt files attached as proof of payment. For costs that repeat automatically, use Automatic Expenses.

How do I create an expense?
Navigate to the Expenses page and click "Add Expense." Select the property, choose a category, enter the amount, pick the currency, set the date, and select a status (typically "Pending" if not yet paid or "Paid" if settled). To record a recurring cost by hand, switch on the "Recurring expense" toggle and optionally add a vendor and a period (e.g. "2026-08"). You can add notes, a reference number, and attach receipt files — PDFs, Word documents, or images.

How do I view an expense's full details?
Click anywhere on an expense row — or open the row's ⋮ menu and choose **View** — to open a read-only detail page at `/expenses/:id`. It shows the complete record: amount and currency, status, source type (one-off, recurring, or service account), date, every linked property, category, vendor, period, due date, invoice number, reference, account reference, meter, the template that generated it, notes, and all attached receipts. Click a receipt to download it. If you have permission, an **Edit** button takes you straight to the edit screen. In the mobile app, tap an expense card to see the same view.

How do receipt attachments work for expenses?
When you add a receipt, the file is encoded and sent to the server, which saves it to the filesystem under `./files/receipts/`. Only the file path is stored in the database. When you view the expense later, the receipt is loaded from disk and displayed in the browser. You can download any attached receipt by clicking on it. Accepted file types are PDF, DOC, DOCX, JPG, JPEG, and PNG.

Can I edit or delete an expense that has already been paid?
No. Once an expense's status is changed to "Paid," it becomes locked. Neither the update nor the delete option is available — both in the UI and enforced by the API. This protects your financial records from accidental changes.

How do I edit an expense?
Click the pencil icon on any row in the Expenses table. An inline dialog opens allowing you to change the status and manage receipts. Only the user who created the expense or a Company Admin can edit it.

How do I delete an expense?
Only users with admin-level roles (Company Admin and above) can delete an expense. Deletion is a hard delete — the record is permanently removed, and any attached receipt files are also deleted. You cannot delete an expense whose status is "Paid."

What are the tabs on the Expenses page?
The page has three tabs: **All** (everything), **One-off** (non-recurring expenses), and **Recurring** (expenses with `recurring: true`). Auto-generated entries (from Automatic Expenses) carry a small "auto" badge and their expand row shows the template that produced them.

Who can see which expenses?
Access is scoped by role: Company Admins see everything in their company; Users (property managers) only see expenses for properties they manage.

What filters are available on the Expenses page?
You can filter by property, category, currency, status, amount range, and expense date range. A search box provides client-side filtering, and the Recent/Historical toggle switches between the last 30 days and all time.

Can I export expenses to CSV?
Yes. Click the "CSV" button on the Expenses page to download all currently displayed expenses as a CSV file. The export respects any active filters you have applied.

What date formats does the expense CSV import accept?
The import accepts YYYY-MM-DD (recommended), YYYY/MM/DD, YYYYMMDD, DD/MM/YYYY, DD.MM.YYYY, DD-MM-YYYY, two-digit years (DD.MM.YY), month names (22 Mar 2025, 22-Mar-2025, March 22 2025), and dates followed by a time (the time is ignored). For ambiguous numeric dates such as 05/01/2025 the day comes first (5 January). A month-first date like 03/22/2025 is only accepted when the day is above 12. Download the template from the import page to see an example of each format.
