diff --git a/create_customer.php b/create_customer.php new file mode 100644 index 0000000..1e0dc81 --- /dev/null +++ b/create_customer.php @@ -0,0 +1,109 @@ +prepare($sql); + $stmt->execute([$name, $email, $phone, $address, $plan_id]); + header("Location: customers.php"); + exit; + } catch (PDOException $e) { + $errors[] = "Database error: " . $e->getMessage(); + } + } +} + +// Fetch plans for the dropdown +try { + $pdo = db(); + $stmt = $pdo->query("SELECT id, name FROM plans"); + $plans = $stmt->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $plans = []; + $errors[] = "Could not fetch plans."; +} + +?> + +
+

Create New Customer

+ + +
+
+ + New Customer Details +
+
+ +
+
    + +
  • + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + Cancel +
+
+
+
+ + diff --git a/create_invoice.php b/create_invoice.php new file mode 100644 index 0000000..ed83342 --- /dev/null +++ b/create_invoice.php @@ -0,0 +1,122 @@ +prepare($sql); + $stmt->execute([$customer_id, $plan_id, $amount, $status]); + header("Location: invoices.php"); + exit; + } catch (PDOException $e) { + $errors[] = "Database error: " . $e->getMessage(); + } + } +} + +// Fetch customers and plans for dropdowns +try { + $pdo = db(); + $customer_stmt = $pdo->query("SELECT id, name FROM customers ORDER BY name"); + $customers = $customer_stmt->fetchAll(PDO::FETCH_ASSOC); + $plan_stmt = $pdo->query("SELECT id, name FROM plans ORDER BY name"); + $plans = $plan_stmt->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $customers = []; + $plans = []; + $errors[] = "Could not fetch data for form."; +} + +?> + +
+

Create New Invoice

+ + +
+
+ + New Invoice Details +
+
+ +
+
    + +
  • + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + Cancel +
+
+
+
+ + diff --git a/create_plan.php b/create_plan.php new file mode 100644 index 0000000..9696d17 --- /dev/null +++ b/create_plan.php @@ -0,0 +1,80 @@ +prepare($sql); + $stmt->execute([$name, $price, $features]); + header("Location: plans.php"); + exit; + } catch (PDOException $e) { + $errors[] = "Database error: " . $e->getMessage(); + } + } +} + +?> + +
+

Create New Plan

+ + +
+
+ + New Plan Details +
+
+ +
+
    + +
  • + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + Cancel +
+
+
+
+ + diff --git a/customers.php b/customers.php index 00dbd18..2be26da 100644 --- a/customers.php +++ b/customers.php @@ -18,10 +18,10 @@ try {

Customers

- +
diff --git a/invoices.php b/invoices.php index 3e2a25a..0e0da7a 100644 --- a/invoices.php +++ b/invoices.php @@ -7,10 +7,10 @@ require_once 'templates/header.php';

Invoices

- +
diff --git a/plans.php b/plans.php index 8b6fec5..a73bc4d 100644 --- a/plans.php +++ b/plans.php @@ -10,10 +10,10 @@ $plans = $stmt->fetchAll(PDO::FETCH_ASSOC);

Subscription Plans

- +