lovstudio-expense-report
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseexpense-report — Invoice → Categorized Excel
expense-report — 发票 → 分类Excel报销报告
Extract invoice information from images or text, classify expenses, and generate
a professional Excel report with subtotals per category.
从图片或文本中提取发票信息,对费用进行分类,并生成带有各类别小计的专业Excel报告。
When to Use
使用场景
- User has invoice photos / scanned receipts to process
- User describes expenses in text and wants them organized
- User needs a categorized reimbursement report (报销单)
- User mentions 发票报销, 报销汇总, 发票整理, expense report
- 用户有发票照片/扫描收据需要处理
- 用户以文本形式描述费用并希望整理归类
- 用户需要分类后的报销报告(报销单)
- 用户提及发票报销、报销汇总、发票整理、expense report
Expense Categories
费用分类
| Category | Keywords / Examples |
|---|---|
| 业务招待 | 客户餐费, 商务宴请, 礼品, 招待 |
| 差旅-交通 | 机票, 火车票, 高铁, 出租车, 打车, 网约车, 加油, 过路费, 停车费 |
| 差旅-住宿 | 酒店, 住宿, 宾馆 |
| 差旅-餐饮 | 出差期间餐费, 工作餐 |
| 办公用品 | 文具, 打印, 办公耗材, 办公设备 |
| 通讯费 | 话费, 流量, 网费, 宽带 |
| 其他 | 不属于以上类别的费用 |
| 分类名称 | 关键词/示例 |
|---|---|
| 业务招待 | 客户餐费, 商务宴请, 礼品, 招待 |
| 差旅-交通 | 机票, 火车票, 高铁, 出租车, 打车, 网约车, 加油, 过路费, 停车费 |
| 差旅-住宿 | 酒店, 住宿, 宾馆 |
| 差旅-餐饮 | 出差期间餐费, 工作餐 |
| 办公用品 | 文具, 打印, 办公耗材, 办公设备 |
| 通讯费 | 话费, 流量, 网费, 宽带 |
| 其他 | 不属于以上类别的费用 |
Workflow (MANDATORY)
工作流程(必须遵循)
Step 1: Collect Invoice Data
步骤1:收集发票数据
Accept input in any of these forms:
- Images: Read invoice photos using the Read tool. Extract: date, vendor, amount, item type, notes.
- Text descriptions: Parse the user's text for the same fields.
- Mixed: Multiple images + supplementary text.
For each invoice, extract these fields:
json
{
"date": "2026-04-15",
"vendor": "海底捞(国贸店)",
"item": "客户餐费",
"amount": 486.00,
"category": "业务招待",
"note": "与XX公司李总晚餐"
}接受以下任意形式的输入:
- 图片:使用Read工具读取发票照片,提取字段:日期、商户、金额、项目类型、备注。
- 文本描述:解析用户文本,提取相同字段。
- 混合形式:多张图片+补充文本。
针对每张发票,提取以下字段:
json
{
"date": "2026-04-15",
"vendor": "海底捞(国贸店)",
"item": "客户餐费",
"amount": 486.00,
"category": "业务招待",
"note": "与XX公司李总晚餐"
}Step 2: Classify
步骤2:分类
Assign each invoice to a category from the table above. Rules:
- If the user explicitly states the category, use it.
- If the item/vendor clearly matches a category keyword, auto-assign.
- For ambiguous items (e.g., "餐费" could be 业务招待 or 差旅-餐饮):
- If the note mentions a client/customer → 业务招待
- If the context is a business trip → 差旅-餐饮
- If unclear, ask the user.
将每张发票归入上述表格中的某一分类,规则如下:
- 若用户明确指定分类,则使用该分类。
- 若项目/商户与某分类关键词明确匹配,则自动分配分类。
- 对于模糊项目(例如“餐费”可能属于业务招待或差旅-餐饮):
- 若备注提及客户/客户方 → 业务招待
- 若上下文为商务出差 → 差旅-餐饮
- 若无法确定,询问用户。
Step 3: Confirm with User
步骤3:与用户确认
Before generating, show the extracted data as a table:
| # | 日期 | 商户 | 项目 | 金额 | 分类 | 备注 |
|---|------|------|------|------|------|------|
| 1 | 2026-04-15 | 海底捞 | 客户餐费 | 486.00 | 业务招待 | 与XX公司李总 |
| 2 | 2026-04-14 | 滴滴出行 | 打车 | 45.50 | 差旅-交通 | 机场→酒店 |Ask: "以上信息是否正确? 需要修改或补充吗?"
生成报表前,将提取的数据以表格形式展示:
| # | 日期 | 商户 | 项目 | 金额 | 分类 | 备注 |
|---|------|------|------|------|------|------|
| 1 | 2026-04-15 | 海底捞 | 客户餐费 | 486.00 | 业务招待 | 与XX公司李总 |
| 2 | 2026-04-14 | 滴滴出行 | 打车 | 45.50 | 差旅-交通 | 机场→酒店 |询问用户:“以上信息是否正确?需要修改或补充吗?”
Step 4: Generate Excel
步骤4:生成Excel
Write the confirmed data to a temp JSON file, then run:
bash
python expense-report-skill/scripts/generate_report.py \
--input /tmp/invoices.json \
--output "发票报销汇总-YYYYMMDD.xlsx"JSON format (array of objects):
json
[
{"date": "2026-04-15", "vendor": "海底捞", "item": "客户餐费", "amount": 486.0, "category": "业务招待", "note": "与XX公司李总"},
{"date": "2026-04-14", "vendor": "滴滴出行", "item": "打车", "amount": 45.5, "category": "差旅-交通", "note": "机场→酒店"}
]将确认后的数据写入临时JSON文件,然后运行以下命令:
bash
python expense-report-skill/scripts/generate_report.py \
--input /tmp/invoices.json \
--output "发票报销汇总-YYYYMMDD.xlsx"JSON格式(对象数组):
json
[
{"date": "2026-04-15", "vendor": "海底捞", "item": "客户餐费", "amount": 486.0, "category": "业务招待", "note": "与XX公司李总"},
{"date": "2026-04-14", "vendor": "滴滴出行", "item": "打车", "amount": 45.5, "category": "差旅-交通", "note": "机场→酒店"}
]Step 5: Deliver
步骤5:交付
Tell the user:
- Output file path
- Total amount and breakdown by category
- Remind them to review the "分类汇总" sheet for the summary
告知用户:
- 输出文件路径
- 总金额及各分类明细
- 提醒用户查看“分类汇总”工作表获取汇总信息
Output Format
输出格式
The Excel file contains two sheets:
- 发票报销汇总 — Full detail, grouped by category with subtotals
- 分类汇总 — Summary table: category, count, subtotal
Style: Lovstudio warm-academic (terracotta headers #CC785C, warm cream accents).
Excel文件包含两个工作表:
- 发票报销汇总 — 完整明细,按分类分组并包含小计
- 分类汇总 — 汇总表格:分类、数量、小计
样式:Lovstudio warm-academic(陶土色表头#CC785C,暖米色点缀)。
Edge Cases
边缘情况
- Blurry/unreadable image: Tell the user which fields couldn't be extracted; ask them to provide manually.
- Foreign currency: Note the currency; convert to CNY if user provides rate, otherwise keep original with note.
- Duplicate invoices: Flag potential duplicates (same date + vendor + amount) before generating.
- No date on invoice: Use the date the user provides, or mark as "日期不详".
- 模糊/无法识别的图片:告知用户哪些字段无法提取,请用户手动提供。
- 外币:标注货币类型;若用户提供汇率则转换为人民币,否则保留原币种并标注。
- 重复发票:生成前标记潜在重复项(相同日期+商户+金额)。
- 发票无日期:使用用户提供的日期,或标记为“日期不详”。