Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions external_plugins/invoice-maker/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "invoice-maker",
"version": "0.1.0",
"description": "Turn a sheet of line items (.xlsx/.csv) into numbered PDF invoices: rows are grouped by invoice number or client, amounts, tax and totals are calculated, and bad numbers or missing clients are flagged. Fix any cell in the panel, preview the invoice and export one PDF per invoice plus an Excel/CSV ledger. Runs locally; no API keys.",
"description_i18n": {
"en": "Turn a sheet of line items (.xlsx/.csv) into numbered PDF invoices: rows are grouped by invoice number or client, amounts, tax and totals are calculated, and bad numbers or missing clients are flagged. Fix any cell in the panel, preview the invoice and export one PDF per invoice plus an Excel/CSV ledger. Runs locally; no API keys.",
"zh-CN": "把一张明细表(.xlsx/.csv)批量做成带编号的 PDF 发票:按发票号或客户自动分组,计算金额、税额和合计,标出数字错误、缺少客户等问题。在面板里直接改单元格、预览发票,导出每张一个 PDF,另附 Excel/CSV 开票台账。在本地运行,无需 API 密钥。"
},
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"keywords": [
"invoice",
"billing",
"pdf",
"freelancer",
"tax",
"ledger",
"发票",
"账单",
"开票",
"报价",
"自由职业"
],
"skills": "skills",
"mcpServers": {
"invoice-maker": {
"type": "stdio",
"command": "node",
"args": [
"${ZCODE_PLUGIN_ROOT}/dist/server.mjs"
],
"cwd": "${ZCODE_PROJECT_DIR}",
"timeoutMs": 900000,
"env": {
"ZCODE_WORKSPACE_ROOT": "${ZCODE_PROJECT_DIR}"
}
}
},
"ui": {
"surfaces": [
{
"id": "editor",
"title": {
"zh-CN": "批量开发票",
"en-US": "Invoice Maker"
},
"icon": "receipt",
"server": "invoice-maker",
"resourceUri": "ui://invoice-maker/panel.html",
"availability": "session"
}
]
}
}
21 changes: 21 additions & 0 deletions external_plugins/invoice-maker/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Penova

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions external_plugins/invoice-maker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Invoice Maker

Turn a sheet of line items (.xlsx/.csv) into numbered PDF invoices: rows are grouped by invoice number or client, amounts, tax and totals are calculated, and bad numbers or missing clients are flagged. Fix any cell in the panel, preview the invoice and export one PDF per invoice plus an Excel/CSV ledger. Runs locally; no API keys.

## Features

- **Input**: one row per line item. Chinese or English column names (发票号 / invoice no., 客户 / client, 地址 / address, 项目 / item, 数量 / qty, 单价 / price, 税率 / tax) are matched automatically; prices like `¥26,000` or `$320.00` and quantities like `一` are understood.
- **Grouping and numbering**: rows with the same invoice number form one invoice; rows without a number are grouped by client and numbered from your prefix and first number (e.g. INV-0001).
- **Checks**: non-numeric quantities and prices, tax rates outside 0–100, missing clients, one invoice number used for two clients, missing addresses and invoices that will not fit on one page.
- **PDF**: your business name and details, client block, item table, subtotal, tax and total, payment due date and notes; Chinese, English or bilingual labels; A4 or Letter; accent colour. Chinese text uses a font already on your computer.
- **Ledger**: invoices.xlsx (summary and lines), invoices.csv and an HTML list.
- **Panel**: pick input files, adjust settings, see problems, edit any cell in the table, preview the result and export — all in the ZCode side panel. Edits are saved in `invoice-maker/<project>.project.json` and kept until you re-open the inputs.

## Usage

Ask the agent in ZCode Desktop:

- "Make invoices from billing/invoices-2026-11.xlsx with 6% tax, our company name Penova Labs, due in 30 days"
- "Change the support hours for Northwind to 5 and switch the invoices to USD in English"
- "Export the invoices as PDFs and the ledger"

## Tools

| Tool | Purpose |
|---|---|
| `invoice_open` | Read the line-item sheet, group rows into invoices and check them. Opens the panel |
| `invoice_edit` | Change settings, edit cells by row, add or remove rows |
| `invoice_status` | Show the current rows, issues and summary |
| `invoice_export` | Write one PDF per invoice, all-invoices.pdf, invoices.xlsx/.csv and an HTML list |

