diff --git a/admin/edit_client.php b/admin/edit_client.php
index 6d76e26..4a11de2 100644
--- a/admin/edit_client.php
+++ b/admin/edit_client.php
@@ -27,58 +27,138 @@ if ($clientId) {
if (!$client) {
die("Klient nie został znaleziony.");
}
-
- // Calculate used credit
+ $available_credit = $client['credit_balance'];
$used_credit = $client['credit_limit'] - $client['credit_balance'];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- $name = $_POST['name'] ?? '';
- $tax_id = $_POST['tax_id'] ?? '';
- $address = $_POST['address'] ?? '';
- $city = $_POST['city'] ?? '';
- $zip_code = $_POST['zip_code'] ?? '';
- $credit_limit = $_POST['credit_limit'] ?? 0;
+ // Handle payment cancellation
+ if (isset($_POST['cancel_payment'])) {
+ $log_id = $_POST['log_id'] ?? null;
+ if ($log_id) {
+ $db->beginTransaction();
+ try {
+ // Get the payment amount from the log
+ $logStmt = $db->prepare("SELECT * FROM client_credit_log WHERE id = :id AND client_id = :client_id");
+ $logStmt->execute(['id' => $log_id, 'client_id' => $clientId]);
+ $logEntry = $logStmt->fetch(PDO::FETCH_ASSOC);
- if (empty($name)) {
- $errorMessage = 'Nazwa klienta jest wymagana.';
+ if ($logEntry && $logEntry['transaction_type'] === 'payment') {
+ // Revert the credit balance
+ $new_credit_balance = $client['credit_balance'] - $logEntry['amount'];
+
+ $updateStmt = $db->prepare("UPDATE clients SET credit_balance = :credit_balance WHERE id = :id");
+ $updateStmt->execute(['credit_balance' => $new_credit_balance, 'id' => $clientId]);
+
+ // Delete the log entry
+ $deleteStmt = $db->prepare("DELETE FROM client_credit_log WHERE id = :id");
+ $deleteStmt->execute(['id' => $log_id]);
+
+ $db->commit();
+ $successMessage = "Płatność została pomyślnie anulowana.";
+
+ // Re-fetch client data
+ $stmt = $db->prepare("SELECT * FROM clients WHERE id = :id");
+ $stmt->execute(['id' => $clientId]);
+ $client = $stmt->fetch(PDO::FETCH_ASSOC);
+ $available_credit = $client['credit_balance'];
+ $used_credit = $client['credit_limit'] - $client['credit_balance'];
+ } else {
+ $db->rollBack();
+ $errorMessage = "Nie znaleziono wpisu płatności lub transakcja nie jest płatnością.";
+ }
+ } catch (PDOException $e) {
+ $db->rollBack();
+ $errorMessage = "Wystąpił błąd podczas anulowania płatności.";
+ // error_log($e->getMessage()); // For debugging
+ }
+ }
+ } elseif (isset($_POST['payback_submit'])) {
+ $payback_amount = (float)($_POST['payback_amount'] ?? 0);
+ $used_credit_for_validation = $client['credit_limit'] - $client['credit_balance'];
+
+ if ($payback_amount <= 0) {
+ $errorMessage = 'Kwota spłaty musi być większa od zera.';
+ } elseif ($payback_amount > $used_credit_for_validation) {
+ $errorMessage = "Kwota spłaty nie może być wyższa niż wykorzystany kredyt (" . number_format($used_credit_for_validation, 2, ',', ' ') . " PLN).";
+ } else {
+ try {
+ $new_credit_balance = $client['credit_balance'] + $payback_amount;
+
+ $stmt = $db->prepare("UPDATE clients SET credit_balance = :credit_balance WHERE id = :id");
+ $stmt->execute(['credit_balance' => $new_credit_balance, 'id' => $clientId]);
+
+ // Log the transaction
+ $logStmt = $db->prepare("INSERT INTO client_credit_log (client_id, amount, transaction_type, notes) VALUES (:client_id, :amount, :transaction_type, :notes)");
+ $logStmt->execute([
+ 'client_id' => $clientId,
+ 'amount' => $payback_amount,
+ 'transaction_type' => 'payment',
+ 'notes' => 'Credit payback'
+ ]);
+
+ $successMessage = 'Spłata kredytu została pomyślnie przetworzona.';
+
+ // Re-fetch data to display updated values
+ $stmt = $db->prepare("SELECT * FROM clients WHERE id = :id");
+ $stmt->execute(['id' => $clientId]);
+ $client = $stmt->fetch(PDO::FETCH_ASSOC);
+ $available_credit = $client['credit_balance'];
+ $used_credit = $client['credit_limit'] - $client['credit_balance'];
+
+ } catch (PDOException $e) {
+ $errorMessage = 'Wystąpił błąd podczas przetwarzania spłaty kredytu.';
+ // error_log($e->getMessage()); // Uncomment for debugging
+ }
+ }
} else {
- try {
- if ($isNewClient) {
- $stmt = $db->prepare("INSERT INTO clients (name, nip, street, city, postal_code, credit_limit) VALUES (:name, :tax_id, :address, :city, :zip_code, :credit_limit)");
- } else {
- $stmt = $db->prepare("UPDATE clients SET name = :name, nip = :tax_id, street = :address, city = :city, postal_code = :zip_code, credit_limit = :credit_limit WHERE id = :id");
+ $name = $_POST['name'] ?? '';
+ $tax_id = $_POST['tax_id'] ?? '';
+ $address = $_POST['address'] ?? '';
+ $city = $_POST['city'] ?? '';
+ $zip_code = $_POST['zip_code'] ?? '';
+ $credit_limit = $_POST['credit_limit'] ?? 0;
+
+ if (empty($name)) {
+ $errorMessage = 'Nazwa klienta jest wymagana.';
+ } else {
+ try {
+ if ($isNewClient) {
+ $stmt = $db->prepare("INSERT INTO clients (name, nip, street, city, postal_code, credit_limit) VALUES (:name, :tax_id, :address, :city, :zip_code, :credit_limit)");
+ } else {
+ $stmt = $db->prepare("UPDATE clients SET name = :name, nip = :tax_id, street = :address, city = :city, postal_code = :zip_code, credit_limit = :credit_limit WHERE id = :id");
+ }
+
+ $params = [
+ 'name' => $name,
+ 'tax_id' => $tax_id,
+ 'address' => $address,
+ 'city' => $city,
+ 'zip_code' => $zip_code,
+ 'credit_limit' => $credit_limit
+ ];
+
+ if (!$isNewClient) {
+ $params['id'] = $clientId;
+ }
+
+ $stmt->execute($params);
+
+ if ($isNewClient) {
+ $clientId = $db->lastInsertId();
+ header('Location: clients.php?status=created');
+ exit;
+ }
+ $successMessage = 'Dane klienta zostały zaktualizowane.';
+ // Re-fetch data to display updated values
+ $stmt = $db->prepare("SELECT * FROM clients WHERE id = :id");
+ $stmt->execute(['id' => $clientId]);
+ $client = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ } catch (PDOException $e) {
+ $errorMessage = 'Wystąpił błąd podczas zapisywania danych klienta.';
+ // error_log($e->getMessage()); // Uncomment for debugging
}
-
- $params = [
- 'name' => $name,
- 'tax_id' => $tax_id,
- 'address' => $address,
- 'city' => $city,
- 'zip_code' => $zip_code,
- 'credit_limit' => $credit_limit
- ];
-
- if (!$isNewClient) {
- $params['id'] = $clientId;
- }
-
- $stmt->execute($params);
-
- if ($isNewClient) {
- $clientId = $db->lastInsertId();
- header('Location: clients.php?status=created');
- exit;
- }
- $successMessage = 'Dane klienta zostały zaktualizowane.';
- // Re-fetch data to display updated values
- $stmt = $db->prepare("SELECT * FROM clients WHERE id = :id");
- $stmt->execute(['id' => $clientId]);
- $client = $stmt->fetch(PDO::FETCH_ASSOC);
-
- } catch (PDOException $e) {
- $errorMessage = 'Wystąpił błąd podczas zapisywania danych klienta.';
- // error_log($e->getMessage()); // Uncomment for debugging
}
}
}
@@ -137,14 +217,67 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
-
- PLN
+
+ PLN
Anuluj
+
+
+ Spłata kredytu
+
+
+
+ Historia kredytu
+ prepare("SELECT * FROM client_credit_log WHERE client_id = :client_id ORDER BY created_at DESC");
+ $logStmt->execute(['client_id' => $clientId]);
+ $creditLogs = $logStmt->fetchAll(PDO::FETCH_ASSOC);
+ ?>
+
+
+
+ | Data |
+ Typ |
+ Kwota |
+ Notatki |
+ Akcje |
+
+
+
+
+
+ |
+ |
+ PLN |
+ |
+
+
+
+
+ |
+
+
+
+
+ | Brak historii kredytowej. |
+
+
+
+
+
diff --git a/db/migrations/029_create_credit_log_table.sql b/db/migrations/029_create_credit_log_table.sql
new file mode 100644
index 0000000..749ca73
--- /dev/null
+++ b/db/migrations/029_create_credit_log_table.sql
@@ -0,0 +1,12 @@
+-- Migration to create the client_credit_log table
+
+CREATE TABLE IF NOT EXISTS `client_credit_log` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `client_id` INT NOT NULL,
+ `amount` DECIMAL(10, 2) NOT NULL,
+ `transaction_type` VARCHAR(50) NOT NULL DEFAULT 'payment',
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ `notes` TEXT,
+ FOREIGN KEY (`client_id`) REFERENCES `clients`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
diff --git a/debug_price.log b/debug_price.log
index 072cd1a..99f486b 100644
--- a/debug_price.log
+++ b/debug_price.log
@@ -3187,3 +3187,427 @@ Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84
Found product price. Net: 233.2, Gross: 286.84
FINAL: Returning Net: 233.2, Gross: 286.84
---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---