> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solya.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Budgets (Open-To-Buy)

> Define spending envelopes per period and scope, and let rules keep plans within budget.

A **budget envelope** is an Open-To-Buy (OTB) spending limit for a period. Rules check
restock and pre-season plans against **live consumption** so you don't overspend.

## Scope

An envelope is scoped to one of:

| Scope          | Applies to                                              |
| -------------- | ------------------------------------------------------- |
| **Total**      | The whole organization for the period (no scope value). |
| **Brand**      | A specific brand.                                       |
| **Department** | A product department (a taxonomy family).               |
| **Collection** | A collection (used for pre-season).                     |

## Consumption

Solya computes consumption live as the sum of open restock and pre-season plans matching
the envelope's period and scope, and reports the consumed percentage and remaining
amount. Budget rules use that signal — for example to **warn** as you approach the limit
or **block** beyond it.

```mermaid theme={null}
flowchart TD
  Define["Define budget envelope<br/>period + scope + amount"]
  OpenPlans["Open restock and<br/>pre-season plans"]
  MatchScope["Match envelope period<br/>and scope"]
  SumConsume["Sum consumption from<br/>matching plans"]
  CalcRemain["Calculate % consumed<br/>and remaining amount"]
  AttachRule["Attach OTB rule<br/>from ruleset"]
  EvalRule["Rule evaluates at<br/>add/validate time"]
  Decide{Consumption<br/>threshold<br/>crossed?}
  Warn["Warn: approaching<br/>or past limit"]
  Block["Block: beyond<br/>budget limit"]
  Proceed["Proceed:<br/>within budget"]
  
  Define --> OpenPlans
  OpenPlans --> MatchScope
  MatchScope --> SumConsume
  SumConsume --> CalcRemain
  CalcRemain --> AttachRule
  AttachRule --> EvalRule
  EvalRule --> Decide
  Decide -->|Yes, warn| Warn
  Decide -->|Yes, block| Block
  Decide -->|No| Proceed
```

## Working with budgets

<Steps>
  <Step title="Open budgets">
    Go to **Intelligence layer → Budgets**.
  </Step>

  <Step title="Create an envelope">
    Choose a period, a scope (total / brand / department / collection), and the amount.
  </Step>

  <Step title="Attach a rule">
    Add an OTB rule from a template (e.g. cap plan value for the scope, or warn at an
    OTB-consumed percentage) to the relevant ruleset.
  </Step>

  <Step title="Track it">
    The budget view shows consumption versus the envelope as plans are built.
  </Step>
</Steps>

<Note>
  If per-brand envelopes sum to more than the total envelope, Solya surfaces a warning so
  you can reconcile them.
</Note>
