This Python script automates the daily generation of inventory adjustment reports by extracting, processing, and exporting data from a SQL Server-based warehouse management system (WMS). It merges ledger activity, adjustment headers, and reason code mappings to produce clean, client-specific Excel reports ready for operational and audit use.
- Connects to a SQL Server WMS database using
pyodbc
- Joins data from multiple tables including adjustment headers, ledger entries, and reason codes
- Filters out non-relevant entries (e.g., RTS returns, zero-quantity adjustments)
- Segments final output by client code, either provided or auto-detected
- Automatically fetches distinct client codes from the database if none are provided
- Python 3.x
- Pandas
- NumPy
- PyODBC
- OpenPyXL / XlsxWriter (via
pandas.to_excel()
)
- Clone this repository:
git clone https://github.com/your-username/inventory-adjustment-automation.git
- Install the required dependencies:
pip install pandas numpy pyodbc openpyxl
-
Update the database connection string and output file paths in the script to match your environment.
-
Run the script with optional client filtering:
python inventory_adjustment_report.py
Or specify client codes manually:
python inventory_adjustment_report.py --clients GRL MRA KAV
The script produces a separate Excel report for each client, containing validated adjustment data ready for operational and finance use.
This project is licensed under the MIT License.
All database names, paths, and sample outputs have been anonymized to protect proprietary information. This script is intended for educational and demonstration purposes.