# Regional Store P&L block

> Store P&L grid with a geography tree, plan attainment bars and profit vs FY25 loss and gain cells

Retail P&L for 28 stores in 10 markets, flat or as a Global, country, sub-region and state tree with rolled-up totals and a depth control. Region filter cards, range popovers, 3-tab sheet, undo. ReUI DataGrid, Cascader; shadcn Sheet. Retail, FP&A.

- Type: Pro block
- Category: [Advanced](https://web.dev.reui.io/blocks/data-grid/advanced.md)
- Page: https://web.dev.reui.io/blocks/data-grid/advanced/data-grid-advanced-2
- Docs (Base UI): https://web.dev.reui.io/docs/components/base/data-grid.md
- Docs (Radix UI): https://web.dev.reui.io/docs/components/radix/data-grid.md
- MCP: `get_block("data-grid-advanced-2")`
- Built with: Alert, Alert Dialog, Avatar, Badge, Button, Button Group, Calendar, Cascader, Chart, Collapsible, Data Grid, Dropdown Menu, Empty, Field, Frame, Icon Tile, Input, Input Group, Item, Popover, Progress, Radio Group, Select, Separator, Sheet, Slider, Switch, Table, Tabs, Toggle Group, Tooltip
- Installs with a ReUI Pro or Ultimate license; setup: https://web.dev.reui.io/docs/license-setup

## Best for

Stores shown flat or as a geography tree with subtotals, plus profit heat cells, rank chips and region scorecards that filter

## Agent notes

- `STORE_SEEDS` holds the 28 sample stores with a fixed `FY_LABEL` and `REPORT_DATE`; replace them with your own P&L rows
- `monthlyOf` builds the Trend tab and quarter figures from a `SEASON` curve, not stored months; feed real monthly sales and profit
- `handleExportView`, `handleExportSelected` and the sheet's `onExport` only show an Export queued toast

## When not to use

- A reporting hierarchy where selecting a parent selects its reports: use [Reporting Hierarchy](https://web.dev.reui.io/blocks/data-grid/grouping/data-grid-grouping-5.md) (`get_block("data-grid-grouping-5")`)
- A flat list needing in-cell sparklines and an AND or OR rule builder over the rows: use [Ad Campaign Performance](https://web.dev.reui.io/blocks/data-grid/advanced/data-grid-advanced-1.md) (`get_block("data-grid-advanced-1")`)

## Third-party libraries

- Recharts v3: [API reference](https://recharts.github.io/en-US/api/), [docs](https://recharts.github.io/en-US/guide/getting-started/)
- TanStack Table v9: [API reference](https://tanstack.com/table/v9/docs/framework/react/reference/index), [docs](https://tanstack.com/table/v9/docs/framework/react/quick-start)
- Sonner v2: [API reference](https://sonner.emilkowal.ski/toast), [docs](https://sonner.emilkowal.ski/getting-started)
- React DayPicker v9: [API reference](https://daypicker.dev/v9/api), [docs](https://daypicker.dev/v9/start), through shadcn Calendar

## Install

```bash
npx shadcn@latest add @reui/data-grid-advanced-2
```

## About Advanced blocks

### When to use

- Reporting tables whose rows carry in-cell bars, sparklines or heat cells beside the figures
- Performance reviews that weigh each record against a target, a plan or a prior period
- Review queues and record lists with create, edit, delete and undo, each row opening a tabbed sheet

### When not to use

- A rule builder on its own, to narrow a list or table you already have: use [Filters](https://web.dev.reui.io/components/filters.md) (`get_component("filters")`)
- A plain sortable table of text cells, assembled from parts in your own layout: use [Data Grid](https://web.dev.reui.io/components/data-grid.md) (`get_component("data-grid")`)
- Values typed into the cells themselves, with validation and a save or discard bar: use the [Editing blocks](https://web.dev.reui.io/blocks/data-grid/editing.md)

### Agent notes

- Rows live in a client store hook whose `create`, `update` and `remove` change only browser state; back them with your API
- Search, filters and sort run in the browser over every row before `useTable` sees them; move that query to your API at scale
- Each page.tsx wraps the block in a `min-h-svh` main with padding, a `max-w-7xl` width and an sr-only `h1`; drop that wrapper inside an app shell

Every ReUI item has a twin like this one; the index is https://web.dev.reui.io/llms.txt. Agents with the ReUI MCP (https://web.dev.reui.io/docs/mcp) get the same guidance from the getters named above.
