Superpy is a command-line interface (CLI) built for supermarkets to help manage their purchases, sales and inventory. It provides features to buy and sell products, check the inventory for expired products, produce reports on costs, revenue and profit for certain periods and more. It uses an internal date system that can be manually adjusted by the user.
- Date management: set and advance the internal date to simulate daily operations.
- Inventory control: add/remove products from the inventory by buying and selling.
- Reports: uses the rich module to generate reports within the CLI that show purchased/sold items, inventory and expired products.
- Calculations: the system is able to calculate the costs, revenue and profit for specified time periods.
- Data storage: all transactions are stored in CSV format for easy reference.
- Make sure you have Python 3 installed.
- Clone or download this repository to your local machine.
- Navigate to the directory in the CLI and open the terminal.
- The first command you run will generate all necessary CSV files.
- Set current date: $ python super.py set_today
YYYY-MM-DD
Use the --today argument to set the current date to today.
- Get current date: $ python super.py get_today
Fetches the current date set by the user.
- Advance date: $ python super.py advance_time
days
The
days
argument can also be a negative number to go back in time.
- Buy product: $ python super.py buy --product_name
"name"
--buy_priceprice
--count100
--expiration_dateYYYY-MM-DD
The system will purchase a product and add it to the inventory. The --count option will default to 1 if you omit the argument.
- Sell product: $ python super.py sell --product_name
"name"
--sell_priceprice
--count100
The system will search for the product in the inventory, and sell if it's in stock. The --count option will default to 1 if you omit the argument.
- Generate report: $ python super.py report
"file_name"
Will show a table in the CLI of a CSV file. Choose between:
"bought"
,"sold"
,"inventory"
,"expired"
.
- Calculate costs: $ python super.py costs
YYYY-MM-DD
Will display the costs for a specified time period. Can be used with the optional --today or --yesterday arguments.
- Calculate revenue: $ python super.py revenue
YYYY-MM-DD
Will display the revenue for a specified time period. Can be used with the optional --today or --yesterday arguments.
- Calculate profit: $ python super.py profit
YYYY-MM-DD
Will display the profit for a specified time period. Can be used with the optional --today or --yesterday arguments.
- Clear all CSV files: $ python super.py clear_history
Deletes all CSV files. Run any command to generate new ones.
All transaction data is stored in CSV files located in the data
directory.
bought.csv
: contains details about bought products including id, name, buy date, buy price, count and expiration date.sold.csv
: contains details about sold products including id, name, buy date, buy price, count, sell date and sell price.inventory.csv
: contains details about the non-expired products.expired.csv
: contains details about the expired products.
The program reads the details from these files to calculate costs, revenue and profit.
Gizem Brasser