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.1.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.1.tar.gz.
File metadata
- Download URL: parsing_project-0.1.1.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 |
61fe5f839e05dd52f22deb4d52c31915626203833800a6afb21770a10a17c056
|
|
| MD5 |
f275517a36b0580ca9b286d7efdba43b
|
|
| BLAKE2b-256 |
def1ad2fc29feac7660bccf1831bc031e956a741ed17f1df0585a0bec5e668ad
|
File details
Details for the file parsing_project-0.1.1-py3-none-any.whl.
File metadata
- Download URL: parsing_project-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.4 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 |
9b276913c455f4ce6bc2c738b2614e66ed69b1e8d9d80a61db74087b8e08dce3
|
|
| MD5 |
5c172f2b08f757f110d13060e7eaad69
|
|
| BLAKE2b-256 |
bfb187a572864b418b9770ed599657c1bf92dbe71b20e816dc8ac56de806170b
|