[insight] Projects: budget lines, payments in projects, tasks, phases, time and invoices; v0.7.0 #9

Manually merged
mnovak merged 2 commits from feature/projects into main 2026-11-11 21:08:08 +01:00
Owner

Projects for Fiscus Domi: planning and tracking a renovation or a trip (simple), or a side business or client work (business). Design: docs/06_projects.md. Version 0.7.0.

What changes

  • fiscus-ledger::project adds these events, with their checks in State::apply:

    • project.created, project.changed, project.status_set;
    • budget lines (project.line_set) and phases (project.phase_set / project.phase_removed);
    • payments put into a project (payment.projected / payment.unprojected) and a merchant rule while the project is open and within its dates (project.rule_set);
    • tasks (task.created / task.changed / task.status_set);
    • time (time.logged / time.removed);
    • invoices for a project with the time they bill (invoice.projected).

    State::project_of(payment) tells which project a payment is in: put there by hand, or by a rule.

  • fiscus-insight::projects, for each project:

    • planned, spent by line, unplanned;
    • income (paid invoices without VAT plus money in put into the project; a statement line that paid a project invoice counts once), profit and margin;
    • progress (by estimates when every task has one, else by count), the forecast (spent + open estimates), over budget, late;
    • time: minutes, billable and unbilled, by task and by Monday-started week.
  • fiscus-insight::rewards: Project on budget and Finished on time for a done project.

Self-review

  • Money: integer haléře only. Time is minutes × a per-hour rate in i128, rounded half up to the haléř once per entry, and every sum saturates. The no-float scan passes.
  • Nothing counted twice: a project is a second label, so a payment stays in its budget and its month. Income never counts both an invoice and the statement line that paid it.
  • Hostile input:
    • serde refuses unknown kinds and statuses, fields a task does not have, negative minutes and float rates;
    • every refusal is a typed reason that changes no project, as the tests check;
    • limits: 50 open projects, 100 lines, 50 phases, 200 open tasks, 24 h a day of time, an invoice billing an entry once, invoiced time not removable.
  • Sharing boundary unchanged: projects live in the personal log, and share.rs is not touched.
  • Limits I accept:
    • a hand-marked paid invoice's money in, if also put into the project, would count twice; the app keeps that payment out of the project and says so;
    • a project rule applies to the payments within the project's dates, not from the moment the rule was set.

Tests

  • fiscus-ledger/tests/projects.rs (7): a project, its lines, tasks and payments; checks when made and changed; lines, phases and tasks; payments into an open project once; time business-only, never over a day, invoiced once; weeks and rounding; hostile JSON.
  • fiscus-insight/tests/projects.rs (4): spent by line by hand and by rule within the dates; the forecast and progress by estimates; business income without VAT and never twice, profit, margin, time by week and task, billed and unbilled; late past the end, and the two medals.
  • cargo test --workspace: 140 passed. cargo clippy --workspace --all-targets: clean.
Projects for Fiscus Domi: planning and tracking a renovation or a trip (simple), or a side business or client work (business). Design: `docs/06_projects.md`. Version **0.7.0**. ## What changes - **`fiscus-ledger::project`** adds these events, with their checks in `State::apply`: - `project.created`, `project.changed`, `project.status_set`; - budget lines (`project.line_set`) and phases (`project.phase_set` / `project.phase_removed`); - payments put into a project (`payment.projected` / `payment.unprojected`) and a merchant rule while the project is open and within its dates (`project.rule_set`); - tasks (`task.created` / `task.changed` / `task.status_set`); - time (`time.logged` / `time.removed`); - invoices for a project with the time they bill (`invoice.projected`). `State::project_of(payment)` tells which project a payment is in: put there by hand, or by a rule. - **`fiscus-insight::projects`**, for each project: - planned, spent by line, unplanned; - income (paid invoices without VAT plus money in put into the project; a statement line that paid a project invoice counts once), profit and margin; - progress (by estimates when every task has one, else by count), the forecast (spent + open estimates), over budget, late; - time: minutes, billable and unbilled, by task and by Monday-started week. - **`fiscus-insight::rewards`**: *Project on budget* and *Finished on time* for a done project. ## Self-review - **Money:** integer haléře only. Time is minutes × a per-hour rate in i128, rounded half up to the haléř once per entry, and every sum saturates. The no-float scan passes. - **Nothing counted twice:** a project is a second label, so a payment stays in its budget and its month. Income never counts both an invoice and the statement line that paid it. - **Hostile input:** - serde refuses unknown kinds and statuses, fields a task does not have, negative minutes and float rates; - every refusal is a typed reason that changes no project, as the tests check; - limits: 50 open projects, 100 lines, 50 phases, 200 open tasks, 24 h a day of time, an invoice billing an entry once, invoiced time not removable. - **Sharing boundary unchanged:** projects live in the personal log, and `share.rs` is not touched. - **Limits I accept:** - a hand-marked paid invoice's money in, if also put into the project, would count twice; the app keeps that payment out of the project and says so; - a project rule applies to the payments within the project's dates, not from the moment the rule was set. ## Tests - `fiscus-ledger/tests/projects.rs` (7): a project, its lines, tasks and payments; checks when made and changed; lines, phases and tasks; payments into an open project once; time business-only, never over a day, invoiced once; weeks and rounding; hostile JSON. - `fiscus-insight/tests/projects.rs` (4): spent by line by hand and by rule within the dates; the forecast and progress by estimates; business income without VAT and never twice, profit, margin, time by week and task, billed and unbilled; late past the end, and the two medals. - `cargo test --workspace`: 140 passed. `cargo clippy --workspace --all-targets`: clean.
mnovak added 2 commits 2026-11-11 21:07:58 +01:00
mnovak manually merged commit a3a50615bb into main 2026-11-11 21:08:08 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mnovak/FiscusPublic#9