Tuesday, 28 January 2025

Employee Leave Management System in PHP using MySQL

Employee Leave Management System in PHP using MySQL


Introduction


An Employee Leave Management System is a powerful tool that simplifies the leave application and management process within an organization. It eliminates the need for manual tracking, paperwork, and inefficiencies by providing a digital platform for employees to apply for leave and administrators to manage requests seamlessly. This system ensures transparency, reduces administrative overhead, and improves the overall experience for both employees and management.





Features of the Employee Leave Management System


  1. Admin Dashboard: Provides an overview of total employees, departments, leave types, and leave statistics such as pending, approved, and rejected leave applications.
  2. Department Management: Add, edit, and manage departments with active/inactive status.
  3. Employee Management: Add, update, and manage employee details, including activation or deactivation of employee accounts.
  4. Leave Type Management: Define leave types such as casual leave, sick leave, and maternity leave with configurable allowances.
  5. Leave Application Processing: Admins can view, approve, reject, and add remarks to employee leave applications.
  6. Employee Dashboard: Allows employees to track their leave balance, view leave history, and stay updated on the status of their applications.
  7. Notifications: Real-time updates for leave application status changes and important announcements.
  8. Leave Balance Management: Tracks leave entitlements and deductions for each employee.
  9. Secure Login System: Role-based access for admins and employees with password encryption.
  10. Responsive Design: Fully optimized for use on desktops, tablets, and mobile devices.



Technologies Used


This Employee Leave Management System is built using the following web technologies:

  • Backend: PHP 8 for server-side scripting and MySQL for database management.
  • Frontend: HTML, CSS, and JavaScript for creating a responsive and user-friendly interface.
  • Frameworks/Libraries:
    • Bootstrap 5 for responsive design and styling.
    • jQuery for dynamic interactions and AJAX functionality.
    • CKEditor for rich text editing in leave descriptions.
  • Security: Password encryption using PHP's password hashing functions and secure session management.



Why Use This System?


  • Efficiency: Automates the entire leave management process, reducing manual errors and saving time.
  • Transparency: Employees can track their leave status in real-time, fostering trust and accountability.
  • Customization: Flexible leave types, allowances, and status updates to suit any organization's policies.
  • Cost-Effective: Minimizes administrative costs associated with traditional leave management methods.
  • Data Security: Ensures sensitive employee and leave data is securely stored and accessed.



Benefits of the System


  1. Simplified Leave Application: Employees can easily apply for leave without the need for paperwork or manual follow-ups.
  2. Better Decision-Making: Administrators have access to leave statistics and employee availability, making resource planning easier.
  3. Improved Productivity: With streamlined processes, both employees and administrators can focus on their core responsibilities.
  4. Scalability: The system can grow with the organization, accommodating more employees and leave types as needed.
  5. Compliance: Helps organizations adhere to labor laws by maintaining accurate leave records.





Database Structure


Below is a simplified structure of the database used in the Employee Leave Management System:

  • elms_admin:
    • admin_id (Primary Key)
    • admin_user_name
    • admin_password
  • elms_department:
    • department_id (Primary Key)
    • department_name
    • added_on
    • updated_on
  • elms_leave_type:
    • leave_type_id (Primary Key)
    • leave_type_name
    • added_on
    • updated_on
  • elms_employee:
    • employee_id (Primary Key)
    • employee_unique_code
    • employee_first_name
    • employee_last_name
    • employee_email
    • employee_password
    • employee_gender
    • employee_birthdate
    • employee_department (Foreign Key)
    • employee_address
    • employee_city
    • employee_country
    • employee_mobile_number
    • employee_status
  • elms_leave:
    • leave_id (Primary Key)
    • employee_id (Foreign Key)
    • leave_type (Foreign Key)
    • leave_start_date
    • leave_end_date
    • leave_description
    • leave_admin_remark
    • leave_status (Pending, Admin Read, Approved, Rejected)
    • leave_apply_date
    • leave_admin_remark_date



Download the Source Code


You can download the complete source code of this Employee Leave Management System from the link below:




Conclusion


The Employee Leave Management System is a practical and efficient solution for organizations of all sizes. It simplifies leave management, ensures transparency, and saves time for both employees and administrators. By implementing this system, organizations can enhance productivity, ensure compliance, and create a better work environment. Start using the Employee Leave Management System today and take a step towards modernizing your workforce management!

Tuesday, 17 September 2024

Generate a Dynamic QR Code in PHP

Generate a Dynamic QR Code in PHP

Introduction


In today's digital age, QR codes have become a ubiquitous tool for quickly sharing information, URLs, contact details, and more. They provide a fast and easy way to encode data in a scannable format that smartphones and other devices can read. Whether it's for marketing campaigns, product packaging, or event tickets, generating dynamic QR codes is an essential feature for many web applications.

