Invoice parsing tool for daily sales register exports
Project description
🧾 Daily Sales Register Parser
This tool parses fixed-width daily sales register text files exported from ERP systems like Infor FACTS, extracting invoice data and converting it into structured JSON and CSV formats.
📂 Folder Structure
parsing_project/
├── main.py # Entry point
├── parser.py # Invoice and line item parsing logic
├── file_ops.py # File reading, JSON/CSV output, file movement
├── utils.py # Logging, formatting, validation
├── config.py # Central config values
├── dailysalesreg/ # Input folder for .txt files
│ └── logged/ # Processed files moved here
├── json_output/
│ ├── by_date/YYYY-MM-DD/
│ ├── customers/CUSTOMER_CODE/
│ └── invoice_number.json
└── processed_files.log # Hashes of processed files to prevent duplicates
🚀 Getting Started
Requirements
- Python 3.7+
- No external packages required (uses standard library)
▶️ Usage
Basic (Parse all .txt files in dailysalesreg/)
python main.py
Parse single file
python main.py dailysalesreg/05022025.txt
Filter by customer
python main.py --customer 1766
Filter by invoice date
python main.py --date 05/02/25
⚙️ Options
| Argument | Description |
|---|---|
file |
(optional) Path to a .txt file to parse |
--customer |
Only extract invoices for a customer code |
--date |
Only extract invoices for a date (format: MM/DD/YY) |
--limit |
Process only first N invoices (for testing) |
--dry-run |
Don’t save JSON/CSV or move files |
--skip-move |
Don’t move processed .txt file to logged/ folder |
--skip-processed |
Force reprocessing even if file was already handled |
--verbose |
Enable debug logging in console |
--logfile name |
Write logs to a specific file (default: process.log) |
📦 Output
- JSON files are saved per invoice.
- A summary CSV with totals and match-check is generated per run.
- Files are organized under
json_output/by:- Full runs →
json_output/by_date/YYYY-MM-DD/ - Customer runs →
json_output/customers/1766/ - Date runs →
json_output/dates/YYYY-MM-DD/
- Full runs →
✅ Features
- Line item and header parsing
- Handles continued invoice pages
- Validates totals vs. calculated extensions
- Logs errors, skips bad lines, shows matches
- Supports CLI filtering, logging, testing
- Safe file handling and duplicate protection
📌 Notes
- Invoice number must be 6 digits.
- Dates must be in MM/DD/YY format.
- Only
.txtfiles placed indailysalesreg/will be picked up automatically.
🛠 Example Development Command
python main.py --customer 100000 --verbose --dry-run --limit 5
🧑💻 Author
Kyle Allen
Levocraft
[Levocraft]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
parsing_project-0.1.0.tar.gz
(8.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parsing_project-0.1.0.tar.gz.
File metadata
- Download URL: parsing_project-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7bd36d6af52e9a8ee6312a4dca7d2406c24c3c8a1ade6f2286eb2f33929b689
|
|
| MD5 |
b60dae78473a594696b438d7fbf2defb
|
|
| BLAKE2b-256 |
4cd1778a3b14322e716fae887df2a71845207f391e6e1994b625e83fad49d4fe
|
File details
Details for the file parsing_project-0.1.0-py3-none-any.whl.
File metadata
- Download URL: parsing_project-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1cc795b4452c4f4ffcf5db5cb9880ab397f0e35808bd81c0328a9052629c925
|
|
| MD5 |
736ca76dfa6c592c78c6d24475cc8d1c
|
|
| BLAKE2b-256 |
d9ae5aa003d4109279533e4fa7788bf40db71df682b63d8c336ba7148be2d06d
|