Output goes to `invoice-maker/<project>/` in the workspace.

## Scope (v0.1)

- One currency per project; tax is a percentage per line (no compound or withholding taxes).
- One page per invoice (about 20 lines). Not an official tax invoice (e.g. China fapiao or EU e-invoice formats); nothing is sent by email.
- Old .xls files: save as .xlsx first.

## Privacy, network and files

- **Everything runs locally.** No network, no uploads, no API keys or accounts.
- Reads only the files you choose. Writes only the `invoice-maker/` folder in the workspace. No hooks.

## Build and test (developers)

- Source: `ui-plugins/invoice-maker/`.
- Build: `pnpm install --frozen-lockfile && pnpm build`, then add `dist/local-marketplace` as a local source.
- Tests: `pnpm --filter @penova/plugin-invoice-maker test` and `test:e2e` (needs Chrome; sample files in `test/samples/`).

## Third-party components and licenses

MIT licensed (author: Penova). Bundled: pdf-lib (MIT), fontkit (MIT), ExcelJS (MIT), MCP SDK and ext-apps (MIT), zod (MIT); the full list is in `dist/THIRD_PARTY_NOTICES.txt`.
52 changes: 52 additions & 0 deletions external_plugins/invoice-maker/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 批量开发票

把一张明细表(.xlsx/.csv)批量做成带编号的 PDF 发票:按发票号或客户自动分组,计算金额、税额和合计,标出数字错误、缺少客户等问题。在面板里直接改单元格、预览发票,导出每张一个 PDF,另附 Excel/CSV 开票台账。在本地运行,无需 API 密钥。

## 功能

- **输入**:每行一个收费项目。自动识别中英文列名(发票号、客户、地址、项目、数量、单价、税率),能读懂 `¥26,000`、`$320.00` 这样的金额和“一”这样的数量。
- **分组与编号**:发票号相同的行合成一张发票;没有发票号的按客户分组,并按前缀和起始编号自动编号(如 INV-0001)。
- **检查**:数量或单价不是数字、税率不在 0–100、缺少客户、同一发票号对应两个客户、缺少地址、行数太多放不下一页。
- **PDF**:开票方名称和信息、客户信息、项目表、小计、税额、合计、付款期限和备注;中文、英文或双语;A4 或 Letter;可选主题色。中文使用电脑上已有的字体。
- **台账**:invoices.xlsx(汇总表和明细表)、invoices.csv 和 HTML 清单。
- **面板**:在 ZCode 侧栏里选择输入文件、调整设置、查看问题、直接修改表格里的任意单元格、预览成品并导出。修改保存在 `invoice-maker/<项目>.project.json`,重新打开输入文件前一直保留。

## 使用方法

在 ZCode 桌面端对助手说:

- “用 账单/invoices-2026-11.xlsx 开发票,税率 6%,开票方 Penova Labs,30 天内付款”
- “把 Northwind 的支持工时改成 5 小时,发票改成美元、英文”
- “导出 PDF 发票和开票台账”

## 工具

| 工具 | 作用 |
|---|---|
| `invoice_open` | 读取明细表,分组成发票并检查,并打开面板 |
| `invoice_edit` | 修改设置、按行修改单元格、新增或删除行 |
| `invoice_status` | 查看当前数据、问题和汇总 |
| `invoice_export` | 导出每张发票的 PDF、合并的 all-invoices.pdf、invoices.xlsx/.csv 和 HTML 清单 |

导出文件写到工作区的 `invoice-maker/<项目>/` 文件夹。

## 范围(v0.1)

- 每个项目一种币种;税额按每行税率计算(不含复合税、代扣税)。
- 每张发票一页(约 20 行)。不是官方税务发票(如增值税发票、欧盟电子发票),也不会通过邮件发送。
- 旧版 .xls 请先另存为 .xlsx。

## 隐私、网络与文件

- **全部在本地运行。** 不联网、不上传,不需要 API 密钥或账号。
- 只读取你选择的文件,只写入工作区的 `invoice-maker/` 文件夹。没有 Hook。

## 构建与测试(开发者)

- 源码:`ui-plugins/invoice-maker/`。
- 构建:`pnpm install --frozen-lockfile && pnpm build`,然后把 `dist/local-marketplace` 添加为本地来源。
- 测试:`pnpm --filter @penova/plugin-invoice-maker test` 和 `test:e2e`(需要 Chrome;样例文件在 `test/samples/`)。