n this article, we’ll walk you through how to generate a dynamic QR code in PHP using the powerful Endroid QR code library. With step-by-step guidance, you’ll learn how to create a simple PHP application that generates QR codes based on user input.

Let’s dive into it!

Step 1: Setting Up the Project


To get started, you'll need to set up a PHP environment. You can use tools like XAMPP or MAMP to run a local server. Once your environment is ready, create a new project folder and open it in your favorite code editor.

Make sure you have Composer installed, as we’ll be using it to manage our dependencies.

Step 2: Install the Endroid QR Code Library


We’ll be using the Endroid/qr-code package to generate QR codes in PHP. This library offers extensive customization options for generating QR codes with different sizes, colors, and error correction levels.

To install the package, run the following command in your project directory:

	
		composer require endroid/qr-code
	

This command will download and install the QR code library into your project’s vendor folder.

Step 3: Create the HTML Form


	
		<form method="post">
			<div class="mb-3">
				<label>Enter Content</label>
				<input type="text" name="content" class="form-control" />
			</div>
			<div class="mb-3">
				<input type="submit" name="create" class="btn btn-primary" value="Generate" />
			</div>
			<?php echo $image_code; ?>
		</form>
	

This form includes:

  • A text input field for entering the content.
  • A submit button to trigger the QR code generation.
  • A placeholder to display the generated QR code.




Step 4: Handle Form Submission and Generate QR Code


Next, we’ll write the PHP script that processes the form data, generates the QR code, and displays it to the user. Open your index.php file and add the following code:

index.php
	
	<?php

	require 'vendor/autoload.php';

	use Endroid\QrCode\QrCode;
	use Endroid\QrCode\Writer\PngWriter;

	$image_code = '';

	if(isset($_POST['create'])){
		if($_POST['content'] !== ''){
			$temporary_directory = 'temp/';
			$file_name = md5(uniqid()) . '.png';
			$file_path = $temporary_directory . $file_name;

			$qr_Code = new QrCode(trim($_POST['content']));
			$qr_Code->setSize(300);

			$writer = new PngWriter();
			$result = $writer->write($qr_Code);

			$result->saveToFile($file_path);
			$image_code = '<div class="text-center"><img src="'.$file_path.'" /></div>';
		}
	}

	?>
	

This script does the following:

  • Includes the Endroid QR code library using Composer’s autoload.php.
  • Captures the form input using the $_POST array.
  • Generates a unique file name for the QR code image.
  • Uses the QrCode class to create the QR code with the user’s content.
  • Saves the generated QR code as a PNG file in the temp/ folder.
  • Displays the QR code on the page after it’s generated.

Step 5: Display the Generated QR Code


After the form is submitted and the QR code is generated, it will be displayed below the form. The image is dynamically loaded from the temporary folder, allowing users to see their custom QR code based on the content they entered.

You can try generating QR codes for different types of content, such as URLs, text, or even custom messages. The flexibility of the Endroid library allows you to tweak various aspects of the QR code, such as its size and appearance.

Step 6: Run the Project


To see the QR code generator in action:

  1. Open the project in your browser by navigating to the local server URL, like http://localhost/your-project-folder/index.php.
  2. Enter some content into the form—this could be a URL like https://www.example.com or any custom text.
  3. Click the ‘Generate’ button, and the page will refresh, displaying the dynamically generated QR code.

You can scan the QR code using any QR code scanner or your smartphone to see the content it represents.

Conclusion


Congratulations! You’ve just learned how to generate a dynamic QR code in PHP using the Endroid library. This process can be extremely useful in building web applications that require QR code functionality, such as event registrations, contact sharing, and more.

Feel free to expand this project by adding more customization, such as setting colors, error correction levels, or even integrating with databases to store generated QR codes.

We hope this guide was helpful. Stay tuned for more PHP tutorials, and don’t forget to share your thoughts in the comments below!



Friday, 6 September 2024

PHP MySQL Point of Sale (POS) System with Full Source Code

PHP MySQL Point of Sale (POS) System with Full Source Code

The PHP MySQL Point of Sale (POS) System is a powerful, flexible, and easy-to-use application designed to meet the needs of small to medium-sized restaurants, cafes, and retail stores. This system helps streamline operations by providing a comprehensive platform to manage orders, users, inventory, and more. Built using PHP and MySQL, this POS system is an ideal solution for businesses looking for a customizable and scalable system with full source code available.

Whether you’re running a restaurant or a cafe, the system is designed to optimize the point-of-sale experience, offering seamless order processing and user management, along with detailed analytics to help business owners track performance.

Key Features of the PHP MySQL POS System


1. Installation of POS System


The system comes with a straightforward installation process. With just a few clicks, users can get the system up and running on their server. This user-friendly installation ensures minimal setup time.

2. Auto Create Database


