1"""Template: six functions of a dollar factor table."""23from __future__ import annotations45from typing import Any678def build(p: dict[str, Any]) -> dict[str, Any]:9 rate = float(p.get("taux", 0.06))10 n_max = int(p.get("periodes_max", 30))11 inputs = [{"cell": "B4", "label": "Taux périodique i", "value": rate, "format": "percent",12 "name": "Taux_i"}]13 rows = []14 for n in range(1, n_max + 1):15 r = 7 + n16 rows.append([n, f"=(1+$B$4)^A{r}", f"=((1+$B$4)^A{r}-1)/$B$4", f"=$B$4/((1+$B$4)^A{r}-1)",17 f"=(1+$B$4)^-A{r}", f"=(1-(1+$B$4)^-A{r})/$B$4", f"=$B$4/(1-(1+$B$4)^-A{r})"])18 table = {19 "anchor": "A7",20 "columns": [{"header": "n", "type": "integer"},21 {"header": "VF de 1 $", "type": "factor"},22 {"header": "VF annuité de 1 $", "type": "factor"},23 {"header": "Fonds d'amortissement", "type": "factor"},24 {"header": "VA de 1 $", "type": "factor"},25 {"header": "VA annuité de 1 $", "type": "factor"},26 {"header": "Recouvrement du capital", "type": "factor"}],27 "rows": rows,28 }29 return {30 "filename": p.get("filename", "six_fonctions_du_dollar.xlsx"),31 "style": "uqo",32 "sheets": [{33 "name": "Six fonctions",34 "title": "Les six fonctions du dollar — table de facteurs",35 "inputs": inputs,36 "tables": [table],37 "notes": ["Colonnes 1-3 : capitalisation ; colonnes 4-6 : actualisation (réciproques).",38 "FRC = FA + i ; VA annuité = 1 / FRC."],39 }],40 }41