Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,3 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer

# Local hook for pytest with 100% coverage requirement
- repo: local
hooks:
- id: pytest-coverage
name: pytest with 100% coverage
language: system
entry: poetry run pytest -q --maxfail=1 --disable-warnings --cov-fail-under=100 --cov-report=term-missing
pass_filenames: false
always_run: true
env:
PYTHONDONTWRITEBYTECODE: "1" # stop __pycache__ / *.pyc
COVERAGE_FILE: ".git/.coverage" # keep coverage DB inside .git
142 changes: 114 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,118 @@
# Invoice Connector
# QuickBooks Invoice Connector

## Setup Project
Once you forked and cloned the repo, run:
```bash
poetry install
```
to install dependencies.
Then write code in the src/ folder.
A command-line tool for synchronising invoices between Excel and QuickBooks Desktop.
The tool compares records, detects conflicts, identifies missing invoices, and writes a detailed JSON report.

## Quality Check
To setup pre-commit hook (you only need to do this once):
```bash
poetry run pre-commit install
```
To manually run pre-commit checks:
```bash
poetry run pre-commit run --all-file
```
To manually run ruff check and auto fix:
```bash
poetry run ruff check --fix
```
------------------------------------------------------------
SETUP PROJECT
------------------------------------------------------------

## Test
Run
```bash
poetry run pytest
```
Clone the repository and install dependencies using Poetry:

poetry install

All development happens inside the src/ directory.

------------------------------------------------------------
QUALITY CHECK
------------------------------------------------------------

Install pre-commit hooks (only once):

poetry run pre-commit install

Run all pre-commit checks manually:

poetry run pre-commit run --all-file

Auto-fix formatting with Ruff:

poetry run ruff check --fix

------------------------------------------------------------
EXECUTION (DEVELOPMENT MODE)
------------------------------------------------------------

Run the CLI using Poetry:

poetry run python -m src.cli --excel company_data.xlsx

## Build
To be filled by student. The CLI project needs to be built as an .exe file.
Optional arguments:

--company "C:\Path\To\Company.QBW"
--output report.json

Example:

poetry run python -m src.cli --excel company_data.xlsx --output invoice_sync_report.json

------------------------------------------------------------
BUILD WINDOWS .EXE
------------------------------------------------------------

Use PyInstaller inside the Poetry environment:

poetry run pyinstaller --onefile --name qb-invoice-sync --hidden-import win32timezone --hidden-import win32com.client src/cli.py

The final executable will be located in:

dist/qb-invoice-sync.exe

------------------------------------------------------------
RUN THE EXE
------------------------------------------------------------

From the dist/ folder:

.\qb-invoice-sync.exe --excel "..\company_data.xlsx"

With custom output:

.\qb-invoice-sync.exe --excel "..\company_data.xlsx" --output "invoice_sync_report.json"

------------------------------------------------------------
EXAMPLE JSON OUTPUT
------------------------------------------------------------
```
{
"status": "success",
"generated_at": "2025-12-08T19:03:14+00:00",
"same_invoice": 1,
"added_invoices": [
{
"record_id": "5000",
"customer": "ExcelOnly",
"invoice_number": "EX-500",
"invoice_date": "2023-01-15",
"invoice_amount": 5040.0
}
],
"conflicts": [
{
"record_id": "7656",
"reason": "data_mismatch",
"excel_customer": "NBT Group LTD",
"excel_invoice_number": "23-0401",
"excel_invoice_date": "2023-09-13",
"excel_invoice_amount": 13100.0,
"qb_customer": "NBT Group LTD",
"qb_invoice_number": "23-0401",
"qb_invoice_date": "2023-09-13",
"qb_invoice_amount": 0.0
},
{
"record_id": "8000",
"reason": "missing_in_excel",
"excel_customer": null,
"excel_invoice_number": null,
"excel_invoice_date": null,
"excel_invoice_amount": null,
"qb_customer": "QBOnlyCustomer",
"qb_invoice_number": "QB-8000",
"qb_invoice_date": "2024-02-20",
"qb_invoice_amount": 0.0
}
],
"error": null
}
```
6 changes: 6 additions & 0 deletions build_exe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Entry point script for building the executable."""

from src.cli import main

if __name__ == "__main__":
main()
Binary file modified company_data.xlsx
Binary file not shown.
2 changes: 2 additions & 0 deletions debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[1015/134334.871:ERROR:third_party\crashpad\crashpad\util\win\registration_protocol_win.cc:108] CreateFile: The system cannot find the file specified. (0x2)
[1015/134338.675:ERROR:third_party\crashpad\crashpad\util\win\registration_protocol_win.cc:108] CreateFile: The system cannot find the file specified. (0x2)
41 changes: 41 additions & 0 deletions invoice_sync_report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"status": "success",
"generated_at": "2025-12-01T19:51:42+00:00",
"same_invoice": 1,
"added_invoices": [
{
"record_id": "5000",
"customer": "ExcelOnly",
"invoice_number": "EX-500",
"invoice_date": "2023-01-15",
"invoice_amount": 5040.0
}
],
"conflicts": [
{
"record_id": "7656",
"reason": "data_mismatch",
"excel_customer": "NBT Group LTD",
"excel_invoice_number": "23-0401",
"excel_invoice_date": "2023-09-13",
"excel_invoice_amount": 13100.0,
"qb_customer": "NBT Group LTD",
"qb_invoice_number": "23-0401",
"qb_invoice_date": "2023-09-13",
"qb_invoice_amount": 0.0
},
{
"record_id": "8000",
"reason": "missing_in_excel",
"excel_customer": null,
"excel_invoice_number": null,
"excel_invoice_date": null,
"excel_invoice_amount": null,
"qb_customer": "QBOnlyCustomer",
"qb_invoice_number": "QB-8000",
"qb_invoice_date": "2024-02-20",
"qb_invoice_amount": 0.0
}
],
"error": null
}
Loading