Invoice QR Scanner
Overview
This skill enables automatic electronic invoice application by scanning QR codes from receipt images and filling out online invoice forms. It handles the complete workflow from QR code detection to invoice submission.
Workflow
Step 1: QR Code Recognition
When a user provides an invoice receipt image containing a QR code:
- 1. Run the QR code recognition script:
node scan-qr.js <image-path>
- 2. The script outputs the decoded QR code URL
- If recognition fails, ask user to provide the URL directly
Step 2: Navigate to Invoice System
- 1. Open the decoded URL in browser automation
- Verify the page loads successfully
- Take snapshot to understand form structure
Step 3: Retrieve Company Information
Before filling the form, retrieve the user's company information:
- 1. Check memory files for stored invoice header information:
- Search
memory/YYYY-MM-DD.md for recent invoice info
- Check
MEMORY.md for long-term stored details
- 2. Required fields typically include:
- Company name (公司名称)
- Tax ID/Unified Social Credit Code (税号)
- Address (地址)
- Phone number (电话)
- Bank name (开户行)
- Bank account number (银行账号)
Step 4: Fill Invoice Form
- 1. Analyze the form structure using browser snapshot
- Fill in company information fields
- Fill in recipient information:
- Phone number (手机号)
- Email address (邮箱)
- 4. Verify all required fields are completed
Step 5: Review and Submit
- 1. Submit the form
- Review confirmation page
- Verify all information is correct
- Report results to user
Error Handling
QR Code Not Recognized
If QR code recognition fails:
- 1. Ask user to provide the URL directly
- Suggest using phone to scan and share the URL
Form Structure Changes
If the invoice system form structure changes:
- 1. Take a new snapshot
- Identify updated field references
- Adapt the filling process accordingly
- Document the new structure for future reference
Missing Information
If required company or contact information is missing:
- 1. Ask user to provide the missing details
- Update memory files with new information
- Continue with the invoice application
Scripts
scan-qr.js
Primary script for QR code recognition from images using Node.js and qrcode-reader library.
Usage:
CODEBLOCK1
Requirements:
- - Node.js environment (v14+)
- npm packages:
qrcode-reader, INLINECODE3
Installation:
CODEBLOCK2
Output:
- - Decoded QR code URL on success (format: "✅ 识别成功: ")
- Error message on failure (format: "❌ 错误: ")
Technology:
- - Uses qrcode-reader library for QR code decoding
- Canvas for image processing
- Pure JavaScript implementation (no Worker required)
Memory Integration
This skill relies on stored user information in memory files:
Company Invoice Header Information (stored in MEMORY.md):
- - Company name
- Tax ID
- Address
- Phone number
- Bank information
Contact Information (stored in MEMORY.md):
- - Mobile phone numbers
- Email addresses
When filling forms, always reference this information first before asking the user.
Best Practices
- 1. Always verify the decoded URL is legitimate before proceeding
- Double-check all information before submission
- Take snapshots at each step for documentation
- Report results clearly to the user after submission
- Update memory with new information if user provides corrections
- Use auto-complete when available (more accurate than manual input)
发票二维码扫描器
概述
本技能可通过扫描收据图片中的二维码,自动填写在线发票表单,实现电子发票的自动申请。它涵盖了从二维码检测到发票提交的完整工作流程。
工作流程
步骤1:二维码识别
当用户提供包含二维码的发票收据图片时:
- 1. 运行二维码识别脚本:
bash
node scan-qr.js <图片路径>
- 2. 脚本输出解码后的二维码URL
- 如果识别失败,请用户直接提供URL
步骤2:导航至发票系统
- 1. 在浏览器自动化中打开解码后的URL
- 验证页面加载成功
- 截取快照以了解表单结构
步骤3:获取公司信息
填写表单前,获取用户的公司信息:
- 1. 检查记忆文件中存储的发票抬头信息:
- 搜索 memory/YYYY-MM-DD.md 获取近期发票信息
- 检查 MEMORY.md 获取长期存储的详细信息
- 2. 必填字段通常包括:
- 公司名称
- 税号/统一社会信用代码
- 地址
- 电话
- 开户行
- 银行账号
步骤4:填写发票表单
- 1. 使用浏览器快照分析表单结构
- 填写公司信息字段
- 填写收票人信息:
- 手机号
- 邮箱地址
- 4. 验证所有必填字段是否已填写完成
步骤5:审核并提交
- 1. 提交表单
- 查看确认页面
- 验证所有信息是否正确
- 向用户报告结果
错误处理
二维码无法识别
如果二维码识别失败:
- 1. 请用户直接提供URL
- 建议用户使用手机扫描并分享URL
表单结构变更
如果发票系统表单结构发生变化:
- 1. 截取新的快照
- 识别更新后的字段引用
- 相应调整填写流程
- 记录新结构以备将来参考
信息缺失
如果缺少必需的公司或联系信息:
- 1. 请用户提供缺失的详细信息
- 用新信息更新记忆文件
- 继续发票申请流程
脚本
scan-qr.js
使用Node.js和qrcode-reader库从图片中识别二维码的主要脚本。
使用方法:
bash
node scan-qr.js <图片路径>
环境要求:
- - Node.js环境(v14+)
- npm包:qrcode-reader、canvas
安装方法:
bash
cd scripts
npm install qrcode-reader canvas
输出结果:
- - 成功时输出解码后的二维码URL(格式:✅ 识别成功: )
- 失败时输出错误信息(格式:❌ 错误: <错误信息>)
技术原理:
- - 使用qrcode-reader库进行二维码解码
- 使用Canvas进行图像处理
- 纯JavaScript实现(无需Worker)
记忆集成
本技能依赖存储在记忆文件中的用户信息:
公司发票抬头信息(存储在MEMORY.md中):
联系信息(存储在MEMORY.md中):
填写表单时,始终优先参考这些信息,然后再询问用户。
最佳实践
- 1. 始终验证解码后的URL是否合法后再继续操作
- 仔细核对提交前的所有信息
- 截取快照记录每个步骤
- 清晰报告提交后的结果给用户
- 更新记忆如果用户提供了更正信息
- 使用自动填充(比手动输入更准确)