From 6236799760e566d0781edd279729c0c8befb0ee8 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 26 Oct 2025 16:47:49 +0000 Subject: [PATCH] Auto commit: 2025-10-26T16:47:49.778Z --- create_customer.php | 109 +++++++++++++++++++++++++++++++++++++++ create_invoice.php | 122 ++++++++++++++++++++++++++++++++++++++++++++ create_plan.php | 80 +++++++++++++++++++++++++++++ customers.php | 4 +- invoices.php | 4 +- plans.php | 4 +- 6 files changed, 317 insertions(+), 6 deletions(-) create mode 100644 create_customer.php create mode 100644 create_invoice.php create mode 100644 create_plan.php 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