## 第三方组件与许可证

MIT 许可(作者:Penova)。打包的组件:pdf-lib (MIT), fontkit (MIT), ExcelJS (MIT)、MCP SDK 与 ext-apps(MIT)、zod(MIT);完整列表见 `dist/THIRD_PARTY_NOTICES.txt`。
15 changes: 15 additions & 0 deletions external_plugins/invoice-maker/skills/invoice-maker/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: invoice-maker
description: 把一张明细表(.xlsx/.csv)批量做成带编号的 PDF 发票:按发票号或客户自动分组,计算金额、税额和合计,标出数字错误、缺少客户等问题。在面板里直接改单元格、预览发票,导出每张一个 PDF,另附 Excel/CSV 开票台账。在本地运行,无需 API 密钥。 用户提到“开发票 / 批量出账单 / invoice / 账单 PDF / 给客户开票”时使用。
---

# 批量开发票

1. `invoice_open(inputs, settings?, project?)`:读取明细表,分组成发票并检查。inputs 是工作区相对路径。
- 结果里有汇总、问题列表(错误 / 提醒)和前几行数据,每行有编号 `#n`。
- 设置里先填开票方名称(seller)、默认税率(taxRate)、币种(currency);用户没说的就问一句或用默认值。
2. 向用户简要说明结果,先说错误和需要确认的地方,不要逐行念。
3. 用户要改时调用 `invoice_edit(project, settings?, set?: [{row, values}], add?, remove?)`。
- 改金额:`set: [{row: 3, values: {qty: 5}}]`;改币种语言:`settings: {currency: "USD", lang: "en"}`。
4. `invoice_export(project, formats?)`:导出每张发票的 PDF、合并的 all-invoices.pdf、invoices.xlsx/.csv 和 HTML 清单。把文件路径告诉用户。
5. 有错误(error)时 PDF 不能导出,先告诉用户哪一行有问题并帮他改好。
49 changes: 49 additions & 0 deletions marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,55 @@
"把上一个 Hi3D 任务生成的模型按角色拆分成部件"
]
}
},
{
"name": "invoice-maker",
"componentTypes": [
"ui"
],
"source": "./external_plugins/invoice-maker",
"displayName": "Invoice Maker",
"displayName_i18n": {
"en": "Invoice Maker",
"zh-CN": "批量开发票"
},
"description": "Turn a sheet of line items (.xlsx/.csv) into numbered PDF invoices: rows are grouped by invoice number or client, amounts, tax and totals are calculated, and bad numbers or missing clients are flagged. Fix any cell in the panel, preview the invoice and export one PDF per invoice plus an Excel/CSV ledger. Runs locally; no API keys.",
"description_i18n": {
"en": "Turn a sheet of line items (.xlsx/.csv) into numbered PDF invoices: rows are grouped by invoice number or client, amounts, tax and totals are calculated, and bad numbers or missing clients are flagged. Fix any cell in the panel, preview the invoice and export one PDF per invoice plus an Excel/CSV ledger. Runs locally; no API keys.",
"zh-CN": "把一张明细表(.xlsx/.csv)批量做成带编号的 PDF 发票:按发票号或客户自动分组,计算金额、税额和合计,标出数字错误、缺少客户等问题。在面板里直接改单元格、预览发票,导出每张一个 PDF,另附 Excel/CSV 开票台账。在本地运行,无需 API 密钥。"
},
"version": "0.1.0",
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"category": "productivity",
"keywords": [
"invoice",
"billing",
"pdf",
"freelancer",
"tax",
"ledger",
"发票",
"账单",
"开票",
"报价",
"自由职业"
],
"examplePrompts": [
"Make invoices from billing/invoices-2026-11.xlsx with 6% tax, our company name Penova Labs, due in 30 days",
"Change the support hours for Northwind to 5 and switch the invoices to USD in English",
"Export the invoices as PDFs and the ledger"
],
"examplePrompts_i18n": {
"zh-CN": [
"用 账单/invoices-2026-11.xlsx 开发票,税率 6%,开票方 Penova Labs,30 天内付款",
"把 Northwind 的支持工时改成 5 小时,发票改成美元、英文",
"导出 PDF 发票和开票台账"
]
}
}
]
}
Loading