During the installation process, the system automatically generates the necessary database tables and structure. This eliminates the need for manual database creation, making the setup process even smoother.

3. Create Admin User


A secure feature that allows the creation of an admin user during setup. The admin has full control over the system, from managing orders to overseeing user roles and system settings.

4. Set Up Restaurant or Cafe POS System


Whether you're running a restaurant or cafe, the system is tailored to your specific needs. The setup process lets you configure items, categories, and pricing, making it easy to get started with your business operations.





5. User Management


Admins can manage user roles, such as cashier or manager, with varying levels of access. This feature ensures that only authorized personnel have access to sensitive sections of the system.

6. Item Category Management


Keep your inventory organized by creating and managing categories for items, such as food, beverages, or merchandise. This makes it easier to track stock and streamline the ordering process.

7. Item Management


Manage items in your inventory with ease. You can add, update, and remove items, set pricing, and even attach them to specific categories for better organization.

8. User Profile


Every user has their own profile where they can update personal information and view order history. This adds a personalized experience for employees or customers interacting with the system.

9. Change Password


Users have the ability to securely change their passwords through the system’s interface. This enhances security by allowing users to update credentials regularly.

10. Create Order


The system enables efficient order creation, allowing users to quickly input customer orders and add items to the cart. The 'Create Order' feature ensures smooth transaction processing.

11. Order Management


The system allows you to view, manage, and update orders as needed. Admins can track completed orders, pending orders, and adjust details where necessary, ensuring efficient order handling.

12. Analytics


Gain insights into business performance through detailed analytics. Track daily sales, total revenue, and customer order trends. This feature helps you make data-driven decisions to grow your business.

This PHP MySQL POS System is a full-fledged solution that covers all aspects of order management, inventory control, and user administration. With its open-source code, you can further customize the system to meet your specific business needs.

Video Demo of PHP MySQL POS System








Monday, 22 July 2024

Efficient Task Management System in PHP with Source Code

Efficient Task Management System in PHP with Source Code

1. Introduction


The Task Management System in PHP is a web-based application designed to manage tasks efficiently within an organization. It enables team managers and other associated individuals to assign, edit, and delete tasks in a streamlined manner. This system is built using PHP and MySQL, making it robust and scalable for any organizational need.

2. Objectives


  • To provide an efficient task management solution for organizations.
  • To reduce the chances of miscommunication and errors in task assignments.
  • To streamline the process of task tracking and status updates.
  • To improve productivity and time management within the organization.

3. System Overview


The Task Management System consists of two main modules: Admin and User. Each module has specific functionalities that contribute to the overall efficiency of the system.

Admin Module:


  • Manage Departments: Add, delete, or edit department information.
  • Manage Users: Register new employees, provide login credentials, and edit or delete user information.
  • Assign Tasks: Assign tasks to users with detailed descriptions.
  • Update Task Status: Change the status of tasks to reflect their current state.

User Module:


  • User Login: Users log in using credentials provided by the admin.
  • View Assigned Tasks: Users can see the tasks assigned to them.
  • Assign Tasks: Users can assign tasks to other employees.
  • Update Task Status: Users can change the status of their tasks.
  • View Task History: Users can browse their task history.

4. System Design


The system design includes an Entity-Relationship (ER) diagram that outlines the database structure and relationships between different entities.

Efficient Task Management System in PHP with Source Code - Database





5. Database Schema


Tables:


task_admin


  • admin_id
  • admin_email
  • admin_password

task_department


  • department_id
  • department_name
  • department_status
  • department_added_on
  • department_updated_on

task_user


  • user_id
  • user_first_name
  • user_last_name
  • department_id
  • user_email_address
  • user_email_password
  • user_contact_no
  • user_date_of_birth
  • user_gender
  • user_address
  • user_status
  • user_image
  • user_added_on
  • user_updated_on

task_manage


  • task_id
  • task_title
  • task_creator_description
  • task_completion_description
  • task_department_id
  • task_user_to
  • task_status
  • task_added_on
  • task_updated_on

6. Implementation


The implementation involves setting up the database, creating the necessary tables, and developing the PHP scripts for various functionalities.

6.1 Installation


  1. Create the database and tables using the provided SQL scripts.
  2. Upload the PHP files to the server.
  3. Configure the database connection settings in the config.php file.
  4. Access the installation page to set up the initial admin user and other configurations.

6.2 Admin Functions


Add Department:



Edit Department:



Add User:



Edit User:



Add Task:



Edit Task:



6.3 User Functions


Login:



View Tasks:



Change Password:



7. Features


  • Task Assignment and Tracking: Efficiently assign tasks to employees and track their progress.
  • User Management: Manage user registration, login, and profile updates.
  • Department Management: Add, edit, and delete departments.
  • Task Status Updates: Update task statuses to reflect their current state.
  • History Tracking: View task history with date filters.

