Skip to content

Repository files navigation

Acceptance Invoice Form

Acceptance Invoice Form is a Windows-first CLI project for generating acceptance invoice spreadsheets from Excel templates while keeping the template format intact.

It is designed for teams that:

  • receive invoice or procurement data in JSON or other structured formats
  • need to fill .xls or .xlsx acceptance forms automatically
  • want to keep sensitive school, project, personal, and phone information out of open-source repositories
  • need to adapt the output to their own Excel templates instead of being locked to one fixed layout

Chinese documentation is available in README.zh-CN.md.

Features

  • Render acceptance forms from configurable Excel templates
  • Keep original workbook formatting by using the local Excel COM engine
  • Support both .xls and .xlsx templates on Windows with Microsoft Excel installed
  • Use JSON config files to map your own template layout
  • Inspect uploaded templates before writing data
  • Generate a starter config for new templates
  • Scan repository content for sensitive words and phone numbers before publishing

Repository Layout

  • src/acceptance_invoice_form/ Core package and CLI implementation.
  • examples/configs/ Example template mapping files.
  • examples/data/ Desensitized sample data.
  • examples/templates/ Desensitized example templates safe for public release.
  • examples/output/ Rendered sample outputs.
  • tests/ Unit tests for config and safety logic.

Requirements

  • Windows
  • Microsoft Excel installed locally
  • Python 3.10+

Install:

pip install -r requirements.txt

Quick Start

Render the included public example:

acceptance-invoice-form render ^
  --template examples/templates/material_acceptance_public.xls ^
  --config examples/configs/material_acceptance_public.json ^
  --data examples/data/sample_invoice_data_public.json ^
  --output examples/output/material_acceptance_public_filled.xls

Inspect a workbook before building a custom mapping:

acceptance-invoice-form inspect --template your_template.xlsx

Generate a starter config for your own template:

acceptance-invoice-form init-config ^
  --output my_template_config.json ^
  --sheet-name Sheet1 ^
  --total-text "合    计"

Scan the repository before publishing:

acceptance-invoice-form scan --root .

Custom Template Support

The custom template workflow is config-driven:

  1. Put your own template under a local path such as workspace/.
  2. Run inspect to learn the sheet names and occupied rows.
  3. Run init-config to generate a starter JSON mapping.
  4. Edit the JSON mapping so it matches your template.
  5. Run render with your template, config, and data file.

The config file controls:

  • which worksheet to use
  • where header fields should be written
  • where the detail table starts
  • which columns map to item name, unit, quantity, unit price, amount, supplier
  • how the total row is located and filled

Privacy and Open-Source Safety

The shipped examples are already desensitized.

Recommended practice:

  • keep real invoices and filled private workbooks under workspace/, user_uploads/, or private/
  • never commit raw PDFs, personal phone numbers, school identifiers, or real tax numbers
  • run acceptance-invoice-form scan --root . before every push

Development

pip install -r requirements-dev.txt
pytest

License

Released under the MIT License.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages