Repository navigation
v0.2.0
导出 Excel、直接读 .zip 压缩包、一条命令看发票,命令行改成中文;阅读顺序更准,新增发票种类。
Excel export, ZIP archives, a one-command invoice view and a Chinese command line; better reading order and the invoice type.
pip install --upgrade ofdkit
ofdkit 发票.ofd # 看一张发票 / show an invoice
ofdkit batch 发票文件夹 -o 发票汇总.xlsx # 汇总到 Excel / summarise into ExcelAdded
- Excel output:
ofdkit batch FOLDER -o 发票汇总.xlsxwrites a workbook, still with only the standard library. Invoice numbers, codes and tax IDs stay text (in a CSV, Excel turns a 20-digit 数电票 number into 2.4E+19), amounts are numbers and dates are dates. A totals row follows filters; duplicates and unreadable files are coloured and explained; a second sheet lists every line item. - ZIP archives:
batch,showand the MCP toollist_ofd_invoicesread the.ofdfiles inside.ziparchives, such as a batch download from the tax service. ofdkit show, and the shortcutofdkit PATH: an invoice as aligned Chinese text, another document's text, or a table of the invoices in folders and archives with totals.ofdkit.read_invoices()reads files, folders and archives intoInvoiceFileresults.- Totals without duplicates, and sums of amounts and tax, in the
batchsummary andlist_ofd_invoices; anitem_namescolumn in the CSV. ofdkit describe: the file's structure as JSON with all text masked, so problems can be reported without sharing an invoice. GitHub issue forms ask for it instead of the file.invoice_type: the invoice type as printed in its title, such as 电子发票(增值税专用发票) or 上海增值税电子普通发票.
Changed
- Better reading order. Vertical labels such as 购买方信息 and 备注 are read as words; columns of prose are read column by column, tables still row by row.
- Command-line help and messages are in Chinese.
textandshowsay when a file has no text at all, which usually means a scan. - The CSV from
batchhas newinvoice_typeanditem_namescolumns.
Fixed
- Older invoices that share a number but have different invoice codes are no longer flagged as duplicates.
- Output piped into a program that stops reading early, such as
head, no longer ends with an error. - The MCP tool
read_ofd_textwith a page range no longer fails when one page in the range is damaged.
Four new reading-order samples in ofd-samples check these changes on every commit.