# 往来台账

当前版本包含银行流水表头识别内核，以及相互独立的总账管理端和公司业务端原型。

## How recognition works

1. Scan the first 50 rows of every worksheet.
2. Normalize whitespace and full-width characters in candidate headers.
3. Match required header aliases against known bank template signatures.
4. Map columns by header name, independent of their order.
5. Normalize transaction dates, income, expense, balance, counterparty, and
   reference fields.
6. Reject unknown or ambiguous templates instead of guessing.

The original Excel file is never modified.

## Run

```powershell
python -m pip install -r requirements.txt
$env:PYTHONPATH = "src"
python -m bank_importer.cli "流水模板"
python -m unittest discover -s tests -v
python server.py
```

访问地址：

- 登录入口：`http://127.0.0.1:4173/`
- 总账管理端：`http://127.0.0.1:4173/admin.html`
- 公司业务端：`http://127.0.0.1:4173/company.html`

公司端上传会把所选工作簿提交到本地 `/api/parse`，与 CLI 使用同一个确定性表头解析器。当前前端是交互原型，公司、账号、期初、提醒和导入确认仅保存在当前浏览器页面中，尚未接入数据库和正式身份认证。

The CLI prints batch summaries only. It does not print sensitive transaction
details.
