diff --git a/.gitignore b/.gitignore index 614187f..e2296db 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ images/ # IDE .vscode/ .idea/ +.cursor/ # OS .DS_Store diff --git a/1. 电容一批.pdf b/1. 电容一批.pdf deleted file mode 100644 index 0f145c4..0000000 Binary files a/1. 电容一批.pdf and /dev/null differ diff --git a/1. 电容一批.png b/1. 电容一批.png deleted file mode 100644 index b896129..0000000 Binary files a/1. 电容一批.png and /dev/null differ diff --git a/2. 电阻一批.pdf b/2. 电阻一批.pdf deleted file mode 100644 index 5411f45..0000000 Binary files a/2. 电阻一批.pdf and /dev/null differ diff --git a/2. 电阻一批.png b/2. 电阻一批.png deleted file mode 100644 index b29b64e..0000000 Binary files a/2. 电阻一批.png and /dev/null differ diff --git a/3. LED一批.pdf b/3. LED一批.pdf deleted file mode 100644 index 1759a7d..0000000 Binary files a/3. LED一批.pdf and /dev/null differ diff --git a/3. LED一批.png b/3. LED一批.png deleted file mode 100644 index aeafa38..0000000 Binary files a/3. LED一批.png and /dev/null differ diff --git a/4. 元器件盒.pdf b/4. 元器件盒.pdf deleted file mode 100644 index f492665..0000000 Binary files a/4. 元器件盒.pdf and /dev/null differ diff --git a/4. 元器件盒.png b/4. 元器件盒.png deleted file mode 100644 index 129c550..0000000 Binary files a/4. 元器件盒.png and /dev/null differ diff --git a/config.json b/config.json deleted file mode 100644 index ad81679..0000000 --- a/config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "username": "202407021", - "password": "wang!1624155937", - "sso_login_url": "https://tyrz.fynu.edu.cn/sso/login", - "portal_url": "https://tyrz.fynu.edu.cn/oshall", - "reimburse_url": "http://210.45.32.214:8081", - "reimburse_page": "/expen/common/common?v=4.0", - "default_name": "王建锋", - "default_card_no": "6282880139161682", - "default_person_id": "202407021" -} \ No newline at end of file diff --git a/invoice_summary.csv b/invoice_summary.csv deleted file mode 100644 index 3321c6a..0000000 --- a/invoice_summary.csv +++ /dev/null @@ -1,5 +0,0 @@ -序号,发票号码,开票日期,项目名称,规格型号,价税合计,销售方名称,人员姓名,刷卡日期,公务卡号,刷卡金额,备注,工号 -1,26442000005432755951,2026/05/18,*电子元件*电容器 电容一批 个 500000 0.0057425742574 2871.29 1% 28.71,电容器 电容一批 个 500000 0.0057425742574 2871.29 1% 28.71,2900.00,佛山市泓宇芯科技有限公司,陈陈,2026/04/28,,2850.00,, -2,26442000005432652421,2026/05/18,*电子元件*电阻 电阻一批 个 500000 0.0057425742574 2871.29 1% 28.71,电阻 电阻一批 个 500000 0.0057425742574 2871.29 1% 28.71,2900.00,佛山市泓宇芯科技有限公司,陈陈,2026/04/28,,2880.00,, -3,26442000005432937661,2026/05/18,*集成电路*集成电路 LED一批 个 2638.92 1% 26.39,集成电路 LED一批 个 2638.92 1% 26.39,2665.31,佛山市泓宇芯科技有限公司,陈陈,2026/04/28,,2661.61,, -4,26442000005468940571,2026/05/18,*电子工业设备*元件盒 1# 个 1 47.5247524752475 47.52 1% 0.48,元件盒 1# 个 1 47.5247524752475 47.52 1% 0.48,96.00,东莞市长安顺淘电子工具经营部,陈陈,2026/05/07,,96.00,, diff --git a/invoice_summary.md b/invoice_summary.md deleted file mode 100644 index 9fabb9b..0000000 --- a/invoice_summary.md +++ /dev/null @@ -1,11 +0,0 @@ -# 发票信息汇总表 - -| 序号 | 发票号码 | 开票日期 | 项目名称 | 规格型号 | 价税合计 | 销售方名称 | 人员姓名 | 刷卡日期 | 公务卡号 | 刷卡金额 | 备注 | 工号 | -|------|------|------|------|------|------|------|------|------|------|------|------|------| -| 1 | 26442000005432755951 | 2026/05/18 | *电子元件*电容器 电容一批 个 500000 0.0057425742574 2871.29 1% 28.71 | 电容器 电容一批 个 500000 0.0057425742574 2871.29 1% 28.71 | ¥2,900.00 | 佛山市泓宇芯科技有限公司 | 陈陈 | 2026/04/28 | | ¥2,850.00 | | | -| 2 | 26442000005432652421 | 2026/05/18 | *电子元件*电阻 电阻一批 个 500000 0.0057425742574 2871.29 1% 28.71 | 电阻 电阻一批 个 500000 0.0057425742574 2871.29 1% 28.71 | ¥2,900.00 | 佛山市泓宇芯科技有限公司 | 陈陈 | 2026/04/28 | | ¥2,880.00 | | | -| 3 | 26442000005432937661 | 2026/05/18 | *集成电路*集成电路 LED一批 个 2638.92 1% 26.39 | 集成电路 LED一批 个 2638.92 1% 26.39 | ¥2,665.31 | 佛山市泓宇芯科技有限公司 | 陈陈 | 2026/04/28 | | ¥2,661.61 | | | -| 4 | 26442000005468940571 | 2026/05/18 | *电子工业设备*元件盒 1# 个 1 47.5247524752475 47.52 1% 0.48 | 元件盒 1# 个 1 47.5247524752475 47.52 1% 0.48 | ¥96.00 | 东莞市长安顺淘电子工具经营部 | 陈陈 | 2026/05/07 | | ¥96.00 | | | - -**价税合计总计: ¥8,561.31** -**刷卡金额总计: ¥8,487.61** diff --git a/run_all.py b/run_all.py deleted file mode 100644 index cc51676..0000000 --- a/run_all.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -财务报销全流程编排脚本 - -依次执行: - 1. extract_invoice.py — 从 PDF 发票提取信息,生成 invoice_summary.csv - 2. extract_image_ocr.py — 从支付截图 OCR 识别刷卡信息,更新 CSV - 3. reimburse.py — 打开浏览器登录财务系统并自动填报 - -用法: - python run_all.py # 默认执行全部三步 - python run_all.py --step invoice # 仅执行第 1 步 - python run_all.py --step ocr # 仅执行第 2 步 - python run_all.py --step submit # 仅执行第 3 步 -""" - -import subprocess -import sys -from pathlib import Path - -PROJECT_DIR = Path(__file__).parent.resolve() -PYTHON = sys.executable - - -def step(name: str, module: str, args: list[str]) -> bool: - """运行单个步骤,返回是否成功""" - cmd = [PYTHON, str(PROJECT_DIR / module), *args] - print(f"\n{'=' * 60}") - print(f" [{name}] {module}") - print(f"{'=' * 60}") - - result = subprocess.run(cmd, cwd=str(PROJECT_DIR)) - ok = result.returncode == 0 - - if ok: - print(f"\n[{name}] 完成") - else: - print(f"\n[错误] {name} 失败 (exit code: {result.returncode})") - - return ok - - -def run_all() -> int: - print("=" * 60) - print(" 财务报销自动化流程") - print(f" 工作目录: {PROJECT_DIR}") - print(f" Python: {PYTHON}") - print("=" * 60) - - if not step("发票提取", "extract_invoice.py", []): - return 1 - - if not step("OCR 识别", "extract_image_ocr.py", []): - return 1 - - if not step("报销提交", "reimburse.py", ["--data", str(PROJECT_DIR / "invoice_summary.csv")]): - return 1 - - print("\n" + "=" * 60) - print(" 全流程执行完毕") - print("=" * 60) - return 0 - - -def main() -> int: - if len(sys.argv) >= 3 and sys.argv[1] == "--step": - name = sys.argv[2] - steps = { - "invoice": ("发票提取", "extract_invoice.py", []), - "ocr": ("OCR 识别", "extract_image_ocr.py", []), - "submit": ("报销提交", "reimburse.py", ["--data", str(PROJECT_DIR / "invoice_summary.csv")]), - } - if name not in steps: - print(f"未知步骤: {name},可选: {', '.join(steps)}") - return 1 - label, module, args = steps[name] - return 0 if step(label, module, args) else 1 - - return run_all() - - -if __name__ == "__main__": - sys.exit(main()) \ No newline at end of file diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index 6fcf93c..0000000 --- a/templates/index.html +++ /dev/null @@ -1,314 +0,0 @@ - - - - - -财务报销自动化 - - - -
- -
-

财务报销自动化

-

上传 PDF 发票和支付截图,自动提取信息并填报报销系统

-
- - -
-

1. 上传文件

-
-
📂
-

拖拽 PDF 和图片到此处,或点击选择文件

- -
-
-
- - -
-

2. 配置

-
-
-
-
-
-
-
-
-
-
- 高级配置 (JSON) - -
-
- - -
-

3. 处理

-
-
等待上传文件...
-
-
- - - -
- -
- -
- - - - \ No newline at end of file