# Projects (F4) in IMS2 — business logic for the user

Projects are the mirror opposite of Orders: here **we ourselves** want to
manufacture/assemble a certain quantity of products, and we track how much
has already been made, plus see in advance which components will fall
short.

---

## 1. Structure

- **Project** (header) — period (a start and end date), comment. Unlike
  Orders, there's no "customer" here — a project is internal.
- **Line** — a product (an item with a recipe/BOM, see Tools → Products),
  with fields:
  - **Target** — how much needs to be made.
  - **Made** — how much has already been made, accumulates as
    manufacture happens. Starts at 0.

A line can technically be added without a recipe — but then the system
can't compute which components are short (see §3), and such a line is
flagged with a warning ("⚠ N without BOM") in the list.

---

## 2. How manufacturing happens

Same as Orders — the Projects screen itself makes nothing, it's just a
list of "what's needed". Actual manufacturing happens through the Workshop
form (the "Project" button): pick an open project line, enter the
quantity made, the document is processed as manufacture (consumes
components per the recipe, receives the finished product).

When the document is processed:
- the made quantity is added to the line's made total;
- when the made total equals the target — the line closes automatically;
- when all lines are closed — the project closes automatically.

Rolling back the manufacture document works in reverse: the made quantity
goes back down, and a line (and the project) closed by it reopens.

## 3. The "Components" tab — what's short for assembly

A separate tab inside a project computes **on the fly** (stores nothing)
how much of each component is needed to make everything still remaining
across all open lines:

1. Takes each product's recipe (BOM) from Products/BOM.
2. Multiplies by the line's **remaining** quantity (target minus already
   made).
3. Sums across all project lines — one component can be part of several
   different products at once, shown as a single row with the combined
   requirement.
4. Compares against current stock on hand — the **Deficit** column shows
   directly what and how much is short.

This is "what needs to be bought" reconnaissance, not a document and not a
reservation — refreshed with the **Refresh** button, doesn't process or
lock anything.

**Example.** A birthday party project: the target is 40 servings of Pizza
Margherita. Each serving's BOM: 1 unit dough, 0.2 unit tomato sauce, 0.3
unit mozzarella cheese, 0.02 unit fresh basil. With 0 made so far and
current stock of 50 dough / 10 sauce / 5 cheese / 0.3 basil, the
Components tab computes the requirement for all 40 remaining servings (40
dough, 8 sauce, 12 cheese, 0.8 basil) and shows the Deficit against stock:
dough 0 (covered by 50 on hand), sauce 0 (covered by 10), cheese 7 short
(need 12, have 5), basil 0.5 short (need 0.8, have 0.3). This tells the
buyer exactly what to order before the party, without reserving anything
or blocking the project.

---

## 4. Manual close

The **Close Project** button forcibly closes a project even if something
isn't finished (same as Close Order in Orders).

---

## 5. Editing restrictions

Same rules as Orders: the target can't be reduced below what's already
made, a line with an already-made quantity can't be deleted, a project
with at least one non-empty line can't be deleted.

---

## 6. Notifications

Same as Orders — closing a line/project is visible in the general log
(Tools → Events → Events), but **does not pop up** on the main-screen
panel (that panel only shows stock shortages).

## 7. Report

**Project Cost Report** — a separate button inside a project, cost based
on what was actually made (not on the target) — separate from the general
reports system, called directly.
