Create an accountant folder within the clinic management system to manage financial-related functionalities such as invoices, payments, salary management, and reports. The system already has existing folders for admin, doctors, patients, and team. This new accountant module should enable accountants to handle financial tasks related to patient billing, payments, employee salary management, and financial reporting. Below is the structure of the required files for the accountant module:

/accountant/
login.php // Accountant login page
logout.php // Accountant logout functionality
dashboard.php // Accountant dashboard displaying financial data
manage_invoices.php // View, edit, and delete invoices
create_invoice.php // Create new invoice for patient billing
view_invoice.php // View individual invoice details
generate_report.php // Generate financial reports (monthly, annual)
manage_payments.php // Track and manage patient payments
manage_salaries.php // Track and manage employee salaries
add_salary.php // Add salary for an employee
edit_salary.php // Edit existing salary details
delete_salary.php // Delete a salary record
view_salaries.php // View all salaries of employees
accountant_profile.php // Accountant profile page for updating details
The accountant module should seamlessly integrate with existing database connections and share financial data with the admin. It should also provide user-friendly interfaces and be responsive across devices. and use this info (a. Patients
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each patient.
name (VARCHAR): Full name of the patient.
age (INT): Age of the patient.
gender (ENUM('Male', 'Female', 'Other')): Gender of the patient.
phone (VARCHAR): Phone number of the patient.
email (VARCHAR): Email address of the patient.
medical_history (TEXT): Medical history of the patient.
date_of_birth (DATE): Date of birth of the patient.
registration_date (DATE): Date when the patient was registered.
registration_datetime (DATETIME): Date and time when the patient was registered.
status (ENUM): Current status of the patient (e.g., 'Initial Consultation', 'Treatment in Progress').
b. Health Records
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each health record.
patient_id (INT, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with this health record.
blood_pressure (VARCHAR): Blood pressure reading.
weight (DECIMAL): Weight of the patient.
bmi (DECIMAL): Body Mass Index of the patient.
cholesterol (DECIMAL): Cholesterol level of the patient.
prescription (TEXT): Prescriptions given to the patient.
treatment_progress (TEXT): Notes on the treatment progress.
record_date (DATE): Date of the health record.
c. Admins
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each admin.
username (VARCHAR): Admin's username.
password (VARCHAR): Hashed password for the admin.
email (VARCHAR): Email address of the admin.
d. Patient Logins
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each patient login.
patient_id (INT, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with this login.
username (VARCHAR): Username for patient login.
password (VARCHAR): Hashed password for patient login.
e. Invoices
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each invoice.
patient_id (INT NOT NULL, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with this invoice.
service_name (VARCHAR(255) NOT NULL): Name of the service rendered.
service_description (TEXT): Description of the service.
cost (DECIMAL(10, 2) NOT NULL): Cost of the service.
tax_rate (DECIMAL(5, 2) DEFAULT 0): Tax rate applied to the service.
discount (DECIMAL(5, 2) DEFAULT 0): Discount applied to the service.
total_amount (DECIMAL(10, 2) NOT NULL): Total amount due after tax and discount.
invoice_date (DATE DEFAULT CURRENT_DATE): Date of the invoice.
notes (TEXT): Additional notes for the invoice.
f. Services
service_id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each service.
service_name (VARCHAR(255) NOT NULL): Name of the service.
service_price (DECIMAL(10, 2) NOT NULL): Price of the service.
service_description (TEXT): Description of the service.
created_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP): Timestamp when the service was created.
updated_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP): Timestamp when the service was last updated.
g. Invoice Services
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each entry in the invoice services table.
invoice_id (INT NOT NULL, FOREIGN KEY REFERENCES invoices(id)): ID of the associated invoice.
service_id (INT NOT NULL, FOREIGN KEY REFERENCES services(service_id)): ID of the associated service.
service_name (VARCHAR(255) NOT NULL): Name of the service rendered.
cost (DECIMAL(10, 2) NOT NULL): Cost of the service rendered.
h. Comments
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each comment.
patient_id (INT NOT NULL, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with the comment.
sender (ENUM('patient', 'doctor', 'admin') NOT NULL): Sender of the comment, which can be 'patient', 'doctor', or 'admin'.
message (TEXT NOT NULL): The message or comment content.
timestamp (DATETIME DEFAULT CURRENT_TIMESTAMP): Date and time the comment was made.
parent_id (INT NULL DEFAULT NULL): ID of the parent comment (for threaded conversations), if applicable.
i. Doctor-Patient
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each doctor-patient relationship.
doctor_id (INT NOT NULL, FOREIGN KEY REFERENCES doctors(id)): ID of the associated doctor.
patient_id (INT NOT NULL, FOREIGN KEY REFERENCES patients(id)): ID of the associated patient.
UNIQUE (doctor_id, patient_id): Ensures a unique doctor-patient pair.
SQL Update for Doctor-Patient Table
The SQL statement ALTER TABLE doctor_patient ADD CONSTRAINT fk_doctor FOREIGN KEY (doctor_id) REFERENCES doctors(id) ON DELETE CASCADE ON UPDATE CASCADE; ensures that any deletion or update of a doctor in the doctors table will automatically cascade to the doctor_patient table, maintaining referential integrity.
j. Employees
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each employee.
name (VARCHAR(255) NOT NULL): Full name of the employee.
role (ENUM('admin', 'doctor', 'staff') NOT NULL): Role of the employee, which can be 'admin', 'doctor', or 'staff'.
email (VARCHAR(255) NOT NULL UNIQUE): Email address of the employee, ensuring it is unique.
phone (VARCHAR(20)): Phone number of the employee.
department (VARCHAR(100)): Department where the employee works.
date_of_joining (DATE): The date when the employee joined the organization.
status (ENUM('active', 'inactive') DEFAULT 'active'): Employment status, either 'active' or 'inactive', with 'active' as the default.
username (VARCHAR(100) NOT NULL UNIQUE): Username for employee login, ensuring it is unique.
password (VARCHAR(255) NOT NULL): Hashed password for the employee.
created_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP): Timestamp when the employee record was created.
updated_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP): Timestamp when the employee record was last updated.
profile_picture (VARCHAR(255) DEFAULT 'default_profile.png'): Profile picture of the employee.
specialization (VARCHAR(255) DEFAULT NULL): Specialization of the employee.
k. Doctors
id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each doctor.
employee_id (INT NOT NULL, FOREIGN KEY REFERENCES employees(id)): ID of the associated employee record.
department (VARCHAR(100) DEFAULT NULL): Department where the doctor works.
date_of_joining (DATE DEFAULT NULL): The date when the doctor joined the organization.
status (ENUM('active', 'inactive') DEFAULT 'active'): Employment status of the doctor.
profile_picture (VARCHAR(255) DEFAULT 'default_profile.png'): Profile picture of the doctor.
SQL Updates for Doctors Table
The SQL statement ALTER TABLE doctors ADD COLUMN date_of_joining DATE DEFAULT NULL; adds a date_of_joining column to the doctors table, allowing the storage of the date when a doctor joined the organization.
The SQL statement ALTER TABLE doctors ADD COLUMN department VARCHAR(100) DEFAULT NULL; adds a department column to the doctors table, enabling the specification of the department where the doctor works.) and these path (/your_web_root/
│
├── admin_dashboard.php    // Admin dashboard displaying patient list
├── admin_login.php              // Admin login page
├── admin_logout.php             // Admin logout functionality
├── admin_report.php             
├── create_patient.php           // Page for creating a new patient
├── view_patient.php             // Page for viewing patient details
├── edit_patient.php             // Page for editing patient information
├── delete_patient.php           // Page for deleting a patient
├── add_health_record.php        // Page for adding health records for a patient
├── edit_health_record.php       // Page for editing health records
├── manage_comments.php       // Page for managing comments
├── db_connect.php               // Database connection file
├── index.php                    // Index home 
├── update_patient_status.php     // Update patient status

├── doctors/
│   ├── login.php                // Doctor login page
│   ├── logout.php               // Doctor logout functionality
│   ├── dashboard.php             // Doctor dashboard
│   ├── view_patient.php         // Doctor view patient page
│   ├── edit_health_record.php    // Doctor edit health record page
│   ├── add_health_record.php     // Doctor add health record page
│   ├── delete_health_records.php        // delete health records page
│   └── manage_doctors.php        // Admin manage doctors page
│   └── add_doctor.php        // add new doctor

│
├── patients/
│   ├── delete_comment.php        // Delete a patient comment
│   ├── patient_dashboard.php     // Patient dashboard
│   ├── patient_login.php         // Patient login page
│   ├── send_comment.php          // Send a comment from patient
│   └── patient_logout.php        // Patient logout functionality
│
├── invoice/
│   ├── index.php                 // Page for generating an invoice
│   ├── services.php              // Page for managing services
│   ├── create_invoice.php        // Page for creating a new invoice
│   ├── edit_invoice.php          // Page for editing an invoice
│   ├── print_invoice.php         // Page for printing an invoice
│   └── view_invoice.php          // Page for viewing an invoice
├── team/
│   ├── add_employee.php          // Page for adding emloyee
│   ├── delete_employee.php          // Page for deleting employee
│   ├── edit_employee.php        // Page for editing employee
│   ├── manage_employees.php          // Page for managing employee
│   ├── view_employee.php         // Page for viewing employee) , don't type style now, and type important codes and make it there relationship between tables and type full guides