A command-line invoice generator written in GnuCOBOL 3.2.0. Generates formatted text invoices with automatic client registry management, collision-safe invoice numbering (e.g. NATL0001), line item entry with running totals, tax calculation, and a buffered line item system supporting unlimited items per invoice. Built as a practical exploration of COBOL's file I/O and data processing capabilities.
- GnuCOBOL 3.2.0+
- WSL or Linux environment
bin/ - compiled binaries data/ - client registry output/ - generated invoices src/ - COBOL source files
cobc -free -c src/calcs.cob -o bin/calcs.o cobc -x -free src/invoice.cob bin/calcs.o -o bin/invoice
Run the program from the project root:
./bin/invoice
Menu Options:
1. Create New Invoice
- Enter client name and confirm or override the auto-generated 4-letter client code
- Enter client address and tax rate
- Enter line items (description, quantity, unit, rate)
- Program calculates line totals, subtotal, tax, and grand total automatically
- Invoice is saved to output/ as a formatted text file e.g. NATL0001.txt
- Client registry in data/ is updated automatically
2. View Last Invoice
- Enter an invoice number e.g. NATL0001
- Displays the invoice directly in the terminal
3. Exit
Invoice Numbering:
Invoice numbers are generated from the first 4 letters of the client name
plus a zero-padded sequence number e.g. NATL0001, NATL0002. The client
registry prevents code collisions between different clients.
- Text output only
- 20 line items per batch flush
- Invoices are immutable once written
- PDF conversion pipeline
- Batch processing
- Void invoice functionality