A comprehensive desktop application for managing pharmacy operations, built with Java Swing and MySQL. This system provides role-based access control for administrators and pharmacists with complete inventory management, sales processing, and reporting capabilities.
- User Management: Add, view, update, and delete system users
- Role Assignment: Assign Admin or Pharmacist roles
- Sales Monitoring: View all bills and transactions
- System Dashboard: Centralized control panel
- Inventory Management: Add, update, view, and delete medicines
- Sales Processing: Complete point-of-sale system with cart functionality
- Bill Generation: Automated PDF invoice creation
- Stock Monitoring: Track out-of-stock items and low inventory
- Profile Management: View and manage personal information
- FIFO Inventory: First-expiry-first-out automatic stock rotation
- Real-time Search: Dynamic medicine search and filtering
- PDF Receipts: Professional invoice generation with auto-print
- Data Validation: Comprehensive input validation and error handling
- Secure Authentication: Role-based login system
- Frontend: Java Swing
- Backend: Java SE
- Database: MySQL 8.0+
- PDF Generation: iText PDF
- Date Components: JCalendar
- Database Connectivity: JDBC
Before running this application, ensure you have:
- Java Development Kit (JDK) 17 or higher
- MySQL Server 8.0 or higher
- MySQL Workbench (optional, for database management)
- An IDE (IntelliJ IDEA, Eclipse, or NetBeans)
git clone <repository-url>
cd pharmacy-management-system- Start your MySQL server
- Create a new database:
CREATE DATABASE gestionpharmacie;- Import the database schema:
mysql -u root -p gestionpharmacie < gestionpharmacie.sqlUpdate the database connection details in the source files:
// In Connect() methods, update these values:
connection = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/gestionpharmacie",
"your_username",
"your_password"
);Ensure these JAR files are in your classpath:
mysql-connector-j-8.2.0.jarjcalendar-1.4.jaritextpdf-5.5.9.jar
# Compile
javac -cp ".:lib/*" src/**/*.java
# Run
java -cp ".:lib/*:src" Main- Execute the
Main.javafile - The login screen will appear
- Use default credentials:
- Username:
admin - Password:
admin - Role: Administrator
- Username:
- Login as admin using default credentials
- Create pharmacist accounts through "Add User"
- Add initial medicine inventory
- System is ready for operations
- Add Users: Navigate to "Add User" to create new accounts
- View Users: Monitor all system users and their details
- View Bills: Track all sales transactions
- System Management: Oversee overall system operations
- Add Medicine: Input new medicine inventory with expiry dates
- Update Medicine: Modify existing medicine information
- Sell Medicine: Process customer purchases with automatic billing
- View Stock: Monitor current inventory levels
- Generate Bills: Create PDF receipts for transactions
pharmacy-management-system/
βββ src/
β βββ Main.java # Application entry point
β βββ Login/
β β βββ User.java # Authentication system
β βββ Admin/
β β βββ Dashboard.java # Admin dashboard
β β βββ Add_user.java # User creation
β β βββ view_user.java # User management
β β βββ Update_user.java # User updates
β β βββ bills.java # Bill viewing
β βββ Pharmacist/
β βββ Pharmacist.java # Pharmacist dashboard
β βββ Add_Medicine.java # Inventory addition
β βββ update_medicine.java # Inventory updates
β βββ View_Medicine.java # Inventory viewing
β βββ Sell_Medicine.java # Sales processing
β βββ bill.java # Bill management
β βββ OutofStock.java # Stock monitoring
β βββ profile.java # Profile management
βββ lib/ # External libraries
βββ gestionpharmacie.sql # Database schema
βββ README.md
- users: System user management
- medicine: Medicine inventory with batch tracking
- out_of_stock: Depleted inventory tracking
- bill: Sales transaction records
- Medicine table uses composite key (MedicineID, ExpiryDate) for batch management
- Bills are linked to users through foreign key relationship
- Out-of-stock items maintain medicine references
- Verify MySQL server is running
- Check connection credentials
- Ensure database exists and schema is imported
- Check if output directory exists
- Verify write permissions
- Ensure iText library is properly included
- Verify all image resources are available
- Check Swing compatibility with your Java version
- Ensure proper classpath configuration
- Default admin credentials should be changed immediately
- Implement proper password policies
- Consider encrypting stored passwords
- Regular database backups recommended
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Web-based interface
- Barcode scanning integration
- Advanced reporting and analytics
- Email notifications for low stock
- Multi-location support
- Mobile application
- Cloud database integration
This project is licensed under the MIT License - see the LICENSE file for details.
- Developer: [Your Name]
- Project Type: Academic/Commercial Project
- Version: 1.0.0
For support and questions:
- Create an issue in the repository
- iText team for PDF generation capabilities
- MySQL team for the reliable database system
- Java Swing community for GUI components
- JCalendar library contributors
Note: This system is designed for educational and small-scale commercial use. For enterprise deployment, additional security measures and scalability considerations should be implemented.