8. Future Enhancements


  • Notifications: Implement email or SMS notifications for task assignments and updates.
  • Reporting: Add reporting features to generate summaries and analytics of tasks.
  • Mobile Application: Develop a mobile app to allow users to manage tasks on the go.

9. Conclusion


The Task Management System in PHP is an effective solution for organizations to manage their tasks efficiently. By automating the task assignment and tracking processes, it reduces miscommunication and errors, ultimately improving productivity and time management.

10. References








Saturday, 22 June 2024

Building an Online Doctor Appointment System with Node.js, Express, and MongoDB

Building an Online Doctor Appointment System with Node.js, Express, and MongoDB

In this tutorial, we will walk you through the development of a comprehensive Online Doctor Appointment System. This system is designed to simplify the process of booking and managing doctor appointments for both healthcare providers and patients. By leveraging modern web technologies and a robust backend, this system ensures efficient management, secure authentication, and a seamless user experience.

Introduction


Why Build an Online Doctor Appointment System?


In today's fast-paced world, managing appointments manually can be both cumbersome and inefficient. An Online Doctor Appointment System offers a streamlined solution, enabling healthcare providers to manage their schedules effectively and allowing patients to book appointments with ease. This system helps in reducing no-show rates, improving patient satisfaction, and optimizing the utilization of healthcare resources.

Key Benefits


  1. Efficiency: Automates the appointment scheduling process, reducing administrative overhead.
  2. Accessibility: Patients can book appointments 24/7 from the comfort of their homes.
  3. Better Resource Management: Helps healthcare providers manage their schedules and patient load effectively.
  4. Reduced Waiting Times: Allows patients to see real-time availability and choose suitable slots, reducing waiting times.
  5. Enhanced Communication: Sends notifications and reminders to patients, improving engagement and adherence.




System Overview


The Online Doctor Appointment System consists of three main user roles: Admin, Doctor, and Patient. Each role has distinct functionalities tailored to their specific needs.

Admin Side


  • Admin Login using JWT Token: Secure authentication.
  • View Analytics Data: Dashboard showing system analytics.
  • Manage Doctor Data: Add, edit, enable, disable doctors.
  • View Patient Data: Access and manage patient details.
  • Manage Doctor Availability: Add, edit, delete doctor schedules.
  • Manage Appointments: View and update appointment details.
  • Profile Management: Admin can edit their profile.
  • Logout: Securely log out of the system.

Doctor Side


  • Doctor Login using JWT Token: Secure authentication.
  • View Appointments: Access appointments specific to the logged-in doctor.
  • Manage Appointments: Add comments and update appointment status.
  • Profile Management: Doctors can edit their profiles.
  • Logout: Securely log out of the system.

Patient Side


  • Patient Registration with Email Verification: New patients can register and verify their email.
  • Patient Login using JWT Token: Secure authentication.
  • View Doctor Availability: Check available slots for doctors.
  • Book an Appointment: Schedule an appointment with a doctor.
  • Manage Appointments: View, download, and manage their appointments.
  • Profile Management: Patients can edit their profiles.
  • Logout: Securely log out of the system.

Technologies Used


Server-Side


  • Node.js: A powerful JavaScript runtime that enables server-side scripting.
  • Express.js: A flexible Node.js web application framework for building robust APIs.
  • MongoDB: A NoSQL database known for its scalability and flexibility in managing large volumes of data.

Client-Side


  • Vanilla JavaScript: Used for client-side logic and interactivity.
  • jQuery: Simplifies HTML document traversal, event handling, and AJAX interactions.
  • jQuery DataTables: Enhances HTML tables with advanced interaction controls.
  • Bootstrap 5: A responsive and modern CSS framework for designing user-friendly interfaces.
  • HTML 5: Provides the structural foundation of the web pages.

Node.js Libraries


  • express: The core web application framework for handling HTTP requests and routing.
  • mongoose: An ODM (Object Data Modeling) library for MongoDB and Node.js.
  • jsonwebtoken: For creating and verifying JSON Web Tokens (JWT) for secure authentication.
  • joi: A powerful schema description language and data validator for JavaScript.
  • multer: Middleware for handling multipart/form-data, useful for file uploads.
  • bcrypt: A library to help hash passwords securely.
  • moment-timezone: For manipulating and formatting dates in different time zones.
  • nodemailer: A module for sending emails from Node.js applications.
  • puppeteer: A Node library that provides a high-level API to control headless Chrome or Chromium, useful for generating PDFs.




Conclusion


This tutorial covered the development of an Online Doctor Appointment System using Node.js, Express, and MongoDB. We explored user authentication, CRUD operations, PDF generation, email notifications, and more. By following these steps, you can build a robust and scalable appointment management system for healthcare providers.





Demo of Online Doctor Appointment Booking System