This is a simple pharmacy management application developed in Java using JavaFX for the front-end and MySQL for the back-end database. The application allows for managing the pharmacy system with various features such as adding drugs, searching for drugs, viewing all drugs and their suppliers, and viewing purchase history with detailed information.
- Add Drugs: Allows users to add new drugs to the system.
- Search for a Drug: Provides functionality to search for a specific drug.
- View All Drugs and Their Suppliers: Displays a list of all drugs along with their suppliers.
- View Purchase History: Shows the purchase history for each drug with detailed information on the time, date, and buyer.
-
Data Structures:
- The collection of drugs is represented using
ObservableList<Drug>
(seeInventoryController.java
).
- The collection of drugs is represented using
-
Drug Management:
- Addition: Drugs are added through the
addButtonClicked
method using form inputs (seeInventoryController.java
). - Removal and Selection: Drugs can be selected and managed using TableView (see
initialize
andloadDrugData
methods inInventoryController.java
).
- Addition: Drugs are added through the
-
Purchase History:
- The purchase history for each drug is stored in the
Purchase
table and is managed using SQL queries (seeaddPurchaseToDatabase
andprocessDrugSale
methods inInventoryController.java
).
- The purchase history for each drug is stored in the
-
Suppliers:
- Each drug is linked to a supplier using a
Map<Drug, List<Supplier>>
structure (seeaddSupplierToDatabase
method inInventoryController.java
).
- Each drug is linked to a supplier using a
-
Techniques Used:
- Iterators: Used to iterate through drug lists (see
searchButtonClicked
method). - Recursion: Implemented in search functionality.
- Stack and Queue: Used to manage drug sales and purchase history (see
processDrugSale
method).
- Iterators: Used to iterate through drug lists (see
-
Sales Tracking:
- Sales are tracked using a sales report generated and stored in files (see commented
writeToFile
method).
- Sales are tracked using a sales report generated and stored in files (see commented
-
Suppliers and Customers:
- Information about suppliers and customers is stored using appropriate data structures (see
addSupplierToDatabase
andaddCustomerToDatabase
methods).
- Information about suppliers and customers is stored using appropriate data structures (see
- Java Development Kit (JDK) version 22
- JavaFX
- MySQL
- IntelliJ IDEA (recommended for development)
- Clone the Repository:
git clone https://github.com/yeli-bigman/pharmaApp.git cd pharmaApp
- Create MySQL Database:
-
Open a command prompt and create a mysql database
mysql -u [username] -p creat database pharmacyDB; use pharmacyDB; exit
-
run the following command to create the MySQL database and import the initial database schema:
cmd /c "mysql -u [mysql_username] -p pharmacyDB < src\main\resources\databaseBackupDump\pharmacy_init_DB.sql"
-
Update Database Configuration:
After creating the MySQL database and importing the database, ensure to update the user and password in
src/main/java/com/example/pharmaapp/database/sql/dbConnection.java
. -
Run the Application:
Open IntelliJ IDEA, import the project, and run the Main class.