diff --git a/check_appointments_schema.php b/check_appointments_schema.php deleted file mode 100644 index e600f56..0000000 --- a/check_appointments_schema.php +++ /dev/null @@ -1,6 +0,0 @@ -query("DESCRIBE appointments"); -$columns = $stmt->fetchAll(PDO::FETCH_COLUMN); -print_r($columns); diff --git a/check_data.php b/check_data.php deleted file mode 100644 index e234a30..0000000 --- a/check_data.php +++ /dev/null @@ -1,20 +0,0 @@ -query("SELECT id, name FROM patients LIMIT 1")->fetch(PDO::FETCH_ASSOC); -// Fetch one doctor (employee with position 'Doctor') -$doctor = $db->query(" - SELECT e.id, e.name_en - FROM employees e - JOIN positions p ON e.position_id = p.id - WHERE UPPER(p.name_en) = 'DOCTOR' - LIMIT 1")->fetch(PDO::FETCH_ASSOC); - -if ($patient && $doctor) { - echo "Found Patient: " . $patient['name'] . " (ID: " . $patient['id'] . ")\n"; - echo "Found Doctor: " . $doctor['name_en'] . " (ID: " . $doctor['id'] . ")\n"; -} else { - echo "Could not find patient or doctor.\n"; -} \ No newline at end of file diff --git a/check_details_schema.php b/check_details_schema.php deleted file mode 100644 index b24167e..0000000 --- a/check_details_schema.php +++ /dev/null @@ -1,16 +0,0 @@ -query("SHOW CREATE TABLE $table"); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - echo $row['Create Table'] . "\n\n"; - } catch (Exception $e) { - echo "Table $table not found: " . $e->getMessage() . "\n\n"; - } -} - diff --git a/check_doctor_holidays_table.php b/check_doctor_holidays_table.php deleted file mode 100644 index fa4fd71..0000000 --- a/check_doctor_holidays_table.php +++ /dev/null @@ -1,19 +0,0 @@ -query("SHOW COLUMNS FROM doctor_holidays"); - if ($result) { - $columns = $result->fetchAll(PDO::FETCH_ASSOC); - echo "Table 'doctor_holidays' exists with columns:\n"; - foreach ($columns as $col) { - echo "- " . $col['Field'] . " (" . $col['Type'] . ")\n"; - } - } else { - echo "Table 'doctor_holidays' does not exist.\n"; - } -} catch (PDOException $e) { - echo "Error: " . $e->getMessage() . "\n"; -} - diff --git a/check_employees_schema.php b/check_employees_schema.php deleted file mode 100644 index 6a85ddc..0000000 --- a/check_employees_schema.php +++ /dev/null @@ -1,8 +0,0 @@ -query("DESCRIBE employees"); -$columns = $stmt->fetchAll(PDO::FETCH_COLUMN); -echo "Columns in employees table:\n"; -print_r($columns); -?> \ No newline at end of file diff --git a/check_nurses_schema.php b/check_nurses_schema.php deleted file mode 100644 index 0b48c62..0000000 --- a/check_nurses_schema.php +++ /dev/null @@ -1,6 +0,0 @@ -query("DESCRIBE nurses"); -$columns = $stmt->fetchAll(PDO::FETCH_COLUMN); -print_r($columns); diff --git a/check_pharmacy_schema.php b/check_pharmacy_schema.php deleted file mode 100644 index f317829..0000000 --- a/check_pharmacy_schema.php +++ /dev/null @@ -1,24 +0,0 @@ -query("DESCRIBE $table"); - $columns = $stmt->fetchAll(PDO::FETCH_ASSOC); - foreach ($columns as $col) { - echo "{$col['Field']} ({$col['Type']}) -"; - } - } catch (PDOException $e) { - echo "Error describing $table: " . $e->getMessage() . " -"; - } - echo " -"; -} - diff --git a/check_prices_schema.php b/check_prices_schema.php deleted file mode 100644 index 4a4c7d9..0000000 --- a/check_prices_schema.php +++ /dev/null @@ -1,16 +0,0 @@ -query("SHOW CREATE TABLE $table"); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - echo $row['Create Table'] . "\n\n"; - } catch (Exception $e) { - echo "Table $table not found or error: " . $e->getMessage() . "\n\n"; - } -} - diff --git a/check_schema_billing.php b/check_schema_billing.php deleted file mode 100644 index 9494a4c..0000000 --- a/check_schema_billing.php +++ /dev/null @@ -1,16 +0,0 @@ -query("SHOW CREATE TABLE $table"); - $row = $stmt->fetch(PDO::FETCH_ASSOC); - echo $row['Create Table'] . "\n\n"; - } catch (Exception $e) { - echo "Table $table not found or error: " . $e->getMessage() . "\n\n"; - } -} - diff --git a/db/migrations/20260329_change_payment_method_type.sql b/db/migrations/20260329_change_payment_method_type.sql new file mode 100644 index 0000000..57ee251 --- /dev/null +++ b/db/migrations/20260329_change_payment_method_type.sql @@ -0,0 +1 @@ +ALTER TABLE bills MODIFY COLUMN payment_method VARCHAR(50) DEFAULT 'Cash'; \ No newline at end of file diff --git a/includes/actions.php b/includes/actions.php index f8794ae..e89fe71 100644 --- a/includes/actions.php +++ b/includes/actions.php @@ -386,6 +386,15 @@ $sick_leave_start_date = !empty($_POST['sick_leave_start_date']) ? $_POST['sick_ $_SESSION['flash_message'] = __('delete') . ' ' . __('successfully'); $redirect = true; } + } elseif ($_POST['action'] === 'mark_paid') { + $bill_id = $_POST['bill_id'] ?? 0; + $payment_method = $_POST['payment_method'] ?? 'Cash'; + if ($bill_id > 0) { + $stmt = $db->prepare("UPDATE bills SET status = 'Paid', payment_method = ? WHERE id = ?"); + $stmt->execute([$payment_method, $bill_id]); + $_SESSION['flash_message'] = __('mark_as_paid') . ' ' . __('successfully'); + $redirect = true; + } } elseif ($_POST['action'] === 'create_bill') { $patient_id = $_POST['patient_id'] ?? ''; $visit_id = $_POST['visit_id'] ?: null; diff --git a/includes/pages/billing.php b/includes/pages/billing.php index d7d90b9..147e579 100644 --- a/includes/pages/billing.php +++ b/includes/pages/billing.php @@ -92,10 +92,23 @@ $bills = $stmt->fetchAll();