Skip to content

Budgets

The Budgets view (/ui/?vista=presupuestos) answers a question the board did not: how much money has each role spent and how much does it have left? It updates itself, like the rest of the application: there is no refresh button.

Four figures at the top —allocated per month, spent, left and unmeasurable— and two tables.

Per role. One row per role with the model it uses, a bar with the percentage consumed, the allocated amount, what is left and the month’s tokens. The colour of the bar says the same as the status column: comfortable, tight (from 80 %), exhausted. The Limits button opens the editor.

Providers. How each one charges, its fee, the tokens the plan includes, which roles hang from it and what is still missing to be declared. A monthly fee with no amount makes it impossible to calculate anything, so the «Missing» column says «the monthly fee» and the row is flagged in amber.

The Limits dialogue changes four things on the role:

Field What it does
Budget per month (€) The role’s euro cap. Empty or 0 = no euro cap
Monthly token cap Safety net when there is no rate to measure with
Input rate (€/million) The role’s own price; it overrides the model’s
Output rate (€/million) Same for output tokens

Changes apply to the current month. The counter of what has already been spent is not reset.

«No rate» is not zero. A role whose model’s price is unknown shows as no rate, never as €0. A zero would say it spends nothing, and the owner would stop looking.

What cannot be measured is counted separately. The unmeasurable figure is the number of roles whose spend cannot be calculated. If one of them also has a euro cap, a highlighted warning appears: it promises a brake the system cannot check. It is fixed by putting a price on the model, or the fee and included tokens on the provider, under Models.

The role’s rate overrides how the provider charges. A role on a monthly-fee provider can carry its own price per million if the owner wants to measure it that way; the fee does not override it.

Everything is calculated in app/organtia/presupuestos.py from what was already measured: the role’s budget, the rate (precios_de_puesto), the real consumption of the shifts (consumo_puesto) and the provider’s record. The view does no arithmetic: it paints what arrives from GET /oficina/presupuestos.json.

Hours and shifts come from organtia.turnos, which is written when a shift genuinely finishes, not when it is launched.