Video Demo: https://youtu.be/J-ajhJ4mD1YYY
Table of Contents
This project was created thinking about solving a repetitive and manual activity that happens to freelancers or companies that need to generate several invoices for services performed for their clients.
The customer information, type of service, date, and other data for generating the invoice are created through a menu on the command line.
With this project, I should acquire knowledge of object orientation, SQLite database with sqlalchemy, creation of tests, and also improve my knowledge in python programming.
The following items below are necessary to have the application working.
- Python 3.10 or higher
- Pip 22.1.2 or higher
- SQLAlchemy
- PrettyTable
- borb: PDF
- configparser
- simple-term-menu
Repository files
README.md - _This file_
logo.png - CS50 logo image
project.py - Main project code
models.py - Models code
test_project.py - Tests
requirements.txt - Requirement modules
.gitignore - Ignore temp files and the ones created after first-run.
Files created after program execution
config.ini - This file is needed to create Company data and db file.
project.db - Created after first run and finish the initial configuration.
invoice.pdf - Created or updated after generate an invoice.
- Ensure
python3.10
andpip
are installed. - Clone repository:
git clone [email protected]:wiltonpaulo/cs50-final-project
cd
into the repository.- pip install -r requirements.txt in your shell.
The first script execution will checks if the file config.ini exists, otherwise will ask to fill the initial configuration as below:
python3 project.py
***No config.ini found.***
Provide the initial configuration
Company name: <YOU COMPANY NAME>
Company address: <YOU COMPANY ADDRESS>
Company phone: <YOU COMPANY PHONE NUMBER>
Company owner: <PROVIDE THE OWNER NAME>
Company logo path: <PATH TO THE COMPANY LOGO FILE>
SUCCESS: Configuration finished
You can also write the file directly as below:
config.ini
[company]
name = <YOU COMPANY NAME>
address = <YOU COMPANY ADDRESS>
phone = <YOU COMPANY PHONE NUMBER>
owner = <PROVIDE THE OWNER NAME>
logo = <PATH TO THE COMPANY LOGO FILE>
[database]
db_connection = sqlite:///project.db
- Run the program and select the Customer option
$ python3 project.py
Invoicing System
Invoice
> Customer
Product
Exit
- The menu is intuitive and you can just select the option you want
Customer Screen
> List Customers
Add new Customer
Delete a Customer
Return
- Run the program and select the Product option
$ python3 project.py
Invoicing System
Invoice
Customer
> Product
Exit
- The menu is intuitive and you can just select the option you want
Product Screen
> List
Add
Delete
Return
*Before you start, make sure that you have created at least one Customer and one Product to generate the invoice
- Run the program and select the Generate Invoice option
$ python3 project.py
Invoice Screen
> Generate Invoice
List Invoices
Return
- Type the customer ID to create your invoice.
Eg.
+----+------------------+--------------------------+-------------------+
| Id | Name | Address | Phone |
+----+------------------+--------------------------+-------------------+
| 1 | Customer Company | Customer Company Address | +55 11 1234 12345 |
+----+------------------+--------------------------+-------------------+
Type the customer id to add in your invoice: 1
- Type the product ID to create your invoice.
Eg.
+----+-------------------------+-----------------------------+-----------+
| Id | Name | Description | Price |
+----+-------------------------+-----------------------------+-----------+
| 1 | Application Development | Development of a python app | $ 1000.00 |
+----+-------------------------+-----------------------------+-----------+
Type the product id to add in your invoice: 1
- Type the Product amount and the invoice Due Date Eg.
Product amount:
Due Date(DD/M/YY): 20/06/2022
After that, the file invoice.pdf will be created.
Expectation | Description |
---|---|
good outcome | As a freelancer or company that provides a service. I want to run the program, type needed information and generate a pdf invoice |
better outcome | As a freelancer or company that provides a service. I want to run the program, type needed information and generate a pdf invoice with data persistence |
best outcome | As a freelancer or company that provides a service. I want to run the program type needed information and generate a pdf invoice with data persistence, list invoice history, add or delete Customers and Products. |
- Create the project idea and design
- Menu
- Read TerminalMenu documentation
- Create command line menu
- Models / Database
- Read SQLAlchemy documentation
- Create models (Customer, Product and Invoice)
- Config
- Read ConfigParser documentation
- Add function "create_config" to generate the config.ini file
- CRUD
- Read PrettyTable documentation
- Create functions to list tables for Customer, Product and Invoice
- Create functions to add Customer, Product and Invoice
- Create functions to remove Customer, Product
- Invoice creation
- Read borb.pdf documentation
- Create functions header, body and items
- Write Tests
- Write README.md
- Record and upload the youtube video.
- I really thank the CS50 Team for providing the content and the ways to learn this course.
- Thank you professor David C. Malan for all the lectures. It was amazing!!!